3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
geomechanics/poroelastic/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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
25#ifndef DUMUX_PRORELASTIC_LOCAL_RESIDUAL_HH
26#define DUMUX_PRORELASTIC_LOCAL_RESIDUAL_HH
27
30
31namespace Dumux {
32
38template<class TypeTag>
40{
41 using ParentType = ElasticLocalResidual<TypeTag>;
42
44 using Element = typename GridView::template Codim<0>::Entity;
45
48 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
49 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
50 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
52 using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
53 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
54 using VolumeVariables = typename ElementVolumeVariables::VolumeVariables;
55
56public:
57 using ParentType::ParentType;
58
72 NumEqVector computeSource(const Problem& problem,
73 const Element& element,
74 const FVElementGeometry& fvGeometry,
75 const ElementVolumeVariables& elemVolVars,
76 const SubControlVolume &scv) const
77 {
78 NumEqVector source(0.0);
79
80 // add contributions from volume flux sources
81 source += problem.source(element, fvGeometry, elemVolVars, scv);
82
83 // add contribution from possible point sources
84 source += problem.scvPointSources(element, fvGeometry, elemVolVars, scv);
85
86 // maybe add gravitational acceleration
87 static const bool gravity = getParamFromGroup<bool>(problem.paramGroup(), "Problem.EnableGravity");
88 if (gravity)
89 {
90 // compute average density
91 const auto& vv = elemVolVars[scv];
92 const auto phi = vv.porosity();
93 const auto rhoFluid = problem.effectiveFluidDensity(element, scv);
94 const auto rhoAverage = phi*rhoFluid + (1.0 - phi*vv.solidDensity());
95
96 // add body force
97 const auto& g = problem.spatialParams().gravity(scv.center());
98 for (int dir = 0; dir < GridView::dimensionworld; ++dir)
99 source[ Indices::momentum(dir) ] += rhoAverage*g[dir];
100 }
101
102 return source;
103 }
104};
105
106} // end namespace Dumux
107
108#endif
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
Element-wise calculation of the local residual for problems using the elastic model considering linea...
Definition: geomechanics/elastic/localresidual.hh:41
Element-wise calculation of the local residual for problems using the poroelastic model.
Definition: geomechanics/poroelastic/localresidual.hh:40
NumEqVector computeSource(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Calculate the source term of the equation.
Definition: geomechanics/poroelastic/localresidual.hh:72
Declares all properties used in Dumux.
Element-wise calculation of the local residual for problems using the elastic model considering linea...