LifeV
AnisotropicMultimechanismMaterialNonLinear.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 _ANISOTROPICMULTIMECHANISM_H_
39 #define _ANISOTROPICMULTIMECHANISM_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 #include <lifev/structure/fem/AssemblyElementalStructure.hpp>
47 #include <lifev/structure/fem/ExpressionDefinitions.hpp>
48 #include <lifev/core/fem/QuadratureRule.hpp>
49 #include <lifev/eta/expression/Evaluate.hpp>
50 
51 #define PI 3.14159265359
52 
53 namespace LifeV
54 {
55 
57 {
58 public:
61 
63  :
65  M_value( )
66  {}
67 
68  SelectionFunctor ( const Real value )
69  :
71  M_value( value )
72  {}
73 
75  {}
76 
77  void setSelectionVector( const vector_Type& selectionVector )
78  {
79  M_selectionVector.reset( new vector_Type( selectionVector ) );
80  }
81 
82  void setValue( const Real value )
83  {
84  M_value = value;
85  }
86 
87  bool operator() ( const UInt i,
88  const UInt nTotDof,
89  const UInt offset) const
90  {
91  Int LIDx = M_selectionVector->blockMap().LID( static_cast<EpetraInt_Type>(i) );
92  Int LIDy = M_selectionVector->blockMap().LID( static_cast<EpetraInt_Type>(i + nTotDof + offset) );
93  Int LIDz = M_selectionVector->blockMap().LID( static_cast<EpetraInt_Type>(i + 2 * nTotDof + offset) );
94 
95  /*
96  Note: the selectionVector of this functor has the same map the
97  origin vector in the AssemblyElementalStructure namespace.
98  Therefore, once the i-th Dof is verified to be part of the
99  blockMap in the origin vector the following assert should never fail.
100  */
101  ASSERT( ( LIDx >= 0 ) &&
102  ( LIDy >= 0 ) &&
103  ( LIDz >= 0 ) , "Problem in the epetra maps cut!" );
104  /*
105  Since the quantity that we are checking it's scalar, we only
106  check one component.
107  */
108 
109  Int GIDx = M_selectionVector->blockMap().GID( LIDx );
110  Int GIDy = M_selectionVector->blockMap().GID( LIDy );
111  Int GIDz = M_selectionVector->blockMap().GID( LIDz );
112 
113  // if( std::fabs(( *M_selectionVector )( GIDx )) <= M_value ||
114  // ( *M_selectionVector )( GIDx ) > 0 )
115 
116  if( ( *M_selectionVector )( GIDx ) > M_value )
117  {
118  return true;
119  }
120 
121  else
122  {
123  return false;
124  }
125 
126  return false;
127 
128  }
129 
130 protected:
133 }; // selector functor
134 
136 {
137 public:
140 
141  booleanSelector ( const vector_Type& selectionVector )
142  :
144  {}
145 
147  {}
148 
149  bool operator() ( const UInt i,
150  const UInt nTotDof,
151  const UInt offset ) const
152  {
153  Int LIDx = M_selectionVector.blockMap().LID( static_cast<EpetraInt_Type>(i) );
154  Int LIDy = M_selectionVector.blockMap().LID( static_cast<EpetraInt_Type>(i + nTotDof + offset) );
155  Int LIDz = M_selectionVector.blockMap().LID( static_cast<EpetraInt_Type>(i + 2 * nTotDof + offset) );
156 
157  /*
158  Note: the selectionVector of this functor is the same as the
159  origin vector in the AssemblyElementalStructure namespace.
160  Therefore, once the i-th Dof is verified to be part of the
161  blockMap in the origin vector the following assert should never fail.
162  */
163  ASSERT( ( LIDx >= 0 ) &&
164  ( LIDy >= 0 ) &&
165  ( LIDz >= 0 ) , "Problem in the epetra maps cut!" );
166 
167  Int GIDx = M_selectionVector.blockMap().GID( LIDx );
168  Int GIDy = M_selectionVector.blockMap().GID( LIDy );
169  Int GIDz = M_selectionVector.blockMap().GID( LIDz );
170 
171  if( ( M_selectionVector )( GIDx ) == 1.0 ||
172  ( M_selectionVector )( GIDy ) == 1.0 ||
173  ( M_selectionVector )( GIDz ) == 1.0 )
174  {
175  return true;
176  }
177  else
178  {
179  return false;
180  }
181 
182  return false;
183 
184  }
185 
186 protected:
188 }; // selector functor
189 
190 
191 template <typename MeshType>
192 class AnisotropicMultimechanismMaterialNonLinear : public StructuralAnisotropicConstitutiveLaw<MeshType>
193 {
194  //!@name Type definitions
195  //@{
196 
197 public:
198  typedef StructuralAnisotropicConstitutiveLaw<MeshType> super;
199 
200  typedef typename super::data_Type data_Type;
201 
202  typedef typename super::vector_Type vector_Type;
203  typedef typename super::matrix_Type matrix_Type;
204 
207  typedef typename super::dataPtr_Type dataPtr_Type;
209 
213 
217 
220 
223 
224  typedef typename super::FESpace_Type FESpace_Type;
227 
230 
231  //Vector for vector parameters
234 
235  typedef MatrixSmall<3, 3> matrixSmall_Type;
236 
239 
242 
244 
246 
247  // Typedefs for expression definitions
248  typedef typename super::tensorF_Type tensorF_Type;
250  typedef typename super::tensorC_Type tensorC_Type;
251  typedef typename super::minusT_Type minusT_Type;
254  typedef typename
255  ExpressionDefinitions::isochoricChangeOfVariable_Type isochoricDet_Type;
256 
257  // Anisotropic typedefs
261  typedef typename super::stretch_Type stretch_Type;
263 
276 
281  //@}
282 
283 
284 
285  //! @name Constructor & Destructor
286  //@{
287 
289 
291 
292  //@}
293 
294 
295 
296  //!@name Methods
297  //@{
298 
299  //! Setup the created object of the class StructuralIsotropicConstitutiveLaw
300  /*!
301  \param dFespace: the FiniteElement Space
302  \param monolithicMap: the MapEpetra
303  \param offset: the offset parameter used assembling the matrices
304  */
305  void setup ( const FESpacePtr_Type& dFESpace,
306  const ETFESpacePtr_Type& dETFESpace,
307  const std::shared_ptr<const MapEpetra>& monolithicMap,
308  const UInt offset,const dataPtr_Type& dataMaterial);
309 
310 
311  //! Compute the Stiffness matrix in StructuralSolver::buildSystem()
312  /*!
313  \param dataMaterial the class with Material properties data
314  */
315  void computeLinearStiff ( dataPtr_Type& /*dataMaterial*/,
316  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
317  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/);
318 
319 
320  //! Updates the Jacobian matrix in StructualSolver::updateJacobian
321  /*!
322  \param disp: solution at the k-th iteration of NonLinearRichardson Method
323  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get
324  the material coefficients (e.g. Young modulus, Poisson ratio..)
325  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
326  */
327  void updateJacobianMatrix ( const vector_Type& disp,
328  const dataPtr_Type& dataMaterial,
329  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
330  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
331  const displayerPtr_Type& displayer );
332 
333 
334  //! Updates the nonlinear terms in the Jacobian matrix in StructualSolver::updateJacobian
335  /*!
336  \param stiff: stiffness matrix provided from outside
337  \param disp: solution at the k-th iteration of NonLinearRichardson Method
338  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get
339  the material coefficients (e.g. Young modulus, Poisson ratio..)
340  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
341  */
343  const vector_Type& disp,
344  const dataPtr_Type& dataMaterial,
345  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
346  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/,
347  const displayerPtr_Type& displayer );
348 
349 
350  //! Interface method to compute the new Stiffness matrix in StructuralSolver::evalResidual and in
351  //! StructuralSolver::updateSystem since the matrix is the expression of the matrix is the same.
352  /*!
353  \param sol: the solution vector
354  \param factor: scaling factor used in FSI
355  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get the
356  material coefficients (e.g. Young modulus, Poisson ratio..)
357  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
358  */
359  void computeStiffness ( const vector_Type& disp,
360  const UInt iter,
361  Real factor,
362  const dataPtr_Type& dataMaterial,
363  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
364  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/,
365  const displayerPtr_Type& displayer );
366 
367  void computeReferenceConfigurations ( const vector_Type& disp,
368  const dataPtr_Type& dataMaterial,
369  const displayerPtr_Type& displayer );
370 
371 
372  //! Computes the new Stiffness vector for Neo-Hookean and Holzapfel materials in StructuralSolver
373  //! given a certain displacement field.
374  //! This function is used both in StructuralSolver::evalResidual and in StructuralSolver::updateSystem
375  //! since the matrix is the expression of the matrix is the same.
376  /*!
377  \param sol: the solution vector
378  \param factor: scaling factor used in FSI
379  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get
380  the material coefficients (e.g. Young modulus, Poisson ratio..)
381  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
382  */
383 
384  //! Computes the deformation gradient F, the cofactor matrix Cof(F),
385  //! the determinant of F (J = det(F)), the trace of right Cauchy-Green tensor tr(C)
386  //! This function is used in StructuralIsotropicConstitutiveLaw::computeStiffness
387  /*!
388  \param dk_loc: the elemental displacement
389  */
391  {
392  }
393 
394  //! Computes the deformation Gradient F, the cofactor of F Cof(F), the determinant of F J = det(F), the trace of C Tr(C).
395  /*!
396  \param dk_loc: local displacement vector
397  */
398  //void computeStress( const vector_Type& sol );
399 
400  //! ShowMe method of the class (saved on a file the stiffness vector and the jacobian)
401  void showMe ( std::string const& fileNameVectStiff,
402  std::string const& fileNameJacobain );
403 
404  //! Compute the First Piola Kirchhoff Tensor
405  /*!
406  \param firstPiola Epetra_SerialDenseMatrix that has to be filled
407  \param tensorF Epetra_SerialDenseMatrix the deformation gradient
408  \param cofactorF Epetra_SerialDenseMatrix cofactor of F
409  \param invariants std::vector with the invariants of C and the detF
410  \param material UInt number to get the material parameteres form the VenantElasticData class
411  */
412  void computeLocalFirstPiolaKirchhoffTensor ( Epetra_SerialDenseMatrix& firstPiola,
413  const Epetra_SerialDenseMatrix& tensorF,
414  const Epetra_SerialDenseMatrix& cofactorF,
415  const std::vector<Real>& invariants,
416  const UInt marker);
417 
418  //! Compute the First Piola Kirchhoff Tensor
419  /*!
420  \param disp the displacement field from which we compute the fisrt piola-Kirchhoff tensor
421  \param sigma_1 the first column of the Cauchy stress tensor
422  \param sigma_2 the second column of the Cauchy stress tensor
423  \param sigma_3 the third column of the Cauchy stress tensor
424  */
425  void computeCauchyStressTensor ( const vectorPtr_Type disp,
426  const QuadratureRule& evalQuad,
427  vectorPtr_Type sigma_1,
428  vectorPtr_Type sigma_2,
429  vectorPtr_Type sigma_3);
430 
431 
432  void setupFiberDirections( vectorFiberFunctionPtr_Type vectorOfFibers );
433 
434 
435  void evaluateActivationFibers( const vector_Type& displacement,
436  vector_Type& fourthInvariant){}
437  //@}
438 
439  //! @name Get Methods
440  //@{
441 
442  //! Get the Stiffness matrix
444  {
445  return super::M_jacobian;
446  }
447 
448 
449  //! Get the stiffness vector
451  {
452  return M_stiff;
453  }
454 
455  //! Specific for multimechanism
456  vectorPtr_Type const selectionCriterion( const UInt i ) const
457  {
458  ASSERT( i <= this->M_vectorInterpolated.size(), " No such fiber family in the class" );
459  return M_selectionCriterion[ i - 1 ];
460  }
461 
462 
464  {
465  ASSERT( i <= this->M_vectorInterpolated.size(), " No such fiber family in the class" );
466  return M_activationDisplacement[ i - 1 ];
467  }
468 
469  vectorPtr_Type const activatedUnitFiber( const UInt i ) const
470  {
471  ASSERT( i <= this->M_vectorInterpolated.size(), " No such fiber family in the class" );
472  return M_unitFiberActivation[ i - 1 ];
473  }
474 
475  vectorPtr_Type const activatedDeterminant( const UInt i ) const
476  {
477  ASSERT( i <= this->M_vectorInterpolated.size(), " No such fiber family in the class" );
478  return M_jacobianActivation[ i - 1 ];
479  }
480 
481 
482  void apply ( const vector_Type& sol, vector_Type& res,
483  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
484  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
485  const displayerPtr_Type displayer) ;
486 
487  //@}
488 
489 
490 
491 protected:
492 
493  //! construct the vectors for the parameters
494  /*!
495  \param VOID
496  \return VOID
497  */
498  // void setupVectorsParameters ( void );
499 
503 
504  //! Vector: stiffness non-linear
506 
507  //! Vector: stiffness non-linear
509 
510  //! Vector: stiffness non-linear
512 
513  //! Vector: stiffness non-linear
515 
516 
517  //! Kinematics quantities related to the activation
520 
521  //! Vector: stiffness non-linear
523 
524  //Create the indentity for F
526 
527  // Scalar ET FESpace to reconstruct scalar fields
529 };
530 
531 
532 
533 
534 
535 template <typename MeshType>
537  super ( ),
538  M_quadrature ( ),
539  M_patchAreaVector ( ),
542  M_selector (0),
543  M_firstActivation (0),
547  M_stiff ( ),
548  M_identity ( ),
550 {
551 }
552 
553 
554 
555 
556 
557 template <typename MeshType>
559 {}
560 
561 
562 
563 
564 
565 template <typename MeshType>
566 void
568  const ETFESpacePtr_Type& dETFESpace,
569  const std::shared_ptr<const MapEpetra>& monolithicMap,
570  const UInt offset,
571  const dataPtr_Type& dataMaterial)
572 {
573 
574  this->M_dataMaterial = dataMaterial;
575  this->M_dispFESpace = dFESpace;
576  this->M_dispETFESpace = dETFESpace;
577  this->M_localMap = monolithicMap;
578  this->M_offset = offset;
579 
580 
581  this->M_scalarETFESpace.reset ( new scalarETFESpace_Type (dFESpace->mesh(), & (dFESpace->refFE() ),
582  & (dFESpace->fe().geoMap() ), dFESpace->mapPtr()->commPtr() ) );
583 
584  // Setting the quadrature rule for the evaluation
585  QuadratureRule fakeQuadratureRule;
586 
587  Real refElemArea (0); //area of reference element
588  //compute the area of reference element
589  for (UInt iq = 0; iq < this->M_dispFESpace->qr().nbQuadPt(); iq++)
590  {
591  refElemArea += this->M_dispFESpace->qr().weight (iq);
592  }
593 
594  Real wQuad (refElemArea / this->M_dispFESpace->refFE().nbDof() );
595 
596  //Setting the quadrature Points = DOFs of the element and weight = 1
597  std::vector<GeoVector> coords = this->M_dispFESpace->refFE().refCoor();
598  std::vector<Real> weights (this->M_dispFESpace->fe().nbFEDof(), wQuad);
599  fakeQuadratureRule.setDimensionShape ( shapeDimension (this->M_dispFESpace->refFE().shape() ), this->M_dispFESpace->refFE().shape() );
600  fakeQuadratureRule.setPoints (coords, weights);
601 
602  M_quadrature.reset( new QuadratureRule( fakeQuadratureRule ) );
603  M_patchAreaVector.reset(new vector_Type(*this->M_localMap) );
604 
605  M_patchAreaVectorScalar.reset(new vector_Type( this->M_scalarETFESpace->map() ) );
606 
607  // Sizing the std::vectors
608  M_selectionCriterion.resize( this->M_dataMaterial->numberFibersFamilies() );
609  M_selector.resize( this->M_dataMaterial->numberFibersFamilies() );
610  M_firstActivation.resize( this->M_dataMaterial->numberFibersFamilies() );
611  M_activationDisplacement.resize( this->M_dataMaterial->numberFibersFamilies() );
612 
613  M_jacobianActivation.resize( this->M_dataMaterial->numberFibersFamilies() );
614  M_unitFiberActivation.resize( this->M_dataMaterial->numberFibersFamilies() );
615 
616  //Resetting pointers
617  for( UInt i(0); i < this->M_dataMaterial->numberFibersFamilies(); i++ )
618  {
619  (M_selectionCriterion[i]).reset(new vector_Type (*this->M_localMap) );
620  (M_firstActivation[i]).reset(new vector_Type (*this->M_localMap) );
621  *(M_firstActivation[i]) *= 0.0;
622 
623  (M_activationDisplacement[i]).reset(new vector_Type (*this->M_localMap) );
624 
625  (M_jacobianActivation[i]).reset(new vector_Type ( M_scalarETFESpace->map() ) );
626  (M_unitFiberActivation[i]).reset(new vector_Type (*this->M_localMap) );
627  }
628 
629 
630  M_stiff.reset (new vector_Type (*this->M_localMap) );
631 
632  M_identity (0, 0) = 1.0;
633  M_identity (0, 1) = 0.0;
634  M_identity (0, 2) = 0.0;
635  M_identity (1, 0) = 0.0;
636  M_identity (1, 1) = 1.0;
637  M_identity (1, 2) = 0.0;
638  M_identity (2, 0) = 0.0;
639  M_identity (2, 1) = 0.0;
640  M_identity (2, 2) = 1.0;
641 
642  this->M_epsilon = this->M_dataMaterial->smoothness();
643 
644 
645  // Computing patch area vector
646  // Assembling
647  ExpressionVectorFromNonConstantScalar<ExpressionMeas, 3 > vMeas( meas_K );
648  evaluateNode( elements ( this->M_dispETFESpace->mesh() ),
649  *M_quadrature,
650  this->M_dispETFESpace,
651  dot( vMeas , phi_i )
652  ) >> M_patchAreaVector;
653  M_patchAreaVector->globalAssemble();
654 
655  evaluateNode( elements ( this->M_scalarETFESpace->mesh() ),
656  *M_quadrature,
657  this->M_scalarETFESpace,
658  meas_K * phi_i
659  ) >> M_patchAreaVectorScalar;
660  M_patchAreaVectorScalar->globalAssemble();
661 
662  //this->setupVectorsParameters( );
663 }
664 
665 
666 // template <typename MeshType>
667 // void
668 // AnisotropicMultimechanismMaterialNonLinear<MeshType>::setupVectorsParameters ( void )
669 // {
670 // // Paolo Tricerri: February, 20th
671 // // In each class, the name of the parameters has to inserted in the law
672 // // TODO: move the saving of the material parameters to more abstract objects
673 // // such that in the class of the material we do not need to call explicitly
674 // // the name of the parameter.
675 
676 // // Number of volume on the local part of the mesh
677 // UInt nbElements = this->M_dispFESpace->mesh()->numVolumes();
678 
679 // // Parameter alpha
680 // // 1. resize the vector in the first element of the vector.
681 // (* (this->M_vectorsParameters) ) [0].resize ( nbElements );
682 
683 // // Parameter gamma
684 // (* (this->M_vectorsParameters) ) [1].resize ( nbElements );
685 
686 // // Parameter bulk
687 // (* (this->M_vectorsParameters) ) [2].resize ( nbElements );
688 
689 // for (UInt i (0); i < nbElements; i++ )
690 // {
691 // // Extracting the marker
692 // UInt markerID = this->M_dispFESpace->mesh()->element ( i ).markerID();
693 
694 // Real alpha = this->M_dataMaterial->alpha ( markerID );
695 // Real gamma = this->M_dataMaterial->gamma ( markerID );
696 // Real bulk = this->M_dataMaterial->bulk ( markerID );
697 
698 // ( (* (this->M_vectorsParameters) ) [0]) [ i ] = alpha;
699 // ( (* (this->M_vectorsParameters) ) [1]) [ i ] = gamma;
700 // ( (* (this->M_vectorsParameters) ) [2]) [ i ] = bulk;
701 // }
702 // }
703 
704 
705 template <typename MeshType>
706 void
708 {
709  // Allocating the right space for the vector of fiber function
710  this->M_vectorOfFibers.reset( new vectorFiberFunction_Type( ) );
711 
712  // In this method, the vector of fiber functions has to be properly set in the main
713  // of the test. The functions are then projected on a FESpace for the integration
714 
715  // Number of volume on the local part of the mesh
716  UInt nbFamilies = (*vectorOfFibers).size();
717 
718  ASSERT( nbFamilies == this->M_dataMaterial->numberFibersFamilies(),
719  " The number of families set in the test is different from the one in the data" );
720 
721  this->M_vectorOfFibers->resize( nbFamilies );
722 
723  for( UInt k(0); k < nbFamilies; k++ )
724  {
725  ( *(this->M_vectorOfFibers) )[ k ] = ( *vectorOfFibers )[ k ];
726  }
727 
728  // Setting the vectors that will be used
729  this->M_vectorInterpolated.resize( nbFamilies );
730 
731  for( UInt k(0); k < nbFamilies; k++ )
732  {
733  this->M_vectorInterpolated[ k ].reset( new vector_Type(*this->M_localMap) );
734  this->M_dispFESpace->interpolate ( *( ( *(this->M_vectorOfFibers) )[ k ] ) ,
735  * ( ( this->M_vectorInterpolated )[ k ] ),
736  0.0 );
737  }
738 
739 }
740 
741 
742 template <typename MeshType>
744  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
745  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/)
746 {
747  //! Empty method for exponential material
748 }
749 
750 
751 
752 
753 
754 template <typename MeshType>
756  const dataPtr_Type& dataMaterial,
757  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
758  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
759  const displayerPtr_Type& displayer )
760 {
761 
762  this->M_jacobian.reset (new matrix_Type (*this->M_localMap) );
763 
764  displayer->leaderPrint (" \n*********************************\n ");
765  updateNonLinearJacobianTerms (this->M_jacobian, disp, this->M_dataMaterial, mapsMarkerVolumes, mapsMarkerIndexes, displayer);
766  displayer->leaderPrint (" \n*********************************\n ");
767 
768 }
769 
770 template <typename MeshType>
772  const vector_Type& disp,
773  const dataPtr_Type& dataMaterial,
774  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
775  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
776  const displayerPtr_Type& displayer )
777 {
778  using namespace ExpressionAssembly;
779 
780  // In the following definitions, the critical template argument is MapEpetra
781  // When other maps will be available in LifeV, the Holzapfel class and its mother
782  // should have as template the MeshType and the MapType.
783 
784  // Definition of F
785  tensorF_Type F = ExpressionDefinitions::deformationGradient( this->M_dispETFESpace, disp, this->M_offset, this->M_identity );
786 
787  // Definition of J
788  determinantF_Type J = ExpressionDefinitions::determinantF( F );
789 
790  //Definition of C
791  tensorC_Type C = ExpressionDefinitions::tensorC( transpose(F), F );
792 
793  // Definition of J^-(2/3) = det( C ) using the isochoric/volumetric decomposition
794  isochoricDet_Type Jel = ExpressionDefinitions::isochoricDeterminant( J );
795 
796  // Definition of F^-T
797  minusT_Type F_T = ExpressionDefinitions::minusT( F );
798 
799  // Update the heaviside function for the stretch of the fibers
800  * (jacobian) *= 0.0;
801 
802  displayer->leaderPrint (" Non-Linear S - updating non linear terms in the Jacobian Matrix (Multi-mechanism model): \n");
803  displayer->leaderPrint (" Non-Linear S - the computation of the activation configuration has been carried out in computeStiffness: \n");
804 
805  for( UInt i(0); i < this->M_vectorInterpolated.size(); i++ )
806  {
807  if( M_activationDisplacement[ i ]->norm2() )
808  {
809  displayer->leaderPrint (" ", i + 1,"-th fiber family \n" );
810 
811  // As in other classes, the specialization of the MapType = MapEpetra makes this expression
812  // not always usable. When other maps will be available in LifeV, the class should be re-templated.
813 
814  // Definition of F_0(ta)
815  tensorF_Type ithFzeroA = ExpressionDefinitions::deformationGradient( this->M_dispETFESpace, *(M_activationDisplacement[ i ]),
816  this->M_offset, this->M_identity );
817 
818  // Determinant of F_0(ta)
819  interpolatedScalarValue_Type ithJzeroA = ExpressionDefinitions::interpolateScalarValue( this->M_scalarETFESpace, *( M_jacobianActivation[ i ] ) );
820 
821  // Definition of J_a
822  activatedDeterminantF_Type Ja = ExpressionMultimechanism::activateDeterminantF( J, ithJzeroA );
823 
824  // Definition of J_a^{-2.0/3.0}
825  activeIsochoricDeterminant_Type JactiveEl = ExpressionMultimechanism::activeIsochoricDeterminant( Ja );
826 
827  // Definition of F_0^{-1}(ta)
828  invTensor_Type FzeroAminus1 = ExpressionDefinitions::inv( ithFzeroA );
829 
830  // Definition of Fa = F_0 * F_0(ta)^{-1}
831  deformationActivatedTensor_Type Fa = ExpressionMultimechanism::createDeformationActivationTensor( F , FzeroAminus1);
832 
833  // Definition of F_0^{-T}(ta)
834  minusT_Type FzeroAminusT = ExpressionDefinitions::minusT( ithFzeroA );
835 
836  activeMinusTtensor_Type FAminusT = ExpressionMultimechanism::createActiveMinusTtensor( F_T, transpose( ithFzeroA ) );
837  // Definition of C_a = F_0^{-T}(ta) * C_0 * F_0^{-1}(ta)
838  tensorCmultiMech_Type Ca = ExpressionMultimechanism::activationRightCauchyGreen( FzeroAminusT, C, FzeroAminus1 );
839 
840  // Interpolating the unit fiber computed before
841  interpolatedValue_Type transformedFiber = ExpressionDefinitions::interpolateValue( this->M_dispETFESpace, *( M_unitFiberActivation[ i ] ) );
842 
843  // Definition of the tensor M = ithFiber \otimes ithFiber
844  // At the moment, it's automatic that the method constructs the expression M = ithFiber \otimes ithFiber
845  // For a more general case, the file ExpressionDefinitions.hpp should be changed
846  outerProduct_Type Mith = ExpressionDefinitions::fiberTensor( transformedFiber );
847 
848  // Definition of the fourth invariant : I_4^i = C:Mith
849  activeInterpolatedStretch_Type IVith = ExpressionMultimechanism::activeInterpolatedFiberStretch( Ca, Mith );
850 
851  // Definition of the fouth isochoric invariant : J^(-2.0/3.0) * I_4^i
852  activeIsochoricStretch_Type IVithBar = ExpressionMultimechanism::activeIsochoricFourthInvariant( JactiveEl, IVith );
853 
854  // Linearization with respect to activation configuration
855  activeLinearization_Type dFa = ExpressionMultimechanism::activatedLinearization( grad(phi_j), FzeroAminus1 );
856 
857  activeTestGradient_Type grPhiI = ExpressionMultimechanism::activatedTestGradient( grad(phi_i), FzeroAminus1);
858 
859  integrate( elements ( this->M_dispETFESpace->mesh() ),
860  this->M_dispFESpace->qr(),
861  this->M_dispETFESpace,
862  this->M_dispETFESpace,
863  ithJzeroA * value( 2.0 ) * value( this->M_dataMaterial->ithStiffnessFibers( i ) ) * JactiveEl *
864  exp( value( this->M_dataMaterial->ithNonlinearityFibers( i ) ) * ( IVithBar- value( 1.0 ) ) * ( IVithBar- value( 1.0 ) ) ) *
865  (
866  derAtan( IVithBar - value( 1.0 ), this->M_epsilon, ( 1.0 / PI ) ) * ( IVithBar - value(1.0) ) +
867  atan( IVithBar - value(1.0), this->M_epsilon, ( 1 / PI ), (1.0/2.0) ) +
868  atan( IVithBar - value(1.0), this->M_epsilon, ( 1 / PI ), (1.0/2.0) ) *
869  value( 2.0 ) * value( this->M_dataMaterial->ithNonlinearityFibers( i ) ) *
870  ( IVithBar- value( 1.0 ) ) * ( IVithBar- value( 1.0 ) )
871  ) *
872  ( dot( value(-2.0/3.0) * IVithBar * FAminusT, dFa ) + JactiveEl * dot( transpose(dFa)*Fa + transpose(Fa) * dFa , Mith ) ) *
873  dot( Fa * Mith - value(1.0/3.0) * IVith * FAminusT, grPhiI )
874  ) >> jacobian;
875 
876  integrate( elements ( this->M_dispETFESpace->mesh() ),
877  this->M_dispFESpace->qr(),
878  this->M_dispETFESpace,
879  this->M_dispETFESpace,
880  ithJzeroA * value( 2.0 ) * value( this->M_dataMaterial->ithStiffnessFibers( i ) ) *
881  exp( value( this->M_dataMaterial->ithNonlinearityFibers( i ) ) * ( IVithBar- value( 1.0 ) ) * ( IVithBar- value( 1.0 ) ) ) *
882  atan( IVithBar - value(1.0), this->M_epsilon, ( 1 / PI ), (1.0/2.0) ) * ( IVithBar - value(1.0) ) *
883  dot( value(-2.0/3.0) * JactiveEl * FAminusT , dFa ) *
884  dot( Fa * Mith - value(1.0/3.0) * IVith * FAminusT, grPhiI )
885  ) >> jacobian;
886 
887  integrate( elements ( this->M_dispETFESpace->mesh() ),
888  this->M_dispFESpace->qr(),
889  this->M_dispETFESpace,
890  this->M_dispETFESpace,
891  ithJzeroA * value( 2.0 ) * value( this->M_dataMaterial->ithStiffnessFibers( i ) ) *
892  JactiveEl * ( IVithBar - value( 1.0 ) ) * atan( IVithBar - value(1.0), this->M_epsilon, ( 1 / PI ), (1.0/2.0) ) *
893  exp( value( this->M_dataMaterial->ithNonlinearityFibers( i ) ) * ( IVithBar- value( 1.0 ) ) * ( IVithBar- value( 1.0 ) ) ) *
894  dot( dFa * Mith - value(1.0/3.0) * ( dot( transpose(dFa)*Fa + transpose(Fa) * dFa , Mith ) ) * FAminusT +
895  value(1.0/3.0) * IVith * FAminusT * transpose(dFa) * FAminusT, grPhiI )
896  ) >> jacobian;
897 
898  }
899  else
900  {
901  displayer->leaderPrint ("The activation displacement of the ", i + 1,"-th fiber family is null. No Jacobian! \n" );
902  }
903  } // closing loop on fibers
904  jacobian->globalAssemble();
905 }
906 
907 
908 
909 
910 
911 template <typename MeshType>
913  const UInt iter,
914  Real /*factor*/,
915  const dataPtr_Type& dataMaterial,
916  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
917  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/,
918  const displayerPtr_Type& displayer )
919 {
920 
921  using namespace ExpressionAssembly;
922 
923  M_stiff.reset (new vector_Type (*this->M_localMap) );
924  * (M_stiff) *= 0.0;
925 
926  displayer->leaderPrint (" \n*********************************\n ");
927  displayer->leaderPrint (" Non-Linear S- Computing the Multi-mechanism nonlinear stiffness vector \n");
928  displayer->leaderPrint (" \n*********************************\n ");
929 
930  if( ( !this->M_dataMaterial->fiberActivation().compare("implicit") ||
931  !iter /* iter == 0 means explicit approach */ ) )
932  {
933  this->computeReferenceConfigurations( disp, this->M_dataMaterial, displayer );
934  }
935 
936  // For anisotropic part of the Piola-Kirchhoff is assemble summing up the parts of the
937  // Piola-Kirchhoff using the fiber index
938 
939  // Here the fiber vector at the quadrature node is deduced using the method
940  // Interpolate value of the expression template.
941 
942  // Definition of F
943  tensorF_Type F = ExpressionDefinitions::deformationGradient( this->M_dispETFESpace, disp, this->M_offset, this->M_identity );
944 
945  // Definition of J
946  determinantF_Type J = ExpressionDefinitions::determinantF( F );
947 
948  //Definition of C
949  tensorC_Type C = ExpressionDefinitions::tensorC( transpose(F), F );
950 
951  // Definition of J^-(2/3) = det( C ) using the isochoric/volumetric decomposition
952  isochoricDet_Type Jel = ExpressionDefinitions::isochoricDeterminant( J );
953 
954  // Definition of F^-T
955  minusT_Type F_T = ExpressionDefinitions::minusT( F );
956 
957  displayer->leaderPrint (" Non-Linear S- Computing contributions to the stiffness vector... \n");
958 
959  for( UInt i(0); i < this->M_vectorInterpolated.size() ; i++ )
960  {
961  if( M_activationDisplacement[ i ]->norm2() )
962  {
963 
964  displayer->leaderPrint (" ", i + 1,"-th fiber family \n" );
965  // As in other classes, the specialization of the MapType = MapEpetra makes this expression
966  // not always usable. When other maps will be available in LifeV, the class should be re-templated.
967 
968  // Definition of F_0(ta)
969  tensorF_Type ithFzeroA = ExpressionDefinitions::deformationGradient( this->M_dispETFESpace, *(M_activationDisplacement[ i ]),
970  this->M_offset, this->M_identity );
971 
972  // Determinant of F_0(ta)
973  interpolatedScalarValue_Type ithJzeroA = ExpressionDefinitions::interpolateScalarValue( this->M_scalarETFESpace, *( M_jacobianActivation[ i ] ) );
974 
975  // Definition of J_a
976  activatedDeterminantF_Type Ja = ExpressionMultimechanism::activateDeterminantF( J, ithJzeroA );
977 
978  // Definition of J_a^{-2.0/3.0}
979  activeIsochoricDeterminant_Type JactiveEl = ExpressionMultimechanism::activeIsochoricDeterminant( Ja );
980 
981  // Definition of F_0^{-1}(ta)
982  invTensor_Type FzeroAminus1 = ExpressionDefinitions::inv( ithFzeroA );
983 
984  // Definition of Fa = F_0 * F_0(ta)^{-1}
985  deformationActivatedTensor_Type Fa = ExpressionMultimechanism::createDeformationActivationTensor( F , FzeroAminus1);
986 
987  // Definition of F_0^{-T}(ta)
988  minusT_Type FzeroAminusT = ExpressionDefinitions::minusT( ithFzeroA );
989 
990  activeMinusTtensor_Type FAminusT = ExpressionMultimechanism::createActiveMinusTtensor( F_T, transpose( ithFzeroA ) );
991  // Definition of C_a = F_0^{-T}(ta) * C_0 * F_0^{-1}(ta)
992  tensorCmultiMech_Type Ca = ExpressionMultimechanism::activationRightCauchyGreen( FzeroAminusT, C, FzeroAminus1 );
993 
994  interpolatedValue_Type fiberIth =
995  ExpressionDefinitions::interpolateFiber( this->M_dispETFESpace, *(this->M_unitFiberActivation[ i ] ) );
996 
997  // Definition of the tensor M = ithFiber \otimes ithFiber
998  // At the moment, it's automatic that the method constructs the expression M = ithFiber \otimes ithFiber
999  // For a more general case, the file ExpressionDefinitions.hpp should be changed
1000  outerProduct_Type Mith = ExpressionDefinitions::fiberTensor( fiberIth );
1001 
1002  // Definition of the fourth invariant : I_4^i = C:Mith
1003  activeInterpolatedStretch_Type IVith = ExpressionMultimechanism::activeInterpolatedFiberStretch( Ca, Mith );
1004 
1005  // Definition of the fouth isochoric invariant : J^(-2.0/3.0) * I_4^i
1006  activeIsochoricStretch_Type IVithBar = ExpressionMultimechanism::activeIsochoricFourthInvariant( JactiveEl, IVith );
1007 
1008  // vectorPtr_Type checkIVithBar( new vector_Type( M_scalarETFESpace->map() ) );
1009 
1010  // *checkIVithBar *= 0.0;
1011  // evaluateNode ( elements ( this->M_scalarETFESpace->mesh() ),
1012  // *M_quadrature,
1013  // this->M_scalarETFESpace,
1014  // meas_K * atan( IVithBar - value( 1.0 ) , this->M_epsilon, ( 1 / PI ), ( 1.0/2.0 ) ) * ithJzeroA *
1015  // (value( 2.0 ) * value( this->M_dataMaterial->ithStiffnessFibers( i ) ) * JactiveEl * ( IVithBar - value( 1.0 ) ) *
1016  // exp( value( this->M_dataMaterial->ithNonlinearityFibers( i ) ) * ( IVithBar- value( 1.0 ) ) * ( IVithBar- value( 1.0 ) ) ) ) * phi_i
1017  // ) >> checkIVithBar;
1018  // checkIVithBar->globalAssemble();
1019  // *checkIVithBar = *checkIVithBar / *M_patchAreaVectorScalar;
1020  // std::cout << "norm of the vector"<< checkIVithBar->norm2()<< std::endl;
1021  // std::cout << "normInf of the vector"<< checkIVithBar->normInf()<< std::endl;
1022  // checkIVithBar->spy("checkVector");
1023 
1024  // The terms for the piola kirchhoff tensor come from the holzapfel model. Then they are rescaled
1025  // according to the change of variable given by the multi-mechanism model.
1026 
1027  // // First term:
1028  // // 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
1029  // // where alpha_i and gamma_i are the fiber parameters and M is the 2nd order tensor of type f_i \otimes \ f_i
1030 
1031  integrate ( elements ( this->M_dispETFESpace->mesh() ),
1032  this->M_dispFESpace->qr(),
1033  this->M_dispETFESpace,
1034  atan( IVithBar - value( 1.0 ) , this->M_epsilon, ( 1 / PI ), ( 1.0/2.0 ) ) * ithJzeroA *
1035  (value( 2.0 ) * value( this->M_dataMaterial->ithStiffnessFibers( i ) ) * JactiveEl * ( IVithBar - value( 1.0 ) ) *
1036  exp( value( this->M_dataMaterial->ithNonlinearityFibers( i ) ) *
1037  ( IVithBar - value( 1.0 ) ) * ( IVithBar - value( 1.0 ))))*
1038  dot( ( Fa * Mith - value(1.0/3.0) * IVithBar * FAminusT) * FzeroAminusT, grad(phi_i) )
1039  ) >> this->M_stiff;
1040  }
1041  else
1042  {
1043  displayer->leaderPrint ("The activation displacement of the ", i + 1,"-th fiber family is null. No contribution to stiffness! \n" );
1044  }
1045  }
1046  this->M_stiff->globalAssemble();
1047 
1048 
1049 }
1050 
1051 
1052 template <typename MeshType>
1053 void AnisotropicMultimechanismMaterialNonLinear<MeshType>::showMe ( std::string const& fileNameStiff,
1054  std::string const& fileNameJacobian )
1055 {
1056  this->M_stiff->spy (fileNameStiff);
1057  this->M_jacobian->spy (fileNameJacobian);
1058 }
1059 
1060 
1061 template <typename MeshType>
1063  vector_Type& res, const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
1064  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
1065  const displayerPtr_Type displayer)
1066 {
1067  computeStiffness (sol, 0, 0, this->M_dataMaterial, mapsMarkerVolumes, mapsMarkerIndexes, displayer);
1068  res += *M_stiff;
1069 }
1070 
1071 
1072 template <typename MeshType>
1074  const dataPtr_Type& dataMaterial,
1075  const displayerPtr_Type& displayer )
1076 {
1077  displayer->leaderPrint (" Non-Linear S- Computing reference configurations... \n");
1078  vectorPtr_Type booleanVector;
1079 
1080  // Definition of F
1081  tensorF_Type F = ExpressionDefinitions::deformationGradient( this->M_dispETFESpace, disp, this->M_offset, this->M_identity );
1082 
1083  // Definition of J
1084  determinantF_Type J = ExpressionDefinitions::determinantF( F );
1085 
1086  //Definition of C
1087  tensorC_Type C = ExpressionDefinitions::tensorC( transpose(F), F );
1088 
1089  // // Definition of J^-(2/3) = det( C ) using the isochoric/volumetric decomposition
1090  // isochoricDet_Type Jel = ExpressionDefinitions::isochoricDeterminant( J );
1091 
1092  // // Definition of F^-T
1093  // minusT_Type F_T = ExpressionDefinitions::minusT( F );
1094 
1095  // 1. Evaluating fiber stretch
1096  for( UInt i(0); i < this->M_vectorInterpolated.size() ; i++ )
1097  {
1098 
1099  displayer->leaderPrint (" ", i + 1,"-th fiber family \n" );
1100  // Note: M_vectorInterpolated.size() == numberOfFibers which has to be equal,
1101  // given a certain assert in the data class to the number of characteristic stretches
1102  // and therefore to the size of the vector that are used to measure the activation.
1103 
1104  // Initializing vectors
1105  (M_selectionCriterion[i]).reset(new vector_Type (*this->M_localMap) );
1106  *(M_selectionCriterion[i]) *= 0.0;
1107 
1108  // As in other classes, the specialization of the MapType = MapEpetra makes this expression
1109  // not always usable. When other maps will be available in LifeV, the class should be re-templated.
1110 
1111  // Defining the expression for the i-th fiber
1112  // Definitions of the quantities which depend on the fiber directions e.g. I_4^i
1113  interpolatedValue_Type fiberIth =
1114  ExpressionDefinitions::interpolateFiber( this->M_dispETFESpace, *(this->M_vectorInterpolated[ i ] ) );
1115 
1116  // Definition of the tensor M = ithFiber \otimes ithFiber
1117  // At the moment, it's automatic that the method constructs the expression M = ithFiber \otimes ithFiber
1118  // For a more general case, the file ExpressionDefinitions.hpp should be changed
1119  outerProduct_Type Mith = ExpressionDefinitions::fiberTensor( fiberIth );
1120 
1121  // Definition of the fourth invariant : I_4^i = C:Mith
1122  stretch_Type IVith = ExpressionDefinitions::fiberStretch( C, Mith );
1123 
1124 
1125  Real referenceStretch = this->M_dataMaterial->ithCharacteristicStretch(i) * this->M_dataMaterial->ithCharacteristicStretch(i);
1126  // Difference between IVith - IVth(t_A)
1127  ExpressionMultimechanism::incompressibleDifference_Type absStretch =
1128  ExpressionMultimechanism::incompressibleAbsoluteStretch( IVith, referenceStretch );
1129 
1130  // Difference between IVith - IVth(t_A) / IVth(t_A)
1131  ExpressionMultimechanism::relativeDifference_Type relStretch =
1132  ExpressionMultimechanism::relativeDifference( absStretch, referenceStretch );
1133 
1134  // Trick to have vector with the scalar expression
1135  ExpressionMultimechanism::expressionVectorFromRelativeDifference_Type vActivation =
1136  ExpressionMultimechanism::vectorFromRelativeDifference( relStretch );
1137 
1138  // Computing expression that determines activation
1139  evaluateNode( elements ( this->M_dispETFESpace->mesh() ),
1140  *M_quadrature,
1141  this->M_dispETFESpace,
1142  meas_K * dot( vActivation , phi_i )
1143  ) >> M_selectionCriterion[ i ];
1144  M_selectionCriterion[ i ]->globalAssemble();
1145  *( M_selectionCriterion[ i ] ) = *( M_selectionCriterion[ i ] ) / *M_patchAreaVector;
1146 
1147  // Setting values in the selector
1148  M_selector[i].setSelectionVector( *(M_selectionCriterion[i]) );
1149  M_selector[i].setValue( this->M_dataMaterial->toleranceActivation() );
1150 
1151  // Saving the vector;
1152  AssemblyElementalStructure::saveVectorAccordingToFunctor( this->M_dispFESpace, M_selector[ i ],
1153  disp, this->M_firstActivation[i],
1154  M_activationDisplacement[i], this->M_offset);
1155 
1156  vectorPtr_Type regularizationVector(new vector_Type( *this->M_localMap ) );
1157  *regularizationVector *= 0.0;
1158 
1159  evaluateNode( elements ( this->M_dispETFESpace->mesh() ),
1160  *M_quadrature,
1161  this->M_dispETFESpace,
1162  meas_K * dot( value( this->M_dispETFESpace, *(M_activationDisplacement[i]) ) , phi_i )
1163  ) >> regularizationVector;
1164  regularizationVector->globalAssemble();
1165  *(regularizationVector ) = *( regularizationVector ) / *M_patchAreaVector;
1166 
1167  *M_activationDisplacement[i] = *regularizationVector;
1168 
1169  booleanVector.reset(new vector_Type( *this->M_localMap ) );
1170  *booleanVector *= 0.0;
1171 
1172  //vector_Type vectorReference( *(M_activationDisplacement[i]) );
1173  vector_Type vectorReference( *(M_firstActivation[i]) );
1174 
1175  std::cout << "Activation: " << M_firstActivation[i]->norm2() << std::endl;
1176  std::cout << "Activation: " << M_activationDisplacement[i]->norm2() << std::endl;
1177 
1178  booleanSelector boolSelector(vectorReference);
1179  AssemblyElementalStructure::saveBooleanVectorAccordingToFunctor( this->M_dispFESpace, boolSelector, (M_activationDisplacement[i]),
1180  booleanVector, this->M_offset);
1181 
1182  *( M_jacobianActivation[ i ] ) *= 0.0;
1183  *( M_unitFiberActivation[ i ]) *= 0.0;
1184 
1185  if( M_activationDisplacement[i]->norm2() )
1186  {
1187  /*
1188  For each of the fiber families the jacobian, the activation stretch
1189  normalized fiber are computed
1190  */
1191 
1192  // Jacobian
1193  tensorF_Type Fa = ExpressionDefinitions::deformationGradient( this->M_dispETFESpace, *(M_activationDisplacement[i]),
1194  this->M_offset, this->M_identity );
1195  // Definition of J
1196  determinantF_Type Ja = ExpressionDefinitions::determinantF( Fa );
1197 
1198  evaluateNode( elements ( M_scalarETFESpace->mesh() ),
1199  *M_quadrature,
1200  M_scalarETFESpace,
1201  meas_K * Ja * phi_i
1202  ) >> M_jacobianActivation[ i ];
1203  M_jacobianActivation[ i ]->globalAssemble();
1204  *( M_jacobianActivation[ i ] ) = *( M_jacobianActivation[ i ] ) / *M_patchAreaVectorScalar;
1205  // Normalized fiber
1206  // Definitions of the quantities which depend on the fiber directions e.g. I_4^i
1207  interpolatedValue_Type fiberIth = ExpressionDefinitions::interpolateFiber( this->M_dispETFESpace, *(this->M_vectorInterpolated[ i ] ) );
1208 
1209  // Definition of the direction of the fiber at the activation moment = F_0(ta) * f_0
1210  activateFiber_Type activeIthFiber = ExpressionMultimechanism::activateFiberDirection( Fa, fiberIth );
1211 
1212  normalizedVector_Type normalizedFiber = ExpressionMultimechanism::unitVector( activeIthFiber );
1213  evaluateNode( elements ( this->M_dispETFESpace->mesh() ),
1214  *M_quadrature,
1215  this->M_dispETFESpace,
1216  meas_K * dot( normalizedFiber , phi_i )
1217  ) >> M_unitFiberActivation[ i ];
1218  M_unitFiberActivation[ i ]->globalAssemble();
1219  *( M_unitFiberActivation[ i ] ) = *( M_unitFiberActivation[ i ] ) / *M_patchAreaVector;
1220 
1221  // Resetting the vector of the fiber to zero when the element of the displacement are zero.
1222  *( M_unitFiberActivation[ i ] ) = *( M_unitFiberActivation[ i ] ) * ( *booleanVector );
1223 
1224  // // Definition of F_0^{-1}(ta)
1225  // invTensor_Type FzeroAminus1 = ExpressionDefinitions::inv( Fa );
1226  // // Definition of F_0^{-T}(ta)
1227  // minusT_Type FzeroAminusT = ExpressionDefinitions::minusT( Fa );
1228  // // Definition of C_a = F_0^{-T}(ta) * C_0 * F_0^{-1}(ta)
1229  // tensorCmultiMech_Type Ca = ExpressionMultimechanism::activationRightCauchyGreen( FzeroAminusT, C, FzeroAminus1 );
1230 
1231  // activeNormalizedOuterProduct_Type Mith = ExpressionMultimechanism::activeNormalizedOuterProduct( normalizedFiber );
1232 
1233  // // Definition of the fourth invariant : I_4^i = C:Mith
1234  // activeStretch_Type IVith = ExpressionMultimechanism::activeFiberStretch( Ca, Mith );
1235 
1236  // evaluateNode( elements ( M_scalarETFESpace->mesh() ),
1237  // *M_quadrature,
1238  // M_scalarETFESpace,
1239  // meas_K * IVith * phi_i
1240  // ) >> M_stretchActivation[ i ];
1241  // M_stretchActivation[ i ]->globalAssemble();
1242  // *( M_stretchActivation[ i ] ) = *( M_stretchActivation[ i ] ) / *M_patchAreaVectorScalar;
1243  }
1244  //( M_unitFiberActivation[ i ] )->spy("interpolatedFiberActivation");
1245  }
1246 }
1247 
1248 template <typename MeshType>
1249 void AnisotropicMultimechanismMaterialNonLinear<MeshType>::computeLocalFirstPiolaKirchhoffTensor ( Epetra_SerialDenseMatrix& firstPiola,
1250  const Epetra_SerialDenseMatrix& tensorF,
1251  const Epetra_SerialDenseMatrix& cofactorF,
1252  const std::vector<Real>& invariants,
1253  const UInt marker)
1254 {
1255 
1256  // It can be done using the evaluateNodal framework that has been shown to work
1257  // for the isotropic laws!
1258 
1259 }
1260 
1261 template <typename MeshType>
1263  const QuadratureRule& evalQuad,
1264  vectorPtr_Type sigma_1,
1265  vectorPtr_Type sigma_2,
1266  vectorPtr_Type sigma_3)
1267 {
1268 
1269  ASSERT( 2 < 0 , "For the multimechanism law the computation of the Cauchy stress has to be defined." );
1270 
1271 }
1272 
1273 
1274 
1275 template <typename MeshType>
1276 inline StructuralAnisotropicConstitutiveLaw<MeshType>* createAnisotropicMultimechanismMaterialNonLinear()
1277 {
1278  return new AnisotropicMultimechanismMaterialNonLinear<MeshType >();
1279 }
1280 
1281 namespace
1282 {
1284 }
1285 
1286 }
1287 
1288 #endif
ExpressionMultimechanism::activeIsochoricDeterminant_Type activeIsochoricDeterminant_Type
VectorEpetra - The Epetra Vector format Wrapper.
ExpressionDefinitions::interpolatedScalarValue_Type interpolatedScalarValue_Type
#define PI
void setupFiberDirections(vectorFiberFunctionPtr_Type vectorOfFibers)
vectorPtr_Type const activatedUnitFiber(const UInt i) const
Get the activation displacement.
void computeLinearStiff(dataPtr_Type &, const mapMarkerVolumesPtr_Type, const mapMarkerIndexesPtr_Type)
Compute the Stiffness matrix in StructuralSolver::buildSystem()
void computeReferenceConfigurations(const vector_Type &disp, const dataPtr_Type &dataMaterial, const displayerPtr_Type &displayer)
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.
bool operator()(const UInt i, const UInt nTotDof, const UInt offset) const
ExpressionMultimechanism::activeNormalizedOuterProduct_Type activeNormalizedOuterProduct_Type
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.
selectionFunctors_Type M_selector
Vector: stiffness non-linear.
void setDimensionShape(const UInt &newDim, const ReferenceShapes &newShape)
Change the dimension and the shape.
ExpressionDefinitions::isochoricChangeOfVariable_Type isochoricDet_Type
int32_type Int
Generic integer data.
Definition: LifeV.hpp:188
ETFESpace< RegionMesh< LinearTetra >, MapEpetra, 3, 1 > scalarETFESpace_Type
std::vector< vectorPtr_Type > M_firstActivation
Vector: stiffness non-linear.
matrixPtr_Type const stiffMatrix() const
Get the Stiffness matrix.
void evaluateActivationFibers(const vector_Type &displacement, vector_Type &fourthInvariant)
void computeKinematicsVariables(const VectorElemental &dk_loc)
Computes the new Stiffness vector for Neo-Hookean and Holzapfel materials in StructuralSolver given a...
StructuralAnisotropicConstitutiveLaw< MeshType > * createAnisotropicMultimechanismMaterialNonLinear()
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
ExpressionMultimechanism::activePowerExpression_Type activePowerExpression_Type
vectorPtr_Type const selectionCriterion(const UInt i) const
Specific for multimechanism.
ExpressionMultimechanism::activeIsochoricStretch_Type activeIsochoricStretch_Type
vectorPtr_Type const activationDisplacement(const UInt i) const
Get the activation displacement.
ExpressionMultimechanism::activeInterpolatedFiberStretch_Type activeInterpolatedStretch_Type
ExpressionMultimechanism::activatedDeterminantF_Type activatedDeterminantF_Type
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.
ExpressionMultimechanism::normActivatedFiber_Type normActivateFiber_Type
double Real
Generic real data.
Definition: LifeV.hpp:175
std::vector< vectorPtr_Type > M_selectionCriterion
Vector: stiffness non-linear.
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...
std::vector< vectorPtr_Type > M_activationDisplacement
Vector: stiffness non-linear.
vectorPtr_Type const stiffVector() const
Get the stiffness vector.
ExpressionMultimechanism::activeTestGradient_Type activeTestGradient_Type
std::vector< vectorPtr_Type > M_jacobianActivation
Kinematics quantities related to the activation.
void setSelectionVector(const vector_Type &selectionVector)
bool operator()(const UInt i, const UInt nTotDof, const UInt offset) const
ExpressionMultimechanism::activeMinusTtensor_Type activeMinusTtensor_Type
QuadratureRule - The basis class for storing and accessing quadrature rules.
ExpressionMultimechanism::rightCauchyGreenMultiMechanism_Type tensorCmultiMech_Type
ExpressionMultimechanism::deformationActivatedTensor_Type deformationActivatedTensor_Type
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.
ExpressionMultimechanism::activeLinearization_Type activeLinearization_Type
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
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)...
booleanSelector(const vector_Type &selectionVector)
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.
void apply(const vector_Type &sol, vector_Type &res, const mapMarkerVolumesPtr_Type mapsMarkerVolumes, const mapMarkerIndexesPtr_Type mapsMarkerIndexes, const displayerPtr_Type displayer)
vectorPtr_Type const activatedDeterminant(const UInt i) const
Get the activation displacement.
quadratureRulePtr_Type M_quadrature
construct the vectors for the parameters