LifeV
StructuralIsotropicConstitutiveLaw.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  * @author Gianmarco Mengaldo
35  * @maintainer Paolo Tricerri <paolo.tricerri@epfl.ch>
36  * @contributor Gianmarco Mengaldo <gianmarco.mengaldo@gmail.com>
37  */
38 
39 #ifndef _STRUCTURALISOTROPICCONSTITUTIVELAW_H_
40 #define _STRUCTURALISOTROPICCONSTITUTIVELAW_H_ 1
41 
42 #include <string>
43 #include <sstream>
44 #include <iostream>
45 #include <stdexcept>
46 
47 #pragma GCC diagnostic ignored "-Wunused-variable"
48 #pragma GCC diagnostic ignored "-Wunused-parameter"
49 
50 #include <Epetra_Vector.h>
51 #include <EpetraExt_MatrixMatrix.h>
52 #include <Epetra_SerialDenseMatrix.h>
53 
54 #pragma GCC diagnostic ignored "-Wunused-variable"
55 #pragma GCC diagnostic ignored "-Wunused-parameter"
56 
57 #include <lifev/core/array/MatrixElemental.hpp>
58 #include <lifev/core/array/VectorElemental.hpp>
59 #include <lifev/core/array/MatrixEpetra.hpp>
60 #include <lifev/core/array/VectorEpetra.hpp>
61 
62 #include <lifev/core/fem/Assembly.hpp>
63 #include <lifev/core/fem/AssemblyElemental.hpp>
64 #include <lifev/structure/fem/AssemblyElementalStructure.hpp>
65 #include <lifev/structure/fem/ExpressionDefinitions.hpp>
66 #include <lifev/core/fem/FESpace.hpp>
67 
68 #include <lifev/core/LifeV.hpp>
69 #include <lifev/core/util/Displayer.hpp>
70 #include <lifev/core/util/Factory.hpp>
71 #include <lifev/core/util/FactorySingleton.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 StructuralIsotropicConstitutiveLaw
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<StructuralIsotropicConstitutiveLaw<MeshType>, std::string> > StructureIsotropicMaterialFactory;
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 
117  typedef ETFESpace<MeshType, MapEpetra, 3, 3 > ETFESpace_Type;
118  typedef std::shared_ptr<ETFESpace_Type> ETFESpacePtr_Type;
119 
120  typedef FESpace< MeshType, MapEpetra > FESpace_Type;
121  typedef std::shared_ptr<FESpace_Type> FESpacePtr_Type;
122 
123  //Vector for vector parameters
124  typedef std::vector<std::vector<Real> > vectorsParameters_Type;
125  typedef std::shared_ptr<vectorsParameters_Type> vectorsParametersPtr_Type;
126 
127 
128  // Typedefs for tensors
130  typedef ExpressionDefinitions::determinantTensorF_Type determinantF_Type;
133  typedef ExpressionDefinitions::traceTensor_Type traceTensor_Type;
134  //@}
135 
136 
137 
138  //! @name Constructor & Deconstructor
139  //@{
140 
141  StructuralIsotropicConstitutiveLaw();
142 
143  virtual ~StructuralIsotropicConstitutiveLaw() {}
144 
145  //@}
146 
147 
148 
149  //!@name Methods
150  //@{
151 
152  //! Setup the created object of the class StructuralIsotropicConstitutiveLaw
153  /*!
154  \param dFespace: the FiniteElement Space
155  \param monolithicMap: the MapEpetra
156  \param offset: the offset parameter used assembling the matrices
157  */
158  virtual void setup ( const FESpacePtr_Type& dFESpace,
159  const ETFESpacePtr_Type& ETFESpace,
160  const std::shared_ptr<const MapEpetra>& monolithicMap,
161  const UInt offset, const dataPtr_Type& dataMaterial ) = 0;
162 
163 
164  //! Computes the linear part of the stiffness matrix StructuralSolver::buildSystem
165  /*!
166  \param dataMaterial the class with Material properties data
167  */
168  virtual void computeLinearStiff ( dataPtr_Type& dataMaterial,
169  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
170  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/ ) = 0;
171 
172  //! Updates the Jacobian matrix in StructuralSolver::updateJacobian
173  /*!
174  \param disp: solution at the k-th iteration of NonLinearRichardson Method
175  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get the
176  material coefficients (e.g. Young modulus, Poisson ratio..)
177  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
178  */
179  virtual void updateJacobianMatrix ( const vector_Type& disp, const dataPtr_Type& dataMaterial,
180  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
181  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
182  const displayerPtr_Type& displayer ) = 0;
183 
184  //! Computes the new Stiffness matrix in StructuralSolver given a certain displacement field.
185  //! This function is used both in StructuralSolver::evalResidual and in
186  //! StructuralSolver::updateSystem since the matrix is the expression of the matrix is the same.
187  //!This is virtual and not pure virtual since in the linear St. Venant-Kirchhoff law it is not needed.
188  /*!
189  \param sol: the solution vector
190  \param factor: scaling factor used in FSI
191  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get the
192  material coefficients (e.g. Young modulus, Poisson ratio..)
193  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
194  */
195  virtual void computeStiffness ( const vector_Type& sol, Real factor, const dataPtr_Type& dataMaterial,
196  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
197  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
198  const displayerPtr_Type& displayer ) = 0;
199 
200 
201  //! Computes the deformation Gradient F, the cofactor of F Cof(F),
202  //! the determinant of F J = det(F), the trace of C Tr(C).
203  /*!
204  \param dk_loc: local displacement vector
205  */
206  virtual void computeKinematicsVariables ( const VectorElemental& dk_loc ) = 0;
207 
208 
209  //! Output of the class
210  /*!
211  \param fileNamelinearStiff the filename where to apply the spy method for the linear part of the Stiffness matrix
212  \param fileNameStiff the filename where to apply the spy method for the Stiffness matrix
213  */
214  virtual void showMe ( std::string const& fileNameStiff, std::string const& fileNameJacobian ) = 0;
215 
216 
217  //! Compute the First Piola Kirchhoff Tensor
218  /*!
219  \param firstPiola Epetra_SerialDenseMatrix that has to be filled
220  \param tensorF Epetra_SerialDenseMatrix the deformation gradient
221  \param cofactorF Epetra_SerialDenseMatrix cofactor of F
222  \param invariants std::vector with the invariants of C and the detF
223  \param material UInt number to get the material parameteres form the VenantElasticData class
224  */
225  virtual void computeLocalFirstPiolaKirchhoffTensor ( Epetra_SerialDenseMatrix& firstPiola,
226  const Epetra_SerialDenseMatrix& tensorF,
227  const Epetra_SerialDenseMatrix& cofactorF,
228  const std::vector<Real>& invariants,
229  const UInt material) = 0;
230 
231  //! Compute the First Piola Kirchhoff Tensor
232  /*!
233  \param disp the displacement field from which we compute the fisrt piola-Kirchhoff tensor
234  \param sigma_1 the first column of the Cauchy stress tensor
235  \param sigma_2 the second column of the Cauchy stress tensor
236  \param sigma_3 the third column of the Cauchy stress tensor
237  */
238  virtual void computeCauchyStressTensor ( const vectorPtr_Type disp,
239  const QuadratureRule& evalQuad,
240  vectorPtr_Type sigma_1,
241  vectorPtr_Type sigma_2,
242  vectorPtr_Type sigma_3) = 0;
243 
244 
245  //! @name Set Methods
246  //@{
247 
248  //No set Methods
249 
250  //@}
251 
252 
253  //! @name Get Methods
254  //@{
255 
256  //! Getters
257  //! Get the Epetramap
258  MapEpetra const& map() const
259  {
260  return *M_localMap;
261  }
262 
263  //! Get the FESpace object
264  FESpace_Type& dFESpace()
265  {
266  return M_dispFESpace;
267  }
268 
269  //! Get the Stiffness matrix
270  matrixPtr_Type const jacobian() const
271  {
272  return M_jacobian;
273  }
274 
275  //! Get the Stiffness matrix
276  virtual matrixPtr_Type const stiffMatrix() const = 0;
277 
278  //! Get the Stiffness matrix
279  virtual vectorPtr_Type const stiffVector() const = 0;
280 
281  virtual void apply ( const vector_Type& sol, vector_Type& res,
282  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
283  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
284  const displayerPtr_Type displayer) = 0;
285 
286  //@}
287 
288 protected:
289 
290 
291  //! construct the vectors for the parameters
292  /*!
293  \param VOID
294  \return VOID
295  */
296  virtual void setupVectorsParameters ( void ) = 0;
297 
298  //!Protected Members
299  dataPtr_Type M_dataMaterial;
300 
301  FESpacePtr_Type M_dispFESpace;
302 
303  ETFESpacePtr_Type M_dispETFESpace;
304 
305  std::shared_ptr<const MapEpetra> M_localMap;
306 
307  //! Matrix jacobian
308  matrixPtr_Type M_jacobian;
309 
310  //! The Offset parameter
311  UInt M_offset;
312 
313  //! Map between markers and volumes on the mesh
314  vectorsParametersPtr_Type M_vectorsParameters;
315 };
316 
317 //=====================================
318 // Constructor
319 //=====================================
320 
321 template <typename MeshType>
322 StructuralIsotropicConstitutiveLaw<MeshType>::StructuralIsotropicConstitutiveLaw( ) :
323  M_dataMaterial ( ),
324  M_dispFESpace ( ),
325  M_dispETFESpace ( ),
326  M_localMap ( ),
327  M_jacobian ( ),
328  M_offset ( 0 ),
329  M_vectorsParameters ( )
330 {
331  // std::cout << "I am in the constructor of StructuralIsotropicConstitutiveLaw" << std::endl;
332 }
333 
334 }
335 #endif /*_STRUCTURALISOTROPICCONSTITUTIVELAW_H_*/
ExpressionMinusTransposed< ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > > minusTransposedTensor_Type
FESpace - Short description here please!
Definition: FESpace.hpp:78
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.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191