23#ifndef DUMUX_SOLIDMECHANICS_HYPERELASTIC_VOLISO_LOCAL_RESIDUAL_HH
24#define DUMUX_SOLIDMECHANICS_HYPERELASTIC_VOLISO_LOCAL_RESIDUAL_HH
26#include <dune/common/fmatrix.hh>
27#include <dune/grid/common/intersectioniterator.hh>
32#include <dumux/common/typetraits/localdofs_.hh>
51template<
class TypeTag>
59 using ElementDiscretization =
typename GridGeometry::LocalView;
60 using GridView =
typename GridGeometry::GridView;
61 using GlobalPosition =
typename GridView::template Codim<0>::Entity::Geometry::GlobalCoordinate;
63 using Tensor = Dune::FieldMatrix<Scalar, GridView::dimension, GridView::dimension>;
64 static constexpr int dim = GridView::dimension;
67 using ElementVariables =
typename GridVariables::GridVariablesCache::LocalView;
70 using ParentType::ParentType;
76 NumEqVector
storageIntegral(
const ElementDiscretization&,
const ElementVariables&,
77 const auto&,
bool)
const
82 const Problem& problem,
84 const ElementDiscretization& elemDisc,
85 const ElementVariables& elemVars)
const
87 if constexpr (Dumux::Detail::LocalDofs::hasNonCVLocalDofsInterface<ElementDiscretization>())
89 if (nonCVLocalDofs(elemDisc).empty())
94 const auto& ipCache = cache(elemVars, qpData.ipData());
95 const auto& ipGlobal = qpData.ipData().global();
97 const auto F = deformationGradient_(elemDisc, elemVars, ipCache);
98 const auto P = firstPiolaKirchhoffStressTensor_(problem, F, elemDisc, ipGlobal);
99 const auto f = problem.source(elemDisc, elemVars, qpData.ipData());
100 const auto& shapeValues = ipCache.shapeValues();
102 for (
const auto& nonCVdof : nonCVLocalDofs(elemDisc))
104 const auto idx = nonCVdof.index();
105 for (
int i = 0; i < dim; ++i)
107 for (
int j = 0; j < dim; ++j)
108 residual[idx][Indices::momentum(i)] += P[i][j] * ipCache.gradN(idx)[j] * qpData.weight();
109 residual[idx][Indices::momentum(i)] -= f[Indices::momentum(i)] * shapeValues[idx][0] * qpData.weight();
117 template<
class SubControlVolumeFace>
119 const ElementVariables& elemVars,
120 const SubControlVolumeFace& scvf)
const
122 const auto& problem = this->asImp().problem();
123 const auto& n = scvf.unitOuterNormal();
128 const auto& ipCache = cache(elemVars, qpData.ipData());
129 const auto F = deformationGradient_(elemDisc, elemVars, ipCache);
130 const auto P = firstPiolaKirchhoffStressTensor_(problem, F, elemDisc, qpData.ipData().global());
132 for (
int i = 0; i < dim; ++i)
133 for (
int j = 0; j < dim; ++j)
134 f[Indices::momentum(i)] -= P[i][j] * n[j] * qpData.weight();
141 const ElementDiscretization& elemDisc,
142 const GlobalPosition& ipGlobal)
const
143 {
return problem.couplingManager().pressureAtPoint(elemDisc, ipGlobal); }
146 template<
class IpCache>
147 Tensor deformationGradient_(
const ElementDiscretization& elemDisc,
148 const ElementVariables& elemVars,
149 const IpCache& ipCache)
const
152 for (
const auto& localDof :
localDofs(elemDisc))
153 for (
int d = 0; d < dim; ++d)
154 F[d].axpy(elemVars[localDof].displacement(d), ipCache.gradN(localDof.index()));
155 for (
int d = 0; d < dim; ++d)
160 Tensor firstPiolaKirchhoffStressTensor_(
const Problem& problem,
162 const ElementDiscretization& elemDisc,
163 const GlobalPosition& ipGlobal)
const
165 auto P = problem.isochoricFirstPiolaKirchhoffStressTensor(F, elemDisc, ipGlobal);
169 const Scalar pJ = this->asImp().volumetricStressPressure(problem, elemDisc, ipGlobal)*F.determinant();
170 for (
int i = 0; i < dim; ++i)
171 for (
int j = 0; j < dim; ++j)
172 P[i][j] += pJ*Finv[j][i];
187template<
class TypeTag>
195 using ElementDiscretization =
typename GridGeometry::LocalView;
196 using GridView =
typename GridGeometry::GridView;
197 using Tensor = Dune::FieldMatrix<Scalar, GridView::dimension, GridView::dimension>;
200 using ElementVariables =
typename GridVariables::GridVariablesCache::LocalView;
203 using ParentType::ParentType;
210 const auto&,
bool)
const
213 NumEqVector
fluxIntegral(
const ElementDiscretization&,
const ElementVariables&,
224 template<
class SubControlVolume_>
226 const ElementVariables& elemVars,
227 const SubControlVolume_& scv)
const
229 NumEqVector source(0.0);
231 const auto& problem = this->asImp().problem();
232 const auto& localBasis = elemDisc.gridDiscretization().feCache().get(elemDisc.element().type()).localBasis();
233 std::vector< Dune::FieldVector<Scalar, 1> > shapeValues;
237 const Tensor F = problem.couplingManager().deformationGradientAtPoint(
238 elemDisc, qpData.ipData().global());
239 const Scalar J = F.determinant();
240 const Scalar psEq = problem.volumetricPressure(J);
242 localBasis.evaluateFunction(qpData.ipData().local(), shapeValues);
244 for (
const auto& localDof :
localDofs(elemDisc))
245 ps += elemVars[localDof].pressure() * shapeValues[localDof.index()][0];
247 source[0] -= (psEq - ps) * qpData.weight();
257 const Problem& problem,
259 const ElementDiscretization& elemDisc,
260 const ElementVariables& elemVars)
const
262 if constexpr (Dumux::Detail::LocalDofs::hasNonCVLocalDofsInterface<ElementDiscretization>())
264 if (nonCVLocalDofs(elemDisc).empty())
267 const auto& problem = this->asImp().problem();
268 const auto& localBasis = elemDisc.gridDiscretization().feCache().get(elemDisc.element().type()).localBasis();
269 std::vector< Dune::FieldVector<Scalar, 1> > shapeValues;
273 const Tensor F = problem.couplingManager().deformationGradientAtPoint(
274 elemDisc, qpData.ipData().global());
275 const Scalar J = F.determinant();
276 const Scalar psEq = problem.volumetricPressure(J);
278 localBasis.evaluateFunction(qpData.ipData().local(), shapeValues);
280 for (
const auto& localDof :
localDofs(elemDisc))
281 ps += elemVars[localDof].pressure() * shapeValues[localDof.index()][0];
283 for (
const auto& nonCVdof : nonCVLocalDofs(elemDisc))
285 const auto idx = nonCVdof.index();
286 residual[idx][0] -= (psEq - ps) * shapeValues[idx][0] * qpData.weight();
Momentum local residual for the mixed u–p hyperelastic model.
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:53
void addToElementFluxAndSourceResidual(ElementResidualVector &residual, const Problem &problem, const auto &element, const ElementDiscretization &elemDisc, const ElementVariables &elemVars) const
FE contributions of stress divergence and body force for non-CV dofs (e.g. PQ2 hybrid).
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:81
NumEqVector storageIntegral(const ElementDiscretization &, const ElementVariables &, const auto &, bool) const
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:76
NumEqVector fluxIntegral(const ElementDiscretization &elemDisc, const ElementVariables &elemVars, const SubControlVolumeFace &scvf) const
Interior flux integral: .
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:118
typename ParentType::ElementResidualVector ElementResidualVector
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:71
Scalar volumetricStressPressure(const Problem &problem, const ElementDiscretization &elemDisc, const GlobalPosition &ipGlobal) const
The scalar of the volumetric stress .
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:140
NumEqVector computeStorage(const auto &, const auto &, const auto &) const
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:73
Pressure local residual for the mixed u–p hyperelastic model.
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:189
NumEqVector computeStorage(const Problem &, const auto &, const auto &) const
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:206
void addToElementFluxAndSourceResidual(ElementResidualVector &residual, const Problem &problem, const auto &element, const ElementDiscretization &elemDisc, const ElementVariables &elemVars) const
FE contributions for non-CV DOFs.
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:256
NumEqVector sourceIntegral(const ElementDiscretization &elemDisc, const ElementVariables &elemVars, const SubControlVolume_ &scv) const
Pressure constraint integrated over an SCV.
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:225
NumEqVector fluxIntegral(const ElementDiscretization &, const ElementVariables &, const auto &) const
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:213
typename ParentType::ElementResidualVector ElementResidualVector
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:204
NumEqVector storageIntegral(const ElementDiscretization &, const ElementVariables &, const auto &, bool) const
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:209
Defines all properties used in Dumux.
The default local operator than can be specialized for each discretization scheme.
free functions for the evaluation of primary variables inside elements.
typename NumEqVectorTraits< PrimaryVariables >::type NumEqVector
A vector with the same size as numbers of equations This is the default implementation and has to be ...
Definition numeqvector.hh:34
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition propertysystem.hh:296
Define some often used mathematical functions.
auto quadratureRule(const FVElementGeometry &fvGeometry, const typename FVElementGeometry::SubControlVolume &scv, QuadratureRules::MidpointQuadrature)
Midpoint quadrature for scv.
Definition quadraturerules.hh:159
typename Detail::DiscretizationDefaultLocalOperator< TypeTag >::type DiscretizationDefaultLocalOperator
Definition defaultlocaloperator.hh:26
auto localDofs(const FVElementGeometry &fvGeometry)
range over local dofs
Definition localdof.hh:50
A helper to deduce a vector with the same size as numbers of equations.
Quadrature rules over sub-control volumes and sub-control volume faces.
Dune-based quadrature rule with specified order.
Definition quadraturerules.hh:66