Skip to content
Snippets Groups Projects
Commit f5174b90 authored by Klaus Böhnlein's avatar Klaus Böhnlein
Browse files

outsource material definitions to materialDefinitions.hh

parent 6895482b
No related branches found
No related tags found
No related merge requests found
#ifndef DUNE_MICROSTRUCTURE_MATERIALDEFINITIONS.HH
#define DUNE_MICROSTRUCTURE_MATERIALDEFINITIONS.HH
#include <dune/common/parametertree.hh>
#include <dune/fufem/dunepython.hh>
#include <dune/microstructure/matrix_operations.hh>
using namespace Dune;
using namespace MatrixOperations;
using std::pow;
using std::abs;
using std::sqrt;
using std::sin;
using std::cos;
using MatrixRT = FieldMatrix< double, 3, 3>;
using VectorRT = FieldVector< double, 3>;
// ----------------------------------------------------------------------------------
template<class Domain>
int indicatorFunction_material_neukamm(const Domain& x)
{
double theta=0.25;
if (x[0] <(-0.5+theta) and x[2]<(-0.5+theta))
return 1; //#Phase1
else if (x[1]<(-0.5+theta) and x[2]>(0.5-theta))
return 2; //#Phase2
else
return 3; //#Phase3
}
MatrixRT material_neukamm(const MatrixRT& G, const int& phase)
{
const FieldVector<double,3> mu = {80.0, 80.0, 60.0};
const FieldVector<double,3> lambda = {80.0, 80.0, 25.0};
if (phase == 1)
return 2.0 * mu[0] * sym(G) + lambda[0] * trace(sym(G)) * Id(); //#Phase1
else if (phase == 2)
return 2.0 * mu[1] * sym(G) + lambda[1] * trace(sym(G)) * Id(); //#Phase2
else
return 2.0 * mu[2] * sym(G) + lambda[2] * trace(sym(G)) * Id(); //#Phase3
}
MatrixRT prestrain_material_neukamm(const int& phase)
{
if (phase == 1)
return {{1.0, 0.0, 0.0}, //#Phase1
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}
};
else if (phase == 2)
return {{1.0, 0.0, 0.0}, //#Phase2
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}
};
else
return {{0.0, 0.0, 0.0}, //#Phase3
{0.0, 0.0, 0.0},
{0.0, 0.0, 0.0}
};
}
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
template<class Domain>
int indicatorFunction_two_phase_material_1(const Domain& x)
{
double theta=0.25;
if(abs(x[0]) > (theta/2.0))
return 1; //#Phase1
else
return 0; //#Phase2
}
MatrixRT two_phase_material_1(const MatrixRT& G, const int& phase)
{
const FieldVector<double,2> mu = {80.0, 160.0};
const FieldVector<double,2> lambda = {80.0, 160.0};
if (phase == 1)
return 2.0 * mu[0] * sym(G) + lambda[0] * trace(sym(G)) * Id();
else
return 2.0 * mu[1] * sym(G) + lambda[1] * trace(sym(G)) * Id();
}
MatrixRT prestrain_two_phase_material_1(const int& phase)
{
const FieldVector<double,2> rho = {3.0, 5.0};
if (phase == 1)
return {{rho[0], 0.0, 0.0}, //#Phase1
{0.0, rho[0], 0.0},
{0.0, 0.0, rho[0]}
};
else
return {{rho[1], 0.0, 0.0}, //#Phase2
{0.0, rho[1], 0.0},
{0.0, 0.0, rho[1]}
};
}
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
template<class Domain>
int indicatorFunction_two_phase_material_2(const Domain& x)
{
double theta=0.25;
if(abs(x[0]) > (theta/2.0))
return 1; //#Phase1
else
return 0; //#Phase2
}
MatrixRT two_phase_material_2(const MatrixRT& G, const int& phase)
{
const FieldVector<double,2> mu = {5.0, 15.0};
const FieldVector<double,2> lambda = {6.0, 8.0};
if (phase == 1)
return 2.0 * mu[0] * sym(G) + lambda[0] * trace(sym(G)) * Id();
else
return 2.0 * mu[1] * sym(G) + lambda[1] * trace(sym(G)) * Id();
}
MatrixRT prestrain_two_phase_material_2(const int& phase)
{
const FieldVector<double,2> rho = {3.0, 5.0};
if (phase == 1)
return {{rho[0], 0.0, 0.0}, //#Phase1
{0.0, rho[0], 0.0},
{0.0, 0.0, rho[0]}
};
else
return {{rho[1], 0.0, 0.0}, //#Phase2
{0.0, rho[1], 0.0},
{0.0, 0.0, rho[1]}
};
}
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
template<class Domain>
int indicatorFunction_material_2(const Domain& x)
{
double theta=0.25;
if(abs(x[0]) > (theta/2.0))
return 1; //#Phase1
else
return 0; //#Phase2
}
MatrixRT material_2(const MatrixRT& G, const int& phase)
{
const FieldVector<double,2> mu = {80.0, 160.0};
const FieldVector<double,2> lambda = {80.0, 160.0};
if (phase == 1)
return 2.0 * mu[0] * sym(G) + lambda[0] * trace(sym(G)) * Id(); //#Phase1
else
return 2.0 * mu[1] * sym(G) + lambda[1] * trace(sym(G)) * Id(); //#Phase2
}
MatrixRT prestrain_material_2(const int& phase)
{
const FieldVector<double,2> rho = {3.0, 5.0};
if (phase == 1)
return {{rho[0], 0.0, 0.0}, //#Phase1
{0.0, rho[0], 0.0},
{0.0, 0.0, rho[0]}
};
else
return {{rho[1], 0.0, 0.0}, //#Phase2
{0.0, rho[1], 0.0},
{0.0, 0.0, rho[1]}
};
}
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
template<class Domain>
int indicatorFunction_material_homogeneous(const Domain& x)
{
return 0;
}
MatrixRT material_homogeneous(const MatrixRT& G, const int& phase)
{
const FieldVector<double,1> mu = {80.0};
const FieldVector<double,1> lambda = {80.0};
return 2.0 * mu[0] * sym(G) + lambda[0] * trace(sym(G)) * Id();
}
MatrixRT prestrain_homogeneous(const int& phase)
{
if (phase == 1)
return {{1.0, 0.0, 0.0}, //#Phase1
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}
};
else if (phase == 2)
return {{1.0, 0.0, 0.0}, //#Phase2
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}
};
else
return {{1.0, 0.0, 0.0}, //#Phase3
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}
};
}
// ----------------------------------------------------------------------------------
#endif
\ No newline at end of file
...@@ -4,14 +4,12 @@ ...@@ -4,14 +4,12 @@
#include <dune/grid/uggrid.hh> #include <dune/grid/uggrid.hh>
#include <dune/grid/yaspgrid.hh> #include <dune/grid/yaspgrid.hh>
#include <dune/microstructure/matrix_operations.hh>
#include <dune/functions/gridfunctions/gridviewfunction.hh> #include <dune/functions/gridfunctions/gridviewfunction.hh>
#include <dune/common/parametertree.hh>
#include <dune/functions/gridfunctions/gridviewentityset.hh> #include <dune/functions/gridfunctions/gridviewentityset.hh>
#include <dune/common/parametertree.hh>
#include <dune/fufem/dunepython.hh> #include <dune/fufem/dunepython.hh>
#include <dune/microstructure/matrix_operations.hh>
#include <dune/microstructure/materialDefinitions.hh>
using namespace Dune; using namespace Dune;
...@@ -27,192 +25,6 @@ using std::make_shared; ...@@ -27,192 +25,6 @@ using std::make_shared;
// ----------------------------------------------------------------------------------
template<class Domain>
int indicatorFunction_material_neukamm(const Domain& x)
{
double theta=0.25;
if (x[0] <(-0.5+theta) and x[2]<(-0.5+theta))
return 1; //#Phase1
else if (x[1]<(-0.5+theta) and x[2]>(0.5-theta))
return 2; //#Phase2
else
return 3; //#Phase3
}
MatrixRT material_neukamm(const MatrixRT& G, const int& phase)
{
const FieldVector<double,3> mu = {80.0, 80.0, 60.0};
const FieldVector<double,3> lambda = {80.0, 80.0, 25.0};
if (phase == 1)
return 2.0 * mu[0] * sym(G) + lambda[0] * trace(sym(G)) * Id(); //#Phase1
else if (phase == 2)
return 2.0 * mu[1] * sym(G) + lambda[1] * trace(sym(G)) * Id(); //#Phase2
else
return 2.0 * mu[2] * sym(G) + lambda[2] * trace(sym(G)) * Id(); //#Phase3
}
MatrixRT prestrain_material_neukamm(const int& phase)
{
if (phase == 1)
return {{1.0, 0.0, 0.0}, //#Phase1
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}
};
else if (phase == 2)
return {{1.0, 0.0, 0.0}, //#Phase2
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}
};
else
return {{0.0, 0.0, 0.0}, //#Phase3
{0.0, 0.0, 0.0},
{0.0, 0.0, 0.0}
};
}
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
template<class Domain>
int indicatorFunction_two_phase_material_1(const Domain& x)
{
double theta=0.25;
if(abs(x[0]) > (theta/2.0))
return 1; //#Phase1
else
return 0; //#Phase2
}
MatrixRT two_phase_material_1(const MatrixRT& G, const int& phase)
{
const FieldVector<double,2> mu = {80.0, 160.0};
const FieldVector<double,2> lambda = {80.0, 160.0};
if (phase == 1)
return 2.0 * mu[0] * sym(G) + lambda[0] * trace(sym(G)) * Id();
else
return 2.0 * mu[1] * sym(G) + lambda[1] * trace(sym(G)) * Id();
}
MatrixRT prestrain_two_phase_material_1(const int& phase)
{
const FieldVector<double,2> rho = {3.0, 5.0};
if (phase == 1)
return {{rho[0], 0.0, 0.0}, //#Phase1
{0.0, rho[0], 0.0},
{0.0, 0.0, rho[0]}
};
else
return {{rho[1], 0.0, 0.0}, //#Phase2
{0.0, rho[1], 0.0},
{0.0, 0.0, rho[1]}
};
}
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
template<class Domain>
int indicatorFunction_two_phase_material_2(const Domain& x)
{
double theta=0.25;
if(abs(x[0]) > (theta/2.0))
return 1; //#Phase1
else
return 0; //#Phase2
}
MatrixRT two_phase_material_2(const MatrixRT& G, const int& phase)
{
const FieldVector<double,2> mu = {5.0, 15.0};
const FieldVector<double,2> lambda = {6.0, 8.0};
if (phase == 1)
return 2.0 * mu[0] * sym(G) + lambda[0] * trace(sym(G)) * Id();
else
return 2.0 * mu[1] * sym(G) + lambda[1] * trace(sym(G)) * Id();
}
MatrixRT prestrain_two_phase_material_2(const int& phase)
{
const FieldVector<double,2> rho = {3.0, 5.0};
if (phase == 1)
return {{rho[0], 0.0, 0.0}, //#Phase1
{0.0, rho[0], 0.0},
{0.0, 0.0, rho[0]}
};
else
return {{rho[1], 0.0, 0.0}, //#Phase2
{0.0, rho[1], 0.0},
{0.0, 0.0, rho[1]}
};
}
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
template<class Domain>
int indicatorFunction_material_2(const Domain& x)
{
double theta=0.25;
if(abs(x[0]) > (theta/2.0))
return 1; //#Phase1
else
return 0; //#Phase2
}
MatrixRT material_2(const MatrixRT& G, const int& phase)
{
const FieldVector<double,2> mu = {80.0, 160.0};
const FieldVector<double,2> lambda = {80.0, 160.0};
if (phase == 1)
return 2.0 * mu[0] * sym(G) + lambda[0] * trace(sym(G)) * Id(); //#Phase1
else
return 2.0 * mu[1] * sym(G) + lambda[1] * trace(sym(G)) * Id(); //#Phase2
}
MatrixRT prestrain_material_2(const int& phase)
{
const FieldVector<double,2> rho = {3.0, 5.0};
if (phase == 1)
return {{rho[0], 0.0, 0.0}, //#Phase1
{0.0, rho[0], 0.0},
{0.0, 0.0, rho[0]}
};
else
return {{rho[1], 0.0, 0.0}, //#Phase2
{0.0, rho[1], 0.0},
{0.0, 0.0, rho[1]}
};
}
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
template<class Domain>
int indicatorFunction_material_homogeneous(const Domain& x)
{
return 0;
}
MatrixRT material_homogeneous(const MatrixRT& G, const int& phase)
{
const FieldVector<double,1> mu = {80.0};
const FieldVector<double,1> lambda = {80.0};
return 2.0 * mu[0] * sym(G) + lambda[0] * trace(sym(G)) * Id();
}
MatrixRT prestrain_homogeneous(const int& phase)
{
if (phase == 1)
return {{1.0, 0.0, 0.0}, //#Phase1
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}
};
else if (phase == 2)
return {{1.0, 0.0, 0.0}, //#Phase2
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}
};
else
return {{1.0, 0.0, 0.0}, //#Phase3
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}
};
}
// ----------------------------------------------------------------------------------
// template<class Domain> // template<class Domain>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment