version 3.11-dev
Loading...
Searching...
No Matches
poromechanics/poroelastic_large_deformations/localresidual.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
13#ifndef DUMUX_POROMECHANICS_POROELASTIC_LARGE_DEFORMATIONS_LOCAL_RESIDUAL_HH
14#define DUMUX_POROMECHANICS_POROELASTIC_LARGE_DEFORMATIONS_LOCAL_RESIDUAL_HH
15
16#include <vector>
17
18#include <dune/common/fmatrix.hh>
19#include <dune/common/fvector.hh>
20
23#include <dumux/common/typetraits/localdofs_.hh>
27
28namespace Dumux {
29
41template<class TypeTag>
44{
48 using GridDiscretization = GetPropType<TypeTag, Properties::GridGeometry>;
49 using ElementDiscretization = typename GridDiscretization::LocalView;
50
51public:
52 using ParentType::ParentType;
53
55 template<class IpData>
56 Scalar volumetricStressPressure(const Problem& problem,
57 const ElementDiscretization& elemDisc,
58 const IpData& ipData) const
59 {
60 const auto& couplingManager = problem.couplingManager();
61 const Scalar ps = couplingManager.solidPressure(elemDisc, ipData);
62 const Scalar pf = couplingManager.fluidPressure(elemDisc, ipData);
63 const Scalar alphaB = problem.spatialParams().biotCoefficient(elemDisc.element(), elemDisc, ipData.global());
64 return ps - alphaB*pf;
65 }
66};
67
77template<class TypeTag>
80{
84 using GridDiscretization = GetPropType<TypeTag, Properties::GridGeometry>;
85 using ElementDiscretization = typename GridDiscretization::LocalView;
86 using GridView = typename GridDiscretization::GridView;
87 using Tensor = Dune::FieldMatrix<Scalar, GridView::dimension, GridView::dimension>;
88
90 using ElementVariables = typename GridVariables::GridVariablesCache::LocalView;
91
92public:
93 using ParentType::ParentType;
94 using ElementResidualVector = typename ParentType::ElementResidualVector;
95
96 NumEqVector storageIntegral(const ElementDiscretization&, const ElementVariables&,
97 const auto&, bool) const
98 { return NumEqVector(0.0); }
99
100 NumEqVector fluxIntegral(const ElementDiscretization&, const ElementVariables&,
101 const auto&) const
102 { return NumEqVector(0.0); }
103
104 NumEqVector sourceIntegral(const ElementDiscretization& elemDisc,
105 const ElementVariables& elemVars,
106 const auto& scv) const
107 {
108 NumEqVector source(0.0);
109
110 const auto& problem = this->asImp().problem();
111 const auto& localBasis = elemDisc.gridDiscretization().feCache().get(elemDisc.element().type()).localBasis();
112 thread_local std::vector< Dune::FieldVector<Scalar, 1> > shapeValues;
113
114 for (const auto& qpData : CVFE::quadratureRule(elemDisc, scv))
115 {
116 const Tensor F = problem.couplingManager().deformationGradient(elemDisc, qpData.ipData());
117 const Scalar J = F.determinant();
118 const Scalar psEq = problem.volumetricPressure(J);
119
120 localBasis.evaluateFunction(qpData.ipData().local(), shapeValues);
121 Scalar ps = 0.0;
122 for (const auto& localDof : localDofs(elemDisc))
123 ps += elemVars[localDof].solidPressure() * shapeValues[localDof.index()][0];
124
125 source[0] -= (psEq - ps) * qpData.weight();
126 }
127
128 return source;
129 }
130};
131
149template<class TypeTag>
151 : public DiscretizationDefaultLocalOperator<TypeTag>
152{
156 using GridDiscretization = GetPropType<TypeTag, Properties::GridGeometry>;
157 using ElementDiscretization = typename GridDiscretization::LocalView;
158 using SubControlVolumeFace = typename GridDiscretization::SubControlVolumeFace;
159 using GridView = typename GridDiscretization::GridView;
160 using GlobalPosition = typename GridView::template Codim<0>::Entity::Geometry::GlobalCoordinate;
161 using Tensor = Dune::FieldMatrix<Scalar, GridView::dimension, GridView::dimension>;
162 static constexpr int dim = GridView::dimension;
163
165 using ElementVariables = typename GridVariables::GridVariablesCache::LocalView;
166
167public:
168 using ParentType::ParentType;
169 using ElementResidualVector = typename ParentType::ElementResidualVector;
170
178 NumEqVector storageIntegral(const ElementDiscretization& elemDisc,
179 const ElementVariables& elemVars,
180 const auto& scv,
181 bool /*isPreviousTimeLevel*/) const
182 {
183 const auto& problem = this->asImp().problem();
184 const auto& spatialParams = problem.spatialParams();
185 const auto& element = elemDisc.element();
186 const Scalar pf = elemVars[scv].fluidPressure();
187
188 NumEqVector storage(0.0);
189 for (const auto& qpData : CVFE::quadratureRule(elemDisc, scv))
190 {
191 const auto& ipGlobal = qpData.ipData().global();
192 const Scalar J = problem.couplingManager().deformationGradient(elemDisc, qpData.ipData()).determinant();
193 const Scalar alphaB = spatialParams.biotCoefficient(element, elemDisc, ipGlobal);
194 const Scalar Sp = spatialParams.storageCoefficient(element, elemDisc, ipGlobal);
195 storage[0] += (alphaB*J + Sp*pf)*qpData.weight();
196 }
197 return storage;
198 }
199
205 NumEqVector fluxIntegral(const ElementDiscretization& elemDisc,
206 const ElementVariables& elemVars,
207 const SubControlVolumeFace& scvf) const
208 {
209 const auto& problem = this->asImp().problem();
210 const auto& n = scvf.unitOuterNormal();
211 NumEqVector f(0.0);
212
213 for (const auto& qpData : CVFE::quadratureRule(elemDisc, scvf))
214 {
215 const auto& ipCache = cache(elemVars, qpData.ipData());
216 const auto& ipGlobal = qpData.ipData().global();
217
218 GlobalPosition gradPf(0.0);
219 for (const auto& localDof : localDofs(elemDisc))
220 gradPf.axpy(elemVars[localDof].fluidPressure(), ipCache.gradN(localDof.index()));
221
222 const Tensor F = problem.couplingManager().deformationGradient(elemDisc, qpData.ipData());
223 const Scalar J = F.determinant();
224
225 Tensor Finv(F);
226 Finv.invert();
227
228 const auto kappa = problem.spatialParams().permeability(
229 elemDisc.element(), elemDisc, ipGlobal, J);
230 const Scalar muInv = 1.0 / problem.spatialParams().fluidViscosity(
231 elemDisc.element(), elemDisc);
232
233 // q_0 = J (kappa/mu_f) C^{-1} grad_X p_f with C^{-1} = F^{-1} F^{-T}
234 GlobalPosition FinvT_gradPf(0.0);
235 Finv.mtv(gradPf, FinvT_gradPf);
236 GlobalPosition q_ref(0.0);
237 Finv.mv(FinvT_gradPf, q_ref);
238 q_ref *= J * kappa * muInv;
239
240 f[0] -= q_ref * n * qpData.weight();
241 }
242 return f;
243 }
244};
245
246} // end namespace Dumux
247#endif
Momentum local residual for the mixed – hyperelastic model.
Definition solidmechanics/hyperelastic_voliso/localresidual.hh:54
Fluid pressure local residual for the poroelastic large-deformation model.
Definition poromechanics/poroelastic_large_deformations/localresidual.hh:152
NumEqVector storageIntegral(const ElementDiscretization &elemDisc, const ElementVariables &elemVars, const auto &scv, bool) const
Storage term .
Definition poromechanics/poroelastic_large_deformations/localresidual.hh:178
typename ParentType::ElementResidualVector ElementResidualVector
Definition poromechanics/poroelastic_large_deformations/localresidual.hh:169
NumEqVector fluxIntegral(const ElementDiscretization &elemDisc, const ElementVariables &elemVars, const SubControlVolumeFace &scvf) const
Flux term: Darcy flux in the reference frame.
Definition poromechanics/poroelastic_large_deformations/localresidual.hh:205
Momentum local residual for the poroelastic large-deformation model.
Definition poromechanics/poroelastic_large_deformations/localresidual.hh:44
Scalar volumetricStressPressure(const Problem &problem, const ElementDiscretization &elemDisc, const IpData &ipData) const
The scalar of the volumetric stress .
Definition poromechanics/poroelastic_large_deformations/localresidual.hh:56
Solid pressure local residual: algebraic constraint .
Definition poromechanics/poroelastic_large_deformations/localresidual.hh:80
NumEqVector sourceIntegral(const ElementDiscretization &elemDisc, const ElementVariables &elemVars, const auto &scv) const
Definition poromechanics/poroelastic_large_deformations/localresidual.hh:104
NumEqVector storageIntegral(const ElementDiscretization &, const ElementVariables &, const auto &, bool) const
Definition poromechanics/poroelastic_large_deformations/localresidual.hh:96
NumEqVector fluxIntegral(const ElementDiscretization &, const ElementVariables &, const auto &) const
Definition poromechanics/poroelastic_large_deformations/localresidual.hh:100
typename ParentType::ElementResidualVector ElementResidualVector
Definition poromechanics/poroelastic_large_deformations/localresidual.hh:94
Defines all properties used in Dumux.
The default local operator than can be specialized for each discretization scheme.
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
auto quadratureRule(const FVElementGeometry &fvGeometry, const typename FVElementGeometry::SubControlVolume &scv, QuadratureRules::MidpointQuadrature)
Midpoint quadrature for scv.
Definition quadraturerules.hh:160
Definition adapt.hh:17
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.
Local residuals for the volumetric-isochoric split hyperelastic mixed – model.