38 #ifndef _SECONDORDEREXPONENTIALMATERIAL_H_ 39 #define _SECONDORDEREXPONENTIALMATERIAL_H_ 41 #pragma GCC diagnostic ignored "-Wunused-variable" 42 #pragma GCC diagnostic ignored "-Wunused-parameter" 44 #include <lifev/structure/solver/isotropic/StructuralIsotropicConstitutiveLaw.hpp> 48 template <
typename MeshType>
49 class SecondOrderExponentialMaterialNonLinear :
public StructuralIsotropicConstitutiveLaw<MeshType>
55 typedef StructuralIsotropicConstitutiveLaw<MeshType> super;
57 typedef typename super::data_Type data_Type;
59 typedef typename super::vector_Type vector_Type;
60 typedef typename super::matrix_Type matrix_Type;
62 typedef typename super::matrixPtr_Type matrixPtr_Type;
63 typedef typename super::vectorPtr_Type vectorPtr_Type;
64 typedef typename super::dataPtr_Type dataPtr_Type;
65 typedef typename super::displayerPtr_Type displayerPtr_Type;
67 typedef typename super::mapMarkerVolumesPtr_Type mapMarkerVolumesPtr_Type;
68 typedef typename super::mapMarkerVolumes_Type mapMarkerVolumes_Type;
69 typedef typename mapMarkerVolumes_Type::const_iterator mapIterator_Type;
71 typedef typename super::vectorVolumes_Type vectorVolumes_Type;
72 typedef std::shared_ptr<vectorVolumes_Type> vectorVolumesPtr_Type;
74 typedef typename super::mapMarkerIndexesPtr_Type mapMarkerIndexesPtr_Type;
75 typedef typename super::mapMarkerIndexes_Type mapMarkerIndexes_Type;
76 typedef typename mapMarkerIndexes_Type::const_iterator mapIteratorIndex_Type;
78 typedef std::vector<UInt> vectorIndexes_Type;
79 typedef std::shared_ptr<vectorIndexes_Type> vectorIndexesPtr_Type;
81 typedef typename super::FESpacePtr_Type FESpacePtr_Type;
82 typedef typename super::ETFESpacePtr_Type ETFESpacePtr_Type;
85 typedef typename super::vectorsParameters_Type vectorsParameters_Type;
86 typedef typename super::vectorsParametersPtr_Type vectorsParametersPtr_Type;
88 typedef MatrixSmall<3, 3> matrixSmall_Type;
91 typedef typename super::tensorF_Type tensorF_Type;
92 typedef typename super::determinantF_Type determinantF_Type;
93 typedef typename super::tensorC_Type tensorC_Type;
94 typedef typename super::minusT_Type minusT_Type;
95 typedef typename super::traceTensor_Type traceTensor_Type;
103 SecondOrderExponentialMaterialNonLinear();
105 virtual ~SecondOrderExponentialMaterialNonLinear();
120 void setup (
const FESpacePtr_Type& dFESpace,
121 const ETFESpacePtr_Type& dETFESpace,
122 const std::shared_ptr<
const MapEpetra>& monolithicMap,
123 const UInt offset,
const dataPtr_Type& dataMaterial);
130 void computeLinearStiff ( dataPtr_Type& ,
const mapMarkerVolumesPtr_Type ,
const mapMarkerIndexesPtr_Type );
139 void updateJacobianMatrix (
const vector_Type& disp,
140 const dataPtr_Type& dataMaterial,
141 const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
142 const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
143 const displayerPtr_Type& displayer );
153 void updateNonLinearJacobianTerms ( matrixPtr_Type& jacobian,
154 const vector_Type& disp,
155 const dataPtr_Type& dataMaterial,
156 const mapMarkerVolumesPtr_Type ,
157 const mapMarkerIndexesPtr_Type ,
158 const displayerPtr_Type& displayer );
169 void computeStiffness (
const vector_Type& disp,
Real factor,
const dataPtr_Type& dataMaterial,
const mapMarkerVolumesPtr_Type ,
170 const mapMarkerIndexesPtr_Type ,
const displayerPtr_Type& displayer );
194 void computeKinematicsVariables (
const VectorElemental& dk_loc );
203 void showMe ( std::string
const& fileNameVectStiff,
204 std::string
const& fileNameJacobain );
214 void computeLocalFirstPiolaKirchhoffTensor ( Epetra_SerialDenseMatrix& firstPiola,
215 const Epetra_SerialDenseMatrix& tensorF,
216 const Epetra_SerialDenseMatrix& cofactorF,
217 const std::vector<Real>& invariants,
227 void computeCauchyStressTensor (
const vectorPtr_Type disp,
229 vectorPtr_Type sigma_1,
230 vectorPtr_Type sigma_2,
231 vectorPtr_Type sigma_3);
239 matrixPtr_Type
const stiffMatrix()
const 241 return super::M_jacobian;
246 vectorPtr_Type
const stiffVector()
const 251 void apply (
const vector_Type& sol, vector_Type& res,
252 const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
253 const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
254 const displayerPtr_Type displayer) ;
267 void setupVectorsParameters (
void );
270 vectorPtr_Type M_stiff;
273 matrixSmall_Type M_identity;
280 template <
typename MeshType>
281 SecondOrderExponentialMaterialNonLinear<MeshType>::SecondOrderExponentialMaterialNonLinear() :
292 template <
typename MeshType>
293 SecondOrderExponentialMaterialNonLinear<MeshType>::~SecondOrderExponentialMaterialNonLinear()
300 template <
typename MeshType>
302 SecondOrderExponentialMaterialNonLinear<MeshType>::setup (
const FESpacePtr_Type& dFESpace,
303 const ETFESpacePtr_Type& dETFESpace,
304 const std::shared_ptr<
const MapEpetra>& monolithicMap,
306 const dataPtr_Type& dataMaterial)
309 this->M_dataMaterial = dataMaterial;
312 this->M_dispFESpace = dFESpace;
313 this->M_dispETFESpace = dETFESpace;
314 this->M_localMap = monolithicMap;
315 this->M_offset = offset;
317 M_stiff.reset (
new vector_Type (*
this->M_localMap) );
319 M_identity (0, 0) = 1.0;
320 M_identity (0, 1) = 0.0;
321 M_identity (0, 2) = 0.0;
322 M_identity (1, 0) = 0.0;
323 M_identity (1, 1) = 1.0;
324 M_identity (1, 2) = 0.0;
325 M_identity (2, 0) = 0.0;
326 M_identity (2, 1) = 0.0;
327 M_identity (2, 2) = 1.0;
332 this->M_vectorsParameters.reset (
new vectorsParameters_Type ( 3 ) );
334 this->setupVectorsParameters();
338 template <
typename MeshType>
340 SecondOrderExponentialMaterialNonLinear<MeshType>::setupVectorsParameters (
void )
349 UInt nbElements =
this->M_dispFESpace->mesh()->numVolumes();
353 (* (
this->M_vectorsParameters) ) [0].resize ( nbElements );
356 (* (
this->M_vectorsParameters) ) [1].resize ( nbElements );
359 (* (
this->M_vectorsParameters) ) [2].resize ( nbElements );
361 for (
UInt i (0); i < nbElements; i++ )
364 UInt markerID =
this->M_dispFESpace->mesh()->element ( i ).markerID();
366 Real alpha =
this->M_dataMaterial->alpha ( markerID );
367 Real gamma =
this->M_dataMaterial->gamma ( markerID );
368 Real bulk =
this->M_dataMaterial->bulk ( markerID );
370 ( (* (
this->M_vectorsParameters) ) [0]) [ i ] = alpha;
371 ( (* (
this->M_vectorsParameters) ) [1]) [ i ] = gamma;
372 ( (* (
this->M_vectorsParameters) ) [2]) [ i ] = bulk;
377 template <
typename MeshType>
378 void SecondOrderExponentialMaterialNonLinear<MeshType>::computeLinearStiff (dataPtr_Type& ,
const mapMarkerVolumesPtr_Type ,
const mapMarkerIndexesPtr_Type )
383 template <
typename MeshType>
384 void SecondOrderExponentialMaterialNonLinear<MeshType>::updateJacobianMatrix (
const vector_Type& disp,
385 const dataPtr_Type& dataMaterial,
386 const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
387 const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
388 const displayerPtr_Type& displayer )
390 this->M_jacobian.reset (
new matrix_Type (*
this->M_localMap) );
392 displayer->leaderPrint (
" \n************************************************\n ");
393 updateNonLinearJacobianTerms (
this->M_jacobian, disp,
this->M_dataMaterial, mapsMarkerVolumes, mapsMarkerIndexes, displayer);
394 displayer->leaderPrint (
" \n************************************************\n ");
401 template <
typename MeshType>
402 void SecondOrderExponentialMaterialNonLinear<MeshType>::updateNonLinearJacobianTerms ( matrixPtr_Type& jacobian,
403 const vector_Type& disp,
404 const dataPtr_Type& dataMaterial,
405 const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
406 const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
407 const displayerPtr_Type& displayer )
414 displayer->leaderPrint (
" Non-Linear S- updating non linear terms in the Jacobian Matrix (Second Order Exponential)");
443 tensorF_Type F = ExpressionDefinitions::deformationGradient(
this->M_dispETFESpace, disp,
this->M_offset,
this->M_identity );
459 integrate ( elements (
this->M_dispETFESpace->mesh() ) ,
460 this->M_dispFESpace->qr(),
461 this->M_dispETFESpace,
462 this->M_dispETFESpace,
467 integrate ( elements (
this->M_dispETFESpace->mesh() ) ,
468 this->M_dispFESpace->qr(),
469 this->M_dispETFESpace,
470 this->M_dispETFESpace,
471 value ( - 1.0 / 2.0 ) * parameter ( (* (
this->M_vectorsParameters) ) [2] ) * ( pow (J, 2.0) - J + log (J) ) * dot ( F_T * transpose (grad (phi_j) ) * F_T, grad (phi_i) )
478 integrate ( elements (
this->M_dispETFESpace->mesh() ) ,
479 this->M_dispFESpace->qr(),
480 this->M_dispETFESpace,
481 this->M_dispETFESpace,
482 value ( -4.0 / 3.0
) * parameter ( (* (
this->M_vectorsParameters) ) [0] ) * pow ( J, -2.0 / 3.0 ) *
483 exp ( parameter ( (* (
this->M_vectorsParameters) ) [1] ) * ( pow( J, -2.0/3.0) * I_C -
value (3.0
) ) * ( pow( J, -2.0/3.0 )* I_C -
value (3.0
) ) ) *
484 ( pow( J, -2.0/3.0 ) * I_C + ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) * (
value ( 2.0
) * parameter ( (* (
this->M_vectorsParameters) ) [1] ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) +
value (1.0
) ) ) *
491 integrate ( elements (
this->M_dispETFESpace->mesh() ),
492 this->M_dispFESpace->qr(),
493 this->M_dispETFESpace,
494 this->M_dispETFESpace,
495 value ( 4.0
) * parameter ( (* (
this->M_vectorsParameters) ) [0] ) * pow ( J, (-4.0 / 3.0) ) *
496 exp ( parameter ( (* (
this->M_vectorsParameters) ) [1] ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) ) *
497 (
value (1.0
) +
value ( 2.0
) * parameter ( (* (
this->M_vectorsParameters) ) [1] ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) ) *
504 integrate ( elements (
this->M_dispETFESpace->mesh() ) ,
505 this->M_dispFESpace->qr(),
506 this->M_dispETFESpace,
507 this->M_dispETFESpace,
508 value (4.0 / 9.0
) * parameter ( (* (
this->M_vectorsParameters) ) [0] ) * pow( J, -2.0/3.0 ) * I_C *
509 exp ( parameter ( (* (
this->M_vectorsParameters) ) [1] ) * ( pow( J, -2.0/3.0) * I_C -
value (3.0
) ) * ( pow( J, -2.0/3.0) * I_C -
value (3.0
) ) ) *
510 ( ( pow( J, -2.0/3.0) * I_C -
value (3.0
) ) * (
value (1.0
) +
value (2.0
) * parameter ( (* (
this->M_vectorsParameters) ) [1] ) * pow(J, -2.0/3.0) * I_C * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) ) + pow( J, -2.0/3.0 ) * I_C ) *
518 integrate ( elements (
this->M_dispETFESpace->mesh() ),
519 this->M_dispFESpace->qr(),
520 this->M_dispETFESpace,
521 this->M_dispETFESpace,
522 value (-4.0 / 3.0
) * parameter ( (* (
this->M_vectorsParameters) ) [0] ) * pow ( J, (-2.0 / 3.0) ) *
523 exp ( parameter ( (* (
this->M_vectorsParameters) ) [1] ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) ) *
524 ( pow( J, -2.0/3.0 ) * I_C + ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) * (
value ( 2.0
) * parameter ( (* (
this->M_vectorsParameters) ) [1] ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) * pow( J, -2.0/3.0 ) * I_C +
value (1.0
) ) ) *
529 integrate ( elements (
this->M_dispETFESpace->mesh() ),
530 this->M_dispFESpace->qr(),
531 this->M_dispETFESpace,
532 this->M_dispETFESpace,
533 value ( 2.0 ) * parameter ( (* (
this->M_vectorsParameters) ) [0] ) * pow ( J, (-2.0 / 3.0) ) * ( pow(J, -2.0/3.0) * I_C - value (3.0) ) *
534 exp ( parameter ( (* (
this->M_vectorsParameters) ) [1] ) * ( pow(J, -2.0/3.0) * I_C - value (3.0) ) * ( pow(J, -2.0/3.0) * I_C - value (3.0) ) ) *
535 dot ( grad (phi_j), grad (phi_i) )
540 integrate ( elements (
this->M_dispETFESpace->mesh() ),
541 this->M_dispFESpace->qr(),
542 this->M_dispETFESpace,
543 this->M_dispETFESpace,
544 value (2.0 / 3.0) * parameter ( (* (
this->M_vectorsParameters) ) [0] ) * pow( J, -2.0/3.0 ) * I_C * ( pow( J, -2.0/3.0 ) * I_C - value (3.0) ) *
545 exp ( parameter ( (* (
this->M_vectorsParameters) ) [1] ) * ( pow( J, -2.0/3.0 ) * I_C - value (3.0) ) * ( pow( J, -2.0/3.0 ) * I_C - value (3.0) ) ) *
546 dot ( F_T * transpose (grad (phi_j) ) * F_T , grad (phi_i) )
552 jacobian->globalAssemble();
559 template <
typename MeshType>
560 void SecondOrderExponentialMaterialNonLinear<MeshType>::computeStiffness (
const vector_Type& disp,
562 const dataPtr_Type& dataMaterial,
563 const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
564 const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
565 const displayerPtr_Type& displayer )
569 this->M_stiff.reset (
new vector_Type (*
this->M_localMap) );
572 displayer->leaderPrint (
" \n*********************************\n ");
573 displayer->leaderPrint (
" Non-Linear S- Computing the Second Order Exponential nonlinear stiffness vector ");
574 displayer->leaderPrint (
" \n*********************************\n ");
603 tensorF_Type F = ExpressionDefinitions::deformationGradient(
this->M_dispETFESpace, disp,
this->M_offset,
this->M_identity );
627 integrate ( elements (
this->M_dispETFESpace->mesh() ),
628 this->M_dispFESpace->qr(),
629 this->M_dispETFESpace,
630 value (1.0 / 2.0
) * parameter ( (* (
this->M_vectorsParameters) ) [2] ) * ( pow ( J , 2.0) - J + log (J) ) * dot ( F_T,
grad (phi_i) )
638 integrate ( elements (
this->M_dispETFESpace->mesh() ),
639 this->M_dispFESpace->qr(),
640 this->M_dispETFESpace,
641 value ( 2.0
) * parameter ( (* (
this->M_vectorsParameters) ) [0] ) * ( pow( J, -2.0/3.0) * I_C -
value (3.0
) ) *
642 exp ( parameter ( (* (
this->M_vectorsParameters) ) [1] ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) ) *
650 this->M_stiff->globalAssemble();
657 template <
typename MeshType>
658 void SecondOrderExponentialMaterialNonLinear<MeshType>::computeKinematicsVariables (
const VectorElemental& dk_loc )
751 template <
typename MeshType>
760 template <
typename MeshType>
761 void SecondOrderExponentialMaterialNonLinear<MeshType>::apply (
const vector_Type& sol, vector_Type& res,
const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
const displayerPtr_Type displayer )
763 computeStiffness (sol, 0,
this->M_dataMaterial, mapsMarkerVolumes, mapsMarkerIndexes, displayer);
768 template <
typename MeshType>
769 void SecondOrderExponentialMaterialNonLinear<MeshType>::computeLocalFirstPiolaKirchhoffTensor ( Epetra_SerialDenseMatrix& firstPiola,
770 const Epetra_SerialDenseMatrix& tensorF,
771 const Epetra_SerialDenseMatrix& cofactorF,
772 const std::vector<Real>& invariants,
776 Real alpha =
this->M_dataMaterial->alpha (marker);
777 Real gamma =
this->M_dataMaterial->gamma (marker);
778 Real bulk =
this->M_dataMaterial->bulk (marker);
782 Epetra_SerialDenseMatrix firstTerm (tensorF);
783 Epetra_SerialDenseMatrix copyCofactorF (cofactorF);
786 scale = -invariants[0] / 3.0;
787 copyCofactorF.Scale ( scale );
788 firstTerm += copyCofactorF;
792 trCiso = std::pow (invariants[3], - (2.0 / 3.0) ) * invariants[0];
795 coef = 2.0 * alpha * std::pow (invariants[3], - (2.0 / 3.0) ) * ( trCiso - 3.0 ) * std::exp ( gamma * ( trCiso - 3 ) * ( trCiso - 3 ) );
796 firstTerm.Scale ( coef );
799 Epetra_SerialDenseMatrix secondTerm (cofactorF);
801 secCoef = invariants[3] * (bulk / 2.0) * (invariants[3] - 1 + (1.0 / invariants[3]) * std::log (invariants[3]) );
803 secondTerm.Scale ( secCoef );
805 firstPiola += firstTerm;
806 firstPiola += secondTerm;
810 template <
typename MeshType>
811 void SecondOrderExponentialMaterialNonLinear<MeshType>::computeCauchyStressTensor (
const vectorPtr_Type disp,
813 vectorPtr_Type sigma_1,
814 vectorPtr_Type sigma_2,
815 vectorPtr_Type sigma_3)
822 tensorF_Type F = ExpressionDefinitions::deformationGradient(
this->M_dispETFESpace, *disp,
this->M_offset,
this->M_identity );
837 evaluateNode( elements (
this->M_dispETFESpace->mesh() ),
839 this->M_dispETFESpace,
840 meas_K * dot ( vectorFromMatrix( ( 1 / J )*
841 (
value (1.0 / 2.0
) * parameter ( (* (
this->M_vectorsParameters) ) [2] ) * ( pow ( J , 2.0) - J + log (J) ) * F_T +
842 value ( 2.0
) * parameter ( (* (
this->M_vectorsParameters) ) [0] ) * ( pow( J, -2.0/3.0) * I_C -
value (3.0
) ) *
843 exp ( parameter ( (* (
this->M_vectorsParameters) ) [1] ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) ) *
844 pow ( J, (-2.0 / 3.0) ) * ( F -
value (1.0 / 3.0
) * I_C * F_T )
846 transpose( F ), 0 ),
phi_i)
848 sigma_1->globalAssemble();
850 evaluateNode( elements (
this->M_dispETFESpace->mesh() ),
852 this->M_dispETFESpace,
853 meas_K * dot ( vectorFromMatrix( ( 1 / J )*
854 (
value (1.0 / 2.0
) * parameter ( (* (
this->M_vectorsParameters) ) [2] ) * ( pow ( J , 2.0) - J + log (J) ) * F_T +
855 value ( 2.0
) * parameter ( (* (
this->M_vectorsParameters) ) [0] ) * ( pow( J, -2.0/3.0) * I_C -
value (3.0
) ) *
856 exp ( parameter ( (* (
this->M_vectorsParameters) ) [1] ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) ) *
857 pow ( J, (-2.0 / 3.0) ) * ( F -
value (1.0 / 3.0
) * I_C * F_T )
859 transpose( F ) , 1 ),
phi_i)
861 sigma_2->globalAssemble();
863 evaluateNode( elements (
this->M_dispETFESpace->mesh() ),
865 this->M_dispETFESpace,
866 meas_K * dot ( vectorFromMatrix( ( 1 / J )*
867 (
value (1.0 / 2.0
) * parameter ( (* (
this->M_vectorsParameters) ) [2] ) * ( pow ( J , 2.0) - J + log (J) ) * F_T +
868 value ( 2.0
) * parameter ( (* (
this->M_vectorsParameters) ) [0] ) * ( pow( J, -2.0/3.0) * I_C -
value (3.0
) ) *
869 exp ( parameter ( (* (
this->M_vectorsParameters) ) [1] ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) * ( pow( J, -2.0/3.0 ) * I_C -
value (3.0
) ) ) *
870 pow ( J, (-2.0 / 3.0) ) * ( F -
value (1.0 / 3.0
) * I_C * F_T )
872 transpose( F ) , 2 ),
phi_i)
874 sigma_3->globalAssemble();
878 template <
typename MeshType>
879 inline StructuralIsotropicConstitutiveLaw<MeshType>* createSecondOrderExponentialMaterialNonLinear()
881 return new SecondOrderExponentialMaterialNonLinear<MeshType >();
void assignFunction(bcBase_Type &base)
Assign the function to the base of the BCHandler.
rightCauchyGreenTensor_Type tensorC(const ExpressionTranspose< deformationGradient_Type > tF, const deformationGradient_Type F)
determinantTensorF_Type determinantF(const deformationGradient_Type F)
static const LifeV::UInt elm_nodes_num[]
const ExpressionPhiJ phi_j
Simple function to be used in the construction of an expression.
minusTransposedTensor_Type minusT(const deformationGradient_Type F)
traceTensor_Type traceTensor(const rightCauchyGreenTensor_Type C)
double Real
Generic real data.
ExpressionScalar value(const Real &myValue)
Simple function to be used in the construction of an expression.
const ExpressionMeas meas_K
Instance to be used in the expressions.
QuadratureRule - The basis class for storing and accessing quadrature rules.
ExpressionDphiJ grad(const ExpressionPhiJ &)
Simple function to be used in the construction of an expression.
const ExpressionPhiI phi_i
Simple function to be used in the construction of an expression.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
ExpressionDphiI grad(const ExpressionPhiI &)
Simple function to be used in the construction of an expression.