39 #ifndef _EXPRESSIONDEFINITIONS_CPP_ 40 #define _EXPRESSIONDEFINITIONS_CPP_ 42 #include <lifev/structure/fem/ExpressionDefinitions.hpp> 47 namespace ExpressionDefinitions
50 using namespace ExpressionAssembly;
52 deformationGradient_Type deformationGradient(
const std::shared_ptr< ETFESpace_Type > dispETFESpace,
53 const vector_Type& disp, UInt offset,
const matrixSmall_Type identity)
55 return deformationGradient_Type( grad( dispETFESpace, disp, offset), value(identity) );
58 determinantTensorF_Type determinantF(
const deformationGradient_Type F )
60 return determinantTensorF_Type( F );
63 rightCauchyGreenTensor_Type tensorC(
const ExpressionTranspose<deformationGradient_Type> tF,
const deformationGradient_Type F )
65 return rightCauchyGreenTensor_Type( tF, F );
68 minusTransposedTensor_Type minusT(
const deformationGradient_Type F )
70 return minusTransposedTensor_Type( F );
73 inverseTensor_Type inv(
const deformationGradient_Type F )
75 return inverseTensor_Type( F );
78 traceTensor_Type traceTensor(
const rightCauchyGreenTensor_Type C )
80 return traceTensor_Type( C );
83 traceSquaredTensor_Type traceSquared(
const rightCauchyGreenTensor_Type C )
85 return traceSquaredTensor_Type( C , C );
88 powerExpression_Type powerExpression(
const determinantTensorF_Type J,
const Real exponent )
90 return powerExpression_Type( J , exponent );
93 isochoricChangeOfVariable_Type isochoricDeterminant(
const determinantTensorF_Type J )
95 return isochoricChangeOfVariable_Type( J );
98 isochoricTrace_Type isochoricTrace(
const powerExpression_Type Jel,
const traceTensor_Type I )
100 return isochoricTrace_Type( Jel , I );
106 interpolatedValue_Type interpolateFiber(
const std::shared_ptr< ETFESpace_Type > dispETFESpace,
107 const vector_Type& fiberVector)
109 return interpolatedValue_Type( dispETFESpace, fiberVector ) ;
112 interpolatedValue_Type interpolateValue(
const std::shared_ptr< ETFESpace_Type > dispETFESpace,
113 const vector_Type& valueVector)
115 return interpolatedValue_Type( dispETFESpace, valueVector ) ;
118 interpolatedScalarValue_Type interpolateScalarValue(
const std::shared_ptr< scalarETFESpace_Type > dispETFESpace,
119 const vector_Type& valueVector)
121 return interpolatedScalarValue_Type( dispETFESpace, valueVector ) ;
124 outerProduct_Type fiberTensor(
const interpolatedValue_Type ithFiber )
126 return outerProduct_Type( ithFiber, ithFiber );
129 stretch_Type fiberStretch(
const rightCauchyGreenTensor_Type C,
const outerProduct_Type M)
131 return stretch_Type( C, M );
134 isochoricStretch_Type isochoricFourthInvariant(
const powerExpression_Type Jel,
const stretch_Type I_4ith)
136 return isochoricStretch_Type( Jel, I_4ith );
150 namespace ExpressionDistributedModel
152 using namespace ExpressionAssembly;
157 distributedIsochoricTrace_Type distributedIsochoricTrace(
const Real coeff,
const ExpressionDefinitions::isochoricTrace_Type ICbar )
159 return distributedIsochoricTrace_Type( value( coeff ), ICbar);
162 distributedIsochoricStretch_Type distributedIsochoricFourthInvariant(
const Real coeff,
const ExpressionDefinitions::isochoricStretch_Type I4bar)
164 return distributedIsochoricStretch_Type( value( coeff ), I4bar );
167 distributedInvariants_Type distributeInvariants(
const distributedIsochoricTrace_Type distrIC,
168 const distributedIsochoricStretch_Type distrI4 )
170 return distributedInvariants_Type( distrIC,distrI4 );
173 distributedStretch_Type distributedStretch(
const ExpressionDefinitions::isochoricTrace_Type trCBar,
174 const ExpressionDefinitions::isochoricStretch_Type I_4ith,
const Real kappa )
176 distributedIsochoricTrace_Type dIC_bar = distributedIsochoricTrace( kappa, trCBar ) ;
177 distributedIsochoricStretch_Type dI4_bar = distributedIsochoricFourthInvariant( 1.0 - 3.0 * kappa, I_4ith ) ;
179 distributedInvariants_Type dInvariants = distributeInvariants( dIC_bar, dI4_bar );
181 return distributedStretch_Type( dInvariants, value( -1.0 ) );
184 minusTFscalarDF_distrType minusTFscalarDF(
const ExpressionDefinitions::minusTransposedTensor_Type minusFT)
186 return minusTFscalarDF_distrType( minusFT, grad( phi_j ) );
189 FscalarDF_distrType FscalarDF(
const ExpressionDefinitions::deformationGradient_Type F )
191 return FscalarDF_distrType( F, grad(phi_j) );
194 dFTtimesFscalarM_distrType dFTtimesFscalarM(
const ExpressionDefinitions::deformationGradient_Type F,
195 const ExpressionDefinitions::outerProduct_Type M)
197 return dFTtimesFscalarM_distrType( transpose( grad(phi_j) ) * F, M );
200 FTtimesDFscalarM_distrType FTtimesDFscalarM(
const ExpressionDefinitions::deformationGradient_Type F,
201 const ExpressionDefinitions::outerProduct_Type M)
203 return FTtimesDFscalarM_distrType( transpose( F ) * grad( phi_j ), M );
206 scaledTrace_Type scaleTrace(
const Real coeff,
const ExpressionDefinitions::traceTensor_Type tr )
208 return scaledTrace_Type( value( coeff ), tr );
211 scaledIsochoricTrace_Type scaleIsochoricTrace(
const Real coeff,
const ExpressionDefinitions::isochoricTrace_Type isoTr )
213 return scaledIsochoricTrace_Type( value( coeff ), isoTr );
216 scaledDeterminant_Type scaleDeterminant(
const Real coeff,
const ExpressionDefinitions::powerExpression_Type Jel )
218 return scaledDeterminant_Type( value( coeff ), Jel );
221 scaledFourthInvariant_Type scaleFourthInvariant(
const Real coeff,
const ExpressionDefinitions::stretch_Type I4 )
223 return scaledFourthInvariant_Type( value( coeff ), I4 );
226 scaledIsochoricFourthInvariant_Type scaleIsochoricFourthInvariant(
const Real coeff,
const ExpressionDefinitions::isochoricStretch_Type isoI4 )
228 return scaledIsochoricFourthInvariant_Type( value( coeff ) , isoI4 );
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)
236 scaledIsochoricTrace_Type scIsoTr = scaleIsochoricTrace( ( -2.0/3.0 ), isoTr );
237 scaledDeterminant_Type scJ = scaleDeterminant( 2.0, Jel );
239 minusTFscalarDF_distrType FTdotDF = minusTFscalarDF( F_T );
240 FscalarDF_distrType FdotDF = FscalarDF( F );
242 return linearizationFisochoricTrace_Type( scIsoTr * FTdotDF , scJ * FdotDF );
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)
251 scaledIsochoricFourthInvariant_Type scIsoI4 = scaleIsochoricFourthInvariant( ( -2.0/3.0 ), isoI4 );
253 minusTFscalarDF_distrType FTdotDF = minusTFscalarDF( F_T );
255 dFTtimesFscalarM_distrType firstTerm = dFTtimesFscalarM( F, M );
256 FTtimesDFscalarM_distrType secondTerm = FTtimesDFscalarM( F, M );
258 return linearizationFisochoricFourthInvariant_Type( scIsoI4 * FTdotDF , Jel * ( firstTerm + secondTerm ) );
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)
269 linearizationFisochoricTrace_Type firstTerm = derivativeIsochoricTrace( isoTr, Jel, F, F_T );
270 linearizationFisochoricFourthInvariant_Type secondTerm = derivativeIsochoricFourthInvariant( isoI4, Jel, F, F_T, M);
272 return linearizationDistributedStretch_Type( value(kappa) * firstTerm, value( 1.0 - 3.0 * kappa) * secondTerm );
275 scaledTensorF_Type scaleF(
const Real coeff,
const ExpressionDefinitions::deformationGradient_Type F )
277 return scaledTensorF_Type( coeff, F);
280 scaledTraceTimesMinusTF_Type scaleTraceMinuTF(
const Real coeff,
281 const ExpressionDefinitions::traceTensor_Type Ic,
282 const ExpressionDefinitions::minusTransposedTensor_Type F_T )
284 scaledTrace_Type scIc = scaleTrace( coeff, Ic );
286 return scaledTraceTimesMinusTF_Type( scIc, F_T );
289 scaledFtimesM_Type scaleFtimesM(
const Real coeff,
290 const ExpressionDefinitions::deformationGradient_Type F,
291 const ExpressionDefinitions::outerProduct_Type M)
294 return scaledFtimesM_Type( coeff, F*M );
297 scaledFourthInvariantTimesMinusTF_Type scaleI4timesMinutTF(
const Real coeff,
298 const ExpressionDefinitions::stretch_Type I4,
299 const ExpressionDefinitions::minusTransposedTensor_Type F_T )
301 scaledFourthInvariant_Type scI4 = scaleFourthInvariant( coeff , I4 );
303 return scaledFourthInvariantTimesMinusTF_Type( scI4, F_T );
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)
321 scaledTensorF_Type scF = scaleF( kappa, F );
322 scaledTraceTimesMinusTF_Type scTrF_T = scaleTraceMinuTF( - kappa / 3.0, tr, F_T );
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 );
327 return tensorialPart_distrType( ( scF + scTrF_T ), ( scFM + scI4F_T ) );
334 namespace ExpressionMultimechanism
336 using namespace ExpressionAssembly;
338 difference_Type absoluteStretch(
const ExpressionDefinitions::isochoricStretch_Type IVbar,
339 const Real valueToSubtract)
341 return difference_Type ( IVbar, value( valueToSubtract ) );
345 incompressibleDifference_Type incompressibleAbsoluteStretch(
const ExpressionDefinitions::stretch_Type IV,
346 const Real valueToSubtract)
348 return incompressibleDifference_Type ( IV, value( valueToSubtract ) );
352 relativeDifference_Type relativeDifference(
const incompressibleDifference_Type difference,
353 const Real refFourthInvariant)
355 return relativeDifference_Type ( difference, value( refFourthInvariant ) );
360 activation_Type activationConstructor(
const ExpressionMultimechanism::difference_Type absoluteStretch,
363 const Real translation)
365 return activation_Type( absoluteStretch, intCoeff, extCoeff, translation );
368 expressionVectorFromDifference_Type vectorFromActivation(
const ExpressionMultimechanism::difference_Type activation )
370 return expressionVectorFromDifference_Type( activation );
373 expressionVectorFromIncompressibleDifference_Type vectorFromIncompressibleDifference(
const ExpressionMultimechanism::incompressibleDifference_Type activation )
375 return expressionVectorFromIncompressibleDifference_Type( activation );
378 expressionVectorFromRelativeDifference_Type vectorFromRelativeDifference(
const ExpressionMultimechanism::relativeDifference_Type activation )
380 return expressionVectorFromRelativeDifference_Type( activation );
383 deformationActivatedTensor_Type createDeformationActivationTensor(
const ExpressionDefinitions::deformationGradient_Type Ft,
384 const ExpressionDefinitions::inverseTensor_Type F0_ta)
386 return deformationActivatedTensor_Type( Ft, F0_ta );
389 rightCauchyGreenMultiMechanism_Type activationRightCauchyGreen(
const ExpressionDefinitions::minusTransposedTensor_Type FzeroAminusT,
390 const ExpressionDefinitions::rightCauchyGreenTensor_Type C,
391 const ExpressionDefinitions::inverseTensor_Type FzeroAminus1 )
393 ExpressionProduct< ExpressionDefinitions::rightCauchyGreenTensor_Type,
394 ExpressionDefinitions::inverseTensor_Type > rightTerm( C, FzeroAminus1 );
395 return rightCauchyGreenMultiMechanism_Type( FzeroAminusT, rightTerm );
398 activatedFiber_Type activateFiberDirection(
const ExpressionDefinitions::deformationGradient_Type F,
399 const ExpressionDefinitions::interpolatedValue_Type ithFiber)
401 return activatedFiber_Type( F, ithFiber );
404 normalizedVector_Type unitVector(
const activatedFiber_Type vector)
406 return normalizedVector_Type( vector );
409 squaredNormActivatedFiber_Type squaredNormActivatedFiber(
const activatedFiber_Type f)
411 return squaredNormActivatedFiber_Type( f, f );
414 normActivatedFiber_Type normActivatedFiber(
const activatedFiber_Type f)
416 squaredNormActivatedFiber_Type squaredNorm = squaredNormActivatedFiber_Type( f, f );
418 return normActivatedFiber_Type( squaredNorm );
421 normalizedFiber_Type normalizedFiberDirection(
const activatedFiber_Type fiber,
422 const normActivatedFiber_Type normFiber)
424 return normalizedFiber_Type( fiber, normFiber );
427 activatedDeterminantF_Type activateDeterminantF(
const ExpressionDefinitions::determinantTensorF_Type Jzero,
428 const ExpressionDefinitions::interpolatedScalarValue_Type JzeroA )
430 return activatedDeterminantF_Type( Jzero, JzeroA );
433 activatedJ_Type activateJ(
const ExpressionDefinitions::determinantTensorF_Type Jzero,
434 const ExpressionDefinitions::powerExpression_Type JzeroA )
436 return activatedJ_Type( Jzero, JzeroA );
439 activePowerExpression_Type activePowerExpression( activatedDeterminantF_Type Ja,
442 return activePowerExpression_Type ( Ja, exp );
445 activeIsochoricDeterminant_Type activeIsochoricDeterminant( activatedDeterminantF_Type Ja )
447 return activeIsochoricDeterminant_Type ( Ja );
450 activeOuterProduct_Type activeOuterProduct(
const activatedFiber_Type activatedFiber )
452 return activeOuterProduct_Type( activatedFiber, activatedFiber );
455 activeNormalizedOuterProduct_Type activeNormalizedOuterProduct(
const normalizedVector_Type normalizedActiveFiber )
457 return activeNormalizedOuterProduct_Type( normalizedActiveFiber, normalizedActiveFiber );
460 activeStretch_Type activeFiberStretch(
const rightCauchyGreenMultiMechanism_Type activeC,
461 const activeNormalizedOuterProduct_Type activeM)
463 return activeStretch_Type( activeC, activeM );
466 activeInterpolatedFiberStretch_Type activeInterpolatedFiberStretch(
const rightCauchyGreenMultiMechanism_Type activeC,
467 const ExpressionDefinitions::outerProduct_Type activeM)
469 return activeInterpolatedFiberStretch_Type( activeC, activeM );
472 activeIsochoricStretch_Type activeIsochoricFourthInvariant(
const activeIsochoricDeterminant_Type activeJ,
473 const activeInterpolatedFiberStretch_Type activeI4)
475 return activeIsochoricStretch_Type( activeJ, activeI4 );
478 activeNoInterpolationStretch_Type activeNoInterpolationFourthInvariant(
const activeIsochoricDeterminant_Type activeJ,
479 const activeStretch_Type activeI4)
481 return activeNoInterpolationStretch_Type( activeJ, activeI4 );
484 activePowerIsochoricStretch_Type activePowerIsochoricFourthInvariant(
const activePowerExpression_Type activeJ,
485 const activeStretch_Type activeI4)
487 return activePowerIsochoricStretch_Type( activeJ, activeI4 );
491 activeMinusTtensor_Type createActiveMinusTtensor(
const ExpressionDefinitions::minusTransposedTensor_Type FminusT,
492 const ExpressionTranspose<ExpressionDefinitions::deformationGradient_Type> FzeroA)
494 return activeMinusTtensor_Type ( FminusT, FzeroA );
497 activeLinearization_Type activatedLinearization(
const ExpressionDphiJ der,
498 const ExpressionDefinitions::inverseTensor_Type inverse)
500 return activeLinearization_Type( der , inverse);
502 activeTestGradient_Type activatedTestGradient(
const ExpressionDphiI gradTest,
503 const ExpressionDefinitions::inverseTensor_Type FAminus1)
505 return activeTestGradient_Type ( gradTest, FAminus1 );