LifeV
structure/fem/ExpressionDefinitions.cpp
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 File containing the procedures for the local assembly of the differential operators
30 
31  @author Gianmarco Mengaldo <gianmarco.mengaldo@gmail.com>
32  @author Paolo Tricerri <gianmarco.mengaldo@gmail.com>
33  @mantainer Paolo Tricerri <paolo.tricerri@epfl.ch>
34 
35  All the methods are described in the report StructuralSolver framework in LifeV: Description and Usage
36  */
37 
38 
39 #ifndef _EXPRESSIONDEFINITIONS_CPP_
40 #define _EXPRESSIONDEFINITIONS_CPP_
41 
42 #include <lifev/structure/fem/ExpressionDefinitions.hpp>
43 
44 
45 namespace LifeV
46 {
47  namespace ExpressionDefinitions
48  {
49 
50  using namespace ExpressionAssembly;
51 
52  deformationGradient_Type deformationGradient( const std::shared_ptr< ETFESpace_Type > dispETFESpace,
53  const vector_Type& disp, UInt offset, const matrixSmall_Type identity)
54  {
55  return deformationGradient_Type( grad( dispETFESpace, disp, offset), value(identity) );
56  }
57 
58  determinantTensorF_Type determinantF( const deformationGradient_Type F )
59  {
60  return determinantTensorF_Type( F );
61  }
62 
63  rightCauchyGreenTensor_Type tensorC( const ExpressionTranspose<deformationGradient_Type> tF, const deformationGradient_Type F )
64  {
65  return rightCauchyGreenTensor_Type( tF, F );
66  }
67 
68  minusTransposedTensor_Type minusT( const deformationGradient_Type F )
69  {
70  return minusTransposedTensor_Type( F );
71  }
72 
73  inverseTensor_Type inv( const deformationGradient_Type F )
74  {
75  return inverseTensor_Type( F );
76  }
77 
78  traceTensor_Type traceTensor( const rightCauchyGreenTensor_Type C )
79  {
80  return traceTensor_Type( C );
81  }
82 
83  traceSquaredTensor_Type traceSquared( const rightCauchyGreenTensor_Type C )
84  {
85  return traceSquaredTensor_Type( C , C );
86  }
87 
88  powerExpression_Type powerExpression( const determinantTensorF_Type J, const Real exponent )
89  {
90  return powerExpression_Type( J , exponent );
91  }
92 
93  isochoricChangeOfVariable_Type isochoricDeterminant( const determinantTensorF_Type J )
94  {
95  return isochoricChangeOfVariable_Type( J );
96  }
97 
98  isochoricTrace_Type isochoricTrace( const powerExpression_Type Jel, const traceTensor_Type I )
99  {
100  return isochoricTrace_Type( Jel , I );
101  }
102 
103 
104 
105  // Constructors for anisotropic laws
106  interpolatedValue_Type interpolateFiber( const std::shared_ptr< ETFESpace_Type > dispETFESpace,
107  const vector_Type& fiberVector)
108  {
109  return interpolatedValue_Type( dispETFESpace, fiberVector ) ;
110  }
111 
112  interpolatedValue_Type interpolateValue( const std::shared_ptr< ETFESpace_Type > dispETFESpace,
113  const vector_Type& valueVector)
114  {
115  return interpolatedValue_Type( dispETFESpace, valueVector ) ;
116  }
117 
118  interpolatedScalarValue_Type interpolateScalarValue( const std::shared_ptr< scalarETFESpace_Type > dispETFESpace,
119  const vector_Type& valueVector)
120  {
121  return interpolatedScalarValue_Type( dispETFESpace, valueVector ) ;
122  }
123 
124  outerProduct_Type fiberTensor( const interpolatedValue_Type ithFiber )
125  {
126  return outerProduct_Type( ithFiber, ithFiber );
127  }
128 
129  stretch_Type fiberStretch( const rightCauchyGreenTensor_Type C, const outerProduct_Type M)
130  {
131  return stretch_Type( C, M );
132  }
133 
134  isochoricStretch_Type isochoricFourthInvariant( const powerExpression_Type Jel, const stretch_Type I_4ith)
135  {
136  return isochoricStretch_Type( Jel, I_4ith );
137  }
138 
139  } //! End namespace ExpressionDefinitions
140 
141 
142  //! The namespace ExpressionDistributedModel is specific for the Dstributed Holzapfel model
143  //! the definitions have been inserted here in order to avoid huge declarations of expressions
144  //! in the header file of the model
145 
146  //! The goal of the current namespace is just to define the expressions (final and intermediate)
147  //! that are needed for the distributed model making use of the previous namespaces already
148  //! defined.
149 
150  namespace ExpressionDistributedModel
151  {
152  using namespace ExpressionAssembly;
153 
154  // Constructors for the expressions defined by the typedefs
155  //@{
156 
157  distributedIsochoricTrace_Type distributedIsochoricTrace( const Real coeff, const ExpressionDefinitions::isochoricTrace_Type ICbar )
158  {
159  return distributedIsochoricTrace_Type( value( coeff ), ICbar);
160  }
161 
162  distributedIsochoricStretch_Type distributedIsochoricFourthInvariant( const Real coeff, const ExpressionDefinitions::isochoricStretch_Type I4bar)
163  {
164  return distributedIsochoricStretch_Type( value( coeff ), I4bar );
165  }
166 
167  distributedInvariants_Type distributeInvariants( const distributedIsochoricTrace_Type distrIC,
168  const distributedIsochoricStretch_Type distrI4 )
169  {
170  return distributedInvariants_Type( distrIC,distrI4 );
171  }
172 
173  distributedStretch_Type distributedStretch( const ExpressionDefinitions::isochoricTrace_Type trCBar,
174  const ExpressionDefinitions::isochoricStretch_Type I_4ith, const Real kappa )
175  {
176  distributedIsochoricTrace_Type dIC_bar = distributedIsochoricTrace( kappa, trCBar ) ;
177  distributedIsochoricStretch_Type dI4_bar = distributedIsochoricFourthInvariant( 1.0 - 3.0 * kappa, I_4ith ) ;
178 
179  distributedInvariants_Type dInvariants = distributeInvariants( dIC_bar, dI4_bar );
180 
181  return distributedStretch_Type( dInvariants, value( -1.0 ) );
182  }
183 
184  minusTFscalarDF_distrType minusTFscalarDF( const ExpressionDefinitions::minusTransposedTensor_Type minusFT)
185  {
186  return minusTFscalarDF_distrType( minusFT, grad( phi_j ) );
187  }
188 
189  FscalarDF_distrType FscalarDF( const ExpressionDefinitions::deformationGradient_Type F )
190  {
191  return FscalarDF_distrType( F, grad(phi_j) );
192  }
193 
194  dFTtimesFscalarM_distrType dFTtimesFscalarM( const ExpressionDefinitions::deformationGradient_Type F,
195  const ExpressionDefinitions::outerProduct_Type M)
196  {
197  return dFTtimesFscalarM_distrType( transpose( grad(phi_j) ) * F, M );
198  }
199 
200  FTtimesDFscalarM_distrType FTtimesDFscalarM( const ExpressionDefinitions::deformationGradient_Type F,
201  const ExpressionDefinitions::outerProduct_Type M)
202  {
203  return FTtimesDFscalarM_distrType( transpose( F ) * grad( phi_j ), M );
204  }
205 
206  scaledTrace_Type scaleTrace( const Real coeff, const ExpressionDefinitions::traceTensor_Type tr )
207  {
208  return scaledTrace_Type( value( coeff ), tr );
209  }
210 
211  scaledIsochoricTrace_Type scaleIsochoricTrace( const Real coeff, const ExpressionDefinitions::isochoricTrace_Type isoTr )
212  {
213  return scaledIsochoricTrace_Type( value( coeff ), isoTr );
214  }
215 
216  scaledDeterminant_Type scaleDeterminant( const Real coeff, const ExpressionDefinitions::powerExpression_Type Jel )
217  {
218  return scaledDeterminant_Type( value( coeff ), Jel );
219  }
220 
221  scaledFourthInvariant_Type scaleFourthInvariant( const Real coeff, const ExpressionDefinitions::stretch_Type I4 )
222  {
223  return scaledFourthInvariant_Type( value( coeff ), I4 );
224  }
225 
226  scaledIsochoricFourthInvariant_Type scaleIsochoricFourthInvariant( const Real coeff, const ExpressionDefinitions::isochoricStretch_Type isoI4 )
227  {
228  return scaledIsochoricFourthInvariant_Type( value( coeff ) , isoI4 );
229  }
230 
231  linearizationFisochoricTrace_Type derivativeIsochoricTrace( const ExpressionDefinitions::isochoricTrace_Type isoTr,
232  const ExpressionDefinitions::powerExpression_Type Jel,
233  const ExpressionDefinitions::deformationGradient_Type F,
234  const ExpressionDefinitions::minusTransposedTensor_Type F_T)
235  {
236  scaledIsochoricTrace_Type scIsoTr = scaleIsochoricTrace( ( -2.0/3.0 ), isoTr );
237  scaledDeterminant_Type scJ = scaleDeterminant( 2.0, Jel );
238 
239  minusTFscalarDF_distrType FTdotDF = minusTFscalarDF( F_T );
240  FscalarDF_distrType FdotDF = FscalarDF( F );
241 
242  return linearizationFisochoricTrace_Type( scIsoTr * FTdotDF , scJ * FdotDF );
243  }
244 
245  linearizationFisochoricFourthInvariant_Type derivativeIsochoricFourthInvariant( const ExpressionDefinitions::isochoricStretch_Type isoI4,
246  const ExpressionDefinitions::powerExpression_Type Jel,
247  const ExpressionDefinitions::deformationGradient_Type F,
248  const ExpressionDefinitions::minusTransposedTensor_Type F_T,
249  const ExpressionDefinitions::outerProduct_Type M)
250  {
251  scaledIsochoricFourthInvariant_Type scIsoI4 = scaleIsochoricFourthInvariant( ( -2.0/3.0 ), isoI4 );
252 
253  minusTFscalarDF_distrType FTdotDF = minusTFscalarDF( F_T );
254 
255  dFTtimesFscalarM_distrType firstTerm = dFTtimesFscalarM( F, M );
256  FTtimesDFscalarM_distrType secondTerm = FTtimesDFscalarM( F, M );
257 
258  return linearizationFisochoricFourthInvariant_Type( scIsoI4 * FTdotDF , Jel * ( firstTerm + secondTerm ) );
259  }
260 
261  linearizationDistributedStretch_Type derivativeDistributedStretch( const Real kappa,
262  const ExpressionDefinitions::isochoricTrace_Type isoTr,
263  const ExpressionDefinitions::isochoricStretch_Type isoI4,
264  const ExpressionDefinitions::powerExpression_Type Jel,
265  const ExpressionDefinitions::deformationGradient_Type F,
266  const ExpressionDefinitions::minusTransposedTensor_Type F_T,
267  const ExpressionDefinitions::outerProduct_Type M)
268  {
269  linearizationFisochoricTrace_Type firstTerm = derivativeIsochoricTrace( isoTr, Jel, F, F_T );
270  linearizationFisochoricFourthInvariant_Type secondTerm = derivativeIsochoricFourthInvariant( isoI4, Jel, F, F_T, M);
271 
272  return linearizationDistributedStretch_Type( value(kappa) * firstTerm, value( 1.0 - 3.0 * kappa) * secondTerm );
273  }
274 
275  scaledTensorF_Type scaleF( const Real coeff, const ExpressionDefinitions::deformationGradient_Type F )
276  {
277  return scaledTensorF_Type( coeff, F);
278  }
279 
280  scaledTraceTimesMinusTF_Type scaleTraceMinuTF( const Real coeff,
281  const ExpressionDefinitions::traceTensor_Type Ic,
282  const ExpressionDefinitions::minusTransposedTensor_Type F_T )
283  {
284  scaledTrace_Type scIc = scaleTrace( coeff, Ic );
285 
286  return scaledTraceTimesMinusTF_Type( scIc, F_T );
287  }
288 
289  scaledFtimesM_Type scaleFtimesM( const Real coeff,
290  const ExpressionDefinitions::deformationGradient_Type F,
291  const ExpressionDefinitions::outerProduct_Type M)
292  {
293 
294  return scaledFtimesM_Type( coeff, F*M );
295  }
296 
297  scaledFourthInvariantTimesMinusTF_Type scaleI4timesMinutTF( const Real coeff,
298  const ExpressionDefinitions::stretch_Type I4,
299  const ExpressionDefinitions::minusTransposedTensor_Type F_T )
300  {
301  scaledFourthInvariant_Type scI4 = scaleFourthInvariant( coeff , I4 );
302 
303  return scaledFourthInvariantTimesMinusTF_Type( scI4, F_T );
304  }
305 
306  tensorialPart_distrType tensorialPartPiola( const Real kappa,
307  const ExpressionDefinitions::traceTensor_Type tr,
308  const ExpressionDefinitions::stretch_Type I4,
309  const ExpressionDefinitions::deformationGradient_Type F,
310  const ExpressionDefinitions::minusTransposedTensor_Type F_T,
311  const ExpressionDefinitions::outerProduct_Type M)
312  {
313  /*
314  First the terms of the expression are built term by term
315  The tensorial part of the Piola tensor corresponding to one fiber
316  reads:
317 
318  kappa * F - ( kappa / 3.0 ) * I_C * F_T + ( 1 - 3*kappa) FM - ( 1 - 3*kappa )/3.0 * I4 * F_T
319  */
320 
321  scaledTensorF_Type scF = scaleF( kappa, F );
322  scaledTraceTimesMinusTF_Type scTrF_T = scaleTraceMinuTF( - kappa / 3.0, tr, F_T );
323 
324  scaledFtimesM_Type scFM = scaleFtimesM( ( 1 - 3.0 * kappa ), F, M );
325  scaledFourthInvariantTimesMinusTF_Type scI4F_T = scaleI4timesMinutTF( - ( 1.0 - 3.0 * kappa ) / 3.0, I4, F_T );
326 
327  return tensorialPart_distrType( ( scF + scTrF_T ), ( scFM + scI4F_T ) );
328  }
329  //@}
330 
331  } // end namespace ExpressionDistributedModel
332 
333  // name space that is specific for the Anisotropic Multi-mechanism class.
334  namespace ExpressionMultimechanism
335  {
336  using namespace ExpressionAssembly;
337 
338  difference_Type absoluteStretch( const ExpressionDefinitions::isochoricStretch_Type IVbar,
339  const Real valueToSubtract)
340  {
341  return difference_Type ( IVbar, value( valueToSubtract ) );
342 
343  }
344 
345  incompressibleDifference_Type incompressibleAbsoluteStretch( const ExpressionDefinitions::stretch_Type IV,
346  const Real valueToSubtract)
347  {
348  return incompressibleDifference_Type ( IV, value( valueToSubtract ) );
349 
350  }
351 
352  relativeDifference_Type relativeDifference( const incompressibleDifference_Type difference,
353  const Real refFourthInvariant)
354  {
355  return relativeDifference_Type ( difference, value( refFourthInvariant ) );
356 
357  }
358 
359 
360  activation_Type activationConstructor( const ExpressionMultimechanism::difference_Type absoluteStretch,
361  const Real intCoeff,
362  const Real extCoeff,
363  const Real translation)
364  {
365  return activation_Type( absoluteStretch, intCoeff, extCoeff, translation );
366  }
367 
368  expressionVectorFromDifference_Type vectorFromActivation( const ExpressionMultimechanism::difference_Type activation )
369  {
370  return expressionVectorFromDifference_Type( activation );
371  }
372 
373  expressionVectorFromIncompressibleDifference_Type vectorFromIncompressibleDifference( const ExpressionMultimechanism::incompressibleDifference_Type activation )
374  {
375  return expressionVectorFromIncompressibleDifference_Type( activation );
376  }
377 
378  expressionVectorFromRelativeDifference_Type vectorFromRelativeDifference( const ExpressionMultimechanism::relativeDifference_Type activation )
379  {
380  return expressionVectorFromRelativeDifference_Type( activation );
381  }
382 
383  deformationActivatedTensor_Type createDeformationActivationTensor( const ExpressionDefinitions::deformationGradient_Type Ft,
384  const ExpressionDefinitions::inverseTensor_Type F0_ta)
385  {
386  return deformationActivatedTensor_Type( Ft, F0_ta );
387  }
388 
389  rightCauchyGreenMultiMechanism_Type activationRightCauchyGreen( const ExpressionDefinitions::minusTransposedTensor_Type FzeroAminusT,
390  const ExpressionDefinitions::rightCauchyGreenTensor_Type C,
391  const ExpressionDefinitions::inverseTensor_Type FzeroAminus1 )
392  {
393  ExpressionProduct< ExpressionDefinitions::rightCauchyGreenTensor_Type,
394  ExpressionDefinitions::inverseTensor_Type > rightTerm( C, FzeroAminus1 );
395  return rightCauchyGreenMultiMechanism_Type( FzeroAminusT, rightTerm );
396  }
397 
398  activatedFiber_Type activateFiberDirection( const ExpressionDefinitions::deformationGradient_Type F,
399  const ExpressionDefinitions::interpolatedValue_Type ithFiber)
400  {
401  return activatedFiber_Type( F, ithFiber );
402  }
403 
404  normalizedVector_Type unitVector( const activatedFiber_Type vector)
405  {
406  return normalizedVector_Type( vector );
407  }
408 
409  squaredNormActivatedFiber_Type squaredNormActivatedFiber( const activatedFiber_Type f)
410  {
411  return squaredNormActivatedFiber_Type( f, f );
412  }
413 
414  normActivatedFiber_Type normActivatedFiber( const activatedFiber_Type f)
415  {
416  squaredNormActivatedFiber_Type squaredNorm = squaredNormActivatedFiber_Type( f, f );
417 
418  return normActivatedFiber_Type( squaredNorm );
419  }
420 
421  normalizedFiber_Type normalizedFiberDirection( const activatedFiber_Type fiber,
422  const normActivatedFiber_Type normFiber)
423  {
424  return normalizedFiber_Type( fiber, normFiber );
425  }
426 
427  activatedDeterminantF_Type activateDeterminantF( const ExpressionDefinitions::determinantTensorF_Type Jzero,
428  const ExpressionDefinitions::interpolatedScalarValue_Type JzeroA )
429  {
430  return activatedDeterminantF_Type( Jzero, JzeroA );
431  }
432 
433  activatedJ_Type activateJ( const ExpressionDefinitions::determinantTensorF_Type Jzero,
434  const ExpressionDefinitions::powerExpression_Type JzeroA )
435  {
436  return activatedJ_Type( Jzero, JzeroA );
437  }
438 
439  activePowerExpression_Type activePowerExpression( activatedDeterminantF_Type Ja,
440  const Real exp)
441  {
442  return activePowerExpression_Type ( Ja, exp );
443  }
444 
445  activeIsochoricDeterminant_Type activeIsochoricDeterminant( activatedDeterminantF_Type Ja )
446  {
447  return activeIsochoricDeterminant_Type ( Ja );
448  }
449 
450  activeOuterProduct_Type activeOuterProduct( const activatedFiber_Type activatedFiber )
451  {
452  return activeOuterProduct_Type( activatedFiber, activatedFiber );
453  }
454 
455  activeNormalizedOuterProduct_Type activeNormalizedOuterProduct( const normalizedVector_Type normalizedActiveFiber )
456  {
457  return activeNormalizedOuterProduct_Type( normalizedActiveFiber, normalizedActiveFiber );
458  }
459 
460  activeStretch_Type activeFiberStretch( const rightCauchyGreenMultiMechanism_Type activeC,
461  const activeNormalizedOuterProduct_Type activeM)
462  {
463  return activeStretch_Type( activeC, activeM );
464  }
465 
466  activeInterpolatedFiberStretch_Type activeInterpolatedFiberStretch( const rightCauchyGreenMultiMechanism_Type activeC,
467  const ExpressionDefinitions::outerProduct_Type activeM)
468  {
469  return activeInterpolatedFiberStretch_Type( activeC, activeM );
470  }
471 
472  activeIsochoricStretch_Type activeIsochoricFourthInvariant( const activeIsochoricDeterminant_Type activeJ,
473  const activeInterpolatedFiberStretch_Type activeI4)
474  {
475  return activeIsochoricStretch_Type( activeJ, activeI4 );
476  }
477 
478  activeNoInterpolationStretch_Type activeNoInterpolationFourthInvariant( const activeIsochoricDeterminant_Type activeJ,
479  const activeStretch_Type activeI4)
480  {
481  return activeNoInterpolationStretch_Type( activeJ, activeI4 );
482  }
483 
484  activePowerIsochoricStretch_Type activePowerIsochoricFourthInvariant( const activePowerExpression_Type activeJ,
485  const activeStretch_Type activeI4)
486  {
487  return activePowerIsochoricStretch_Type( activeJ, activeI4 );
488  }
489 
490 
491  activeMinusTtensor_Type createActiveMinusTtensor( const ExpressionDefinitions::minusTransposedTensor_Type FminusT,
492  const ExpressionTranspose<ExpressionDefinitions::deformationGradient_Type> FzeroA)
493  {
494  return activeMinusTtensor_Type ( FminusT, FzeroA );
495  }
496 
497  activeLinearization_Type activatedLinearization( const ExpressionDphiJ der,
498  const ExpressionDefinitions::inverseTensor_Type inverse)
499  {
500  return activeLinearization_Type( der , inverse);
501  }
502  activeTestGradient_Type activatedTestGradient(const ExpressionDphiI gradTest,
503  const ExpressionDefinitions::inverseTensor_Type FAminus1)
504  {
505  return activeTestGradient_Type ( gradTest, FAminus1 );
506  }
507  }// end namespace ExpressionDistributedModel
508 
509 } //! End namespace LifeV
510 #endif