LifeV
StructuralAnisotropicConstitutiveLaw.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 by
12  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 an abstract class to implement different kinds of materials for structural dynamic problems (St. Venant-Kirchhoff, Neo-Hookean and Exponential materials right now )
30  *
31  * @version 1.0
32  * @date 01-01-2010
33  * @author Paolo Tricerri
34  * @maintainer Paolo Tricerri <paolo.tricerri@epfl.ch>
35  */
36 
37 #ifndef _STRUCTURALANISOTROPICCONSTITUTIVELAW_H_
38 #define _STRUCTURALANISOTROPICCONSTITUTIVELAW_H_ 1
39 
40 #include <string>
41 #include <sstream>
42 #include <iostream>
43 #include <stdexcept>
44 
45 #pragma GCC diagnostic ignored "-Wunused-variable"
46 #pragma GCC diagnostic ignored "-Wunused-parameter"
47 
48 #include <Epetra_Vector.h>
49 #include <EpetraExt_MatrixMatrix.h>
50 #include <Epetra_SerialDenseMatrix.h>
51 
52 #pragma GCC diagnostic ignored "-Wunused-variable"
53 #pragma GCC diagnostic ignored "-Wunused-parameter"
54 
55 #include <lifev/core/array/MatrixElemental.hpp>
56 #include <lifev/core/array/VectorElemental.hpp>
57 #include <lifev/core/array/MatrixEpetra.hpp>
58 #include <lifev/core/array/VectorEpetra.hpp>
59 
60 #include <lifev/core/fem/Assembly.hpp>
61 #include <lifev/core/fem/AssemblyElemental.hpp>
62 #include <lifev/structure/fem/AssemblyElementalStructure.hpp>
63 #include <lifev/structure/fem/ExpressionDefinitions.hpp>
64 #include <lifev/core/fem/FESpace.hpp>
65 
66 #include <lifev/core/LifeV.hpp>
67 #include <lifev/core/util/Displayer.hpp>
68 #include <lifev/core/util/Factory.hpp>
69 #include <lifev/core/util/FactorySingleton.hpp>
70 
71 #include <lifev/core/algorithm/SolverAztecOO.hpp>
72 
73 #include <lifev/structure/solver/StructuralConstitutiveLawData.hpp>
74 
75 //ET include for assemblings
76 #include <lifev/eta/fem/ETFESpace.hpp>
77 #include <lifev/eta/expression/Integrate.hpp>
78 
79 namespace LifeV
80 {
81 /*!
82  \class StructuralConstitutiveLaw
83  \brief
84  This class is an abstract class to define different type of models for the arterial wall.
85  This class has just pure virtual methods. They are implemented in the specific class for one material
86 */
87 
88 template <typename MeshType>
89 class StructuralAnisotropicConstitutiveLaw
90 {
91 public:
92 
93  //!@name Type definitions
94  //@{
95  typedef StructuralConstitutiveLawData data_Type;
96 
97  typedef MatrixEpetra<Real> matrix_Type;
98  typedef std::shared_ptr<matrix_Type> matrixPtr_Type;
99  typedef VectorEpetra vector_Type;
100  typedef std::shared_ptr<vector_Type> vectorPtr_Type;
101 
102  typedef typename std::shared_ptr<data_Type> dataPtr_Type;
103  typedef typename std::shared_ptr<const Displayer> displayerPtr_Type;
104 
105  typedef FactorySingleton<Factory<StructuralAnisotropicConstitutiveLaw<MeshType>, std::string> > StructureAnisotropicMaterialFactory;
106 
107  typedef std::vector< typename MeshType::element_Type* > vectorVolumes_Type;
108 
109  typedef std::map< UInt, vectorVolumes_Type> mapMarkerVolumes_Type;
110  typedef std::shared_ptr<mapMarkerVolumes_Type> mapMarkerVolumesPtr_Type;
111 
112  typedef std::vector<UInt> vectorIndexes_Type;
113  typedef std::map< UInt, vectorIndexes_Type> mapMarkerIndexes_Type;
114  typedef std::shared_ptr<mapMarkerIndexes_Type> mapMarkerIndexesPtr_Type;
115 
116  typedef ETFESpace<MeshType, MapEpetra, 3, 3 > ETFESpace_Type;
117  typedef std::shared_ptr<ETFESpace_Type> ETFESpacePtr_Type;
118 
119  typedef FESpace< MeshType, MapEpetra > FESpace_Type;
120  typedef std::shared_ptr<FESpace_Type> FESpacePtr_Type;
121 
122  //Vector for vector parameters
123  typedef std::vector<std::vector<Real> > vectorsParameters_Type;
124  typedef std::shared_ptr<vectorsParameters_Type> vectorsParametersPtr_Type;
125 
126 
127  // std function for fiber direction
128  typedef std::function<Real ( Real const&, Real const&, Real const&, Real const&, ID const& ) > fiberFunction_Type;
129  typedef std::shared_ptr<fiberFunction_Type> fiberFunctionPtr_Type;
130 
131  typedef std::vector<fiberFunctionPtr_Type> vectorFiberFunction_Type;
132  typedef std::shared_ptr<vectorFiberFunction_Type> vectorFiberFunctionPtr_Type;
133 
134  // Vector to store the interpolated fiber direction
135  typedef std::vector<vectorPtr_Type> vectorInterpolatedFibers_Type;
136 
137 
138  // Typedefs for tensors
140  typedef ExpressionDefinitions::determinantTensorF_Type determinantF_Type;
143  typedef ExpressionDefinitions::traceTensor_Type traceTensor_Type;
144  typedef ExpressionDefinitions::powerExpression_Type powerExpression_Type;
145  typedef ExpressionDefinitions::isochoricTrace_Type isochoricTrace_Type;
146 
147  // Anisotropic typedefs
148  typedef ExpressionDefinitions::interpolatedValue_Type interpolatedValue_Type;
149  typedef ExpressionDefinitions::outerProduct_Type outerProduct_Type;
150  typedef ExpressionDefinitions::stretch_Type stretch_Type;
151  typedef ExpressionDefinitions::isochoricStretch_Type isochoricStretch_Type;
152  //@}
153 
154 
155 
156  //! @name Constructor & Deconstructor
157  //@{
158 
159  StructuralAnisotropicConstitutiveLaw();
160 
161  virtual ~StructuralAnisotropicConstitutiveLaw() {}
162 
163  //@}
164 
165 
166 
167  //!@name Methods
168  //@{
169 
170  //! Setup the created object of the class StructuralAnisotropicConstitutiveLaw
171  /*!
172  \param dFespace: the FiniteElement Space
173  \param monolithicMap: the MapEpetra
174  \param offset: the offset parameter used assembling the matrices
175  */
176  virtual void setup ( const FESpacePtr_Type& dFESpace,
177  const ETFESpacePtr_Type& ETFESpace,
178  const std::shared_ptr<const MapEpetra>& monolithicMap,
179  const UInt offset, const dataPtr_Type& dataMaterial) = 0;
180 
181 
182  //! Computes the linear part of the stiffness matrix StructuralSolver::buildSystem
183  /*!
184  \param dataMaterial the class with Material properties data
185  */
186  virtual void computeLinearStiff ( dataPtr_Type& dataMaterial,
187  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
188  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/ ) = 0;
189 
190  //! Updates the Jacobian matrix in StructuralSolver::updateJacobian
191  /*!
192  \param disp: solution at the k-th iteration of NonLinearRichardson Method
193  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get the
194  material coefficients (e.g. Young modulus, Poisson ratio..)
195  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
196  */
197  virtual void updateJacobianMatrix ( const vector_Type& disp, const dataPtr_Type& dataMaterial,
198  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
199  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
200  const displayerPtr_Type& displayer ) = 0;
201 
202  //! Computes the new Stiffness matrix in StructuralSolver given a certain displacement field.
203  //! This function is used both in StructuralSolver::evalResidual and in
204  //! StructuralSolver::updateSystem since the matrix is the expression of the matrix is the same.
205  //!This is virtual and not pure virtual since in the linear St. Venant-Kirchhoff law it is not needed.
206  /*!
207  \param sol: the solution vector
208  \param factor: scaling factor used in FSI
209  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get the
210  material coefficients (e.g. Young modulus, Poisson ratio..)
211  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
212  */
213  virtual void computeStiffness ( const vector_Type& sol, const UInt iter, Real factor, const dataPtr_Type& dataMaterial,
214  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
215  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
216  const displayerPtr_Type& displayer ) = 0;
217 
218  virtual void computeReferenceConfigurations ( const vector_Type& sol,
219  const dataPtr_Type& dataMaterial,
220  const displayerPtr_Type& displayer ) = 0;
221 
222  //! Computes the deformation Gradient F, the cofactor of F Cof(F),
223  //! the determinant of F J = det(F), the trace of C Tr(C).
224  /*!
225  \param dk_loc: local displacement vector
226  */
227  virtual void computeKinematicsVariables ( const VectorElemental& dk_loc ) = 0;
228 
229 
230  //! Output of the class
231  /*!
232  \param fileNamelinearStiff the filename where to apply the spy method for the linear part of the Stiffness matrix
233  \param fileNameStiff the filename where to apply the spy method for the Stiffness matrix
234  */
235  virtual void showMe ( std::string const& fileNameStiff, std::string const& fileNameJacobian ) = 0;
236 
237 
238  //! Compute the First Piola Kirchhoff Tensor
239  /*!
240  \param firstPiola Epetra_SerialDenseMatrix that has to be filled
241  \param tensorF Epetra_SerialDenseMatrix the deformation gradient
242  \param cofactorF Epetra_SerialDenseMatrix cofactor of F
243  \param invariants std::vector with the invariants of C and the detF
244  \param material UInt number to get the material parameteres form the VenantElasticData class
245  */
246  virtual void computeLocalFirstPiolaKirchhoffTensor ( Epetra_SerialDenseMatrix& firstPiola,
247  const Epetra_SerialDenseMatrix& tensorF,
248  const Epetra_SerialDenseMatrix& cofactorF,
249  const std::vector<Real>& invariants,
250  const UInt material) = 0;
251 
252  //! Compute the First Piola Kirchhoff Tensor
253  /*!
254  \param disp the displacement field from which we compute the fisrt piola-Kirchhoff tensor
255  \param sigma_1 the first column of the Cauchy stress tensor
256  \param sigma_2 the second column of the Cauchy stress tensor
257  \param sigma_3 the third column of the Cauchy stress tensor
258  */
259  virtual void computeCauchyStressTensor ( const vectorPtr_Type disp,
260  const QuadratureRule& evalQuad,
261  vectorPtr_Type sigma_1,
262  vectorPtr_Type sigma_2,
263  vectorPtr_Type sigma_3) = 0;
264 
265 
266  virtual void setupFiberDirections( vectorFiberFunctionPtr_Type vectorOfFibers ) = 0;
267 
268 
269  virtual void evaluateActivationFibers( const vector_Type& displacement,
270  vector_Type& fourthInvariant) = 0;
271 
272  //! @name Set Methods
273  //@{
274 
275  // Used to set the fibers families
276  void setIthFiberVector( const vector_Type& fiberInterpolated, const UInt i )
277  {
278  ASSERT( i <= M_vectorInterpolated.size(), " No such fiber family in the class" );
279  this->M_vectorInterpolated[ i-1 ].reset( new vector_Type(*this->M_localMap) );
280 
281  // The minus one is becase std::vector numbering starts from 0
282  // while the user starts counting from 1
283  *( M_vectorInterpolated[ i - 1 ] ) = fiberInterpolated;
284  }
285 
286  void setNumberOfFamilies( const UInt n )
287  {
288  this->M_vectorInterpolated.resize( n );
289  }
290 
291  //@}
292 
293 
294  //! @name Get Methods
295  //@{
296 
297  //! Getters
298  //! Get the Epetramap
299  MapEpetra const& map() const
300  {
301  return *M_localMap;
302  }
303 
304  //! Get the FESpace object
305  FESpace_Type& dFESpace()
306  {
307  return M_dispFESpace;
308  }
309 
310  //! Get the Stiffness matrix
311  matrixPtr_Type const jacobian() const
312  {
313  return M_jacobian;
314  }
315 
316  // Used to export the fibers families
317  const vector_Type& ithFiberVector( const UInt i ) const
318  {
319  ASSERT( i <= M_vectorInterpolated.size(), " No such fiber family in the class" );
320 
321  // The minus one is becase std::vector numbering starts from 0
322  // while the user starts counting from 1
323  return *( M_vectorInterpolated[ i - 1 ] );
324  }
325 
326  //! Get the Stiffness matrix
327  virtual matrixPtr_Type const stiffMatrix() const = 0;
328 
329  //! Get the Stiffness vector
330  virtual vectorPtr_Type const stiffVector() const = 0;
331 
332  //! Getters specific for the multi-mechanism model
333  //! Get the selction vector (the one that measures if the activation criterion is met)
334  virtual vectorPtr_Type const selectionCriterion( const UInt i ) const = 0;
335 
336  //! Get the activation displacement
337  virtual vectorPtr_Type const activationDisplacement( const UInt i ) const = 0;
338 
339  //! Get the activation displacement
340  virtual vectorPtr_Type const activatedUnitFiber( const UInt i ) const = 0;
341 
342  //! Get the activation displacement
343  virtual vectorPtr_Type const activatedDeterminant( const UInt i ) const = 0;
344 
345  virtual void apply ( const vector_Type& sol, vector_Type& res,
346  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
347  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
348  const displayerPtr_Type displayer ) = 0;
349 
350  //@}
351 
352 protected:
353 
354 
355  //! construct the vectors for the parameters
356  /*!
357  \param VOID
358  \return VOID
359  */
360  // virtual void setupVectorsParameters ( void ) = 0;
361 
362  //!Protected Members
363 
364  FESpacePtr_Type M_dispFESpace;
365 
366  ETFESpacePtr_Type M_dispETFESpace;
367 
368  std::shared_ptr<const MapEpetra> M_localMap;
369 
370  //! Matrix jacobian
371  matrixPtr_Type M_jacobian;
372 
373  //! The Offset parameter
374  UInt M_offset;
375 
376  dataPtr_Type M_dataMaterial;
377 
378  displayerPtr_Type M_displayer;
379 
380  //! Map between markers and volumes on the mesh
381  //vectorsParametersPtr_Type M_vectorsParameters;
382 
383  //! std::shared to the vector of fibers
384  vectorFiberFunctionPtr_Type M_vectorOfFibers;
385 
386  //! std::vector to store the vector of the interpolation of the
387  //! fiber direction.
388  vectorInterpolatedFibers_Type M_vectorInterpolated;
389 
390  // Smoothness parameter for the fiber activation
391  Real M_epsilon;
392 };
393 
394 //=====================================
395 // Constructor
396 //=====================================
397 
398 template <typename MeshType>
399 StructuralAnisotropicConstitutiveLaw<MeshType>::StructuralAnisotropicConstitutiveLaw( ) :
400  M_dispFESpace ( ),
401  M_dispETFESpace ( ),
402  M_localMap ( ),
403  M_jacobian ( ),
404  M_offset ( 0 ),
405  M_vectorOfFibers ( ),
406  M_vectorInterpolated ( ),
407  M_epsilon ( 0 )
408 {
409  // std::cout << "I am in the constructor of StructuralAnisotropicConstitutiveLaw" << std::endl;
410 }
411 
412 }
413 #endif /*_STRUCTURALMATERIAL_H*/
ExpressionMinusTransposed< ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > > minusTransposedTensor_Type
ExpressionDot< ExpressionProduct< ExpressionTranspose< ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > >, ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > >, ExpressionOuterProduct< ExpressionInterpolateValue< MeshType, MapEpetra, 3, 3 >, ExpressionInterpolateValue< MeshType, MapEpetra, 3, 3 > > > stretch_Type
FESpace - Short description here please!
Definition: FESpace.hpp:78
ExpressionInterpolateValue< MeshType, MapEpetra, 3, 3 > interpolatedValue_Type
ExpressionProduct< ExpressionPower< ExpressionDeterminant< ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > > >, ExpressionTrace< ExpressionProduct< ExpressionTranspose< ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > >, ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > > > > isochoricTrace_Type
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
ExpressionOuterProduct< ExpressionInterpolateValue< MeshType, MapEpetra, 3, 3 >, ExpressionInterpolateValue< MeshType, MapEpetra, 3, 3 > > outerProduct_Type
ExpressionProduct< ExpressionPower< ExpressionDeterminant< ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > > >, ExpressionDot< ExpressionProduct< ExpressionTranspose< ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > >, ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > >, ExpressionOuterProduct< ExpressionInterpolateValue< MeshType, MapEpetra, 3, 3 >, ExpressionInterpolateValue< MeshType, MapEpetra, 3, 3 > > > > isochoricStretch_Type
ExpressionProduct< ExpressionTranspose< ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > >, ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > > rightCauchyGreenTensor_Type
double Real
Generic real data.
Definition: LifeV.hpp:175
ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > deformationGradient_Type
ExpressionTrace< ExpressionProduct< ExpressionTranspose< ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > >, ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > > > traceTensor_Type
ExpressionDeterminant< ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > > determinantTensorF_Type
QuadratureRule - The basis class for storing and accessing quadrature rules.
class ETFESpace A light, templated version of the FESpace
Definition: ETFESpace.hpp:93
DataElasticStructure - Data container for solid problems with elastic structure.
ExpressionPower< ExpressionDeterminant< ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > > > powerExpression_Type
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191