diff --git a/dune/microstructure/prestrainedMaterial.hh b/dune/microstructure/prestrainedMaterial.hh index 210d46cae20a3d0f80abd04cb43a7a167ed58a78..1fa1abe4f1b81d724f97bcacd145563ce8fcd6d6 100644 --- a/dune/microstructure/prestrainedMaterial.hh +++ b/dune/microstructure/prestrainedMaterial.hh @@ -32,10 +32,12 @@ using std::make_shared; template<class Domain> int indicatorFunction_material_1(const Domain& x) { + // std::cout << "x[0] , x[1] , x[2]" << x[0] << " , " << x[1] << ", "<< x[2] << std::endl; + // std::cout << "-1/2: " << -1/2 << std::endl; double theta=0.25; - if (x[0] < (-1/2+theta) && x[2]<(-1/2+theta)) + if (x[0] <(-0.5+theta) and x[2]<(-0.5+theta)) return 1; //#Phase1 - else if (x[1]< (-1/2+theta) && x[2]>(1/2-theta)) + else if (x[1]<(-0.5+theta) and x[2]>(0.5-theta)) return 2; //#Phase2 else return 0; //#Phase3 @@ -194,7 +196,7 @@ public: : gridView_(gridView), parameterSet_(parameterSet) { - std::string materialFunctionName_ = parameterSet.get<std::string>("materialFunction", "material"); + std::string materialFunctionName_ = parameterSet.get<std::string>("materialFunction", "material_1"); std::cout << "materialFunctionName_ : " << materialFunctionName_ << std::endl; @@ -227,6 +229,50 @@ public: ///////////////////////////////////////////////////////////////////////////////////////////////////////// + // static int indicatorFunction_material_1(const Domain& x) + // { + // // std::cout << "x[0] , x[1] , x[2]" << x[0] << " , " << x[1] << ", "<< x[2] << std::endl; + // double theta=0.25; + // std::cout << "-1/2" << -1/2 << std::endl; + // if ((x[1]< (-0.5+theta)) and (x[2]>(0.5-theta))) + // { + // return 2; //#Phase1 + // } + // else if ((x[0] < (-0.5+theta)) and (x[2]<(-0.5+theta))) + // { + // return 1; //#Phase2 + // } + // else + // { + // return 0; //#Phase3 + // } + // } + + + // static int indicatorFunction_material_1(const Domain& x) + // { + // // std::cout << "x[0] , x[1] , x[2]" << x[0] << " , " << x[1] << ", "<< x[2] << std::endl; + // double theta=0.25; + // if ((x[0] < (-1/2+theta)) and (x[2]<(-1/2+theta))) + // return 1; //#Phase1 + // else if ((x[1]< (-1/2+theta)) and (x[2]>(1/2-theta))) + // return 2; //#Phase2 + // else + // return 0; //#Phase3 + // } + + static MatrixRT material_1(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(); + if (phase == 2) + return 2.0 * mu[1] * sym(G) + lambda[1] * trace(sym(G)) * Id(); + else + return 2.0 * mu[2] * sym(G) + lambda[2] * trace(sym(G)) * Id(); + } + // static int indicatorFunction_material_1(const Domain& x) // { @@ -267,8 +313,9 @@ public: //---function that determines elasticity Tensor void setupElasticityTensor(const std::string name) // cant use materialFunctionName_ here!? { - if(name == "material") - { + std::cout << "Using material definition:" << name << std::endl; + if(name == "material_1") + { // indicatorFunctionGVF_ = Dune::Functions::makeGridViewFunction(indicatorFunction_material_1, gridView_); // indicatorFunction_ = indicatorFunction_material_1; indicatorFunctionGVF_ = Dune::Functions::makeGridViewFunction(indicatorFunction_material_1<Domain>, gridView_); @@ -279,7 +326,7 @@ public: { // indicatorFunctionGVF_ = Dune::Functions::makeGridViewFunction(indicatorFunction_material_1, gridView_); // indicatorFunction_ = indicatorFunction_material_1; - indicatorFunctionGVF_ = Dune::Functions::makeGridViewFunction(indicatorFunction_material_1<Domain>, gridView_); + indicatorFunctionGVF_ = Dune::Functions::makeGridViewFunction(indicatorFunction_material_homogeneous<Domain>, gridView_); indicatorFunction_ = indicatorFunction_material_homogeneous<Domain>; elasticityTensor_ = material_homogeneous; } @@ -318,7 +365,11 @@ public: // return material_1(G,indicatorFunction_(x)); } - + int applyIndicatorFunction(const Domain& x) const + { + // return indicatorFunction_(x); + return indicatorFunction_material_1(x); + } ////////////////////////////////////////////////////////////////////////////// @@ -378,6 +429,11 @@ public: auto getIndicatorFunctionGVF() const {return indicatorFunctionGVF_;} //get as GridViewFunction auto getIndicatorFunction() const {return indicatorFunction_;} + // shared_ptr<Func2int> getIndicatorFunction(){return make_shared<Func2int>(indicatorFunction_);} + // auto getIndicatorFunction(){return make_shared<Func2int>(indicatorFunction_);} + + + // shared_ptr<Func2TensorParam> getElasticityTensor(){return make_shared<Func2TensorParam>(elasticityTensor_);}