diff --git a/dune/microstructure/prestrainedMaterial.hh b/dune/microstructure/prestrainedMaterial.hh index e04cffb0e6328432c2461b196fcca0b53cf51b0f..60ddc69118b2f5897a750e830f341ca2acfa9e02 100644 --- a/dune/microstructure/prestrainedMaterial.hh +++ b/dune/microstructure/prestrainedMaterial.hh @@ -432,56 +432,20 @@ Dune::FieldMatrix<double,6,6> setupPhase(const std::string phaseType, Python::Mo std::cout << "Material setup done." << std::endl; } - /////////////////////////////////////////////////////////////////////// - // //---function that determines elasticity Tensor - // void setupMaterial(const std::string name) // cant use materialFunctionName_ here!? - // { - // // std::cout << "Using material definition:" << name << std::endl; - // if(name == "material_neukamm") - // { - // indicatorFunction_ = indicatorFunction_material_neukamm<Domain>; - // elasticityTensor_ = material_neukamm; - // prestrain_ = prestrain_material_neukamm; - // } - // else if(name == "two_phase_material_1") - // { - // indicatorFunction_ = indicatorFunction_two_phase_material_1<Domain>; - // elasticityTensor_ = two_phase_material_1; - // prestrain_ = prestrain_two_phase_material_1; - // } - // else if(name == "two_phase_material_2") - // { - // indicatorFunction_ = indicatorFunction_two_phase_material_2<Domain>; - // elasticityTensor_ = two_phase_material_2; - // prestrain_ = prestrain_two_phase_material_2; - // } - // else if(name == "homogeneous") - // { - // indicatorFunction_ = indicatorFunction_material_homogeneous<Domain>; - // elasticityTensor_ = material_homogeneous; - // prestrain_ = prestrain_homogeneous; - // } - // else - // DUNE_THROW(Exception, "There exists no material with this name "); - // } - - - - //////////////////////////////////////////////////////// // MATERIAL CLASSES DEFINITIONS: //////////////////////////////////////////////////////// - //--- Definition of isotropic elasticity tensor (in voigt notation) + //--- Definition of isotropic elasticity tensor (stiffness matrix in voigt notation) Dune::FieldMatrix<double,6,6> isotropic(const double& mu, const double& lambda) { - return {{lambda+2.0*mu, lambda , lambda , 0.0 , 0.0 , 0.0 }, + return {{lambda+2.0*mu, lambda , lambda , 0.0 , 0.0 , 0.0 }, {lambda , lambda+2.0*mu, lambda , 0.0 , 0.0 , 0.0 }, {lambda , lambda , lambda+2.0*mu, 0.0 , 0.0 , 0.0 }, - { 0.0 , 0.0 , 0.0 , 2.0*mu, 0.0 , 0.0 }, - { 0.0 , 0.0 , 0.0 , 0.0 , 2.0*mu, 0.0 }, - { 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 2.0*mu} + { 0.0 , 0.0 , 0.0 , mu , 0.0 , 0.0 }, + { 0.0 , 0.0 , 0.0 , 0.0 , mu , 0.0 }, + { 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , mu } }; } //------------------------------------------------------------------------------- @@ -591,55 +555,11 @@ Dune::FieldMatrix<double,6,6> setupPhase(const std::string phaseType, Python::Mo //------------------------------------------------------------------------------- - static Dune::FieldVector<double,6> strainToVoigt(const MatrixRT& G) - { - // return {G[0][0], G[1][1], G[2][2], G[1][2], G[0][2], G[0][1]}; - return {G[0][0], G[1][1], G[2][2], 2.0*G[1][2], 2.0*G[0][2], 2.0*G[0][1]}; - - } - - static Dune::FieldVector<double,6> stressToVoigt(const MatrixRT& G) - { - // return {G[0][0], G[1][1], G[2][2], G[1][2], G[0][2], G[0][1]}; - return {G[0][0], G[1][1], G[2][2], G[1][2], G[0][2], G[0][1]}; - - } - - static MatrixRT VoigtToStress(const Dune::FieldVector<double,6>& v) - { - // return {{v[0], v[5], v[4]}, {v[5], v[1], v[3]}, {v[4], v[3], v[2]}}; - return {{v[0], v[5], v[4]}, {v[5], v[1], v[3]}, {v[4], v[3], v[2]}}; - } - - static MatrixRT VoigtToStrain(const Dune::FieldVector<double,6>& v) - { - // return {{v[0], v[5], v[4]}, {v[5], v[1], v[3]}, {v[4], v[3], v[2]}}; - return {{v[0], v[5]/2.0, v[4]/2.0}, {v[5]/2.0, v[1], v[3]/2.0}, {v[4]/2.0, v[3]/2.0, v[2]}}; - } - MatrixRT applyElasticityTensor(const MatrixRT& G, const int& phase) const { - // FieldVector<double,6> G_tmp = {G[0][0], G[1][1], G[2][2], sqrt(2.0)*G[1][2], sqrt(2.0)*G[0][2], sqrt(2.0)*G[0][1]}; - // FieldVector<double,6> G_tmp = {G[0][0], G[1][1], G[2][2], G[1][2], G[0][2], G[0][1]}; - VoigtVector<double,3> G_tmp = matrixToVoigt(G); + + VoigtVector<double,3> G_tmp = strainToVoigt(G); VoigtVector<double,3> out(0); - // printvector(std::cout, G_tmp, "G_tmp", "--"); - - // if (phase == 1) - // { - // // printmatrix(std::cout, L1_, "L1_", "--"); - // L1_.mv(G_tmp,out); - // } - // else if (phase == 2) - // { - // // printmatrix(std::cout, L2_, "L2_", "--"); - // L2_.mv(G_tmp,out); - // } - // else - // { - // // printmatrix(std::cout, L3_, "L3_", "--"); - // L3_.mv(G_tmp,out); - // } switch (phase) { @@ -663,7 +583,7 @@ Dune::FieldMatrix<double,6,6> setupPhase(const std::string phaseType, Python::Mo } case 4: { - // printmatrix(std::cout, L3_, "L3_", "--"); + // printmatrix(std::cout, L4_, "L4_", "--"); L4_.mv(G_tmp,out); break; } @@ -672,14 +592,8 @@ Dune::FieldMatrix<double,6,6> setupPhase(const std::string phaseType, Python::Mo break; } + return voigtToStress(out); - // printvector(std::cout, out, "out", "--"); - return voigtToMatrix(out); // Muss hier stress zurücktransformieren! - // return VoigtToStress(out); - // return image as Matrix again - // return {{out[0], (1.0/sqrt(2.0))*out[5], (1.0/sqrt(2.0))*out[4]}, {(1.0/sqrt(2.0))*out[5], out[1], (1.0/sqrt(2.0))*out[3]}, {(1.0/sqrt(2.0))*out[4], (1.0/sqrt(2.0))*out[3], out[2]}}; - // return {{out[0], (1.0/2.0)*out[5], (1.0/2.0)*out[4]}, {(1.0/2.0)*out[5], out[1], (1.0/2.0)*out[3]}, {(1.0/2.0)*out[4], (1.0/2.0)*out[3], out[2]}}; - // return {{out[0], out[5], out[4]}, {out[5], out[1], out[3]}, {out[4], out[3], out[2]}}; } @@ -715,9 +629,6 @@ Dune::FieldMatrix<double,6,6> setupPhase(const std::string phaseType, Python::Mo } - - - //////////////////////////////////////////////////////// diff --git a/dune/microstructure/voigthelper.hh b/dune/microstructure/voigthelper.hh index fbea65a183f9af269547f4da26dd9ae6376d6bab..db0bf17c49e3049950de77900f77c5d16ee826d0 100644 --- a/dune/microstructure/voigthelper.hh +++ b/dune/microstructure/voigthelper.hh @@ -17,15 +17,27 @@ using VoigtMatrix = Dune::FieldMatrix<T,dim*(dim+1)/2,dim*(dim+1)/2>; template<typename T> -static VoigtVector<T,3> matrixToVoigt(const Dune::FieldMatrix<T,3,3>& matrix) +static VoigtVector<T,3> strainToVoigt(const Dune::FieldMatrix<T,3,3>& G) { - return {matrix[0][0], matrix[1][1], matrix[2][2], 2.0*matrix[1][2], 2.0*matrix[0][2], 2.0*matrix[0][1]}; + return {G[0][0], G[1][1], G[2][2], 2.0*G[1][2], 2.0*G[0][2], 2.0*G[0][1]}; } template<typename T> -static Dune::FieldMatrix<T,3,3> voigtToMatrix(const VoigtVector<T,3>& v) +static Dune::FieldMatrix<T,3,3> voigtToStrain(const VoigtVector<T,3>& v) { return {{v[0], v[5]/2.0, v[4]/2.0}, {v[5]/2.0, v[1], v[3]/2.0}, {v[4]/2.0, v[3]/2.0, v[2]}}; } +template<typename T> +static VoigtVector<T,3> stressToVoigt(const Dune::FieldMatrix<T,3,3>& G) +{ + return {G[0][0], G[1][1], G[2][2], G[1][2], G[0][2], G[0][1]}; +} + +template<typename T> +static Dune::FieldMatrix<T,3,3> voigtToStress(const VoigtVector<T,3>& v) +{ + return {{v[0], v[5], v[4]}, {v[5], v[1], v[3]}, {v[4], v[3], v[2]}}; +} + #endif // DUNE_MICROSTRUCTURE_VOIGTHELPER_HH