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