LifeV
VenantKirchhoffMaterialNonLinearPenalized.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 _VENANTKIRCHHOFFPENALIZED_H_
39 #define _VENANTKIRCHHOFFPENALIZED_H_
40 
41 #pragma GCC diagnostic ignored "-Wunused-variable"
42 #pragma GCC diagnostic ignored "-Wunused-parameter"
43 
44 
45 #include <lifev/structure/solver/isotropic/StructuralIsotropicConstitutiveLaw.hpp>
46 
47 namespace LifeV
48 {
49 template <typename MeshType>
50 class VenantKirchhoffMaterialNonLinearPenalized : public StructuralIsotropicConstitutiveLaw<MeshType>
51 {
52  //!@name Type definitions
53  //@{
54 
55 public:
56  typedef StructuralIsotropicConstitutiveLaw<MeshType> super;
57 
58  typedef typename super::data_Type data_Type;
59 
60  typedef typename super::vector_Type vector_Type;
61  typedef typename super::matrix_Type matrix_Type;
62 
63  typedef typename super::matrixPtr_Type matrixPtr_Type;
64  typedef typename super::vectorPtr_Type vectorPtr_Type;
65  typedef typename super::dataPtr_Type dataPtr_Type;
66  typedef typename super::displayerPtr_Type displayerPtr_Type;
67 
68  typedef typename super::mapMarkerVolumesPtr_Type mapMarkerVolumesPtr_Type;
69  typedef typename super::mapMarkerVolumes_Type mapMarkerVolumes_Type;
70  typedef typename mapMarkerVolumes_Type::const_iterator mapIterator_Type;
71 
72  typedef typename super::vectorVolumes_Type vectorVolumes_Type;
73  typedef std::shared_ptr<vectorVolumes_Type> vectorVolumesPtr_Type;
74 
75  typedef typename super::mapMarkerIndexesPtr_Type mapMarkerIndexesPtr_Type;
76  typedef typename super::mapMarkerIndexes_Type mapMarkerIndexes_Type;
77  typedef typename mapMarkerIndexes_Type::const_iterator mapIteratorIndex_Type;
78 
79  typedef std::vector<UInt> vectorIndexes_Type;
80  typedef std::shared_ptr<vectorIndexes_Type> vectorIndexesPtr_Type;
81 
82  typedef typename super::FESpacePtr_Type FESpacePtr_Type;
83  typedef typename super::ETFESpacePtr_Type ETFESpacePtr_Type;
84 
85  //Vector for vector parameters
86  typedef typename super::vectorsParameters_Type vectorsParameters_Type;
87  typedef typename super::vectorsParametersPtr_Type vectorsParametersPtr_Type;
88 
89  typedef MatrixSmall<3, 3> matrixSmall_Type;
90 
91  // Typedefs for expression definitions
92  typedef typename super::tensorF_Type tensorF_Type;
93  typedef typename super::determinantF_Type determinantF_Type;
94  typedef typename super::tensorC_Type tensorC_Type;
95  typedef typename super::minusT_Type minusT_Type;
96  typedef typename super::traceTensor_Type traceTensor_Type;
97  typedef ExpressionDefinitions::traceSquaredTensor_Type traceSquaredTensor_Type;
98  //@}
99 
100 
101 
102  //! @name Constructor & Destructor
103  //@{
104 
105  VenantKirchhoffMaterialNonLinearPenalized();
106 
107  virtual ~VenantKirchhoffMaterialNonLinearPenalized();
108 
109  //@}
110 
111 
112 
113  //!@name Methods
114  //@{
115 
116  //! Setup the created object of the class StructuralIsotropicConstitutiveLaw
117  /*!
118  \param dFespace: the FiniteElement Space
119  \param monolithicMap: the MapEpetra
120  \param offset: the offset parameter used assembling the matrices
121  */
122  void setup ( const FESpacePtr_Type& dFESpace,
123  const ETFESpacePtr_Type& dETFESpace,
124  const std::shared_ptr<const MapEpetra>& monolithicMap,
125  const UInt offset, const dataPtr_Type& dataMaterial);
126 
127  //! Compute the Stiffness matrix in StructuralSolver::buildSystem()
128  /*!
129  \param dataMaterial the class with Material properties data
130  */
131  void computeLinearStiff ( dataPtr_Type& /*dataMaterial*/,
132  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
133  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/ );
134 
135 
136  //! Updates the Jacobian matrix in StructualSolver::updateJacobian
137  /*!
138  \param disp: solution at the k-th iteration of NonLinearRichardson Method
139  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get the material coefficients (e.g. Young modulus, Poisson ratio..)
140  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
141  */
142  void updateJacobianMatrix ( const vector_Type& sol,
143  const dataPtr_Type& dataMaterial,
144  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
145  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
146  const displayerPtr_Type& displayer );
147 
148 
149  //! Updates the nonlinear terms in the Jacobian matrix in StructualSolver::updateJacobian
150  /*!
151  \param stiff: stiffness matrix provided from outside
152  \param disp: solution at the k-th iteration of NonLinearRichardson Method
153  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get the material coefficients (e.g. Young modulus, Poisson ratio..)
154  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
155  */
156  void updateNonLinearJacobianTerms ( matrixPtr_Type& jacobian,
157  const vector_Type& sol,
158  const dataPtr_Type& dataMaterial,
159  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
160  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/,
161  const displayerPtr_Type& displayer );
162 
163 
164  //! Interface method to compute the new Stiffness matrix in StructuralSolver::evalResidual and in
165  //! StructuralSolver::updateSystem since the matrix is the expression of the matrix is the same.
166  /*!
167  \param sol: the solution vector
168  \param factor: scaling factor used in FSI
169  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get the material coefficients (e.g. Young modulus, Poisson ratio..)
170  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
171  */
172  void computeStiffness ( const vector_Type& sol,
173  Real factor,
174  const dataPtr_Type& dataMaterial,
175  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
176  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/,
177  const displayerPtr_Type& displayer );
178 
179  //! Computes the new Stiffness vector for Neo-Hookean and VK-Penalized materials in StructuralSolver given a certain displacement field.
180  //! This function is used both in StructuralSolver::evalResidual and in StructuralSolver::updateSystem since the matrix is the expression of the matrix is the same.
181  /*!
182  \param sol: the solution vector
183  \param factor: scaling factor used in FSI
184  \param dataMaterial: a pointer to the dataType member in StructuralSolver class to get the material coefficients (e.g. Young modulus, Poisson ratio..)
185  \param displayer: a pointer to the Dysplaier member in the StructuralSolver class
186  */
187  // void computeVector( const vector_Type& sol,
188  // Real factor,
189  // const dataPtr_Type& dataMaterial,
190  // const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
191  // const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
192  // const displayerPtr_Type& displayer );
193 
194  //! Computes the deformation gradient F, the cofactor matrix Cof(F), the determinant of F (J = det(F)), the trace of right Cauchy-Green tensor tr(C)
195  //! This function is used in StructuralIsotropicConstitutiveLaw::computeStiffness
196  /*!
197  \param dk_loc: the elemental displacement
198  */
199  void computeKinematicsVariables ( const VectorElemental& dk_loc );
200 
201  //! Computes the deformation Gradient F, the cofactor of F Cof(F), the determinant of F J = det(F), the trace of C Tr(C).
202  /*!
203  \param dk_loc: local displacement vector
204  */
205  //void computeStress( const vector_Type& sol );
206 
207  //! ShowMe method of the class (saved on a file the stiffness vector and the jacobian)
208  void showMe ( std::string const& fileNameVectStiff,
209  std::string const& fileNameJacobain );
210 
211  //! Compute the First Piola Kirchhoff Tensor
212  /*!
213  \param firstPiola Epetra_SerialDenseMatrix that has to be filled
214  \param tensorF Epetra_SerialDenseMatrix the deformation gradient
215  \param cofactorF Epetra_SerialDenseMatrix cofactor of F
216  \param invariants std::vector with the invariants of C and the detF
217  \param material UInt number to get the material parameteres form the VenantElasticData class
218  */
219  void computeLocalFirstPiolaKirchhoffTensor ( Epetra_SerialDenseMatrix& firstPiola,
220  const Epetra_SerialDenseMatrix& tensorF,
221  const Epetra_SerialDenseMatrix& cofactorF,
222  const std::vector<Real>& invariants,
223  const UInt marker);
224  //! Compute the First Piola Kirchhoff Tensor
225  /*!
226  \param disp the displacement field from which we compute the fisrt piola-Kirchhoff tensor
227  \param sigma_1 the first column of the Cauchy stress tensor
228  \param sigma_2 the second column of the Cauchy stress tensor
229  \param sigma_3 the third column of the Cauchy stress tensor
230  */
231  void computeCauchyStressTensor ( const vectorPtr_Type disp,
232  const QuadratureRule& evalQuad,
233  vectorPtr_Type sigma_1,
234  vectorPtr_Type sigma_2,
235  vectorPtr_Type sigma_3);
236 
237 
238  //@}
239 
240  //! @name Get Methods
241  //@{
242 
243  //! Get the Stiffness matrix
244  matrixPtr_Type const stiffMatrix() const
245  {
246  return super::M_jacobian;
247  }
248 
249 
250  //! Get the stiffness vector
251  vectorPtr_Type const stiffVector() const
252  {
253  return M_stiff;
254  }
255 
256  void apply ( const vector_Type& sol, vector_Type& res, const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
257  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
258  const displayerPtr_Type displayer);
259 
260  //@}
261 
262 
263 
264 protected:
265 
266  //! construct the vectors for the parameters
267  /*!
268  \param VOID
269  \return VOID
270  */
271  void setupVectorsParameters ( void );
272 
273 
274  //! Vector: stiffness non-linear
275  vectorPtr_Type M_stiff;
276 
277  //Create the indentity for F
278  matrixSmall_Type M_identity;
279 };
280 
281 
282 
283 
284 
285 template <typename MeshType>
286 VenantKirchhoffMaterialNonLinearPenalized<MeshType>::VenantKirchhoffMaterialNonLinearPenalized() :
287  super ( ),
288  M_stiff ( ),
289  M_identity ( )
290 {
291 }
292 
293 
294 
295 
296 
297 template <typename MeshType>
298 VenantKirchhoffMaterialNonLinearPenalized<MeshType>::~VenantKirchhoffMaterialNonLinearPenalized()
299 {}
300 
301 
302 
303 
304 
305 template <typename MeshType>
306 void
307 VenantKirchhoffMaterialNonLinearPenalized<MeshType>::setup ( const FESpacePtr_Type& dFESpace,
308  const ETFESpacePtr_Type& dETFESpace,
309  const std::shared_ptr<const MapEpetra>& monolithicMap,
310  const UInt offset, const dataPtr_Type& dataMaterial)
311 {
312  this->M_dataMaterial = dataMaterial;
313  this->M_dispFESpace = dFESpace;
314  this->M_dispETFESpace = dETFESpace;
315  this->M_localMap = monolithicMap;
316  this->M_offset = offset;
317 
318  M_stiff.reset ( new vector_Type (*this->M_localMap) );
319 
320  M_identity (0, 0) = 1.0;
321  M_identity (0, 1) = 0.0;
322  M_identity (0, 2) = 0.0;
323  M_identity (1, 0) = 0.0;
324  M_identity (1, 1) = 1.0;
325  M_identity (1, 2) = 0.0;
326  M_identity (2, 0) = 0.0;
327  M_identity (2, 1) = 0.0;
328  M_identity (2, 2) = 1.0;
329 
330  // The 3 is because the law uses three parameters (lambda, mu, bulk).
331  // another way would be to set up the number of constitutive parameters of the law
332  // in the data file to get the right size. Note the comment below.
333  this->M_vectorsParameters.reset ( new vectorsParameters_Type ( 3 ) );
334 
335  this->setupVectorsParameters();
336 
337 }
338 
339 template <typename MeshType>
340 void
341 VenantKirchhoffMaterialNonLinearPenalized<MeshType>::setupVectorsParameters ( void )
342 {
343  // Paolo Tricerri: February, 20th
344  // In each class, the name of the parameters has to inserted in the law
345  // TODO: move the saving of the material parameters to more abstract objects
346  // such that in the class of the material we do not need to call explicitly
347  // the name of the parameter.
348 
349  // Number of volume on the local part of the mesh
350  UInt nbElements = this->M_dispFESpace->mesh()->numVolumes();
351 
352  // Parameter lambda
353  // 1. resize the vector in the first element of the vector.
354  (* (this->M_vectorsParameters) ) [0].resize ( nbElements );
355 
356  // Parameter mu
357  (* (this->M_vectorsParameters) ) [1].resize ( nbElements );
358 
359  // Parameter mu
360  (* (this->M_vectorsParameters) ) [2].resize ( nbElements );
361 
362  for (UInt i (0); i < nbElements; i++ )
363  {
364  // Extracting the marker
365  UInt markerID = this->M_dispFESpace->mesh()->element ( i ).markerID();
366 
367  Real lambda = this->M_dataMaterial->lambda ( markerID );
368  Real mu = this->M_dataMaterial->mu ( markerID );
369  Real bulk = this->M_dataMaterial->bulk ( markerID );
370 
371  ( (* (this->M_vectorsParameters) ) [0]) [ i ] = lambda;
372  ( (* (this->M_vectorsParameters) ) [1]) [ i ] = mu;
373  ( (* (this->M_vectorsParameters) ) [2]) [ i ] = bulk;
374  }
375 }
376 
377 
378 
379 
380 template <typename MeshType>
381 void VenantKirchhoffMaterialNonLinearPenalized<MeshType>::computeLinearStiff (dataPtr_Type& /*dataMaterial*/,
382  const mapMarkerVolumesPtr_Type /*mapsMarkerVolumes*/,
383  const mapMarkerIndexesPtr_Type /*mapsMarkerIndexes*/)
384 {
385  //! Empty method for this law
386 }
387 
388 
389 
390 
391 
392 template <typename MeshType>
393 void VenantKirchhoffMaterialNonLinearPenalized<MeshType>::updateJacobianMatrix ( const vector_Type& sol,
394  const dataPtr_Type& dataMaterial,
395  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
396  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
397  const displayerPtr_Type& displayer )
398 {
399  this->M_jacobian.reset (new matrix_Type (*this->M_localMap) );
400 
401  displayer->leaderPrint (" \n************************************************\n ");
402  updateNonLinearJacobianTerms (this->M_jacobian, sol, this->M_dataMaterial, mapsMarkerVolumes, mapsMarkerIndexes, displayer);
403  displayer->leaderPrint (" \n************************************************\n ");
404 
405 }
406 
407 
408 
409 
410 
411 template <typename MeshType>
412 void VenantKirchhoffMaterialNonLinearPenalized<MeshType>::updateNonLinearJacobianTerms ( matrixPtr_Type& jacobian,
413  const vector_Type& sol,
414  const dataPtr_Type& dataMaterial,
415  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
416  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
417  const displayerPtr_Type& displayer )
418 {
419 
420  using namespace ExpressionAssembly;
421 
422  *jacobian *= 0.0;
423 
424  displayer->leaderPrint (" Non-Linear S- updating non linear terms in the Jacobian Matrix (VK-Penalized)");
425 
426  //! Nonlinear part of jacobian
427  //! loop on volumes (i)
428 
429  // mapIterator_Type it;
430  // //mapIteratorIndex_Type itIndex;
431 
432  // vectorVolumesPtr_Type pointerListOfVolumes;
433  // vectorIndexesPtr_Type pointerListOfIndexes;
434 
435  // for( it = (*mapsMarkerVolumes).begin(); it != (*mapsMarkerVolumes).end(); it++)
436  // {
437 
438  // //Given the marker pointed by the iterator, let's extract the material parameters
439  // UInt marker = it->first;
440 
441  // // Debug
442  // // UInt markerIndex = itIndex->first;
443  // // ASSERT( marker == markerIndex, "The list of volumes is referring to a marker that is not the same as the marker of index!!!");
444 
445  // pointerListOfVolumes.reset( new vectorVolumes_Type(it->second) );
446  // pointerListOfIndexes.reset( new vectorIndexes_Type((*mapsMarkerIndexes)[marker] ) );
447 
448  // Real bulk = dataMaterial->bulk(marker);
449  // Real mu = dataMaterial->mu(marker);
450  // Real lambda = dataMaterial->lambda(marker);
451 
452  // Definition of F
453  tensorF_Type F = ExpressionDefinitions::deformationGradient( this->M_dispETFESpace, sol, this->M_offset, this->M_identity );
454 
455  // Definition of J
456  determinantF_Type J = ExpressionDefinitions::determinantF( F );
457 
458  // Definition of tensor C
459  tensorC_Type C = ExpressionDefinitions::tensorC( transpose(F), F );
460 
461  // Definition of F^-T
462  minusT_Type F_T = ExpressionDefinitions::minusT( F );
463 
464  // Definition of tr( C )
465  traceTensor_Type I_C = ExpressionDefinitions::traceTensor( C );
466 
467  // Definition of C:C
468  traceSquaredTensor_Type I_Csq = ExpressionDefinitions::traceSquared( C );
469 
470  //! Stiffness for non-linear terms of the VK-Penalized model
471  /*!
472  The results of the integrals are stored at each step into elmatK, until to build K matrix of the bilinear form
473  */
474 
475  //! VOLUMETRIC PART
476  //! 1. Stiffness matrix: int { 1/2 * bulk * ( 2 - 1/J + 1/J^2 ) * ( CofF : \nabla \delta ) (CofF : \nabla v) }
477  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
478  this->M_dispFESpace->qr(),
479  this->M_dispETFESpace,
480  this->M_dispETFESpace,
481  value ( 1.0 / 2.0 ) * parameter ( (* (this->M_vectorsParameters) ) [2] ) * ( value (2.0) *pow (J, 2.0) - J + value (1.0) ) * dot ( F_T, grad (phi_j) ) * dot ( F_T, grad (phi_i) )
482  ) >> jacobian;
483 
484  //! 2. Stiffness matrix: int { 1/2 * bulk * ( 1/J- 1 - log(J)/J^2 ) * ( CofF1 [\nabla \delta]^t CofF ) : \nabla v }
485  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
486  this->M_dispFESpace->qr(),
487  this->M_dispETFESpace,
488  this->M_dispETFESpace,
489  value ( - 1.0 / 2.0 ) * parameter ( (* (this->M_vectorsParameters) ) [2] ) * ( pow (J, 2.0) - J + log (J) ) * dot ( F_T * transpose (grad (phi_j) ) * F_T, grad (phi_i) )
490  ) >> jacobian;
491 
492 
493  //! ISOCHORIC PART
494  //! 0. Stiffness matrix : int { -(2.0/3.0) * Jk^(-2.0/3.0) * ( (lambda/2) * Ic_isok - ( (3/2)*lambda + mu ) ) * F^-T:\nabla \delta ) * ( F - (1.0/3.0) * Ic_k * F^-T ): \nabla \v }
495  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
496  this->M_dispFESpace->qr(),
497  this->M_dispETFESpace,
498  this->M_dispETFESpace,
499  value ( - 2.0 / 3.0 ) * pow ( J, - (2.0 / 3.0) ) * ( value ( 1.0 / 2.0 ) * parameter ( (* (this->M_vectorsParameters) ) [0] ) * pow(J, -2.0/3.0) * I_C -
500  ( value (3.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [0] ) + parameter ( (* (this->M_vectorsParameters) ) [1] ) ) ) *
501  dot ( F_T, grad (phi_j) ) * dot ( F + value (-1.0 / 3.0) * I_C * F_T, grad (phi_i) )
502  ) >> jacobian;
503 
504 
505  // //! 1. Stiffness matrix : int { J^(-2/3) * (lambda / 2) * ( (-2/3) * Ic_k * J^(-2/3) * F^-T:\nabla \delta ) * ( F : \nabla \v ) }
506  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
507  this->M_dispFESpace->qr(),
508  this->M_dispETFESpace,
509  this->M_dispETFESpace,
510  pow ( J, - (4.0 / 3.0) ) * value ( -1.0 / 3.0 ) * parameter ( (* (this->M_vectorsParameters) ) [0] ) * I_C *
511  dot ( F_T, grad (phi_j) ) * dot ( F , grad (phi_i) )
512  ) >> jacobian;
513 
514  // //! 2. Stiffness matrix : int { J^(-2/3) * (lambda / 2) * ( ( 2/9 ) * J^(-2/3) * Ic_k^2 ) * ( F^-T : \nabla \delta ) ( F^-T : \nabla \v ) }
515  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
516  this->M_dispFESpace->qr(),
517  this->M_dispETFESpace,
518  this->M_dispETFESpace,
519  pow ( J, - (4.0 / 3.0) ) * value ( 1.0 / 9.0 ) * parameter ( (* (this->M_vectorsParameters) ) [0] ) * pow ( I_C, 2.0) *
520  dot ( F_T, grad (phi_j) ) * dot ( F_T , grad (phi_i) )
521  ) >> jacobian;
522 
523  // //! 3. Stiffness matrix:int { J^(-2/3) * (lambda / 2) * ( 2 * J^(-2/3) * F : \nabla \delta ) * ( F : \nabla v) }
524  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
525  this->M_dispFESpace->qr(),
526  this->M_dispETFESpace,
527  this->M_dispETFESpace,
528  pow ( J, - (4.0 / 3.0) ) * parameter ( (* (this->M_vectorsParameters) ) [0] ) *
529  dot ( F, grad (phi_j) ) * dot ( F , grad (phi_i) )
530  ) >> jacobian;
531 
532  // //! 4. Stiffness matrix:int{ J^(-2/3) * (lambda / 2) * ( -2.0/3.0 * J^(-2/3) * Ic_k ) * ( F : \nabla \delta ) * ( F^-T : \nabla \v ) }
533  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
534  this->M_dispFESpace->qr(),
535  this->M_dispETFESpace,
536  this->M_dispETFESpace,
537  pow ( J, - (4.0 / 3.0) ) * value ( -1.0 / 3.0 ) * parameter ( (* (this->M_vectorsParameters) ) [0] ) * I_C *
538  dot ( F, grad (phi_j) ) * dot ( F_T , grad (phi_i) )
539  ) >> jacobian;
540 
541  // //! 5. Stiffness matrix : int { J^(-2/3) * ( (lambda/2) * Ic_isok - ( (3/2)*lambda + mu ) ) * \nabla \delta : \nabla v }
542  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
543  this->M_dispFESpace->qr(),
544  this->M_dispETFESpace,
545  this->M_dispETFESpace,
546  pow ( J, - (2.0 / 3.0) ) * ( value ( 1.0 / 2.0 ) * parameter ( (* (this->M_vectorsParameters) ) [0] ) * pow( J, -2.0/3.0 ) * I_C -
547  (value (3.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [0] ) + parameter ( (* (this->M_vectorsParameters) ) [1] ) ) ) *
548  dot ( grad (phi_j) , grad (phi_i) )
549  ) >> jacobian;
550 
551 
552  // //! 6. Stiffness matrix : int { J^(-2.0/3.0) * ( (lambda/2) * Ic_isok - ( (3/2)*lambda + mu ) ) * ( (-2/3) * ( F :\nabla \delta ) ) * ( F^-T : \nabla v ) }
553  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
554  this->M_dispFESpace->qr(),
555  this->M_dispETFESpace,
556  this->M_dispETFESpace,
557  pow ( J, - (2.0 / 3.0) ) * ( value ( 1.0 / 2.0 ) * parameter ( (* (this->M_vectorsParameters) ) [0] ) * pow( J, -2.0/3.0 ) * I_C -
558  (value (3.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [0] ) + parameter ( (* (this->M_vectorsParameters) ) [1] ) ) ) * value (-2.0 / 3.0) *
559  dot ( F, grad (phi_j) ) * dot ( F_T , grad (phi_i) )
560  ) >> jacobian;
561 
562 
563 
564  // //! 7. Stiffness matrix : int { ( J^(-2.0/3.0) * (lambda/2) * Ic_isok - ( (3/2)*lambda + mu ) ) * ( (1/3) * Ic_k * ( F^-T \nabla \delta^T F-T ) : \nabla v }
565  integrate ( elements ( this->M_dispETFESpace->mesh() ),
566  this->M_dispFESpace->qr(),
567  this->M_dispETFESpace,
568  this->M_dispETFESpace,
569  pow ( J, - (2.0 / 3.0) ) * ( value ( 1.0 / 2.0 ) * parameter ( (* (this->M_vectorsParameters) ) [0] ) * pow( J, -2.0/3.0 ) * I_C -
570  (value (3.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [0] ) + parameter ( (* (this->M_vectorsParameters) ) [1] ) ) ) * value (1.0 / 3.0) * I_C *
571  dot ( F_T * transpose (grad (phi_j) ) * F_T , grad (phi_i) )
572  ) >> jacobian;
573 
574  //! 8. Stiffness matrix : int { ( -4.0/3.0) * ( mu * J^(-4/3) ) * ( F^-T: \grad \delta ) * ( F C ) : \nabla v }
575  integrate ( elements ( this->M_dispETFESpace->mesh() ),
576  this->M_dispFESpace->qr(),
577  this->M_dispETFESpace,
578  this->M_dispETFESpace,
579  value ( (-4.0 / 3.0) ) * parameter ( (* (this->M_vectorsParameters) ) [1] ) * pow ( J, (-4.0 / 3.0) ) *
580  dot ( F_T , grad (phi_j) ) * dot ( F * C , grad (phi_i) )
581  ) >> jacobian;
582 
583 
584  // //! 9. Stiffness matrix : int { ( 4.0/9.0) * ( mu * J^(-4/3) ) * Ic_kSquared * (F^-T : \grad \delta ) * F^-T : \nabla \v }
585  integrate ( elements ( this->M_dispETFESpace->mesh() ),
586  this->M_dispFESpace->qr(),
587  this->M_dispETFESpace,
588  this->M_dispETFESpace,
589  value ( 4.0 / 9.0 ) * parameter ( (* (this->M_vectorsParameters) ) [1] ) * pow ( J, (-4.0 / 3.0) ) * I_Csq *
590  dot ( F_T , grad (phi_j) ) * dot ( F_T , grad (phi_i) )
591  ) >> jacobian;
592 
593 
594  // //! 10. Stiffness matrix : int { ( mu * J^(-4/3) ) * ( \nabla \delta * C ) : \nabla v }
595  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
596  this->M_dispFESpace->qr(),
597  this->M_dispETFESpace,
598  this->M_dispETFESpace,
599  parameter ( (* (this->M_vectorsParameters) ) [1] ) * pow ( J, (-4.0 / 3.0) ) *
600  dot ( grad (phi_j) * C , grad (phi_i) )
601  ) >> jacobian;
602 
603 
604  // //! 11. Stiffness matrix : int { ( mu * J^(-4/3) ) * (F [\nabla \delta]^T F ) : \nabla \v }
605  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
606  this->M_dispFESpace->qr(),
607  this->M_dispETFESpace,
608  this->M_dispETFESpace,
609  parameter ( (* (this->M_vectorsParameters) ) [1] ) * pow ( J, (-4.0 / 3.0) ) *
610  dot ( F * transpose ( grad (phi_j) ) * F, grad (phi_i) )
611  ) >> jacobian;
612 
613 
614  // //! 12. Stiffness matrix : int { ( mu * J^(-4/3) ) * (F * F^T * [\nabla \delta] ) : \nabla \v }
615  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
616  this->M_dispFESpace->qr(),
617  this->M_dispETFESpace,
618  this->M_dispETFESpace,
619  parameter ( (* (this->M_vectorsParameters) ) [1] ) * pow ( J, (-4.0 / 3.0) ) *
620  dot ( F * transpose (F) * grad (phi_j), grad (phi_i) )
621  ) >> jacobian;
622 
623  // //! 13. Stiffness matrix : int { ( mu * J^(-4/3) ) * ( (1/3) * Ic_SquaredK * ( F^-T [\nabla \delta ]^T F^-T) : \nabla v ) }
624  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
625  this->M_dispFESpace->qr(),
626  this->M_dispETFESpace,
627  this->M_dispETFESpace,
628  parameter ( (* (this->M_vectorsParameters) ) [1] ) * pow ( J, (-4.0 / 3.0) ) * value ( 1.0 / 3.0 ) * I_Csq *
629  dot ( F_T * transpose ( grad (phi_j) ) * F_T, grad (phi_i) )
630  ) >> jacobian;
631 
632 
633  //! 14. Stiffness matrix : int { ( mu * J^(-4/3) ) * ( (-4.0/3.0) * ( FkCk : \nabla \delta ) ) * F^-T : \nabla v ) }
634  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
635  this->M_dispFESpace->qr(),
636  this->M_dispETFESpace,
637  this->M_dispETFESpace,
638  parameter ( (* (this->M_vectorsParameters) ) [1] ) * pow ( J, (-4.0 / 3.0) ) * value ( -4.0 / 3.0 ) *
639  dot ( F * C, grad (phi_j) ) *dot ( F_T, grad (phi_i) )
640  ) >> jacobian;
641 
642  // }
643 
644  jacobian->globalAssemble();
645 }
646 
647 
648 
649 
650 
651 template <typename MeshType>
652 void VenantKirchhoffMaterialNonLinearPenalized<MeshType>::computeStiffness ( const vector_Type& sol,
653  Real /*factor*/,
654  const dataPtr_Type& dataMaterial,
655  const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
656  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,
657  const displayerPtr_Type& displayer )
658 {
659  using namespace ExpressionAssembly;
660 
661  this->M_stiff.reset (new vector_Type (*this->M_localMap) );
662  * (M_stiff) *= 0.0;
663 
664  displayer->leaderPrint (" \n*********************************\n ");
665  displayer->leaderPrint (" Non-Linear S- Computing the VK-Penalized nonlinear stiffness vector ");
666  displayer->leaderPrint (" \n*********************************\n ");
667 
668  // mapIterator_Type it;
669  // //mapIteratorIndex_Type itIndex;
670  // vectorVolumesPtr_Type pointerListOfVolumes;
671  // vectorIndexesPtr_Type pointerListOfIndexes;
672 
673  // for( it = (*mapsMarkerVolumes).begin(); it != (*mapsMarkerVolumes).end(); it++)
674  // {
675 
676  // //Given the marker pointed by the iterator, let's extract the material parameters
677  // UInt marker = it->first;
678 
679  // // Debug
680  // // UInt markerIndex = itIndex->first;
681  // // ASSERT( marker == markerIndex, "The list of volumes is referring to a marker that is not the same as the marker of index!!!");
682 
683  // pointerListOfVolumes.reset( new vectorVolumes_Type(it->second) );
684  // pointerListOfIndexes.reset( new vectorIndexes_Type( (*mapsMarkerIndexes)[marker] ) );
685 
686  // Real bulk = dataMaterial->bulk(marker);
687  // Real mu = dataMaterial->mu(marker);
688  // Real lambda = dataMaterial->lambda(marker);
689 
690  // Definition of F
691  tensorF_Type F = ExpressionDefinitions::deformationGradient( this->M_dispETFESpace, sol, this->M_offset, this->M_identity );
692 
693  // Definition of J
694  determinantF_Type J = ExpressionDefinitions::determinantF( F );
695 
696  // Definition of tensor C
697  tensorC_Type C = ExpressionDefinitions::tensorC( transpose(F), F );
698 
699  // Definition of F^-T
700  minusT_Type F_T = ExpressionDefinitions::minusT( F );
701 
702  // Definition of tr( C )
703  traceTensor_Type I_C = ExpressionDefinitions::traceTensor( C );
704 
705  // Definition of C:C
706  traceSquaredTensor_Type I_Csq = ExpressionDefinitions::traceSquared( C );
707 
708  //! Stiffness for non-linear terms of the Neo-Hookean model
709  //! Volumetric part : int { bulk /2* (J1^2 - J1 + log(J1) ) * 1/J1 * (CofF1 : \nabla v) }
710  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
711  this->M_dispFESpace->qr(),
712  this->M_dispETFESpace,
713  value (1.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [2] ) * ( pow ( J , 2.0) - J + log (J) ) * dot ( F_T, grad (phi_i) )
714  ) >> M_stiff;
715 
716  //! Isochoric part : int { J^(-2.0/3.0) * ( \frac{lambda}{2}*Ic_isoK - \frac{3}{2}*lambda - mu )*
717  // ( (F1 : \nabla v) - 1/3 * (Ic) * (F1^-T : \nabla v) ) }
718  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
719  this->M_dispFESpace->qr(),
720  this->M_dispETFESpace,
721  pow ( J , (-2.0 / 3.0) ) * ( value (1.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [0] ) * pow( J, -2.0/3.0 ) * I_C -
722  value (3.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [0]) - parameter ( (* (this->M_vectorsParameters) ) [1] ) ) *
723  dot ( F + value ( (-1.0 / 3.0) ) * I_C * F_T, grad (phi_i) )
724  ) >> M_stiff;
725 
726  //! Isochoric part second term
727  /*!
728  Source term P2iso_VKPenalized: int { ( mu * Jk^(-4.0/3.0) )*
729  ( (F*C : \nabla v) - 1/3 * (Ic_squared) * (F1^-T : \nabla v) ) }
730  */
731  integrate ( elements ( this->M_dispETFESpace->mesh() ) ,
732  this->M_dispFESpace->qr(),
733  this->M_dispETFESpace,
734  parameter ( (* (this->M_vectorsParameters) ) [1] ) * pow ( J , (-4.0 / 3.0) ) *
735  dot ( F * C + value ( (-1.0 / 3.0) ) * I_Csq * F_T, grad (phi_i) )
736  ) >> M_stiff;
737 
738  //}
739 
740  this->M_stiff->globalAssemble();
741 }
742 
743 
744 
745 
746 
747 template <typename MeshType>
748 void VenantKirchhoffMaterialNonLinearPenalized<MeshType>::computeKinematicsVariables ( const VectorElemental& dk_loc )
749 {
750 
751  // Real s;
752  // Real sum;
753 
754  // //! loop on quadrature points (ig)
755  // for ( UInt ig = 0; ig < this->M_dispFESpace->fe().nbQuadPt(); ig++ )
756  // {
757  // //! loop on space coordinates (icoor)
758  // for ( UInt icoor = 0; icoor < nDimensions; icoor++ )
759  // {
760  // //! loop on space coordinates (jcoor)
761  // for ( UInt jcoor = 0; jcoor < nDimensions; jcoor++ )
762  // {
763  // s = 0.0;
764  // for ( UInt i = 0; i < this->M_dispFESpace->fe().nbFEDof(); i++ )
765  // {
766  // //! \grad u^k at a quadrature point
767  // s += this->M_dispFESpace->fe().phiDer( i, jcoor, ig ) * dk_loc[ i + icoor * this->M_dispFESpace->fe().nbFEDof() ];
768  // }
769  // //! gradient of displacement
770  // (*M_Fk)[ icoor ][ jcoor ][ig ] = s;
771  // }
772  // }
773  // }
774 
775  // //! loop on quadrature points (ig)
776  // for ( UInt ig = 0; ig < this->M_dispFESpace->fe().nbQuadPt(); ig++ )
777  // {
778  // //! loop on space coordinates (icoor)
779  // for ( UInt icoor = 0;icoor < nDimensions; icoor++ )
780  // {
781  // //! deformation gradient Fk
782  // (*M_Fk)[ icoor ][ icoor ][ ig ] += 1.0;
783  // }
784  // }
785 
786  // Real a,b,c,d,e,f,g,h,i;
787 
788  // for( UInt ig=0; ig< this->M_dispFESpace->fe().nbQuadPt(); ig++ )
789  // {
790  // a = (*M_Fk)[ 0 ][ 0 ][ ig ];
791  // b = (*M_Fk)[ 0 ][ 1 ][ ig ];
792  // c = (*M_Fk)[ 0 ][ 2 ][ ig ];
793  // d = (*M_Fk)[ 1 ][ 0 ][ ig ];
794  // e = (*M_Fk)[ 1 ][ 1 ][ ig ];
795  // f = (*M_Fk)[ 1 ][ 2 ][ ig ];
796  // g = (*M_Fk)[ 2 ][ 0 ][ ig ];
797  // h = (*M_Fk)[ 2 ][ 1 ][ ig ];
798  // i = (*M_Fk)[ 2 ][ 2 ][ ig ];
799 
800  // //! determinant of deformation gradient Fk
801  // (*M_Jack)[ig] = a*( e*i - f*h ) - b*( d*i - f*g ) + c*( d*h - e*g );
802 
803  // ASSERT_PRE((*M_Jack)[ig] > 0, "Negative Jacobian. Error!" );
804 
805  // (*M_FkMinusTransposed)[ 0 ][ 0 ][ ig ] = ( e*i - f*h ) / ( (*M_Jack)[ig] );
806  // (*M_FkMinusTransposed)[ 0 ][ 1 ][ ig ] = - ( d*i - g*f ) / ( (*M_Jack)[ig] );
807  // (*M_FkMinusTransposed)[ 0 ][ 2 ][ ig ] = ( d*h - e*g ) / ( (*M_Jack)[ig] );
808  // (*M_FkMinusTransposed)[ 1 ][ 0 ][ ig ] = - ( b*i - c*h ) / ( (*M_Jack)[ig] );
809  // (*M_FkMinusTransposed)[ 1 ][ 1 ][ ig ] = ( a*i - c*g ) / ( (*M_Jack)[ig] );
810  // (*M_FkMinusTransposed)[ 1 ][ 2 ][ ig ] = - ( a*h - g*b ) / ( (*M_Jack)[ig] );
811  // (*M_FkMinusTransposed)[ 2 ][ 0 ][ ig ] = ( b*f - c*e ) / ( (*M_Jack)[ig] );
812  // (*M_FkMinusTransposed)[ 2 ][ 1 ][ ig ] = - ( a*f - c*d ) / ( (*M_Jack)[ig] );
813  // (*M_FkMinusTransposed)[ 2 ][ 2 ][ ig ] = ( a*e - d*b ) / ( (*M_Jack)[ig] );
814 
815  // (*M_CofFk)[ 0 ][ 0 ][ ig ] = ( e*i - f*h );
816  // (*M_CofFk)[ 0 ][ 1 ][ ig ] = - ( d*i - g*f );
817  // (*M_CofFk)[ 0 ][ 2 ][ ig ] = ( d*h - e*g );
818  // (*M_CofFk)[ 1 ][ 0 ][ ig ] = - ( b*i - c*h );
819  // (*M_CofFk)[ 1 ][ 1 ][ ig ] = ( a*i - c*g );
820  // (*M_CofFk)[ 1 ][ 2 ][ ig ] = - ( a*h - g*b );
821  // (*M_CofFk)[ 2 ][ 0 ][ ig ] = ( b*f - c*e );
822  // (*M_CofFk)[ 2 ][ 1 ][ ig ] = - ( a*f - c*d );
823  // (*M_CofFk)[ 2 ][ 2 ][ ig ] = ( a*e - d*b );
824  // }
825 
826  // //! Compute the tensor C
827  // for ( UInt ig = 0;ig < this->M_dispFESpace->fe().nbQuadPt(); ig++ )
828  // {
829  // for ( UInt i = 0; i < nDimensions; i++)
830  // {
831  // for ( UInt j = 0; j < nDimensions; j++)
832  // {
833  // s = 0.0;
834  // for( UInt p = 0; p < nDimensions; p++ )
835  // {
836  // s += (*M_Fk)[ p ][ i ][ ig ] * (*M_Fk)[ p ][ j ][ ig ];
837  // }
838  // (*M_Ck)[ i ][ j ][ ig ] = s;
839  // }
840  // }
841  // }
842 
843  // //! compute the trace of C and the trace of C squared
844  // for ( UInt ig = 0;ig < this->M_dispFESpace->fe().nbQuadPt(); ig++ )
845  // {
846  // s = 0.0;
847  // sum = 0.0;
848 
849  // for ( UInt i = 0; i < nDimensions; i++)
850  // {
851  // for ( UInt j = 0; j < nDimensions; j++)
852  // {
853  // //! trace of C1 = (F1k^t F1k) = \sum_{i,j} F[i][j]*F[i][j]
854  // s += (*M_Fk)[ i ][ j ][ ig ] * (*M_Fk)[ i ][ j ][ ig ];
855  // //! trace of C^2 = (Ck^t Ck) = \sum_{i,j} C[i][j]*C[i][j]
856  // sum += (*M_Ck)[ i ][ j ][ ig ] * (*M_Ck)[ i ][ j ][ ig ];
857  // }
858  // }
859 
860  // (*M_trCk)[ ig ] = s;
861  // (*M_trCkSquared)[ ig ] = sum;
862  // }
863 
864  // for ( UInt ig = 0; ig < this->M_dispFESpace->fe().nbQuadPt(); ig++ )
865  // {
866  // //! trace of deviatoric C
867  // (*M_trCisok)[ ig ] = std::pow((*M_Jack)[ ig ], -2.0/3.0) * (*M_trCk)[ ig ];
868  // }
869 
870  // //! Compute the product FC
871  // for ( UInt ig = 0;ig < this->M_dispFESpace->fe().nbQuadPt(); ig++ )
872  // {
873  // for ( UInt i = 0; i < nDimensions; i++)
874  // {
875  // for ( UInt j = 0; j < nDimensions; j++)
876  // {
877  // s = 0.0;
878  // for( UInt p = 0; p < nDimensions; p++ )
879  // {
880  // s += (*M_Fk)[ i ][ p ][ ig ] * (*M_Ck)[ p ][ j ][ ig ];
881  // }
882  // (*M_FkCk)[ i ][ j ][ ig ] = s;
883  // }
884  // }
885  // }
886 
887 }
888 
889 template <typename MeshType>
890 void VenantKirchhoffMaterialNonLinearPenalized<MeshType>::showMe ( std::string const& fileNameStiff,
891  std::string const& fileNameJacobian )
892 {
893  this->M_stiff->spy (fileNameStiff);
895 }
896 
897 
898 template <typename MeshType>
899 void VenantKirchhoffMaterialNonLinearPenalized<MeshType>::apply ( const vector_Type& sol, vector_Type& res, const mapMarkerVolumesPtr_Type mapsMarkerVolumes,
900  const mapMarkerIndexesPtr_Type mapsMarkerIndexes,const displayerPtr_Type displayer )
901 {
902  computeStiffness (sol, 0, this->M_dataMaterial, mapsMarkerVolumes, mapsMarkerIndexes, displayer);
903  res += *M_stiff;
904 }
905 
906 
907 template <typename MeshType>
908 void VenantKirchhoffMaterialNonLinearPenalized<MeshType>::computeLocalFirstPiolaKirchhoffTensor ( Epetra_SerialDenseMatrix& firstPiola,
909  const Epetra_SerialDenseMatrix& tensorF,
910  const Epetra_SerialDenseMatrix& cofactorF,
911  const std::vector<Real>& invariants,
912  const UInt marker)
913 {
914 
915  //Get the material parameters
916  Real lambda = this->M_dataMaterial->lambda (marker);
917  Real mu = this->M_dataMaterial->mu (marker);
918  Real bulk = this->M_dataMaterial->bulk (marker);
919 
920  //Computing the first term J^{-2/3} * ( {lambda/2.0}*I_c - {3.0/2.0}*lambda - mu )* [F-(1/3)tr(C)F^{-T}]
921  Epetra_SerialDenseMatrix firstTerm (tensorF);
922  Epetra_SerialDenseMatrix copyCofactorF (cofactorF);
923 
924  Real scale (0.0);
925  scale = -invariants[0] / 3.0;
926  copyCofactorF.Scale ( scale );
927  firstTerm += copyCofactorF;
928 
929  //Computation trace of the isochoric C
930  Real trCiso (0.0);
931  trCiso = std::pow (invariants[3], - (2.0 / 3.0) ) * invariants[0];
932 
933  Real firstCoef ( 0.0 );
934  firstCoef = std::pow (invariants[3], - (2.0 / 3.0) ) * ( ( lambda / 2.0 ) * trCiso - (3.0 / 2.0) * lambda - mu);
935  firstTerm.Scale ( firstCoef );
936 
937  Epetra_SerialDenseMatrix secondTerm (this->M_dispFESpace->fieldDim(), this->M_dispFESpace->fieldDim() );
938  Epetra_SerialDenseMatrix rightCauchyC (this->M_dispFESpace->fieldDim(), this->M_dispFESpace->fieldDim() );
939  rightCauchyC.Scale (0.0);
940 
941  //Compute the tensors C
942  rightCauchyC.Multiply ('T', 'N', 1.0, tensorF, tensorF, 0.0); //see Epetra_SerialDenseMatrix
943  secondTerm.Multiply ('N', 'N', 1.0, tensorF, rightCauchyC, 0.0);
944 
945  Real trCsquared (0.0);
946  trCsquared = rightCauchyC (0, 0) * rightCauchyC (0, 0) + rightCauchyC (0, 1) * rightCauchyC (0, 1) + rightCauchyC (0, 2) * rightCauchyC (0, 2) +
947  rightCauchyC (1, 0) * rightCauchyC (1, 0) + rightCauchyC (1, 1) * rightCauchyC (1, 1) + rightCauchyC (1, 2) * rightCauchyC (1, 2) +
948  rightCauchyC (2, 0) * rightCauchyC (2, 0) + rightCauchyC (2, 1) * rightCauchyC (2, 1) + rightCauchyC (2, 2) * rightCauchyC (2, 2);
949 
950  Real scaleFactor (0.0);
951  scaleFactor = - trCsquared / 3.0;
952 
953  Epetra_SerialDenseMatrix secondCofactorF (cofactorF);
954  secondCofactorF.Scale ( scaleFactor );
955 
956  secondTerm += secondCofactorF;
957 
958  Real secondCoef ( 0.0 );
959  secondCoef = mu * std::pow (invariants[3], - (4.0 / 3.0) );
960 
961  secondTerm.Scale ( secondCoef );
962 
963  //Computing the second term (volumetric part) J*(bulk/2)(J-1+(1/J)*ln(J))F^{-T}
964  Epetra_SerialDenseMatrix thirdTerm (cofactorF);
965  Real thirdCoef (0);
966  thirdCoef = invariants[3] * (bulk / 2.0) * (invariants[3] - 1 + (1.0 / invariants[3]) * std::log (invariants[3]) );
967 
968  thirdTerm.Scale ( thirdCoef );
969 
970  firstPiola += firstTerm;
971  firstPiola += secondTerm;
972  firstPiola += thirdTerm;
973 
974 }
975 
976 template <typename MeshType>
977 void VenantKirchhoffMaterialNonLinearPenalized<MeshType>::computeCauchyStressTensor ( const vectorPtr_Type disp,
978  const QuadratureRule& evalQuad,
979  vectorPtr_Type sigma_1,
980  vectorPtr_Type sigma_2,
981  vectorPtr_Type sigma_3)
982 
983 {
984  using namespace ExpressionAssembly;
985 
986  // Definition of F
987  tensorF_Type F = ExpressionDefinitions::deformationGradient( this->M_dispETFESpace, *disp, this->M_offset, this->M_identity );
988 
989  // Definition of J
990  determinantF_Type J = ExpressionDefinitions::determinantF( F );
991 
992  // Definition of tensor C
993  tensorC_Type C = ExpressionDefinitions::tensorC( transpose(F), F );
994 
995  // Definition of F^-T
996  minusT_Type F_T = ExpressionDefinitions::minusT( F );
997 
998  // Definition of tr( C )
999  traceTensor_Type I_C = ExpressionDefinitions::traceTensor( C );
1000 
1001  // Definition of C:C
1002  traceSquaredTensor_Type I_Csq = ExpressionDefinitions::traceSquared( C );
1003 
1004  evaluateNode( elements ( this->M_dispETFESpace->mesh() ),
1005  evalQuad,
1006  this->M_dispETFESpace,
1007  meas_K * dot ( vectorFromMatrix( ( 1 / J )*
1008  ( value (1.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [2] ) * ( pow ( J , 2.0) - J + log (J) ) * F_T + //vol
1009  pow ( J , (-2.0 / 3.0) ) * ( value (1.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [0] ) * pow( J, -2.0/3.0 ) * I_C -
1010  value (3.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [0]) - parameter ( (* (this->M_vectorsParameters) ) [1] ) ) * ( F - value(1.0/3.0) * I_C * F_T ) +
1011  parameter ( (* (this->M_vectorsParameters) ) [1] ) * pow ( J , (-4.0 / 3.0) ) * ( F * C + value ( (-1.0 / 3.0) ) * I_Csq * F_T )
1012  ) *
1013  transpose( F ), 0 ), phi_i)
1014  ) >> sigma_1;
1015  sigma_1->globalAssemble();
1016 
1017  evaluateNode( elements ( this->M_dispETFESpace->mesh() ),
1018  evalQuad,
1019  this->M_dispETFESpace,
1020  meas_K * dot ( vectorFromMatrix( ( 1 / J )*
1021  ( value (1.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [2] ) * ( pow ( J , 2.0) - J + log (J) ) * F_T + //vol
1022  pow ( J , (-2.0 / 3.0) ) * ( value (1.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [0] ) * pow( J, -2.0/3.0 ) * I_C -
1023  value (3.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [0]) - parameter ( (* (this->M_vectorsParameters) ) [1] ) ) * ( F - value(1.0/3.0) * I_C * F_T ) +
1024  parameter ( (* (this->M_vectorsParameters) ) [1] ) * pow ( J , (-4.0 / 3.0) ) * ( F * C + value ( (-1.0 / 3.0) ) * I_Csq * F_T )
1025  ) *
1026  transpose( F ) , 1 ), phi_i)
1027  ) >> sigma_2;
1028  sigma_2->globalAssemble();
1029 
1030  evaluateNode( elements ( this->M_dispETFESpace->mesh() ),
1031  evalQuad,
1032  this->M_dispETFESpace,
1033  meas_K * dot ( vectorFromMatrix( ( 1 / J )*
1034  ( value (1.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [2] ) * ( pow ( J , 2.0) - J + log (J) ) * F_T + //vol
1035  pow ( J , (-2.0 / 3.0) ) * ( value (1.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [0] ) * pow( J, -2.0/3.0 ) * I_C -
1036  value (3.0 / 2.0) * parameter ( (* (this->M_vectorsParameters) ) [0]) - parameter ( (* (this->M_vectorsParameters) ) [1] ) ) * ( F - value(1.0/3.0) * I_C * F_T ) +
1037  parameter ( (* (this->M_vectorsParameters) ) [1] ) * pow ( J , (-4.0 / 3.0) ) * ( F * C + value ( (-1.0 / 3.0) ) * I_Csq * F_T )
1038  ) *
1039  transpose( F ) , 2 ), phi_i)
1040  ) >> sigma_3;
1041  sigma_3->globalAssemble();
1042 
1043 }
1044 
1045 
1046 template <typename MeshType>
1047 inline StructuralIsotropicConstitutiveLaw<MeshType>* createVenantKirchhoffMaterialNonLinearPenalized()
1048 {
1049  return new VenantKirchhoffMaterialNonLinearPenalized<MeshType >();
1050 }
1051 
1052 namespace
1053 {
1055 }
1056 
1057 } //Namespace LifeV
1058 
1059 #endif /* __VENANTKIRCHHOFFPENALIZED_H */
void assignFunction(bcBase_Type &base)
Assign the function to the base of the BCHandler.
rightCauchyGreenTensor_Type tensorC(const ExpressionTranspose< deformationGradient_Type > tF, const deformationGradient_Type F)
determinantTensorF_Type determinantF(const deformationGradient_Type F)
ExpressionDot< ExpressionProduct< ExpressionTranspose< ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > >, ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > >, ExpressionProduct< ExpressionTranspose< ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > >, ExpressionAddition< ExpressionInterpolateGradient< MeshType, MapEpetra, 3, 3 >, ExpressionMatrix< 3, 3 > > > > traceSquaredTensor_Type
const ExpressionPhiJ phi_j
Simple function to be used in the construction of an expression.
minusTransposedTensor_Type minusT(const deformationGradient_Type F)
traceTensor_Type traceTensor(const rightCauchyGreenTensor_Type C)
double Real
Generic real data.
Definition: LifeV.hpp:175
ExpressionScalar value(const Real &myValue)
Simple function to be used in the construction of an expression.
QuadratureRule - The basis class for storing and accessing quadrature rules.
ExpressionDphiJ grad(const ExpressionPhiJ &)
Simple function to be used in the construction of an expression.
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.