38 #ifndef _LINVENANTKIRCHHOFFMATERIAL_H_ 39 #define _LINVENANTKIRCHHOFFMATERIAL_H_ 41 #include <lifev/structure/solver/isotropic/StructuralIsotropicConstitutiveLaw.hpp> 46 template <
typename MeshType>
47 class VenantKirchhoffMaterialLinear :
48 public StructuralIsotropicConstitutiveLaw<MeshType>
54 typedef StructuralIsotropicConstitutiveLaw<MeshType> super;
56 typedef typename super::data_Type data_Type;
58 typedef typename super::vector_Type vector_Type;
59 typedef typename super::matrix_Type matrix_Type;
61 typedef typename super::matrixPtr_Type matrixPtr_Type;
62 typedef typename super::dataPtr_Type dataPtr_Type;
63 typedef typename super::displayerPtr_Type displayerPtr_Type;
64 typedef typename super::vectorPtr_Type vectorPtr_Type;
66 typedef typename super::mapMarkerVolumesPtr_Type mapMarkerVolumesPtr_Type;
67 typedef typename super::mapMarkerVolumes_Type mapMarkerVolumes_Type;
68 typedef typename mapMarkerVolumes_Type::const_iterator mapIterator_Type;
70 typedef typename super::vectorVolumes_Type vectorVolumes_Type;
71 typedef std::shared_ptr<vectorVolumes_Type> vectorVolumesPtr_Type;
73 typedef std::vector<UInt> vectorIndexes_Type;
74 typedef std::shared_ptr<vectorIndexes_Type> vectorIndexesPtr_Type;
75 typedef std::map< UInt, vectorIndexes_Type> mapMarkerIndexes_Type;
76 typedef std::shared_ptr<mapMarkerIndexes_Type> mapMarkerIndexesPtr_Type;
77 typedef typename mapMarkerIndexes_Type::const_iterator mapIteratorIndex_Type;
79 typedef typename super::FESpacePtr_Type FESpacePtr_Type;
80 typedef typename super::ETFESpacePtr_Type ETFESpacePtr_Type;
83 typedef typename super::vectorsParameters_Type vectorsParameters_Type;
84 typedef typename super::vectorsParametersPtr_Type vectorsParametersPtr_Type;
86 typedef MatrixSmall<3, 3> matrixSmall_Type;
88 typedef typename super::tensorF_Type tensorF_Type;
95 VenantKirchhoffMaterialLinear();
97 virtual ~VenantKirchhoffMaterialLinear();
110 void setup (
const FESpacePtr_Type& dFESpace,
111 const ETFESpacePtr_Type& ETFESpace,
112 const std::shared_ptr<
const MapEpetra>& monolithicMap,
113 const UInt offset,
const dataPtr_Type& dataMaterial);
119 void computeLinearStiff ( dataPtr_Type& ,
120 const mapMarkerVolumesPtr_Type ,
121 const mapMarkerIndexesPtr_Type );
130 void updateJacobianMatrix (
const vector_Type& disp,
131 const dataPtr_Type& dataMaterial,
132 const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
133 const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
134 const displayerPtr_Type& displayer);
144 void updateNonLinearJacobianTerms ( matrixPtr_Type& jacobian,
146 const dataPtr_Type& ,
147 const mapMarkerVolumesPtr_Type ,
148 const mapMarkerIndexesPtr_Type ,
149 const displayerPtr_Type& );
161 void computeStiffness (
const vector_Type& sol,
Real factor,
const dataPtr_Type& dataMaterial,
162 const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
163 const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
164 const displayerPtr_Type& displayer );
166 void computeKinematicsVariables (
const VectorElemental& ) {}
169 void showMe ( std::string
const& fileNameStiff,
170 std::string
const& fileNameJacobian);
180 void computeLocalFirstPiolaKirchhoffTensor ( Epetra_SerialDenseMatrix& firstPiola,
181 const Epetra_SerialDenseMatrix& tensorF,
182 const Epetra_SerialDenseMatrix& cofactorF,
183 const std::vector<Real>& invariants,
192 void computeCauchyStressTensor (
const vectorPtr_Type disp,
194 vectorPtr_Type sigma_1,
195 vectorPtr_Type sigma_2,
196 vectorPtr_Type sigma_3);
204 matrixPtr_Type
const linearStiff()
const 206 return M_linearStiff;
210 matrixPtr_Type
const stiffMatrix()
const 216 vectorPtr_Type
const stiffVector()
const 218 vectorPtr_Type zero (
new vector_Type() );
222 void apply (
const vector_Type& sol, vector_Type& res,
223 const mapMarkerVolumesPtr_Type ,
224 const mapMarkerIndexesPtr_Type ,
225 const displayerPtr_Type )
227 res += *M_stiff * sol;
239 void setupVectorsParameters (
void);
244 matrixPtr_Type M_linearStiff;
247 matrixPtr_Type M_stiff;
251 template <
typename MeshType>
252 VenantKirchhoffMaterialLinear<MeshType>::VenantKirchhoffMaterialLinear() :
259 template <
typename MeshType>
260 VenantKirchhoffMaterialLinear<MeshType>::~VenantKirchhoffMaterialLinear()
264 template <
typename MeshType>
266 VenantKirchhoffMaterialLinear<MeshType>::setup (
const FESpacePtr_Type& dFESpace,
267 const ETFESpacePtr_Type& dETFESpace,
268 const std::shared_ptr<
const MapEpetra>& monolithicMap,
269 const UInt offset,
const dataPtr_Type& dataMaterial)
271 this->M_dataMaterial = dataMaterial;
272 this->M_dispFESpace = dFESpace;
273 this->M_dispETFESpace = dETFESpace;
274 this->M_localMap = monolithicMap;
275 this->M_linearStiff.reset (
new matrix_Type (*
this->M_localMap) );
276 this->M_offset = offset;
281 this->M_vectorsParameters.reset (
new vectorsParameters_Type ( 2 ) );
283 this->setupVectorsParameters( );
288 template <
typename MeshType>
290 VenantKirchhoffMaterialLinear<MeshType>::setupVectorsParameters (
void )
299 UInt nbElements =
this->M_dispFESpace->mesh()->numVolumes();
303 (* (
this->M_vectorsParameters) ) [0].resize ( nbElements );
306 (* (
this->M_vectorsParameters) ) [1].resize ( nbElements );
308 for (
UInt i (0); i < nbElements; i++ )
311 UInt markerID =
this->M_dispFESpace->mesh()->element ( i ).markerID();
313 Real lambda =
this->M_dataMaterial->lambda ( markerID );
314 Real mu =
this->M_dataMaterial->mu ( markerID );
316 ( (* (
this->M_vectorsParameters) ) [0]) [ i ] = lambda;
317 ( (* (
this->M_vectorsParameters) ) [1]) [ i ] = mu;
322 template <
typename MeshType>
323 void VenantKirchhoffMaterialLinear<MeshType>::computeLinearStiff (dataPtr_Type& ,
324 const mapMarkerVolumesPtr_Type ,
325 const mapMarkerIndexesPtr_Type )
329 * (
this->M_linearStiff) *= 0.0;
335 integrate ( elements (
this->M_dispETFESpace->mesh() ),
336 this->M_dispFESpace->qr(),
337 this->M_dispETFESpace,
338 this->M_dispETFESpace,
342 integrate ( elements (
this->M_dispETFESpace->mesh() ),
343 this->M_dispFESpace->qr(),
344 this->M_dispETFESpace,
345 this->M_dispETFESpace,
346 value ( 2.0 ) * parameter ( (* (
this->M_vectorsParameters) ) [1]) * dot ( sym (grad (phi_j) ) , grad (phi_i) )
349 this->M_linearStiff->globalAssemble();
352 this->M_stiff =
this->M_linearStiff;
353 this->M_jacobian =
this->M_linearStiff;
357 template <
typename MeshType>
358 void VenantKirchhoffMaterialLinear<MeshType>::updateJacobianMatrix (
const vector_Type& disp,
359 const dataPtr_Type& dataMaterial,
360 const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
361 const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
362 const displayerPtr_Type& displayer)
365 displayer->leaderPrint (
" S- Updating the Jacobian Matrix (constant, Linear Elastic)\n");
369 updateNonLinearJacobianTerms (
this->M_jacobian, disp,
this->M_dataMaterial, mapsMarkerVolumes, mapsMarkerIndexes, displayer);
374 template <
typename MeshType>
375 void VenantKirchhoffMaterialLinear<MeshType>::updateNonLinearJacobianTerms ( matrixPtr_Type& ,
377 const dataPtr_Type& ,
378 const mapMarkerVolumesPtr_Type ,
379 const mapMarkerIndexesPtr_Type ,
380 const displayerPtr_Type& )
386 template <
typename MeshType>
387 void VenantKirchhoffMaterialLinear<MeshType>::computeStiffness (
const vector_Type& ,
389 const dataPtr_Type& ,
390 const mapMarkerVolumesPtr_Type ,
391 const mapMarkerIndexesPtr_Type ,
392 const displayerPtr_Type& displayer )
395 displayer->leaderPrint (
" \n*********************************\n ");
396 displayer->leaderPrint (
" S- Using the the Stiffness Matrix (constant, Linear Elastic)");
397 displayer->leaderPrint (
" \n*********************************\n ");
401 template <
typename MeshType>
416 template <
typename MeshType>
418 VenantKirchhoffMaterialLinear<MeshType>::computeLocalFirstPiolaKirchhoffTensor ( Epetra_SerialDenseMatrix& firstPiola,
419 const Epetra_SerialDenseMatrix& tensorF,
420 const Epetra_SerialDenseMatrix& cofactorF,
421 const std::vector<Real>& invariants,
426 Real lambda =
this->M_dataMaterial->lambda (marker);
427 Real mu =
this->M_dataMaterial->mu (marker);
429 Epetra_SerialDenseMatrix copyF (tensorF);
430 Epetra_SerialDenseMatrix identity (nDimensions, nDimensions);
436 identity (0,0) = 1.0;
437 identity (1,1) = 1.0;
438 identity (2,2) = 1.0;
440 Real divergenceU ( copyF (0, 0) + copyF (1, 1) + copyF (2, 2) );
441 Real coefIdentity (0.0);
442 coefIdentity = divergenceU * lambda;
443 identity.Scale ( coefIdentity );
445 Epetra_SerialDenseMatrix transposed (copyF);
446 transposed.SetUseTranspose (
true);
448 Epetra_SerialDenseMatrix secondTerm (nDimensions, nDimensions);
451 secondTerm += transposed;
452 secondTerm.Scale (mu);
454 firstPiola = identity;
455 firstPiola += secondTerm;
460 firstPiola.Scale( invariants[3] );
462 Epetra_SerialDenseMatrix tensorP (nDimensions, nDimensions);
464 tensorP.Multiply (
'N',
'N', 1.0, firstPiola, cofactorF, 0.0);
466 firstPiola.Scale(0.0);
467 firstPiola += tensorP;
470 template <
typename MeshType>
471 void VenantKirchhoffMaterialLinear<MeshType>::computeCauchyStressTensor (
const vectorPtr_Type disp,
473 vectorPtr_Type sigma_1,
474 vectorPtr_Type sigma_2,
475 vectorPtr_Type sigma_3)
481 MatrixSmall<3, 3> identity;
484 identity (0, 0) = 1.0; identity (0, 1) = 0.0; identity (0, 2) = 0.0;
485 identity (1, 0) = 0.0; identity (1, 1) = 1.0; identity (1, 2) = 0.0;
486 identity (2, 0) = 0.0; identity (2, 1) = 0.0; identity (2, 2) = 1.0;
490 evaluateNode( elements (
this->M_dispETFESpace->mesh() ),
492 this->M_dispETFESpace,
493 meas_K * dot ( vectorFromMatrix( parameter ( (* (
this->M_vectorsParameters) ) [0]) * Div * identity +
494 parameter ( (* (
this->M_vectorsParameters) ) [1]) *
495 ( grad (
this->M_dispETFESpace, *disp,
this->M_offset ) +
496 transpose ( grad (
this->M_dispETFESpace, *disp,
this->M_offset ) )
500 sigma_1->globalAssemble();
504 evaluateNode( elements (
this->M_dispETFESpace->mesh() ),
506 this->M_dispETFESpace,
507 meas_K * dot ( vectorFromMatrix( parameter ( (* (
this->M_vectorsParameters) ) [0]) * Div * identity +
508 parameter ( (* (
this->M_vectorsParameters) ) [1]) *
509 ( grad (
this->M_dispETFESpace, *disp,
this->M_offset ) +
510 transpose ( grad (
this->M_dispETFESpace, *disp,
this->M_offset ) )
514 sigma_2->globalAssemble();
516 evaluateNode( elements (
this->M_dispETFESpace->mesh() ),
518 this->M_dispETFESpace,
519 meas_K * dot ( vectorFromMatrix( parameter ( (* (
this->M_vectorsParameters) ) [0]) * Div * identity +
520 parameter ( (* (
this->M_vectorsParameters) ) [1]) *
521 ( grad (
this->M_dispETFESpace, *disp,
this->M_offset ) +
522 transpose ( grad (
this->M_dispETFESpace, *disp,
this->M_offset ) )
526 sigma_3->globalAssemble();
531 template <
typename MeshType>
532 inline StructuralIsotropicConstitutiveLaw<MeshType>* createVenantKirchhoffLinear()
534 return new VenantKirchhoffMaterialLinear<MeshType >();
void assignFunction(bcBase_Type &base)
Assign the function to the base of the BCHandler.
class ExpressionInterpolateGradient Class representing an interpolation in an expression.
class ExpressionEmult Class for representing the transpose operation of an expression ...
static const LifeV::UInt elm_nodes_num[]
ExpressionDivJ div(const ExpressionPhiJ &)
Simple function to be used in the construction of an expression.
const ExpressionPhiJ phi_j
Simple function to be used in the construction of an expression.
double Real
Generic real data.
ExpressionDivI div(const ExpressionPhiI &)
Simple function to be used in the construction of an expression.
QuadratureRule - The basis class for storing and accessing quadrature rules.
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)