void LinearElastic3DLaw::CalculateMaterialResponseKirchhoff (Parameters& rValues) { //-----------------------------// //a.-Check if the constitutive parameters are passed correctly to the law calculation //CheckParameters(rValues); //b.- Get Values to compute the constitutive law: Flags &Options=rValues.GetOptions(); const Properties& MaterialProperties = rValues.GetMaterialProperties(); Vector& StrainVector = rValues.GetStrainVector(); Vector& StressVector = rValues.GetStressVector(); //-----------------------------// //1.- Lame constants const double& YoungModulus = MaterialProperties[YOUNG_MODULUS]; const double& PoissonCoefficient = MaterialProperties[POISSON_RATIO]; // //1.1- Thermal constants // double ThermalExpansionCoefficient = 0; // if( MaterialProperties.Has(THERMAL_EXPANSION_COEFFICIENT) ) // ThermalExpansionCoefficient = MaterialProperties[THERMAL_EXPANSION_COEFFICIENT]; // double ReferenceTemperature = 0; // if( MaterialProperties.Has(REFERENCE_TEMPERATURE) ) // ReferenceTemperature = MaterialProperties[REFERENCE_TEMPERATURE]; if(Options.Is( ConstitutiveLaw::COMPUTE_STRAIN )) //large strains { //1.-Compute total deformation gradient const Matrix& DeformationGradientF = rValues.GetDeformationGradientF(); //2.-Left Cauchy-Green tensor b Matrix LeftCauchyGreenMatrix = prod(DeformationGradientF,trans(DeformationGradientF)); //3.-Almansi Strain: //e= 0.5*(1-invFT*invF) this->CalculateAlmansiStrain(LeftCauchyGreenMatrix,StrainVector); //LARGE STRAINS OBJECTIVE MESURE KIRCHHOFF MATERIAL: // Kirchhoff model is set with S = CE this->CalculateMaterialResponsePK2 (rValues); //1.- Obtain parameters const double& DeterminantF = rValues.GetDeterminantF(); //2.-Almansi Strain: // if(Options.Is( ConstitutiveLaw::COMPUTE_STRAIN )) // { // TransformStrains (StrainVector, DeformationGradientF, StrainMeasure_GreenLagrange, StrainMeasure_Almansi); // } //3.-Calculate Total Kirchhoff stress if( Options.Is( ConstitutiveLaw::COMPUTE_STRESS ) ) { TransformStresses(StressVector, DeformationGradientF, DeterminantF, StressMeasure_PK2, StressMeasure_Kirchhoff); } // COMMENTED BECAUSE THE CONVERGENCE IS NOT IMPROVED AND IS TIME CONSUMING: //4.-Calculate Cauchy constitutive tensor // if( Options.Is( ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR ) ) // { // Matrix& ConstitutiveMatrix = rValues.GetConstitutiveMatrix(); // PushForwardConstitutiveMatrix(ConstitutiveMatrix, DeformationGradientF); // } if( Options.Is( ConstitutiveLaw::COMPUTE_STRAIN_ENERGY ) ) { mStrainEnergy *= DeterminantF; } } else{ //small strains //7.-Calculate total Kirchhoff stress if( Options.Is( ConstitutiveLaw::COMPUTE_STRESS ) ){ if( Options.Is( ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR ) ){ Matrix& ConstitutiveMatrix = rValues.GetConstitutiveMatrix(); this->CalculateLinearElasticMatrix( ConstitutiveMatrix, YoungModulus, PoissonCoefficient ); this->CalculateStress( StrainVector, ConstitutiveMatrix, StressVector ); } else { Matrix ConstitutiveMatrix = ZeroMatrix( StrainVector.size() ,StrainVector.size()); this->CalculateLinearElasticMatrix( ConstitutiveMatrix, YoungModulus, PoissonCoefficient ); this->CalculateStress( StrainVector, ConstitutiveMatrix, StressVector ); } } else if( Options.IsNot( ConstitutiveLaw::COMPUTE_STRESS ) && Options.Is( ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR ) ) { Matrix& ConstitutiveMatrix = rValues.GetConstitutiveMatrix(); this->CalculateLinearElasticMatrix( ConstitutiveMatrix, YoungModulus, PoissonCoefficient ); } if( Options.Is( ConstitutiveLaw::COMPUTE_STRAIN_ENERGY ) ) { if( Options.IsNot( ConstitutiveLaw::COMPUTE_STRESS ) ){ if(Options.Is( ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR )){ Matrix ConstitutiveMatrix = ZeroMatrix( StrainVector.size(), StrainVector.size()); this->CalculateLinearElasticMatrix( ConstitutiveMatrix, YoungModulus, PoissonCoefficient ); this->CalculateStress( StrainVector, ConstitutiveMatrix, StressVector ); } else{ Matrix& ConstitutiveMatrix = rValues.GetConstitutiveMatrix(); this->CalculateStress( StrainVector, ConstitutiveMatrix, StressVector ); } } mStrainEnergy = 0.5 * inner_prod(StrainVector,StressVector); //Belytschko Nonlinear Finite Elements pag 226 (5.4.3) : w = 0.5*E:C:E } } //std::cout<<" Strain "<<StrainVector<<std::endl; //std::cout<<" Stress "<<StressVector<<std::endl; //Matrix& ConstitutiveMatrix = rValues.GetConstitutiveMatrix(); //std::cout<<" Constitutive "<<ConstitutiveMatrix<<std::endl; }
void HyperElasticUP3DLaw::CalculateMaterialResponsePK2 (Parameters& rValues) { //-----------------------------// //a.-Check if the constitutive parameters are passed correctly to the law calculation CheckParameters(rValues); //b.- Get Values to compute the constitutive law: Flags &Options=rValues.GetOptions(); const Properties& MaterialProperties = rValues.GetMaterialProperties(); const Matrix& DeformationGradientF = rValues.GetDeformationGradientF(); const double& DeterminantF = rValues.GetDeterminantF(); const GeometryType& DomainGeometry = rValues.GetElementGeometry (); const Vector& ShapeFunctions = rValues.GetShapeFunctionsValues (); Vector& StrainVector = rValues.GetStrainVector(); Vector& StressVector = rValues.GetStressVector(); Matrix& ConstitutiveMatrix = rValues.GetConstitutiveMatrix(); //-----------------------------// //0.- Initialize parameters MaterialResponseVariables ElasticVariables; ElasticVariables.Identity = identity_matrix<double> ( 3 ); ElasticVariables.SetElementGeometry(DomainGeometry); ElasticVariables.SetShapeFunctionsValues(ShapeFunctions); // Initialize Splited Parts: Isochoric and Volumetric stresses and constitutive tensors double voigtsize = StressVector.size(); VectorSplit SplitStressVector; MatrixSplit SplitConstitutiveMatrix; //1.- Lame constants const double& YoungModulus = MaterialProperties[YOUNG_MODULUS]; const double& PoissonCoefficient = MaterialProperties[POISSON_RATIO]; ElasticVariables.LameLambda = (YoungModulus*PoissonCoefficient)/((1+PoissonCoefficient)*(1-2*PoissonCoefficient)); ElasticVariables.LameMu = YoungModulus/(2*(1+PoissonCoefficient)); //2.- Thermal constants if( MaterialProperties.Has(THERMAL_EXPANSION_COEFFICIENT) ) ElasticVariables.ThermalExpansionCoefficient = MaterialProperties[THERMAL_EXPANSION_COEFFICIENT]; else ElasticVariables.ThermalExpansionCoefficient = 0; if( MaterialProperties.Has(REFERENCE_TEMPERATURE) ) ElasticVariables.ReferenceTemperature = MaterialProperties[REFERENCE_TEMPERATURE]; else ElasticVariables.ReferenceTemperature = 0; //3.-DeformationGradient Tensor 3D ElasticVariables.DeformationGradientF = DeformationGradientF; ElasticVariables.DeformationGradientF = Transform2DTo3D( ElasticVariables.DeformationGradientF ); //4.-Determinant of the Total Deformation Gradient ElasticVariables.DeterminantF = DeterminantF; //5.-Right Cauchy Green tensor C Matrix RightCauchyGreen = prod(trans(ElasticVariables.DeformationGradientF),ElasticVariables.DeformationGradientF); //6.-Inverse of the Right Cauchy-Green tensor C: (stored in the CauchyGreenMatrix) ElasticVariables.traceCG = 0; ElasticVariables.CauchyGreenMatrix( 3, 3 ); MathUtils<double>::InvertMatrix( RightCauchyGreen, ElasticVariables.CauchyGreenMatrix, ElasticVariables.traceCG); //8.-Green-Lagrange Strain: if(Options.Is( ConstitutiveLaw::COMPUTE_STRAIN )) { this->CalculateGreenLagrangeStrain(RightCauchyGreen, StrainVector); } //9.-Calculate Total PK2 stress SplitStressVector.Isochoric = ZeroVector(voigtsize); if( Options.Is(ConstitutiveLaw::COMPUTE_STRESS ) || Options.Is(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR ) ) this->CalculateIsochoricStress( ElasticVariables, StressMeasure_PK2, SplitStressVector.Isochoric ); Vector IsochoricStressVector = SplitStressVector.Isochoric; if( Options.Is( ConstitutiveLaw::COMPUTE_STRESS ) ) { SplitStressVector.Volumetric = ZeroVector(voigtsize); this->CalculateVolumetricStress ( ElasticVariables, SplitStressVector.Volumetric ); //PK2 Stress: StressVector = SplitStressVector.Isochoric + SplitStressVector.Volumetric; if( Options.Is(ConstitutiveLaw::ISOCHORIC_TENSOR_ONLY ) ) { StressVector = SplitStressVector.Isochoric; } else if( Options.Is(ConstitutiveLaw::VOLUMETRIC_TENSOR_ONLY ) ) { StressVector = SplitStressVector.Volumetric; } } //10.-Calculate Constitutive Matrix related to Total PK2 stress if( Options.Is( ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR ) ) { //initialize constitutive tensors ConstitutiveMatrix.clear(); SplitConstitutiveMatrix.Isochoric = ConstitutiveMatrix; SplitConstitutiveMatrix.Volumetric = ConstitutiveMatrix; Matrix IsoStressMatrix = MathUtils<double>::StressVectorToTensor( IsochoricStressVector ); this->CalculateIsochoricConstitutiveMatrix ( ElasticVariables, IsoStressMatrix, SplitConstitutiveMatrix.Isochoric ); this->CalculateVolumetricConstitutiveMatrix ( ElasticVariables, SplitConstitutiveMatrix.Volumetric ); //if( Options.Is(ConstitutiveLaw::TOTAL_TENSOR ) ) ConstitutiveMatrix = SplitConstitutiveMatrix.Isochoric + SplitConstitutiveMatrix.Volumetric; if( Options.Is(ConstitutiveLaw::ISOCHORIC_TENSOR_ONLY ) ) { ConstitutiveMatrix = SplitConstitutiveMatrix.Isochoric; } else if( Options.Is(ConstitutiveLaw::VOLUMETRIC_TENSOR_ONLY ) ) { ConstitutiveMatrix = SplitConstitutiveMatrix.Volumetric; } } // std::cout<<" Constitutive "<<ConstitutiveMatrix<<std::endl; // std::cout<<" Stress "<<StressVector<<std::endl; //-----------------------------// }
void LinearElastic3DLaw::CalculateMaterialResponsePK2 (Parameters& rValues) { //-----------------------------// //a.-Check if the constitutive parameters are passed correctly to the law calculation //CheckParameters(rValues); //b.- Get Values to compute the constitutive law: Flags &Options=rValues.GetOptions(); mStrainEnergy = 0.0; //When it is not calculated, a zero will be returned const Properties& MaterialProperties = rValues.GetMaterialProperties(); Vector& StrainVector = rValues.GetStrainVector(); Vector& StressVector = rValues.GetStressVector(); //-----------------------------// //1.- Lame constants const double& YoungModulus = MaterialProperties[YOUNG_MODULUS]; const double& PoissonCoefficient = MaterialProperties[POISSON_RATIO]; // //1.1- Thermal constants // double ThermalExpansionCoefficient = 0; // if( MaterialProperties.Has(THERMAL_EXPANSION_COEFFICIENT) ) // ThermalExpansionCoefficient = MaterialProperties[THERMAL_EXPANSION_COEFFICIENT]; // double ReferenceTemperature = 0; // if( MaterialProperties.Has(REFERENCE_TEMPERATURE) ) // ReferenceTemperature = MaterialProperties[REFERENCE_TEMPERATURE]; if(Options.Is( ConstitutiveLaw::COMPUTE_STRAIN )) //large strains { //1.-Compute total deformation gradient const Matrix& DeformationGradientF = rValues.GetDeformationGradientF(); //2.-Right Cauchy-Green tensor C Matrix RightCauchyGreen = prod(trans(DeformationGradientF),DeformationGradientF); //3.-Green-Lagrange Strain: //E= 0.5*(FT*F-1) this->CalculateGreenLagrangeStrain(RightCauchyGreen,StrainVector); } //7.-Calculate Total PK2 stress if( Options.Is( ConstitutiveLaw::COMPUTE_STRESS ) ) { if( Options.Is( ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR ) ){ Matrix& ConstitutiveMatrix = rValues.GetConstitutiveMatrix(); this->CalculateLinearElasticMatrix( ConstitutiveMatrix, YoungModulus, PoissonCoefficient ); this->CalculateStress( StrainVector, ConstitutiveMatrix, StressVector ); } else { Matrix ConstitutiveMatrix = ZeroMatrix( StrainVector.size(), StrainVector.size() ); this->CalculateLinearElasticMatrix( ConstitutiveMatrix, YoungModulus, PoissonCoefficient ); this->CalculateStress( StrainVector, ConstitutiveMatrix, StressVector ); } } else if( Options.IsNot( ConstitutiveLaw::COMPUTE_STRESS ) && Options.Is( ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR ) ) { Matrix& ConstitutiveMatrix = rValues.GetConstitutiveMatrix(); this->CalculateLinearElasticMatrix( ConstitutiveMatrix, YoungModulus, PoissonCoefficient ); } if( Options.Is( ConstitutiveLaw::COMPUTE_STRAIN_ENERGY ) ) { if( Options.IsNot( ConstitutiveLaw::COMPUTE_STRESS ) ) { if(Options.Is( ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR )) { Matrix ConstitutiveMatrix = ZeroMatrix( StrainVector.size(), StrainVector.size() ); this->CalculateLinearElasticMatrix( ConstitutiveMatrix, YoungModulus, PoissonCoefficient ); this->CalculateStress( StrainVector, ConstitutiveMatrix, StressVector ); } else { Matrix& ConstitutiveMatrix = rValues.GetConstitutiveMatrix(); this->CalculateStress( StrainVector, ConstitutiveMatrix, StressVector ); } } mStrainEnergy = 0.5 * inner_prod(StrainVector,StressVector); //Belytschko Nonlinear Finite Elements pag 226 (5.4.3) : w = 0.5*E:C:E } //std::cout<<" Strain "<<StrainVector<<std::endl; //std::cout<<" Stress "<<StressVector<<std::endl; //Matrix& ConstitutiveMatrix = rValues.GetConstitutiveMatrix(); //std::cout<<" Constitutive "<<ConstitutiveMatrix<<std::endl; }