LifeV
HolzapfelGeneralizedMaterialNonLinear.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published
12  by the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  * @file
29  * @brief This file contains the definition for the St. Venant Kirchhoff linear material
30  *
31  * @version 1.0
32  * @date 29-07-2010
33  * @author Paolo Tricerri
34  *
35  * @maintainer Paolo Tricerri <paolo.tricerri@epfl.ch>
36  */
37 
38 #ifndef _HOLZAPFELGENERALIZEDMATERIAL_H_
39 #define _HOLZAPFELGENERALIZEDMATERIAL_H_
40 
41 #pragma GCC diagnostic ignored "-Wunused-variable"
42 #pragma GCC diagnostic ignored "-Wunused-parameter"
43 
44 
45 #include <lifev/structure/solver/anisotropic/StructuralAnisotropicConstitutiveLaw.hpp>
46 
47 #define PI 3.14159265359
48 
49 namespace LifeV
50 {
51 template <typename MeshType>
52 class HolzapfelGeneralizedMaterialNonLinear : public StructuralAnisotropicConstitutiveLaw<MeshType>
53 {
54  //!@name Type definitions
55  //@{
56 
57 public:
58  typedef StructuralAnisotropicConstitutiveLaw<MeshType> super;
59 
60  typedef typename super::data_Type data_Type;
61 
62  typedef typename super::vector_Type vector_Type;
63  typedef typename super::matrix_Type matrix_Type;
64 
65  typedef typename super::matrixPtr_Type matrixPtr_Type;
66  typedef typename super::vectorPtr_Type vectorPtr_Type;
67  typedef typename super::dataPtr_Type dataPtr_Type;
69 
73 
77 
80 
83 
84  typedef typename super::FESpace_Type FESpace_Type;
87 
88  //Vector for vector parameters
91 
92  typedef MatrixSmall<3, 3> matrixSmall_Type;
93 
96 
99 
100  // Typedefs for expression definitions
101  typedef typename super::tensorF_Type tensorF_Type;
103  typedef typename super::tensorC_Type tensorC_Type;
104  typedef typename super::minusT_Type minusT_Type;
107 
108  // Anisotropic typedefs
111  typedef typename super::stretch_Type stretch_Type;
113  //@}
114 
115 
116 
117  //! @name Constructor & Destructor
118  //@{
119 
121 
123 
124  //@}
125 
126 
127 
128  //!@name Methods
129  //@{
130 
131  //! Setup the created object of the class StructuralIsotropicConstitutiveLaw
132  /*!
133  \param dFespace: the FiniteElement Space
134  \param monolithicMap: the MapEpetra
135  \param offset: the offset parameter used assembling the matrices
136  */
137  void setup ( const FESpacePtr_Type& dFESpace,
138  const ETFESpacePtr_Type& dETFESpace,
139  const std::shared_ptr<const MapEpetra>& monolithicMap,
140  const UInt offset,const dataPtr_Type& dataMaterial);
141 
142 
143  //! Compute the Stiffness matrix in StructuralSolver::buildSystem()
144  /*!
145  \param dataMaterial the class with Material properties data
146  */
147  void computeLinearStiff ( dataPtr_Type& /*dataMaterial*/,
148  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
149  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/);
150 
151 
152  //! Updates the Jacobian matrix in StructualSolver::updateJacobian
153  /*!
154  \param disp: solution at the k-th iteration of NonLinearRichardson Method
155  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get
156  the material coefficients (e.g. Young modulus, Poisson ratio..)
157  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
158  */
159  void updateJacobianMatrix ( const vector_Type& disp,
160  const dataPtr_Type& dataMaterial,
161  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
162  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
163  const displayerPtr_Type& displayer );
164 
165 
166  //! Updates the nonlinear terms in the Jacobian matrix in StructualSolver::updateJacobian
167  /*!
168  \param stiff: stiffness matrix provided from outside
169  \param disp: solution at the k-th iteration of NonLinearRichardson Method
170  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get
171  the material coefficients (e.g. Young modulus, Poisson ratio..)
172  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
173  */
175  const vector_Type& disp,
176  const dataPtr_Type& dataMaterial,
177  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
178  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/,
179  const displayerPtr_Type& displayer );
180 
181 
182  //! Interface method to compute the new Stiffness matrix in StructuralSolver::evalResidual and in
183  //! StructuralSolver::updateSystem since the matrix is the expression of the matrix is the same.
184  /*!
185  \param sol: the solution vector
186  \param factor: scaling factor used in FSI
187  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get the
188  material coefficients (e.g. Young modulus, Poisson ratio..)
189  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
190  */
191  void computeStiffness ( const vector_Type& disp,
192  const UInt iter,
193  Real factor,
194  const dataPtr_Type& dataMaterial,
195  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
196  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/,
197  const displayerPtr_Type& displayer );
198 
199 
201  const dataPtr_Type& dataMaterial,
202  const displayerPtr_Type& displayer ){};
203 
204  //! Computes the new Stiffness vector for Neo-Hookean and HolzapfelGeneralized materials in StructuralSolver
205  //! given a certain displacement field.
206  //! This function is used both in StructuralSolver::evalResidual and in StructuralSolver::updateSystem
207  //! since the matrix is the expression of the matrix is the same.
208  /*!
209  \param sol: the solution vector
210  \param factor: scaling factor used in FSI
211  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get
212  the material coefficients (e.g. Young modulus, Poisson ratio..)
213  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
214  */
215 
216  //! Computes the deformation gradient F, the cofactor matrix Cof(F),
217  //! the determinant of F (J = det(F)), the trace of right Cauchy-Green tensor tr(C)
218  //! This function is used in StructuralIsotropicConstitutiveLaw::computeStiffness
219  /*!
220  \param dk_loc: the elemental displacement
221  */
222  void computeKinematicsVariables ( const VectorElemental& dk_loc )
223  {
224  }
225 
226  //! Computes the deformation Gradient F, the cofactor of F Cof(F), the determinant of F J = det(F), the trace of C Tr(C).
227  /*!
228  \param dk_loc: local displacement vector
229  */
230  //void computeStress( const vector_Type& sol );
231 
232  //! ShowMe method of the class (saved on a file the stiffness vector and the jacobian)
233  void showMe ( std::string const& fileNameVectStiff,
234  std::string const& fileNameJacobain );
235 
236  //! Compute the First Piola Kirchhoff Tensor
237  /*!
238  \param firstPiola Epetra_SerialDenseMatrix that has to be filled
239  \param tensorF Epetra_SerialDenseMatrix the deformation gradient
240  \param cofactorF Epetra_SerialDenseMatrix cofactor of F
241  \param invariants std::vector with the invariants of C and the detF
242  \param material UInt number to get the material parameteres form the VenantElasticData class
243  */
244  void computeLocalFirstPiolaKirchhoffTensor ( Epetra_SerialDenseMatrix& firstPiola,
245  const Epetra_SerialDenseMatrix& tensorF,
246  const Epetra_SerialDenseMatrix& cofactorF,
247  const std::vector<Real>& invariants,
248  const UInt marker);
249 
250  //! Compute the First Piola Kirchhoff Tensor
251  /*!
252  \param disp the displacement field from which we compute the fisrt piola-Kirchhoff tensor
253  \param sigma_1 the first column of the Cauchy stress tensor
254  \param sigma_2 the second column of the Cauchy stress tensor
255  \param sigma_3 the third column of the Cauchy stress tensor
256  */
257  void computeCauchyStressTensor ( const vectorPtr_Type disp,
258  const QuadratureRule& evalQuad,
259  vectorPtr_Type sigma_1,
260  vectorPtr_Type sigma_2,
261  vectorPtr_Type sigma_3);
262 
263 
264  void setupFiberDirections( vectorFiberFunctionPtr_Type vectorOfFibers );
265 
266 
267  void evaluateActivationFibers( const vector_Type& displacement,
268  vector_Type& fourthInvariant){}
269  //@}
270 
271  //! @name Get Methods
272  //@{
273 
274  //! Get the Stiffness matrix
276  {
277  return super::M_jacobian;
278  }
279 
280 
281  //! Get the stiffness vector
283  {
284  return M_stiff;
285  }
286 
287  //! Specific for multimechanism
288  vectorPtr_Type const selectionCriterion( const UInt /*i*/ ) const
289  {
290  vectorPtr_Type empty( new vector_Type( this->M_dispFESpace->map() ) );
291  return empty;
292  }
293 
294 
295  vectorPtr_Type const activationDisplacement( const UInt /*i*/ ) const
296  {
297  vectorPtr_Type empty( new vector_Type( this->M_dispFESpace->map() ) );
298  return empty;
299  }
300 
301  vectorPtr_Type const activatedUnitFiber( const UInt /*i*/ ) const
302  {
303  vectorPtr_Type empty( new vector_Type( this->M_dispFESpace->map() ) );
304  return empty;
305  }
306 
307  vectorPtr_Type const activatedDeterminant( const UInt /*i*/ ) const
308  {
309  vectorPtr_Type empty( new vector_Type( this->M_dispFESpace->map() ) );
310  return empty;
311  }
312 
313 
314 
315  void apply ( const vector_Type& sol, vector_Type& res,
316  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
317  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
318  const displayerPtr_Type displayer) ;
319 
320  //@}
321 
322 
323 
324 protected:
325 
326  //! construct the vectors for the parameters
327  /*!
328  \param VOID
329  \return VOID
330  */
331  // void setupVectorsParameters ( void );
332 
333 
334  //! Vector: stiffness non-linear
336 
337  //Create the indentity for F
339 
340 };
341 
342 
343 
344 
345 
346 template <typename MeshType>
348  super ( ),
349  M_stiff ( ),
350  M_identity ( )
351 {
352 }
353 
354 
355 
356 
357 
358 template <typename MeshType>
360 {}
361 
362 
363 
364 
365 
366 template <typename MeshType>
367 void
369  const ETFESpacePtr_Type& dETFESpace,
370  const std::shared_ptr<const MapEpetra>& monolithicMap,
371  const UInt offset,
372  const dataPtr_Type& dataMaterial)
373 {
374 
375  this->M_dataMaterial = dataMaterial;
376  this->M_dispFESpace = dFESpace;
377  this->M_dispETFESpace = dETFESpace;
378  this->M_localMap = monolithicMap;
379  this->M_offset = offset;
380 
381  M_stiff.reset (new vector_Type (*this->M_localMap) );
382 
383  M_identity (0, 0) = 1.0;
384  M_identity (0, 1) = 0.0;
385  M_identity (0, 2) = 0.0;
386  M_identity (1, 0) = 0.0;
387  M_identity (1, 1) = 1.0;
388  M_identity (1, 2) = 0.0;
389  M_identity (2, 0) = 0.0;
390  M_identity (2, 1) = 0.0;
391  M_identity (2, 2) = 1.0;
392 
393  this->M_epsilon = this->M_dataMaterial->smoothness();
394  //this->setupVectorsParameters( );
395 }
396 
397 
398 // template <typename MeshType>
399 // void
400 // HolzapfelGeneralizedMaterialNonLinear<MeshType>::setupVectorsParameters ( void )
401 // {
402 // // Paolo Tricerri: February, 20th
403 // // In each class, the name of the parameters has to inserted in the law
404 // // TODO: move the saving of the material parameters to more abstract objects
405 // // such that in the class of the material we do not need to call explicitly
406 // // the name of the parameter.
407 
408 // // Number of volume on the local part of the mesh
409 // UInt nbElements = this->M_dispFESpace->mesh()->numVolumes();
410 
411 // // Parameter alpha
412 // // 1. resize the vector in the first element of the vector.
413 // (* (this->M_vectorsParameters) ) [0].resize ( nbElements );
414 
415 // // Parameter gamma
416 // (* (this->M_vectorsParameters) ) [1].resize ( nbElements );
417 
418 // // Parameter bulk
419 // (* (this->M_vectorsParameters) ) [2].resize ( nbElements );
420 
421 // for (UInt i (0); i < nbElements; i++ )
422 // {
423 // // Extracting the marker
424 // UInt markerID = this->M_dispFESpace->mesh()->element ( i ).markerID();
425 
426 // Real alpha = this->M_dataMaterial->alpha ( markerID );
427 // Real gamma = this->M_dataMaterial->gamma ( markerID );
428 // Real bulk = this->M_dataMaterial->bulk ( markerID );
429 
430 // ( (* (this->M_vectorsParameters) ) [0]) [ i ] = alpha;
431 // ( (* (this->M_vectorsParameters) ) [1]) [ i ] = gamma;
432 // ( (* (this->M_vectorsParameters) ) [2]) [ i ] = bulk;
433 // }
434 // }
435 
436 
437 template <typename MeshType>
438 void
440 {
441  // Allocating the right space for the vector of fiber function
442  this->M_vectorOfFibers.reset( new vectorFiberFunction_Type( ) );
443 
444  // In this method, the vector of fiber functions has to be properly set in the main
445  // of the test. The functions are then projected on a FESpace for the integration
446 
447  // Number of volume on the local part of the mesh
448  UInt nbFamilies = (*vectorOfFibers).size();
449 
450  ASSERT( nbFamilies == this->M_dataMaterial->numberFibersFamilies(),
451  " The number of families set in the test is different from the one in the data" );
452 
453  this->M_vectorOfFibers->resize( nbFamilies );
454 
455  for( UInt k(0); k < nbFamilies; k++ )
456  {
457  ( *(this->M_vectorOfFibers) )[ k ] = ( *vectorOfFibers )[ k ];
458  }
459 
460  // Setting the vectors that will be used
461  this->M_vectorInterpolated.resize( nbFamilies );
462 
463  for( UInt k(0); k < nbFamilies; k++ )
464  {
465  this->M_vectorInterpolated[ k ].reset( new vector_Type(*this->M_localMap) );
466  this->M_dispFESpace->interpolate ( *( ( *(this->M_vectorOfFibers) )[ k ] ) ,
467  * ( ( this->M_vectorInterpolated )[ k ] ),
468  0.0 );
469  }
470 
471 }
472 
473 
474 template <typename MeshType>
476  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
477  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/)
478 {
479  //! Empty method for exponential material
480 }
481 
482 
483 
484 
485 
486 template <typename MeshType>
488  const dataPtr_Type& dataMaterial,
489  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
490  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
491  const displayerPtr_Type& displayer )
492 {
493 
494  this->M_jacobian.reset (new matrix_Type (*this->M_localMap) );
495 
496  displayer->leaderPrint (" \n*********************************\n ");
497  updateNonLinearJacobianTerms (this->M_jacobian, disp, this->M_dataMaterial, mapsMarkerVolumes, mapsMarkerIndexes, displayer);
498  displayer->leaderPrint (" \n*********************************\n ");
499 
500 }
501 
502 template <typename MeshType>
504  const vector_Type& disp,
505  const dataPtr_Type& dataMaterial,
506  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
507  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
508  const displayerPtr_Type& displayer )
509 {
510  using namespace ExpressionAssembly;
511 
512  // In the following definitions, the critical template argument is MapEpetra
513  // When other maps will be available in LifeV, the HolzapfelGeneralized class and its mother
514  // should have as template the MeshType and the MapType.
515 
516  // Definition of F
517  tensorF_Type F = ExpressionDefinitions::deformationGradient( this->M_dispETFESpace, disp, this->M_offset, this->M_identity );
518 
519  // Definition of J
520  determinantF_Type J = ExpressionDefinitions::determinantF( F );
521 
522  //Definition of C
523  tensorC_Type C = ExpressionDefinitions::tensorC( transpose(F), F );
524 
525  // Definition of J^-(2/3) = det( C ) using the isochoric/volumetric decomposition
526  powerExpression_Type Jel = ExpressionDefinitions::powerExpression( J , (-2.0/3.0) );
527 
528  // Definition of F^-T
529  minusT_Type F_T = ExpressionDefinitions::minusT( F );
530 
531  // Update the heaviside function for the stretch of the fibers
532  * (jacobian) *= 0.0;
533 
534  displayer->leaderPrint (" Non-Linear S - updating non linear terms in the Jacobian Matrix (N fibers HolzapfelGeneralized): \n");
535 
536  for( UInt i(0); i < this->M_vectorInterpolated.size(); i++ )
537  {
538 
539  displayer->leaderPrint (" ", i + 1,"-th fiber family \n" );
540  // Defining the expression for the i-th fiber
541  // Definitions of the quantities which depend on the fiber directions e.g. I_4^i
542  interpolatedValue_Type fiberIth = ExpressionDefinitions::interpolateFiber( this->M_dispETFESpace, *(this->M_vectorInterpolated[ i ] ) );
543 
544  // Definition of the tensor M = ithFiber \otimes ithFiber
545  // At the moment, it's automatic that the method constructs the expression M = ithFiber \otimes ithFiber
546  // For a more general case, the file ExpressionDefinitions.hpp should be changed
547  outerProduct_Type Mith = ExpressionDefinitions::fiberTensor( fiberIth );
548 
549  // Definition of the fourth invariant : I_4^i = C:Mith
550  stretch_Type IVith = ExpressionDefinitions::fiberStretch( C, Mith );
551 
552  // Definition of the fouth isochoric invariant : J^(-2.0/3.0) * I_4^i
553  isochoricStretch_Type IVithBar = ExpressionDefinitions::isochoricFourthInvariant( Jel, IVith );
554 
555  Real IVact = this->M_dataMaterial->ithCharacteristicStretch(i) * this->M_dataMaterial->ithCharacteristicStretch(i);
556  Real alpha = this->M_dataMaterial->ithStiffnessFibers( i );
557  Real gamma = this->M_dataMaterial->ithNonlinearityFibers( i );
558 
559  integrate( elements ( this->M_dispETFESpace->mesh() ),
560  this->M_dispFESpace->qr(),
561  this->M_dispETFESpace,
562  this->M_dispETFESpace,
563  value( 2.0 ) * value( alpha ) *
564  ( derAtan( IVithBar - value( IVact ), this->M_epsilon, ( 1.0 / PI ) ) * ( IVithBar - value( IVact ) ) +
565  atan( IVithBar - value( IVact ), this->M_epsilon, ( 1 / PI ), (1.0/2.0) ) *
566  ( value( 1.0 ) + value(2.0)*value(gamma)*( IVithBar - value( IVact ) ) * ( IVithBar - value( IVact ) ) ) ) *
567  exp( value( gamma ) * ( IVithBar - value( IVact) ) * ( IVithBar - value( IVact) ) ) * Jel *
568  ( value(-2.0/3.0) * IVithBar * dot( F_T, grad(phi_j) ) + Jel * dot( transpose(grad(phi_j)) * F + transpose(F) * grad(phi_j), Mith) ) *
569  dot( F * Mith - value(1.0/3.0) * IVith * F_T, grad(phi_i) )
570  ) >> jacobian;
571 
572  integrate( elements ( this->M_dispETFESpace->mesh() ),
573  this->M_dispFESpace->qr(),
574  this->M_dispETFESpace,
575  this->M_dispETFESpace,
576  value( 2.0 ) * value( alpha ) *
577  atan( IVithBar - value( IVact ), this->M_epsilon, ( 1 / PI ), (1.0/2.0) ) *
578  ( IVithBar - value( IVact ) ) *
579  exp( value( gamma ) * ( IVithBar - value( IVact) ) * ( IVithBar - value( IVact) ) ) *
580  value(-2.0/3.0) * Jel * dot( F_T, grad(phi_j) ) *
581  dot( F * Mith - value(1.0/3.0) * IVith * F_T, grad(phi_i) )
582  ) >> jacobian;
583 
584  integrate( elements ( this->M_dispETFESpace->mesh() ),
585  this->M_dispFESpace->qr(),
586  this->M_dispETFESpace,
587  this->M_dispETFESpace,
588  value( 2.0 ) * value( alpha ) *
589  atan( IVithBar - value( IVact ), this->M_epsilon, ( 1 / PI ), (1.0/2.0) ) *
590  ( IVithBar - value( IVact ) ) *
591  exp( value( gamma ) * ( IVithBar - value( IVact) ) * ( IVithBar - value( IVact) ) ) * Jel *
592  dot( grad(phi_j) * Mith - value(1.0/3.0) * dot( transpose(grad(phi_j)) * F + transpose(F) * grad(phi_j) , Mith ) * F_T +
593  value( 1.0/3.0 ) * IVith * F_T * transpose(grad(phi_j)) * F_T , grad(phi_i) )
594  ) >> jacobian;
595 
596  } // closing loop on fibers
597 
598  jacobian->globalAssemble();
599 }
600 
601 
602 
603 
604 
605 template <typename MeshType>
607  const UInt /*iter*/,
608  Real /*factor*/,
609  const dataPtr_Type& dataMaterial,
610  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
611  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
612  const displayerPtr_Type& displayer )
613 {
614 
615  using namespace ExpressionAssembly;
616 
617  M_stiff.reset (new vector_Type (*this->M_localMap) );
618  * (M_stiff) *= 0.0;
619 
620  displayer->leaderPrint (" \n*********************************\n ");
621  displayer->leaderPrint (" Non-Linear S- Computing the HolzapfelGeneralized nonlinear stiffness vector (N fibers HolzapfelGeneralized)");
622  displayer->leaderPrint (" \n*********************************\n ");
623 
624  // For anisotropic part of the Piola-Kirchhoff is assemble summing up the parts of the
625  // Piola-Kirchhoff using the fiber index
626 
627  // Here the fiber vector at the quadrature node is deduced using the method
628  // Interpolate value of the expression template.
629 
630  // Defining quantities which depend of the displacement field and not on the fiber direction
631 
632  // Definition of F
633  tensorF_Type F = ExpressionDefinitions::deformationGradient( this->M_dispETFESpace, disp, this->M_offset, this->M_identity );
634 
635  // Definition of J
636  determinantF_Type J = ExpressionDefinitions::determinantF( F );
637 
638  //Definition of C
639  tensorC_Type C = ExpressionDefinitions::tensorC( transpose(F), F );
640 
641  // Definition of J^-(2/3) = det( C ) using the isochoric/volumetric decomposition
642  powerExpression_Type Jel = ExpressionDefinitions::powerExpression( J , (-2.0/3.0) );
643 
644  // Definition of F^-T
645  minusT_Type F_T = ExpressionDefinitions::minusT( F );
646 
647  for( UInt i(0); i < this->M_vectorInterpolated.size() ; i++ )
648  {
649  // As in other classes, the specialization of the MapType = MapEpetra makes this expression
650  // not always usable. When other maps will be available in LifeV, the class should be re-templated.
651 
652  // Defining the expression for the i-th fiber
653  // Definitions of the quantities which depend on the fiber directions e.g. I_4^i
654  interpolatedValue_Type fiberIth = ExpressionDefinitions::interpolateFiber( this->M_dispETFESpace, *(this->M_vectorInterpolated[ i ] ) );
655 
656  // Definition of the tensor M = ithFiber \otimes ithFiber
657  // At the moment, it's automatic that the method constructs the expression M = ithFiber \otimes ithFiber
658  // For a more general case, the file ExpressionDefinitions.hpp should be changed
659  outerProduct_Type Mith = ExpressionDefinitions::fiberTensor( fiberIth );
660 
661  // Definition of the fourth invariant : I_4^i = C:Mith
662  stretch_Type IVith = ExpressionDefinitions::fiberStretch( C, Mith );
663 
664  // Definition of the fouth isochoric invariant : J^(-2.0/3.0) * I_4^i
665  isochoricStretch_Type IVithBar = ExpressionDefinitions::isochoricFourthInvariant( Jel, IVith );
666 
667  Real IVact = this->M_dataMaterial->ithCharacteristicStretch(i) * this->M_dataMaterial->ithCharacteristicStretch(i);
668  // First term:
669  // 2 alpha_i J^(-2.0/3.0) ( \bar{I_4} - 1 ) exp( gamma_i * (\bar{I_4} - 1)^2 ) * F M : \grad phi_i
670  // where alpha_i and gamma_i are the fiber parameters and M is the 2nd order tensor of type f_i \otimes \ f_i
671  integrate ( elements ( this->M_dispETFESpace->mesh() ),
672  this->M_dispFESpace->qr(),
673  this->M_dispETFESpace,
674  atan( IVithBar - value( IVact ) , this->M_epsilon, ( 1 / PI ), ( 1.0/2.0 ) ) *
675  value( 2.0 ) * value( this->M_dataMaterial->ithStiffnessFibers( i ) ) * Jel * ( IVithBar - value( IVact ) ) *
676  exp( value( this->M_dataMaterial->ithNonlinearityFibers( i ) ) * ( IVithBar- value( IVact ) ) * ( IVithBar- value( IVact ) ) ) *
677  dot( F * Mith + value(-1.0/3.0) * IVith * F_T , grad( phi_i ) )
678  ) >> this->M_stiff;
679  }
680 
681  this->M_stiff->globalAssemble();
682 }
683 
684 
685 template <typename MeshType>
687  std::string const& fileNameJacobian )
688 {
689  this->M_stiff->spy (fileNameStiff);
691 }
692 
693 
694 template <typename MeshType>
696  vector_Type& res, const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
697  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
698  const displayerPtr_Type displayer)
699 {
700  computeStiffness (sol, 0, 0, this->M_dataMaterial, mapsMarkerVolumes, mapsMarkerIndexes, displayer);
701  res += *M_stiff;
702 }
703 
704 
705 template <typename MeshType>
706 void HolzapfelGeneralizedMaterialNonLinear<MeshType>::computeLocalFirstPiolaKirchhoffTensor ( Epetra_SerialDenseMatrix& firstPiola,
707  const Epetra_SerialDenseMatrix& tensorF,
708  const Epetra_SerialDenseMatrix& cofactorF,
709  const std::vector<Real>& invariants,
710  const UInt marker)
711 {
712 
713  // Still Need to Define P
714 
715 }
716 
717 template <typename MeshType>
719  const QuadratureRule& evalQuad,
720  vectorPtr_Type sigma_1,
721  vectorPtr_Type sigma_2,
722  vectorPtr_Type sigma_3)
723 {
724 
725  using namespace ExpressionAssembly;
726 
727  // Definition of F
728  tensorF_Type F = ExpressionDefinitions::deformationGradient( this->M_dispETFESpace, *disp, this->M_offset, this->M_identity );
729 
730  // Definition of J
731  determinantF_Type J = ExpressionDefinitions::determinantF( F );
732 
733  //Definition of C
734  tensorC_Type C = ExpressionDefinitions::tensorC( transpose(F), F );
735 
736  // Definition of J^-(2/3) = det( C ) using the isochoric/volumetric decomposition
737  powerExpression_Type Jel = ExpressionDefinitions::powerExpression( J , (-2.0/3.0) );
738 
739  // Definition of F^-T
740  minusT_Type F_T = ExpressionDefinitions::minusT( F );
741 
742  for( UInt i(0); i < this->M_vectorInterpolated.size() ; i++ )
743  {
744  // As in other classes, the specialization of the MapType = MapEpetra makes this expression
745  // not always usable. When other maps will be available in LifeV, the class should be re-templated.
746 
747  // Defining the expression for the i-th fiber
748  // Definitions of the quantities which depend on the fiber directions e.g. I_4^i
749  interpolatedValue_Type fiberIth = ExpressionDefinitions::interpolateFiber( this->M_dispETFESpace, *(this->M_vectorInterpolated[ i ] ) );
750 
751  // Definition of the tensor M = ithFiber \otimes ithFiber
752  // At the moment, it's automatic that the method constructs the expression M = ithFiber \otimes ithFiber
753  // For a more general case, the file ExpressionDefinitions.hpp should be changed
754  outerProduct_Type Mith = ExpressionDefinitions::fiberTensor( fiberIth );
755 
756  // Definition of the fourth invariant : I_4^i = C:Mith
757  stretch_Type IVith = ExpressionDefinitions::fiberStretch( C, Mith );
758 
759  // Definition of the fouth isochoric invariant : J^(-2.0/3.0) * I_4^i
760  isochoricStretch_Type IVithBar = ExpressionDefinitions::isochoricFourthInvariant( Jel, IVith );
761 
762  Real IVact = this->M_dataMaterial->ithCharacteristicStretch(i) * this->M_dataMaterial->ithCharacteristicStretch(i);
763  // First term:
764  // 2 alpha_i J^(-2.0/3.0) ( \bar{I_4} - 1 ) exp( gamma_i * (\bar{I_4} - 1)^2 ) * F M : \grad phi_i
765  // where alpha_i and gamma_i are the fiber parameters and M is the 2nd order tensor of type f_i \otimes \ f_i
766 
767  evaluateNode( elements( this->M_dispETFESpace->mesh() ),
768  evalQuad,
769  this->M_dispETFESpace,
770  meas_K * dot( vectorFromMatrix( ( 1 / J ) *
771  ( atan( IVithBar - value( IVact ) , this->M_epsilon, ( 1 / PI ), ( 1.0/2.0 ) ) *
772  value( 2.0 ) * value( this->M_dataMaterial->ithStiffnessFibers( i ) ) * Jel * ( IVithBar - value( IVact ) ) *
773  exp( value( this->M_dataMaterial->ithNonlinearityFibers( i ) ) * ( IVithBar- value( IVact ) ) * ( IVithBar- value( IVact ) ) ) *
774  F * Mith ) *
775  transpose(F) , 0 ), phi_i )
776  ) >> sigma_1;
777 
778  // Second term:
779  // 2 alpha_i J^(-2.0/3.0) ( \bar{I_4} - 1 ) exp( gamma_i * (\bar{I_4} - 1)^2 ) * ( 1.0/3.0 * I_4 ) F^-T : \grad phi_i
780  // where alpha_i and gamma_i are the fiber parameters and M is the 2nd order tensor of type f_i \otimes \ f_i
781  evaluateNode( elements( this->M_dispETFESpace->mesh() ),
782  evalQuad,
783  this->M_dispETFESpace,
784  meas_K * dot( vectorFromMatrix( ( 1 / J ) *
785  ( atan( IVithBar - value( IVact ) , this->M_epsilon, ( 1 / PI ), ( 1.0/2.0 ) ) *
786  value( 2.0 ) * value( this->M_dataMaterial->ithStiffnessFibers( i ) ) * Jel * ( IVithBar - value( IVact ) ) *
787  exp( value( this->M_dataMaterial->ithNonlinearityFibers( i ) ) * ( IVithBar- value( IVact ) ) * ( IVithBar- value( IVact ) ) ) *
788  value( -1.0/3.0 ) * IVith *
789  F_T ) *
790  transpose(F) , 0 ), phi_i )
791  ) >> sigma_1;
792  sigma_1->globalAssemble();
793 
794  evaluateNode( elements( this->M_dispETFESpace->mesh() ),
795  evalQuad,
796  this->M_dispETFESpace,
797  meas_K * dot( vectorFromMatrix( ( 1 / J ) *
798  ( atan( IVithBar - value( IVact ) , this->M_epsilon, ( 1 / PI ), ( 1.0/2.0 ) ) *
799  value( 2.0 ) * value( this->M_dataMaterial->ithStiffnessFibers( i ) ) * Jel * ( IVithBar - value( IVact ) ) *
800  exp( value( this->M_dataMaterial->ithNonlinearityFibers( i ) ) * ( IVithBar- value( IVact ) ) * ( IVithBar- value( IVact ) ) ) *
801  F * Mith ) *
802  transpose(F) , 1 ), phi_i )
803  ) >> sigma_2;
804 
805  evaluateNode( elements( this->M_dispETFESpace->mesh() ),
806  evalQuad,
807  this->M_dispETFESpace,
808  meas_K * dot( vectorFromMatrix( ( 1 / J ) *
809  ( atan( IVithBar - value( IVact ) , this->M_epsilon, ( 1 / PI ), ( 1.0/2.0 ) ) *
810  value( 2.0 ) * value( this->M_dataMaterial->ithStiffnessFibers( i ) ) * Jel * ( IVithBar - value( IVact ) ) *
811  exp( value( this->M_dataMaterial->ithNonlinearityFibers( i ) ) * ( IVithBar- value( IVact ) ) * ( IVithBar- value( IVact ) ) ) *
812  value( -1.0/3.0 ) * IVith *
813  F_T ) *
814  transpose(F) , 1 ), phi_i )
815  ) >> sigma_2;
816  sigma_2->globalAssemble();
817 
818  evaluateNode( elements( this->M_dispETFESpace->mesh() ),
819  evalQuad,
820  this->M_dispETFESpace,
821  meas_K * dot( vectorFromMatrix( ( 1 / J ) *
822  ( atan( IVithBar - value( IVact ) , this->M_epsilon, ( 1 / PI ), ( 1.0/2.0 ) ) *
823  value( 2.0 ) * value( this->M_dataMaterial->ithStiffnessFibers( i ) ) * Jel * ( IVithBar - value( IVact ) ) *
824  exp( value( this->M_dataMaterial->ithNonlinearityFibers( i ) ) * ( IVithBar- value( IVact ) ) * ( IVithBar- value( IVact ) ) ) *
825  F * Mith ) *
826  transpose(F) , 2 ), phi_i )
827  ) >> sigma_3;
828 
829  evaluateNode( elements( this->M_dispETFESpace->mesh() ),
830  evalQuad,
831  this->M_dispETFESpace,
832  meas_K * dot( vectorFromMatrix( ( 1 / J ) *
833  ( atan( IVithBar - value( IVact ) , this->M_epsilon, ( 1 / PI ), ( 1.0/2.0 ) ) *
834  value( 2.0 ) * value( this->M_dataMaterial->ithStiffnessFibers( i ) ) * Jel * ( IVithBar - value( IVact ) ) *
835  exp( value( this->M_dataMaterial->ithNonlinearityFibers( i ) ) * ( IVithBar- value( IVact ) ) * ( IVithBar- value( IVact ) ) ) *
836  value( -1.0/3.0 ) * IVith *
837  F_T ) *
838  transpose(F) , 2 ), phi_i )
839  ) >> sigma_3;
840  sigma_3->globalAssemble();
841  }
842 
843 }
844 
845 
846 template <typename MeshType>
847 inline StructuralAnisotropicConstitutiveLaw<MeshType>* createHolzapfelGeneralizedMaterialNonLinear()
848 {
849  return new HolzapfelGeneralizedMaterialNonLinear<MeshType >();
850 }
851 
852 namespace
853 {
855 }
856 
857 } //Namespace LifeV
858 
859 #endif /* __EXPONENTIALMATERIAL_H */
void assignFunction(bcBase_Type &base)
Assign the function to the base of the BCHandler.
vectorPtr_Type const activatedDeterminant(const UInt) const
Get the activation displacement.
#define PI
void setup(const FESpacePtr_Type &dFESpace, const ETFESpacePtr_Type &dETFESpace, const std::shared_ptr< const MapEpetra > &monolithicMap, const UInt offset, const dataPtr_Type &dataMaterial)
Setup the created object of the class StructuralIsotropicConstitutiveLaw.
void updateNonLinearJacobianTerms(matrixPtr_Type &jacobian, const vector_Type &disp, const dataPtr_Type &dataMaterial, const mapMarkerVolumesPtr_Type, const mapMarkerIndexesPtr_Type, const displayerPtr_Type &displayer)
Updates the nonlinear terms in the Jacobian matrix in StructualSolver::updateJacobian.
void setupFiberDirections(vectorFiberFunctionPtr_Type vectorOfFibers)
matrixPtr_Type const stiffMatrix() const
Get the Stiffness matrix.
std::vector< typename MeshType::element_Type * > vectorVolumes_Type
vectorPtr_Type const selectionCriterion(const UInt) const
Specific for multimechanism.
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
vectorPtr_Type const stiffVector() const
Get the stiffness vector.
vectorPtr_Type const activationDisplacement(const UInt) const
Get the activation displacement.
StructuralAnisotropicConstitutiveLaw< MeshType > super
void updateJacobianMatrix(const vector_Type &disp, const dataPtr_Type &dataMaterial, const mapMarkerVolumesPtr_Type mapsMarkerVolumes, const mapMarkerIndexesPtr_Type mapsMarkerIndexes, const displayerPtr_Type &displayer)
Updates the Jacobian matrix in StructualSolver::updateJacobian.
void computeKinematicsVariables(const VectorElemental &dk_loc)
Computes the new Stiffness vector for Neo-Hookean and HolzapfelGeneralized materials in StructuralSol...
double Real
Generic real data.
Definition: LifeV.hpp:175
void computeStiffness(const vector_Type &disp, const UInt iter, Real factor, const dataPtr_Type &dataMaterial, const mapMarkerVolumesPtr_Type, const mapMarkerIndexesPtr_Type, const displayerPtr_Type &displayer)
Interface method to compute the new Stiffness matrix in StructuralSolver::evalResidual and in Structu...
void evaluateActivationFibers(const vector_Type &displacement, vector_Type &fourthInvariant)
void showMe(std::string const &fileNameVectStiff, std::string const &fileNameJacobain)
Computes the deformation Gradient F, the cofactor of F Cof(F), the determinant of F J = det(F)...
void computeLocalFirstPiolaKirchhoffTensor(Epetra_SerialDenseMatrix &firstPiola, const Epetra_SerialDenseMatrix &tensorF, const Epetra_SerialDenseMatrix &cofactorF, const std::vector< Real > &invariants, const UInt marker)
Compute the First Piola Kirchhoff Tensor.
void apply(const vector_Type &sol, vector_Type &res, const mapMarkerVolumesPtr_Type mapsMarkerVolumes, const mapMarkerIndexesPtr_Type mapsMarkerIndexes, const displayerPtr_Type displayer)
void computeReferenceConfigurations(const vector_Type &disp, const dataPtr_Type &dataMaterial, const displayerPtr_Type &displayer)
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.
void computeCauchyStressTensor(const vectorPtr_Type disp, const QuadratureRule &evalQuad, vectorPtr_Type sigma_1, vectorPtr_Type sigma_2, vectorPtr_Type sigma_3)
Compute the First Piola Kirchhoff Tensor.
StructuralAnisotropicConstitutiveLaw< MeshType > * createHolzapfelGeneralizedMaterialNonLinear()
vectorPtr_Type M_stiff
construct the vectors for the parameters
QuadratureRule - The basis class for storing and accessing quadrature rules.
vectorPtr_Type const activatedUnitFiber(const UInt) const
Get the activation displacement.
void computeLinearStiff(dataPtr_Type &, const mapMarkerVolumesPtr_Type, const mapMarkerIndexesPtr_Type)
Compute the Stiffness matrix in StructuralSolver::buildSystem()
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)
Definition: LifeV.hpp:191
ExpressionDphiI grad(const ExpressionPhiI &)
Simple function to be used in the construction of an expression.