39 #ifndef _EXPRESSIONDEFINITIONS_CPP_ 40 #define _EXPRESSIONDEFINITIONS_CPP_ 42 #include <lifev/fsi_blocks/solver/ExpressionDefinitions.hpp> 43 #include <boost/shared_ptr.hpp> 48 namespace ExpressionDefinitions
51 using namespace ExpressionAssembly;
53 deformationGradient_Type deformationGradient(
const std::shared_ptr< ETFESpace_Type > dispETFESpace,
54 const vector_Type& disp, UInt offset,
const matrixSmall_Type identity)
56 return deformationGradient_Type( grad( dispETFESpace, disp, offset), value(identity) );
59 determinantTensorF_Type determinantF(
const deformationGradient_Type F )
61 return determinantTensorF_Type( F );
64 rightCauchyGreenTensor_Type tensorC(
const ExpressionTranspose<deformationGradient_Type> tF,
const deformationGradient_Type F )
66 return rightCauchyGreenTensor_Type( tF, F );
69 minusTransposedTensor_Type minusT(
const deformationGradient_Type F )
71 return minusTransposedTensor_Type( F );
74 inverseTensor_Type inv(
const deformationGradient_Type F )
76 return inverseTensor_Type( F );
79 traceTensor_Type traceTensor(
const rightCauchyGreenTensor_Type C )
81 return traceTensor_Type( C );
84 traceSquaredTensor_Type traceSquared(
const rightCauchyGreenTensor_Type C )
86 return traceSquaredTensor_Type( C , C );
89 powerExpression_Type powerExpression(
const determinantTensorF_Type J,
const Real exponent )
91 return powerExpression_Type( J , exponent );
94 isochoricChangeOfVariable_Type isochoricDeterminant(
const determinantTensorF_Type J )
96 return isochoricChangeOfVariable_Type( J );
99 isochoricTrace_Type isochoricTrace(
const powerExpression_Type Jel,
const traceTensor_Type I )
101 return isochoricTrace_Type( Jel , I );
107 interpolatedValue_Type interpolateFiber(
const std::shared_ptr< ETFESpace_Type > dispETFESpace,
108 const vector_Type& fiberVector)
110 return interpolatedValue_Type( dispETFESpace, fiberVector ) ;
113 interpolatedValue_Type interpolateValue(
const std::shared_ptr< ETFESpace_Type > dispETFESpace,
114 const vector_Type& valueVector)
116 return interpolatedValue_Type( dispETFESpace, valueVector ) ;
119 interpolatedScalarValue_Type interpolateScalarValue(
const std::shared_ptr< scalarETFESpace_Type > dispETFESpace,
120 const vector_Type& valueVector)
122 return interpolatedScalarValue_Type( dispETFESpace, valueVector ) ;
125 outerProduct_Type fiberTensor(
const interpolatedValue_Type ithFiber )
127 return outerProduct_Type( ithFiber, ithFiber );
130 stretch_Type fiberStretch(
const rightCauchyGreenTensor_Type C,
const outerProduct_Type M)
132 return stretch_Type( C, M );
135 isochoricStretch_Type isochoricFourthInvariant(
const powerExpression_Type Jel,
const stretch_Type I_4ith)
137 return isochoricStretch_Type( Jel, I_4ith );
151 namespace ExpressionDistributedModel
153 using namespace ExpressionAssembly;
158 distributedIsochoricTrace_Type distributedIsochoricTrace(
const Real coeff,
const ExpressionDefinitions::isochoricTrace_Type ICbar )
160 return distributedIsochoricTrace_Type( value( coeff ), ICbar);
163 distributedIsochoricStretch_Type distributedIsochoricFourthInvariant(
const Real coeff,
const ExpressionDefinitions::isochoricStretch_Type I4bar)
165 return distributedIsochoricStretch_Type( value( coeff ), I4bar );
168 distributedInvariants_Type distributeInvariants(
const distributedIsochoricTrace_Type distrIC,
169 const distributedIsochoricStretch_Type distrI4 )
171 return distributedInvariants_Type( distrIC,distrI4 );
174 distributedStretch_Type distributedStretch(
const ExpressionDefinitions::isochoricTrace_Type trCBar,
175 const ExpressionDefinitions::isochoricStretch_Type I_4ith,
const Real kappa )
177 distributedIsochoricTrace_Type dIC_bar = distributedIsochoricTrace( kappa, trCBar ) ;
178 distributedIsochoricStretch_Type dI4_bar = distributedIsochoricFourthInvariant( 1.0 - 3.0 * kappa, I_4ith ) ;
180 distributedInvariants_Type dInvariants = distributeInvariants( dIC_bar, dI4_bar );
182 return distributedStretch_Type( dInvariants, value( -1.0 ) );
185 minusTFscalarDF_distrType minusTFscalarDF(
const ExpressionDefinitions::minusTransposedTensor_Type minusFT)
187 return minusTFscalarDF_distrType( minusFT, grad( phi_j ) );
190 FscalarDF_distrType FscalarDF(
const ExpressionDefinitions::deformationGradient_Type F )
192 return FscalarDF_distrType( F, grad(phi_j) );
195 dFTtimesFscalarM_distrType dFTtimesFscalarM(
const ExpressionDefinitions::deformationGradient_Type F,
196 const ExpressionDefinitions::outerProduct_Type M)
198 return dFTtimesFscalarM_distrType( transpose( grad(phi_j) ) * F, M );
201 FTtimesDFscalarM_distrType FTtimesDFscalarM(
const ExpressionDefinitions::deformationGradient_Type F,
202 const ExpressionDefinitions::outerProduct_Type M)
204 return FTtimesDFscalarM_distrType( transpose( F ) * grad( phi_j ), M );
207 scaledTrace_Type scaleTrace(
const Real coeff,
const ExpressionDefinitions::traceTensor_Type tr )
209 return scaledTrace_Type( value( coeff ), tr );
212 scaledIsochoricTrace_Type scaleIsochoricTrace(
const Real coeff,
const ExpressionDefinitions::isochoricTrace_Type isoTr )
214 return scaledIsochoricTrace_Type( value( coeff ), isoTr );
217 scaledDeterminant_Type scaleDeterminant(
const Real coeff,
const ExpressionDefinitions::powerExpression_Type Jel )
219 return scaledDeterminant_Type( value( coeff ), Jel );
222 scaledFourthInvariant_Type scaleFourthInvariant(
const Real coeff,
const ExpressionDefinitions::stretch_Type I4 )
224 return scaledFourthInvariant_Type( value( coeff ), I4 );
227 scaledIsochoricFourthInvariant_Type scaleIsochoricFourthInvariant(
const Real coeff,
const ExpressionDefinitions::isochoricStretch_Type isoI4 )
229 return scaledIsochoricFourthInvariant_Type( value( coeff ) , isoI4 );
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)
237 scaledIsochoricTrace_Type scIsoTr = scaleIsochoricTrace( ( -2.0/3.0 ), isoTr );
238 scaledDeterminant_Type scJ = scaleDeterminant( 2.0, Jel );
240 minusTFscalarDF_distrType FTdotDF = minusTFscalarDF( F_T );
241 FscalarDF_distrType FdotDF = FscalarDF( F );
243 return linearizationFisochoricTrace_Type( scIsoTr * FTdotDF , scJ * FdotDF );
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)
252 scaledIsochoricFourthInvariant_Type scIsoI4 = scaleIsochoricFourthInvariant( ( -2.0/3.0 ), isoI4 );
254 minusTFscalarDF_distrType FTdotDF = minusTFscalarDF( F_T );
256 dFTtimesFscalarM_distrType firstTerm = dFTtimesFscalarM( F, M );
257 FTtimesDFscalarM_distrType secondTerm = FTtimesDFscalarM( F, M );
259 return linearizationFisochoricFourthInvariant_Type( scIsoI4 * FTdotDF , Jel * ( firstTerm + secondTerm ) );
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)
270 linearizationFisochoricTrace_Type firstTerm = derivativeIsochoricTrace( isoTr, Jel, F, F_T );
271 linearizationFisochoricFourthInvariant_Type secondTerm = derivativeIsochoricFourthInvariant( isoI4, Jel, F, F_T, M);
273 return linearizationDistributedStretch_Type( value(kappa) * firstTerm, value( 1.0 - 3.0 * kappa) * secondTerm );
276 scaledTensorF_Type scaleF(
const Real coeff,
const ExpressionDefinitions::deformationGradient_Type F )
278 return scaledTensorF_Type( coeff, F);
281 scaledTraceTimesMinusTF_Type scaleTraceMinuTF(
const Real coeff,
282 const ExpressionDefinitions::traceTensor_Type Ic,
283 const ExpressionDefinitions::minusTransposedTensor_Type F_T )
285 scaledTrace_Type scIc = scaleTrace( coeff, Ic );
287 return scaledTraceTimesMinusTF_Type( scIc, F_T );
290 scaledFtimesM_Type scaleFtimesM(
const Real coeff,
291 const ExpressionDefinitions::deformationGradient_Type F,
292 const ExpressionDefinitions::outerProduct_Type M)
295 return scaledFtimesM_Type( coeff, F*M );
298 scaledFourthInvariantTimesMinusTF_Type scaleI4timesMinutTF(
const Real coeff,
299 const ExpressionDefinitions::stretch_Type I4,
300 const ExpressionDefinitions::minusTransposedTensor_Type F_T )
302 scaledFourthInvariant_Type scI4 = scaleFourthInvariant( coeff , I4 );
304 return scaledFourthInvariantTimesMinusTF_Type( scI4, F_T );
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)
322 scaledTensorF_Type scF = scaleF( kappa, F );
323 scaledTraceTimesMinusTF_Type scTrF_T = scaleTraceMinuTF( - kappa / 3.0, tr, F_T );
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 );
328 return tensorialPart_distrType( ( scF + scTrF_T ), ( scFM + scI4F_T ) );
335 namespace ExpressionMultimechanism
337 using namespace ExpressionAssembly;
339 difference_Type absoluteStretch(
const ExpressionDefinitions::isochoricStretch_Type IVbar,
340 const Real valueToSubtract)
342 return difference_Type ( IVbar, value( valueToSubtract ) );
346 incompressibleDifference_Type incompressibleAbsoluteStretch(
const ExpressionDefinitions::stretch_Type IV,
347 const Real valueToSubtract)
349 return incompressibleDifference_Type ( IV, value( valueToSubtract ) );
353 relativeDifference_Type relativeDifference(
const incompressibleDifference_Type difference,
354 const Real refFourthInvariant)
356 return relativeDifference_Type ( difference, value( refFourthInvariant ) );
361 activation_Type activationConstructor(
const ExpressionMultimechanism::difference_Type absoluteStretch,
364 const Real translation)
366 return activation_Type( absoluteStretch, intCoeff, extCoeff, translation );
369 expressionVectorFromDifference_Type vectorFromActivation(
const ExpressionMultimechanism::difference_Type activation )
371 return expressionVectorFromDifference_Type( activation );
374 expressionVectorFromIncompressibleDifference_Type vectorFromIncompressibleDifference(
const ExpressionMultimechanism::incompressibleDifference_Type activation )
376 return expressionVectorFromIncompressibleDifference_Type( activation );
379 expressionVectorFromRelativeDifference_Type vectorFromRelativeDifference(
const ExpressionMultimechanism::relativeDifference_Type activation )
381 return expressionVectorFromRelativeDifference_Type( activation );
384 deformationActivatedTensor_Type createDeformationActivationTensor(
const ExpressionDefinitions::deformationGradient_Type Ft,
385 const ExpressionDefinitions::inverseTensor_Type F0_ta)
387 return deformationActivatedTensor_Type( Ft, F0_ta );
390 rightCauchyGreenMultiMechanism_Type activationRightCauchyGreen(
const ExpressionDefinitions::minusTransposedTensor_Type FzeroAminusT,
391 const ExpressionDefinitions::rightCauchyGreenTensor_Type C,
392 const ExpressionDefinitions::inverseTensor_Type FzeroAminus1 )
394 ExpressionProduct< ExpressionDefinitions::rightCauchyGreenTensor_Type,
395 ExpressionDefinitions::inverseTensor_Type > rightTerm( C, FzeroAminus1 );
396 return rightCauchyGreenMultiMechanism_Type( FzeroAminusT, rightTerm );
399 activatedFiber_Type activateFiberDirection(
const ExpressionDefinitions::deformationGradient_Type F,
400 const ExpressionDefinitions::interpolatedValue_Type ithFiber)
402 return activatedFiber_Type( F, ithFiber );
405 normalizedVector_Type unitVector(
const activatedFiber_Type vector)
407 return normalizedVector_Type( vector );
410 squaredNormActivatedFiber_Type squaredNormActivatedFiber(
const activatedFiber_Type f)
412 return squaredNormActivatedFiber_Type( f, f );
415 normActivatedFiber_Type normActivatedFiber(
const activatedFiber_Type f)
417 squaredNormActivatedFiber_Type squaredNorm = squaredNormActivatedFiber_Type( f, f );
419 return normActivatedFiber_Type( squaredNorm );
422 normalizedFiber_Type normalizedFiberDirection(
const activatedFiber_Type fiber,
423 const normActivatedFiber_Type normFiber)
425 return normalizedFiber_Type( fiber, normFiber );
428 activatedDeterminantF_Type activateDeterminantF(
const ExpressionDefinitions::determinantTensorF_Type Jzero,
429 const ExpressionDefinitions::interpolatedScalarValue_Type JzeroA )
431 return activatedDeterminantF_Type( Jzero, JzeroA );
434 activatedJ_Type activateJ(
const ExpressionDefinitions::determinantTensorF_Type Jzero,
435 const ExpressionDefinitions::powerExpression_Type JzeroA )
437 return activatedJ_Type( Jzero, JzeroA );
440 activePowerExpression_Type activePowerExpression( activatedDeterminantF_Type Ja,
443 return activePowerExpression_Type ( Ja, exp );
446 activeIsochoricDeterminant_Type activeIsochoricDeterminant( activatedDeterminantF_Type Ja )
448 return activeIsochoricDeterminant_Type ( Ja );
451 activeOuterProduct_Type activeOuterProduct(
const activatedFiber_Type activatedFiber )
453 return activeOuterProduct_Type( activatedFiber, activatedFiber );
456 activeNormalizedOuterProduct_Type activeNormalizedOuterProduct(
const normalizedVector_Type normalizedActiveFiber )
458 return activeNormalizedOuterProduct_Type( normalizedActiveFiber, normalizedActiveFiber );
461 activeStretch_Type activeFiberStretch(
const rightCauchyGreenMultiMechanism_Type activeC,
462 const activeNormalizedOuterProduct_Type activeM)
464 return activeStretch_Type( activeC, activeM );
467 activeInterpolatedFiberStretch_Type activeInterpolatedFiberStretch(
const rightCauchyGreenMultiMechanism_Type activeC,
468 const ExpressionDefinitions::outerProduct_Type activeM)
470 return activeInterpolatedFiberStretch_Type( activeC, activeM );
473 activeIsochoricStretch_Type activeIsochoricFourthInvariant(
const activeIsochoricDeterminant_Type activeJ,
474 const activeInterpolatedFiberStretch_Type activeI4)
476 return activeIsochoricStretch_Type( activeJ, activeI4 );
479 activeNoInterpolationStretch_Type activeNoInterpolationFourthInvariant(
const activeIsochoricDeterminant_Type activeJ,
480 const activeStretch_Type activeI4)
482 return activeNoInterpolationStretch_Type( activeJ, activeI4 );
485 activePowerIsochoricStretch_Type activePowerIsochoricFourthInvariant(
const activePowerExpression_Type activeJ,
486 const activeStretch_Type activeI4)
488 return activePowerIsochoricStretch_Type( activeJ, activeI4 );
492 activeMinusTtensor_Type createActiveMinusTtensor(
const ExpressionDefinitions::minusTransposedTensor_Type FminusT,
493 const ExpressionTranspose<ExpressionDefinitions::deformationGradient_Type> FzeroA)
495 return activeMinusTtensor_Type ( FminusT, FzeroA );
498 activeLinearization_Type activatedLinearization(
const ExpressionDphiJ der,
499 const ExpressionDefinitions::inverseTensor_Type inverse)
501 return activeLinearization_Type( der , inverse);
503 activeTestGradient_Type activatedTestGradient(
const ExpressionDphiI gradTest,
504 const ExpressionDefinitions::inverseTensor_Type FAminus1)
506 return activeTestGradient_Type ( gradTest, FAminus1 );