10 #if !defined(KRATOS_CONSTITUTIVE_MODEL_UTILITIES )
11 #define KRATOS_CONSTITUTIVE_MODEL_UTILITIES
87 for(
unsigned int i=0;
i<rF.size1();
i++)
88 for(
unsigned int j=0;
j<rF.size2();
j++)
91 if (rF.size1() == 2 && rF.size2() == 2)
101 else if(rF.size1() != 3 && rF.size2() != 3)
103 KRATOS_ERROR <<
"Matrix Dimensions are not correct" << std::endl;
122 for(
unsigned int i=0;
i<rL.size1();
i++)
123 for(
unsigned int j=0;
j<rL.size2();
j++)
126 if (rL.size1() == 2 && rL.size2() == 2)
136 else if(rL.size1() != 3 && rL.size2() != 3)
138 KRATOS_ERROR <<
"Matrix Dimensions are not correct" << std::endl;
156 noalias( rRightCauchyGreen ) =
prod(
trans(rDeformationGradientF), rDeformationGradientF );
167 Matrix& rLeftCauchyGreen )
169 noalias( rLeftCauchyGreen ) =
prod( rDeformationGradientF,
trans(rDeformationGradientF) );
180 Matrix& rInverseLeftCauchyGreen )
183 CalculateLeftCauchyGreen( rDeformationGradientF, LeftCauchyGreen );
199 rStrainMatrix = rRightCauchyGreen;
201 rStrainMatrix(0,0) -= 1.0;
202 rStrainMatrix(1,1) -= 1.0;
203 rStrainMatrix(2,2) -= 1.0;
205 rStrainMatrix *= 0.5;
219 InvertMatrix3( rLeftCauchyGreen, rStrainMatrix,
I3 );
221 rStrainMatrix *= (-0.5);
223 rStrainMatrix(0,0) += 0.5;
224 rStrainMatrix(1,1) += 0.5;
225 rStrainMatrix(2,2) += 0.5;
238 if( rStrainVector.size() == 6 ){
240 rStrainVector[0] = 0.5 * ( rRightCauchyGreen( 0, 0 ) - 1.00 );
241 rStrainVector[1] = 0.5 * ( rRightCauchyGreen( 1, 1 ) - 1.00 );
242 rStrainVector[2] = 0.5 * ( rRightCauchyGreen( 2, 2 ) - 1.00 );
243 rStrainVector[3] = rRightCauchyGreen( 0, 1 );
244 rStrainVector[4] = rRightCauchyGreen( 1, 2 );
245 rStrainVector[5] = rRightCauchyGreen( 0, 2 );
248 else if( rStrainVector.size() == 4 ){
250 rStrainVector[0] = 0.5 * ( rRightCauchyGreen( 0, 0 ) - 1.00 );
251 rStrainVector[1] = 0.5 * ( rRightCauchyGreen( 1, 1 ) - 1.00 );
252 rStrainVector[2] = 0.5 * ( rRightCauchyGreen( 2, 2 ) - 1.00 );
253 rStrainVector[3] = rRightCauchyGreen( 0, 1 );
255 else if( rStrainVector.size() == 3){
257 rStrainVector[0] = 0.5 * ( rRightCauchyGreen( 0, 0 ) - 1.00 );
258 rStrainVector[1] = 0.5 * ( rRightCauchyGreen( 1, 1 ) - 1.00 );
259 rStrainVector[2] = rRightCauchyGreen( 0, 1 );
263 KRATOS_ERROR <<
"Strain Vector dimensions are not correct" << std::endl;
280 CalculateRightCauchyGreen( rDeformationGradientF, RightCauchyGreen );
283 RightCauchyToGreenLagrangeStrain(RightCauchyGreen,rStrainVector);
302 CalculateRightCauchyGreen( rDeformationGradientF, rStrainMatrix );
304 rStrainMatrix(0,0) -= 1;
305 rStrainMatrix(1,1) -= 1;
306 rStrainMatrix(2,2) -= 1;
308 rStrainMatrix *= 0.5;
322 Matrix InverseLeftCauchyGreen;
324 InverseLeftCauchyToAlmansiStrain( InverseLeftCauchyGreen, rStrainVector );
337 if( rStrainVector.size() == 6 ){
339 rStrainVector[0] = 0.5 * ( 1.00 - rInverseLeftCauchyGreen( 0, 0 ) );
340 rStrainVector[1] = 0.5 * ( 1.00 - rInverseLeftCauchyGreen( 1, 1 ) );
341 rStrainVector[2] = 0.5 * ( 1.00 - rInverseLeftCauchyGreen( 2, 2 ) );
342 rStrainVector[3] = - rInverseLeftCauchyGreen( 0, 1 );
343 rStrainVector[4] = - rInverseLeftCauchyGreen( 1, 2 );
344 rStrainVector[5] = - rInverseLeftCauchyGreen( 0, 2 );
347 else if( rStrainVector.size() == 4 ){
349 rStrainVector[0] = 0.5 * ( 1.00 - rInverseLeftCauchyGreen( 0, 0 ) );
350 rStrainVector[1] = 0.5 * ( 1.00 - rInverseLeftCauchyGreen( 1, 1 ) );
351 rStrainVector[2] = 0.5 * ( 1.00 - rInverseLeftCauchyGreen( 2, 2 ) );
352 rStrainVector[3] = - rInverseLeftCauchyGreen( 0, 1 );
355 else if( rStrainVector.size() == 3){
357 rStrainVector[0] = 0.5 * ( 1.00 - rInverseLeftCauchyGreen( 0, 0 ) );
358 rStrainVector[1] = 0.5 * ( 1.00 - rInverseLeftCauchyGreen( 1, 1 ) );
359 rStrainVector[2] = - rInverseLeftCauchyGreen( 0, 1 );
363 KRATOS_ERROR <<
"Strain Vector dimensions are not correct" << std::endl;
384 Matrix InverseLeftCauchyGreen(3,3);
385 CalculateInverseLeftCauchyGreen( rDeformationGradientF, InverseLeftCauchyGreen );
387 InverseLeftCauchyToAlmansiStrain( InverseLeftCauchyGreen, rStrainVector );
405 CalculateInverseLeftCauchyGreen( rDeformationGradientF, rStrainMatrix );
407 rStrainMatrix(0,0) -= 1;
408 rStrainMatrix(1,1) -= 1;
409 rStrainMatrix(2,2) -= 1;
411 rStrainMatrix *= -0.5;
427 if( rMatrix.size1() == 6 ){
432 else if( rMatrix.size1() == 4 ){
434 for(
unsigned int i=0;
i<3;
i++)
436 for(
unsigned int j=0;
j<3;
j++)
438 rMatrix(
i,
j) = rTensor(
i,
j);
442 rMatrix(3,3) = rTensor(3,3);
445 else if( rMatrix.size1() == 3){
447 for(
unsigned int i=0;
i<2;
i++)
449 for(
unsigned int j=0;
j<2;
j++)
451 rMatrix(
i,
j) = rTensor(
i,
j);
455 rMatrix(2,2) = rTensor(3,3);
459 KRATOS_ERROR <<
"Constitutive Matrix dimensions are not correct" << std::endl;
482 if (rVector.size() == 4)
484 rTensor(0,0) = rVector[0];
485 rTensor(0,1) = rVector[2];
488 rTensor(1,0) = rVector[3];
489 rTensor(1,1) = rVector[1];
496 else if (rVector.size() == 9)
498 rTensor(0,0) = rVector[0];
499 rTensor(0,1) = rVector[3];
500 rTensor(0,2) = rVector[8];
502 rTensor(1,0) = rVector[6];
503 rTensor(1,1) = rVector[1];
504 rTensor(1,2) = rVector[4];
506 rTensor(2,0) = rVector[5];
507 rTensor(2,1) = rVector[7];
508 rTensor(2,2) = rVector[2];
511 KRATOS_ERROR <<
" VectorToTensor transform Vector Size not correct : " << rVector.size() <<std::endl;
534 if (rVector.size() == 4)
536 rVector[0] = rTensor(0,0);
537 rVector[1] = rTensor(1,1);
538 rVector[2] = rTensor(0,1);
539 rVector[3] = rTensor(1,0);
541 else if (rVector.size() == 9)
543 rVector[0] = rTensor(0,0);
544 rVector[1] = rTensor(1,1);
545 rVector[2] = rTensor(2,2);
546 rVector[3] = rTensor(0,1);
547 rVector[4] = rTensor(1,2);
548 rVector[5] = rTensor(2,0);
549 rVector[6] = rTensor(1,0);
550 rVector[7] = rTensor(2,1);
551 rVector[8] = rTensor(0,2);
554 KRATOS_ERROR <<
" TensorToVector transform Vector Size not correct : " << rVector.size() <<std::endl;
572 rMatrix(0,0) = rVector[0];
573 rMatrix(0,1) = rVector[3];
574 rMatrix(0,2) = rVector[5];
576 rMatrix(1,0) = rVector[3];
577 rMatrix(1,1) = rVector[1];
578 rMatrix(1,2) = rVector[4];
580 rMatrix(2,0) = rVector[5];
581 rMatrix(2,1) = rVector[4];
582 rMatrix(2,2) = rVector[2];
601 rVector[0]= rMatrix(0,0);
602 rVector[1]= rMatrix(1,1);
603 rVector[2]= rMatrix(2,2);
605 rVector[3]= rMatrix(0,1);
606 rVector[4]= rMatrix(1,2);
607 rVector[5]= rMatrix(2,0);
623 rMatrix(0,0) = rVector[0];
624 rMatrix(0,1) = 0.5*rVector[3];
625 rMatrix(0,2) = 0.5*rVector[5];
626 rMatrix(1,0) = 0.5*rVector[3];
627 rMatrix(1,1) = rVector[1];
628 rMatrix(1,2) = 0.5*rVector[4];
629 rMatrix(2,0) = 0.5*rVector[5];
630 rMatrix(2,1) = 0.5*rVector[4];
631 rMatrix(2,2) = rVector[2];
650 rVector[0]= rMatrix(0,0);
651 rVector[1]= rMatrix(1,1);
652 rVector[2]= rMatrix(2,2);
653 rVector[3]= 2.0*rMatrix(0,1);
654 rVector[4]= 2.0*rMatrix(1,2);
655 rVector[5]= 2.0*rMatrix(0,2);
673 if (rStrainVector.size() == 3)
675 rStrainTensor(0,0) = rStrainVector[0];
676 rStrainTensor(0,1) = 0.5*rStrainVector[2];
677 rStrainTensor(0,2) = 0.0;
679 rStrainTensor(1,0) = 0.5*rStrainVector[2];
680 rStrainTensor(1,1) = rStrainVector[1];
681 rStrainTensor(1,2) = 0.0;
683 rStrainTensor(2,0) = 0.0;
684 rStrainTensor(2,1) = 0.0;
685 rStrainTensor(2,2) = 0.0;
687 else if (rStrainVector.size() == 4)
689 rStrainTensor(0,0) = rStrainVector[0];
690 rStrainTensor(0,1) = 0.5*rStrainVector[3];
691 rStrainTensor(0,2) = 0.0;
693 rStrainTensor(1,0) = 0.5*rStrainVector[3];
694 rStrainTensor(1,1) = rStrainVector[1];
695 rStrainTensor(1,2) = 0.0;
697 rStrainTensor(2,0) = 0.0;
698 rStrainTensor(2,1) = 0.0;
699 rStrainTensor(2,2) = rStrainVector[2];
701 else if (rStrainVector.size() == 6)
703 rStrainTensor(0,0) = rStrainVector[0];
704 rStrainTensor(0,1) = 0.5*rStrainVector[3];
705 rStrainTensor(0,2) = 0.5*rStrainVector[5];
707 rStrainTensor(1,0) = 0.5*rStrainVector[3];
708 rStrainTensor(1,1) = rStrainVector[1];
709 rStrainTensor(1,2) = 0.5*rStrainVector[4];
711 rStrainTensor(2,0) = 0.5*rStrainVector[5];
712 rStrainTensor(2,1) = 0.5*rStrainVector[4];
713 rStrainTensor(2,2) = rStrainVector[2];
716 KRATOS_ERROR <<
"Unexpected voigt size: " << rStrainVector.size() << std::endl;
719 return rStrainTensor;
737 if (rStrainVector.size() == 3)
739 rStrainVector[0] = rStrainTensor(0,0);
740 rStrainVector[1] = rStrainTensor(1,1);
741 rStrainVector[2] = 2.0*rStrainTensor(0,1);
743 else if (rStrainVector.size() == 4)
745 rStrainVector[0] = rStrainTensor(0,0);
746 rStrainVector[1] = rStrainTensor(1,1);
747 rStrainVector[2] = rStrainTensor(2,2);
748 rStrainVector[3] = 2.0*rStrainTensor(0,1);
750 else if (rStrainVector.size() == 6)
752 rStrainVector[0] = rStrainTensor(0,0);
753 rStrainVector[1] = rStrainTensor(1,1);
754 rStrainVector[2] = rStrainTensor(2,2);
755 rStrainVector[3] = 2.0*rStrainTensor(0,1);
756 rStrainVector[4] = 2.0*rStrainTensor(1,2);
757 rStrainVector[5] = 2.0*rStrainTensor(0,2);
760 KRATOS_ERROR <<
"Unexpected voigt size: " << rStrainVector.size() << std::endl;
764 return rStrainVector;
783 if (rStressVector.size() == 3)
785 rStressTensor(0,0) = rStressVector[0];
786 rStressTensor(0,1) = rStressVector[2];
787 rStressTensor(0,2) = 0.0;
789 rStressTensor(1,0) = rStressVector[2];
790 rStressTensor(1,1) = rStressVector[1];
791 rStressTensor(1,2) = 0.0;
793 rStressTensor(2,0) = 0.0;
794 rStressTensor(2,1) = 0.0;
795 rStressTensor(2,2) = 0.0;
797 else if (rStressVector.size() == 4)
799 rStressTensor(0,0) = rStressVector[0];
800 rStressTensor(0,1) = rStressVector[3];
801 rStressTensor(0,2) = 0.0;
803 rStressTensor(1,0) = rStressVector[3];
804 rStressTensor(1,1) = rStressVector[1];
805 rStressTensor(1,2) = 0.0;
807 rStressTensor(2,0) = 0.0;
808 rStressTensor(2,1) = 0.0;
809 rStressTensor(2,2) = rStressVector[2];
811 else if (rStressVector.size() == 6)
813 rStressTensor(0,0) = rStressVector[0];
814 rStressTensor(0,1) = rStressVector[3];
815 rStressTensor(0,2) = rStressVector[5];
817 rStressTensor(1,0) = rStressVector[3];
818 rStressTensor(1,1) = rStressVector[1];
819 rStressTensor(1,2) = rStressVector[4];
821 rStressTensor(2,0) = rStressVector[5];
822 rStressTensor(2,1) = rStressVector[4];
823 rStressTensor(2,2) = rStressVector[2];
826 KRATOS_ERROR <<
"Unexpected voigt size: " << rStressVector.size() << std::endl;
829 return rStressTensor;
847 if (rStressVector.size() == 3)
849 rStressVector[0] = rStressTensor(0,0);
850 rStressVector[1] = rStressTensor(1,1);
851 rStressVector[2] = rStressTensor(0,1);
853 else if (rStressVector.size() == 4)
855 rStressVector[0] = rStressTensor(0,0);
856 rStressVector[1] = rStressTensor(1,1);
857 rStressVector[2] = rStressTensor(2,2);
858 rStressVector[3] = rStressTensor(0,1);
860 else if (rStressVector.size() == 6)
862 rStressVector[0] = rStressTensor(0,0);
863 rStressVector[1] = rStressTensor(1,1);
864 rStressVector[2] = rStressTensor(2,2);
865 rStressVector[3] = rStressTensor(0,1);
866 rStressVector[4] = rStressTensor(1,2);
867 rStressVector[5] = rStressTensor(0,2);
870 return rStressVector;
882 double& rStressNorm )
885 rStressNorm = sqrt((rStressMatrix(0,0)*rStressMatrix(0,0))+(rStressMatrix(1,1)*rStressMatrix(1,1))+(rStressMatrix(2,2)*rStressMatrix(2,2))+
886 (rStressMatrix(0,1)*rStressMatrix(0,1))+(rStressMatrix(0,2)*rStressMatrix(0,2))+(rStressMatrix(1,2)*rStressMatrix(1,2))+
887 (rStressMatrix(1,0)*rStressMatrix(1,0))+(rStressMatrix(2,0)*rStressMatrix(2,0))+(rStressMatrix(2,1)*rStressMatrix(2,1)));
901 double& rCharacteristicSize )
910 rCharacteristicSize = pow((6.0*rDomainGeometry.
Volume()/
Globals::Pi),0.33333333333333);
912 return rCharacteristicSize;
928 const unsigned int VSize = InputVector.size();
929 if(rPerturbationVector.size() != VSize)
930 rPerturbationVector.
resize(VSize,
false);
932 const double MinTol = 1.0e-10;
933 const double MaxTol = 1.0e-5;
936 double max_component = fabs(InputVector[0]) , min_component = fabs(InputVector[0]);
938 for(
unsigned int i=1;
i<VSize;
i++ )
940 if( fabs(InputVector[
i]) < min_component )
942 min_component = fabs(InputVector[
i]);
944 else if( fabs(InputVector[
i]) > max_component )
946 max_component = fabs(InputVector[
i]);
950 double aux = min_component*MaxTol;
952 if( aux < (max_component*MinTol) )
954 aux = max_component*MinTol;
958 for(
unsigned int i=0;
i<VSize;
i++ )
960 if( fabs(InputVector[
i]) > 1.0e-20 )
962 rPerturbationVector[
i] = InputVector[
i]*MaxTol;
964 else if( InputVector[
i] >= 0.0 )
966 rPerturbationVector[
i] = aux;
970 rPerturbationVector[
i] = -aux;
990 const double p1 =
A(0,1)*
A(0,1) +
A(0,2)*
A(0,2) +
A(1,2)*
A(1,2);
999 const double q = (
A(0,0) +
A(1,1) +
A(2,2)) / 3.0;
1000 const double p2 = (
A(0,0) -
q) * (
A(0,0) -
q) + (
A(1,1) -
q) * (
A(1,1) -
q) + (
A(2,2) -
q) * (
A(2,2) -
q) + 2.0 * p1;
1001 const double p = sqrt(p2 / 6.0);
1004 const double inv_p = 1.0/
p;
1007 B(0,0) = inv_p * (
A(0,0) -
q);
1008 B(1,1) = inv_p * (
A(1,1) -
q);
1009 B(2,2) = inv_p * (
A(2,2) -
q);
1010 B(0,1) = inv_p *
A(0,1);
1011 B(1,0) = inv_p *
A(1,0);
1012 B(0,2) = inv_p *
A(0,2);
1013 B(2,0) = inv_p *
A(2,0);
1014 B(1,2) = inv_p *
A(1,2);
1015 B(2,1) = inv_p *
A(2,1);
1018 double r = 0.5 * (
B(0,0)*
B(1,1)*
B(2,2) +
B(0,1)*
B(1,2)*
B(2,0) +
B(1,0)*
B(2,1)*
B(0,2) -
B(2,0)*
B(1,1)*
B(0,2) -
B(1,0)*
B(0,1)*
B(2,2) -
B(0,0)*
B(2,1)*
B(1,2) );
1024 else if (r >= 1) {
phi = 0.0; }
1025 else {
phi = acos(r) / 3.0;}
1028 Result[0] =
q + 2.0 *
p * cos(
phi);
1030 Result[1] = 3.0 *
q - Result[0] - Result[2];
1045 double& InputMatrixDet
1053 InvertedMatrix(0,0) = InputMatrix(1,1)*InputMatrix(2,2) - InputMatrix(1,2)*InputMatrix(2,1);
1054 InvertedMatrix(1,0) = -InputMatrix(1,0)*InputMatrix(2,2) + InputMatrix(1,2)*InputMatrix(2,0);
1055 InvertedMatrix(2,0) = InputMatrix(1,0)*InputMatrix(2,1) - InputMatrix(1,1)*InputMatrix(2,0);
1058 InvertedMatrix(0,1) = -InputMatrix(0,1)*InputMatrix(2,2) + InputMatrix(0,2)*InputMatrix(2,1);
1059 InvertedMatrix(1,1) = InputMatrix(0,0)*InputMatrix(2,2) - InputMatrix(0,2)*InputMatrix(2,0);
1060 InvertedMatrix(2,1) = -InputMatrix(0,0)*InputMatrix(2,1) + InputMatrix(0,1)*InputMatrix(2,0);
1063 InvertedMatrix(0,2) = InputMatrix(0,1)*InputMatrix(1,2) - InputMatrix(0,2)*InputMatrix(1,1);
1064 InvertedMatrix(1,2) = -InputMatrix(0,0)*InputMatrix(1,2) + InputMatrix(0,2)*InputMatrix(1,0);
1065 InvertedMatrix(2,2) = InputMatrix(0,0)*InputMatrix(1,1) - InputMatrix(0,1)*InputMatrix(1,0);
1068 InputMatrixDet = InputMatrix(0,0)*InvertedMatrix(0,0) + InputMatrix(0,1)*InvertedMatrix(1,0) + InputMatrix(0,2)*InvertedMatrix(2,0);
1071 InvertedMatrix *= ( 1.0 / InputMatrixDet );
1084 const unsigned int VSize = InputVector.
size();
1085 if(rPerturbationVector.
size() != VSize)
1086 rPerturbationVector.
resize(VSize,
false);
1088 const double MinTol = 1.0e-10;
1089 const double MaxTol = 1.0e-5;
1092 double max_component = fabs(InputVector[0]) , min_component = fabs(InputVector[0]);
1094 for(
unsigned int i=1;
i<VSize;
i++ )
1096 if( fabs(InputVector[
i]) < min_component )
1098 min_component = fabs(InputVector[
i]);
1100 else if( fabs(InputVector[
i]) > max_component )
1102 max_component = fabs(InputVector[
i]);
1106 double aux = min_component*MaxTol;
1108 if( aux < (max_component*MinTol) )
1110 aux = max_component*MinTol;
1114 for(
unsigned int i=0;
i<VSize;
i++ )
1116 if( fabs(InputVector[
i]) > 1.0e-20 )
1118 rPerturbationVector[
i] = InputVector[
i]*MaxTol;
1120 else if( InputVector[
i] >= 0.0 )
1122 rPerturbationVector[
i] = aux;
1126 rPerturbationVector[
i] = -aux;
1141 const unsigned int&
a,
const unsigned int&
b,
1142 const unsigned int&
c,
const unsigned int&
d )
1147 rValue = CalculateFourthOrderUnitTensor(Identity,rValue,
a,
b,
c,
d);
1162 const unsigned int&
a,
const unsigned int&
b,
1163 const unsigned int&
c,
const unsigned int&
d )
1167 if((
a==
c &&
b==
d) && (
a==
d &&
b==
c))
1169 else if((
a==
c &&
b==
d) || (
a==
d &&
b==
c))
1194 rValue = 0.5*(rMatrix(
a,
c)*rMatrix(
b,
d)+rMatrix(
a,
d)*rMatrix(
b,
c));
1209 const unsigned int&
a,
const unsigned int&
b,
1210 const unsigned int&
c,
const unsigned int&
d )
1215 rValue = CalculateSquareTensorDerivative(rMatrix,Identity,rValue,
a,
b,
c,
d);
1231 const unsigned int&
a,
const unsigned int&
b,
1232 const unsigned int&
c,
const unsigned int&
d )
1234 rValue = 0.5*(rIdentityMatrix(
a,
c)*rMatrix(
d,
b)+rIdentityMatrix(
a,
d)*rMatrix(
c,
b)+rIdentityMatrix(
b,
d)*rMatrix(
a,
c)+rIdentityMatrix(
c,
b)*rMatrix(
a,
d));
1251 const unsigned int&
a,
const unsigned int&
b,
1252 const unsigned int&
c,
const unsigned int&
d )
1254 rValue = rMatrixA(
a,
b)*rMatrixB(
c,
d);
1270 const unsigned int&
a,
const unsigned int&
b,
1271 const unsigned int&
c,
const unsigned int&
d )
1273 rValue = (rVectorA[
a]*rVectorA[
b])*(rVectorB[
c]*rVectorB[
d]);
1290 const unsigned int&
a,
const unsigned int&
b,
1291 const unsigned int&
c,
const unsigned int&
d )
1293 rValue = rMatrixA(
a,
b)*(rVectorB[
c]*rVectorB[
d]);
1309 const unsigned int&
a,
const unsigned int&
b,
1310 const unsigned int&
c,
const unsigned int&
d )
1312 rValue = (rVectorA[
a]*rVectorA[
b])*rMatrixB(
c,
d);
1323 static inline bool AreEqual(
const double& rA,
const double& rB )
1330 double absDiff = std::fabs(rA - rB);
1331 if(absDiff <= std::numeric_limits<double>::epsilon())
1337 double maxAbs =
std::max(std::fabs(rA), std::fabs(rB));
1338 return (absDiff/maxAbs) < 1
E-8;
1356 Matrix OriginalConstitutiveMatrix = rConstitutiveMatrix;
1358 rConstitutiveMatrix.
clear();
1360 Matrix InverseF ( 3, 3 );
1364 ConstitutiveMatrixTransformation( rConstitutiveMatrix, OriginalConstitutiveMatrix, InverseF );
1374 Matrix OriginalConstitutiveMatrix = rConstitutiveMatrix;
1376 rConstitutiveMatrix.
clear();
1378 ConstitutiveMatrixTransformation( rConstitutiveMatrix, OriginalConstitutiveMatrix, rF );
1386 const Matrix& rOriginalConstitutiveMatrix,
1389 unsigned int size = rOriginalConstitutiveMatrix.size1();
1392 const unsigned int IndexVoigt3D6C [6][2] = { {0, 0}, {1, 1}, {2, 2}, {0, 1}, {1, 2}, {0, 2} };
1394 for(
unsigned int i=0;
i<6;
i++)
1396 for(
unsigned int j=0;
j<6;
j++)
1398 rConstitutiveMatrix(
i,
j ) = TransformConstitutiveComponent(rConstitutiveMatrix(
i,
j ), rOriginalConstitutiveMatrix, rF,
1399 IndexVoigt3D6C[
i][0], IndexVoigt3D6C[
i][1], IndexVoigt3D6C[
j][0], IndexVoigt3D6C[
j][1]);
1404 else if( size == 4 )
1407 const unsigned int IndexVoigt2D4C [4][2] = { {0, 0}, {1, 1}, {2, 2}, {0, 1} };
1409 for(
unsigned int i=0;
i<4;
i++)
1411 for(
unsigned int j=0;
j<4;
j++)
1413 rConstitutiveMatrix(
i,
j ) = TransformConstitutiveComponent(rConstitutiveMatrix(
i,
j ), rOriginalConstitutiveMatrix, rF,
1414 IndexVoigt2D4C[
i][0], IndexVoigt2D4C[
i][1], IndexVoigt2D4C[
j][0], IndexVoigt2D4C[
j][1]);
1419 else if( size == 3 )
1422 const unsigned int IndexVoigt2D3C [3][2] = { {0, 0}, {1, 1}, {0, 1} };
1424 for(
unsigned int i=0;
i<3;
i++)
1426 for(
unsigned int j=0;
j<3;
j++)
1428 rConstitutiveMatrix(
i,
j ) = TransformConstitutiveComponent(rConstitutiveMatrix(
i,
j ), rOriginalConstitutiveMatrix, rF,
1429 IndexVoigt2D3C[
i][0], IndexVoigt2D3C[
i][1], IndexVoigt2D3C[
j][0], IndexVoigt2D3C[
j][1]);
1443 const Matrix & rConstitutiveMatrix,
1445 const unsigned int&
a,
const unsigned int&
b,
1446 const unsigned int&
c,
const unsigned int&
d)
1465 rCabcd +=rF(
a,
i)*rF(
b,
j)*rF(
c,
k)*rF(
d,
l)*GetConstitutiveComponent(Cijkl,rConstitutiveMatrix,
i,
j,
k,
l);
1480 const Matrix& rConstitutiveMatrix,
1481 const unsigned int&
a,
const unsigned int&
b,
1482 const unsigned int&
c,
const unsigned int&
d)
1485 unsigned int k=0,
l= 0;
1487 unsigned int size = rConstitutiveMatrix.size1();
1492 const unsigned int IndexVoigt2D3C [3][2] = { {0, 0}, {1, 1}, {0, 1} };
1495 for(
unsigned int i=0;
i<3;
i++)
1499 if( IndexVoigt2D3C[
i][0] ==
a && IndexVoigt2D3C[
i][1] ==
b )
1507 if( (IndexVoigt2D3C[
i][0] ==
a && IndexVoigt2D3C[
i][1] ==
b) ||
1508 (IndexVoigt2D3C[
i][1] ==
a && IndexVoigt2D3C[
i][0] ==
b) )
1517 for(
unsigned int i=0;
i<3;
i++)
1521 if( IndexVoigt2D3C[
i][0] ==
c && IndexVoigt2D3C[
i][1] ==
d )
1529 if( (IndexVoigt2D3C[
i][0] ==
c && IndexVoigt2D3C[
i][1] ==
d) ||
1530 (IndexVoigt2D3C[
i][1] ==
c && IndexVoigt2D3C[
i][0] ==
d) )
1540 else if( size == 4 )
1543 const unsigned int IndexVoigt2D4C [4][2] = { {0, 0}, {1, 1}, {2, 2}, {0, 1} };
1545 for(
unsigned int i=0;
i<4;
i++)
1549 if( IndexVoigt2D4C[
i][0] ==
a && IndexVoigt2D4C[
i][1] ==
b )
1557 if( (IndexVoigt2D4C[
i][0] ==
a && IndexVoigt2D4C[
i][1] ==
b) ||
1558 (IndexVoigt2D4C[
i][1] ==
a && IndexVoigt2D4C[
i][0] ==
b) )
1567 for(
unsigned int i=0;
i<4;
i++)
1571 if( IndexVoigt2D4C[
i][0] ==
c && IndexVoigt2D4C[
i][1] ==
d )
1579 if( (IndexVoigt2D4C[
i][0] ==
c && IndexVoigt2D4C[
i][1] ==
d) ||
1580 (IndexVoigt2D4C[
i][1] ==
c && IndexVoigt2D4C[
i][0] ==
d) )
1589 else if( size == 6 )
1592 const unsigned int IndexVoigt3D6C [6][2] = { {0, 0}, {1, 1}, {2, 2}, {0, 1}, {1, 2}, {0, 2} };
1595 for(
unsigned int i=0;
i<6;
i++)
1599 if( IndexVoigt3D6C[
i][0] ==
a && IndexVoigt3D6C[
i][1] ==
b )
1607 if( (IndexVoigt3D6C[
i][0] ==
a && IndexVoigt3D6C[
i][1] ==
b) ||
1608 (IndexVoigt3D6C[
i][1] ==
a && IndexVoigt3D6C[
i][0] ==
b) )
1617 for(
unsigned int i=0;
i<6;
i++)
1621 if( IndexVoigt3D6C[
i][0] ==
c && IndexVoigt3D6C[
i][1] ==
d )
1629 if( (IndexVoigt3D6C[
i][0] ==
c && IndexVoigt3D6C[
i][1] ==
d) ||
1630 (IndexVoigt3D6C[
i][1] ==
c && IndexVoigt3D6C[
i][0] ==
d) )
1639 rCabcd = rConstitutiveMatrix(
k,
l);
Short class definition.
Definition: constitutive_model_utilities.hpp:54
static void ComputePerturbationVector(VectorType &rPerturbationVector, const VectorType &InputVector)
Definition: constitutive_model_utilities.hpp:1082
~ConstitutiveModelUtilities()
Destructor.
Definition: constitutive_model_utilities.hpp:69
static MatrixType & StrainVectorToTensor(const Vector &rStrainVector, MatrixType &rStrainTensor)
Definition: constitutive_model_utilities.hpp:669
static Vector EigenValuesDirectMethod(const Matrix &A)
Definition: constitutive_model_utilities.hpp:983
static MatrixType & VectorToTensor(const Vector &rVector, MatrixType &rTensor)
Definition: constitutive_model_utilities.hpp:475
static double & CalculateSquareTensorDerivative(const MatrixType &rMatrix, double &rValue, const unsigned int &a, const unsigned int &b, const unsigned int &c, const unsigned int &d)
Definition: constitutive_model_utilities.hpp:1208
static double & CalculateStressNorm(const MatrixType &rStressMatrix, double &rStressNorm)
Definition: constitutive_model_utilities.hpp:881
static void RightCauchyToGreenLagrangeStrain(const MatrixType &rRightCauchyGreen, MatrixType &rStrainMatrix)
Definition: constitutive_model_utilities.hpp:196
static MatrixType & DeformationGradientTo3D(const MatrixType &rF, MatrixType &rF3D)
Definition: constitutive_model_utilities.hpp:83
static void CalculateAlmansiStrain(const Matrix &rDeformationGradientF, Matrix &rStrainMatrix)
Definition: constitutive_model_utilities.hpp:401
static void CalculateAlmansiStrain(const Matrix &rDeformationGradientF, Vector &rStrainVector)
Definition: constitutive_model_utilities.hpp:379
static void CalculateRightCauchyGreen(const MatrixType &rDeformationGradientF, MatrixType &rRightCauchyGreen)
Definition: constitutive_model_utilities.hpp:153
static void ConstitutiveMatrixTransformation(Matrix &rConstitutiveMatrix, const Matrix &rOriginalConstitutiveMatrix, const Matrix &rF)
Definition: constitutive_model_utilities.hpp:1385
static void CalculateGreenLagrangeStrain(const MatrixType &rDeformationGradientF, MatrixType &rStrainMatrix)
Definition: constitutive_model_utilities.hpp:298
static double & CalculateFourthOrderTensorProduct(const MatrixType &rMatrixA, const array_1d< double, 3 > &rVectorB, double &rValue, const unsigned int &a, const unsigned int &b, const unsigned int &c, const unsigned int &d)
Definition: constitutive_model_utilities.hpp:1289
static double & GetConstitutiveComponent(double &rCabcd, const Matrix &rConstitutiveMatrix, const unsigned int &a, const unsigned int &b, const unsigned int &c, const unsigned int &d)
Definition: constitutive_model_utilities.hpp:1479
static MatrixType & VectorToSymmetricTensor(const array_1d< double, 6 > &rVector, MatrixType &rMatrix)
Definition: constitutive_model_utilities.hpp:568
static double & CalculateFourthOrderUnitTensor(const MatrixType &rIdentityMatrix, double &rValue, const unsigned int &a, const unsigned int &b, const unsigned int &c, const unsigned int &d)
Definition: constitutive_model_utilities.hpp:1161
static double & TransformConstitutiveComponent(double &rCabcd, const Matrix &rConstitutiveMatrix, const Matrix &rF, const unsigned int &a, const unsigned int &b, const unsigned int &c, const unsigned int &d)
Definition: constitutive_model_utilities.hpp:1442
static double & CalculateFourthOrderUnitTensor(double &rValue, const unsigned int &a, const unsigned int &b, const unsigned int &c, const unsigned int &d)
Definition: constitutive_model_utilities.hpp:1140
static void ComputePerturbationVector(Vector &rPerturbationVector, const Vector &InputVector)
Definition: constitutive_model_utilities.hpp:926
ConstitutiveModelUtilities()
Default constructor.
Definition: constitutive_model_utilities.hpp:66
static void StrainTensorToVector(const MatrixType &rMatrix, array_1d< double, 6 > &rVector)
Definition: constitutive_model_utilities.hpp:646
static void CalculateLeftCauchyGreen(const Matrix &rDeformationGradientF, Matrix &rLeftCauchyGreen)
Definition: constitutive_model_utilities.hpp:166
static void LeftCauchyToAlmansiStrain(const MatrixType &rLeftCauchyGreen, MatrixType &rStrainMatrix)
Definition: constitutive_model_utilities.hpp:214
static void InvertMatrix3(const MatrixType &InputMatrix, MatrixType &InvertedMatrix, double &InputMatrixDet)
Definition: constitutive_model_utilities.hpp:1043
static Matrix & ConstitutiveTensorToMatrix(const BoundedMatrix< double, 6, 6 > &rTensor, Matrix &rMatrix)
Definition: constitutive_model_utilities.hpp:423
static void CalculateGreenLagrangeStrain(const Matrix &rDeformationGradientF, Vector &rStrainVector)
Definition: constitutive_model_utilities.hpp:274
static double & CalculateFourthOrderTensorProduct(const MatrixType &rMatrixA, const MatrixType &rMatrixB, double &rValue, const unsigned int &a, const unsigned int &b, const unsigned int &c, const unsigned int &d)
Definition: constitutive_model_utilities.hpp:1250
BoundedMatrix< double, 3, 3 > MatrixType
Definition: constitutive_model_utilities.hpp:59
static Vector & StressTensorToVector(const MatrixType &rStressTensor, Vector &rStressVector)
Definition: constitutive_model_utilities.hpp:843
static MatrixType & VelocityGradientTo3D(const MatrixType &rL, MatrixType &rL3D)
Definition: constitutive_model_utilities.hpp:118
static Vector & StrainTensorToVector(const MatrixType &rStrainTensor, Vector &rStrainVector)
Definition: constitutive_model_utilities.hpp:733
static double & CalculateFourthOrderTensorProduct(const array_1d< double, 3 > &rVectorA, const array_1d< double, 3 > &rVectorB, double &rValue, const unsigned int &a, const unsigned int &b, const unsigned int &c, const unsigned int &d)
Definition: constitutive_model_utilities.hpp:1269
static double & CalculateFourthOrderTensorProduct(const array_1d< double, 3 > &rVectorA, const MatrixType &rMatrixB, double &rValue, const unsigned int &a, const unsigned int &b, const unsigned int &c, const unsigned int &d)
Definition: constitutive_model_utilities.hpp:1308
static void PullBackConstitutiveMatrix(Matrix &rConstitutiveMatrix, const Matrix &rF)
Definition: constitutive_model_utilities.hpp:1353
static bool AreEqual(const double &rA, const double &rB)
Definition: constitutive_model_utilities.hpp:1323
static double & CalculateSquareTensorDerivative(const MatrixType &rMatrix, const MatrixType &rIdentityMatrix, double &rValue, const unsigned int &a, const unsigned int &b, const unsigned int &c, const unsigned int &d)
Definition: constitutive_model_utilities.hpp:1230
static MatrixType & StressVectorToTensor(const Vector &rStressVector, MatrixType &rStressTensor)
Definition: constitutive_model_utilities.hpp:779
static MatrixType & StrainVectorToTensor(const array_1d< double, 6 > &rVector, MatrixType &rMatrix)
Definition: constitutive_model_utilities.hpp:619
array_1d< double, 6 > VectorType
Definition: constitutive_model_utilities.hpp:60
static void CalculateInverseLeftCauchyGreen(const Matrix &rDeformationGradientF, Matrix &rInverseLeftCauchyGreen)
Definition: constitutive_model_utilities.hpp:179
static Vector & TensorToVector(const MatrixType &rTensor, Vector &rVector)
Definition: constitutive_model_utilities.hpp:527
static void RightCauchyToGreenLagrangeStrain(const Matrix &rRightCauchyGreen, Vector &rStrainVector)
Definition: constitutive_model_utilities.hpp:234
static void LeftCauchyToAlmansiStrain(const Matrix &rLeftCauchyGreen, Vector &rStrainVector)
Definition: constitutive_model_utilities.hpp:318
static double & CalculateFourthOrderTensor(const MatrixType &rMatrix, double &rValue, const double &a, const double &b, const double &c, const double &d)
Definition: constitutive_model_utilities.hpp:1187
static void SymmetricTensorToVector(const MatrixType &rMatrix, array_1d< double, 6 > &rVector)
Definition: constitutive_model_utilities.hpp:597
static void InverseLeftCauchyToAlmansiStrain(const Matrix &rInverseLeftCauchyGreen, Vector &rStrainVector)
Definition: constitutive_model_utilities.hpp:333
static void PushForwardConstitutiveMatrix(Matrix &rConstitutiveMatrix, const Matrix &rF)
Definition: constitutive_model_utilities.hpp:1371
static double & CalculateCharacteristicSize(const Geometry< Node > &rDomainGeometry, double &rCharacteristicSize)
Definition: constitutive_model_utilities.hpp:900
Geometry base class.
Definition: geometry.h:71
virtual double Volume() const
This method calculate and return volume of this geometry.
Definition: geometry.h:1358
SizeType WorkingSpaceDimension() const
Definition: geometry.h:1287
virtual double Area() const
This method calculate and return area or surface area of this geometry depending to it's dimension.
Definition: geometry.h:1345
Definition: amatrix_interface.h:41
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
void clear()
Definition: amatrix_interface.h:284
static BoundedMatrix< double, TDim, TDim > InvertMatrix(const BoundedMatrix< double, TDim, TDim > &rInputMatrix, double &rInputMatrixDet, const double Tolerance=ZeroTolerance)
Calculates the inverse of a 2x2, 3x3 and 4x4 matrices (using bounded matrix for performance)
Definition: math_utils.h:197
BOOST_UBLAS_INLINE void resize(size_type array_size, bool preserve=true)
Definition: array_1d.h:242
BOOST_UBLAS_INLINE size_type size() const
Definition: array_1d.h:370
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
static double max(double a, double b)
Definition: GeometryFunctions.h:79
constexpr double Pi
Definition: global_variables.h:25
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
AMatrix::IdentityMatrix< double > IdentityMatrix
Definition: amatrix_interface.h:564
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
q
Definition: generate_convection_diffusion_explicit_element.py:109
E
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:26
a
Definition: generate_stokes_twofluid_element.py:77
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
c
Definition: generate_weakly_compressible_navier_stokes_element.py:108
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
phi
Definition: isotropic_damage_automatic_differentiation.py:168
tuple I3
Definition: isotropic_damage_automatic_differentiation.py:232
int d
Definition: ode_solve.py:397
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
A
Definition: sensitivityMatrix.py:70
p
Definition: sensitivityMatrix.py:52
int dim
Definition: sensitivityMatrix.py:25
B
Definition: sensitivityMatrix.py:76
integer i
Definition: TensorModule.f:17
integer l
Definition: TensorModule.f:17