3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/geomechanics/poroelastic/problem.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_POROELASTIC_PROBLEM_HH
26#define DUMUX_POROELASTIC_PROBLEM_HH
27
28#include <dune/common/fmatrix.hh>
29#include <dune/grid/yaspgrid.hh>
30
34
37
38#include "spatialparams.hh"
39
40namespace Dumux {
41
42template <class TypeTag>
43class PoroElasticProblem;
44
45namespace Properties {
46// Create new type tags
47namespace TTag {
48struct TestPoroElastic { using InheritsFrom = std::tuple<PoroElastic, BoxModel>; };
49} // end namespace TTag
50// Set the grid type
51template<class TypeTag>
52struct Grid<TypeTag, TTag::TestPoroElastic> { using type = Dune::YaspGrid<2>; };
53// Set the problem property
54template<class TypeTag>
55struct Problem<TypeTag, TTag::TestPoroElastic> { using type = Dumux::PoroElasticProblem<TypeTag>; };
56// The fluid phase consists of one constant component
57template<class TypeTag>
58struct FluidSystem<TypeTag, TTag::TestPoroElastic>
59{
62};
63// The spatial parameters property
64template<class TypeTag>
65struct SpatialParams<TypeTag, TTag::TestPoroElastic>
66{
69};
70} // end namespace Properties
71
76template<class TypeTag>
78{
80
86 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
87
89 using FVElementGeometry = typename GridGeometry::LocalView;
90 using SubControlVolume = typename GridGeometry::SubControlVolume;
91 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
92
94 using Element = typename GridView::template Codim<0>::Entity;
95 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
96
97 static constexpr Scalar pi = M_PI;
98 static constexpr int dim = GridView::dimension;
99 static constexpr int dimWorld = GridView::dimensionworld;
100 using GradU = Dune::FieldMatrix<Scalar, dim, dimWorld>;
101
102public:
103 PoroElasticProblem(std::shared_ptr<const GridGeometry> gridGeometry)
105 {}
106
108 static constexpr Scalar temperature()
109 { return 273.15; }
110
112 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
113 { return PrimaryVariables(0.0); }
114
116 PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
117 { return PrimaryVariables(0.0); }
118
124 Scalar effectiveFluidDensityAtPos(const GlobalPosition& globalPos) const
125 {
126 // This test uses the constant component, obtain density only once
128 static const Scalar rho = FS::density( effectivePorePressureAtPos(globalPos), temperature() );
129 return rho;
130 }
131
140 Scalar effectivePorePressureAtPos(const GlobalPosition& globalPos) const
141 { return exactSolution(globalPos)[0] + 10; }
142
149 BoundaryTypes boundaryTypesAtPos(const GlobalPosition& globalPos) const
150 {
151 BoundaryTypes values;
152 values.setAllDirichlet();
153 return values;
154 }
155
160 NumEqVector source(const Element& element,
161 const FVElementGeometry& fvGeometry,
162 const ElementVolumeVariables& elemVolVars,
163 const SubControlVolume& scv) const
164 {
165 using std::sin;
166 using std::cos;
167
168 const auto ipGlobal = scv.center();
169 const auto x = ipGlobal[0];
170 const auto y = ipGlobal[1];
171
172 // the lame parameters (we know they only depend on position here)
173 const auto& lameParams = this->spatialParams().lameParamsAtPos(scv.center());
174 const auto lambda = lameParams.lambda();
175 const auto mu = lameParams.mu();
176
177 // precalculated products
178 const Scalar pi_2 = 2.0*pi;
179 const Scalar pi_2_square = pi_2*pi_2;
180 const Scalar cos_2pix = cos(pi_2*x);
181 const Scalar sin_2pix = sin(pi_2*x);
182 const Scalar cos_2piy = cos(pi_2*y);
183 const Scalar sin_2piy = sin(pi_2*y);
184
185 const Scalar dE11_dx = -2.0*sin_2piy;
186 const Scalar dE22_dx = pi_2_square*cos_2pix*cos_2piy;
187 const Scalar dE11_dy = pi_2*(1.0-2.0*x)*cos_2piy;
188 const Scalar dE22_dy = -1.0*pi_2_square*sin_2pix*sin_2piy;
189 const Scalar dE12_dy = 0.5*pi_2_square*(cos_2pix*cos_2piy - (x-x*x)*sin_2piy);
190 const Scalar dE21_dx = 0.5*((1.0-2*x)*pi_2*cos_2piy - pi_2_square*sin_2pix*sin_2piy);
191
192 // compute exact divergence of sigma
193 PrimaryVariables divSigma(0.0);
194 divSigma[Indices::momentum(/*x-dir*/0)] = lambda*(dE11_dx + dE22_dx) + 2*mu*(dE11_dx + dE12_dy);
195 divSigma[Indices::momentum(/*y-dir*/1)] = lambda*(dE11_dy + dE22_dy) + 2*mu*(dE21_dx + dE22_dy);
196 return divSigma;
197 }
198
202 PrimaryVariables exactSolution(const GlobalPosition& globalPos) const
203 {
204 using std::sin;
205
206 const auto x = globalPos[0];
207 const auto y = globalPos[1];
208
209 PrimaryVariables exact(0.0);
210 exact[Indices::momentum(/*x-dir*/0)] = (x-x*x)*sin(2*pi*y);
211 exact[Indices::momentum(/*y-dir*/1)] = sin(2*pi*x)*sin(2*pi*y);
212 return exact;
213 }
214
218 GradU exactGradient(const GlobalPosition& globalPos) const
219 {
220 using std::sin;
221 using std::cos;
222
223 const auto x = globalPos[0];
224 const auto y = globalPos[1];
225
226 static constexpr int xIdx = Indices::momentum(/*x-dir*/0);
227 static constexpr int yIdx = Indices::momentum(/*y-dir*/1);
228
229 GradU exactGrad(0.0);
230 exactGrad[xIdx][xIdx] = (1-2*x)*sin(2*pi*y);
231 exactGrad[xIdx][yIdx] = (x - x*x)*2*pi*cos(2*pi*y);
232 exactGrad[yIdx][xIdx] = 2*pi*cos(2*pi*x)*sin(2*pi*y);
233 exactGrad[yIdx][yIdx] = 2*pi*sin(2*pi*x)*cos(2*pi*y);
234 return exactGrad;
235 }
236
237private:
238 static constexpr Scalar eps_ = 3e-6;
239};
240
241} // end namespace Dumux
242
243#endif
Defines a type tag and some properties for models using the box scheme.
Setting constant fluid properties via the input file.
A liquid phase consisting of a single component.
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
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:588
The DUNE grid type.
Definition: common/properties.hh:57
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:69
The type of the spatial parameters object.
Definition: common/properties.hh:221
The type of the fluid system to use.
Definition: common/properties.hh:223
Base class for all geomechanical problems.
Definition: geomechanics/fvproblem.hh:68
A component which returns run time specified values for all fluid properties.
Definition: constant.hh:58
A liquid phase consisting of a single component.
Definition: 1pliquid.hh:46
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/problem.hh:146
Problem definition for the deformation of a poro-elastic body.
Definition: test/geomechanics/poroelastic/problem.hh:78
GradU exactGradient(const GlobalPosition &globalPos) const
Evaluates the exact displacement gradient to this problem at a given position.
Definition: test/geomechanics/poroelastic/problem.hh:218
Scalar effectivePorePressureAtPos(const GlobalPosition &globalPos) const
Returns the effective pore pressure.
Definition: test/geomechanics/poroelastic/problem.hh:140
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition: test/geomechanics/poroelastic/problem.hh:149
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition: test/geomechanics/poroelastic/problem.hh:116
Scalar effectiveFluidDensityAtPos(const GlobalPosition &globalPos) const
Returns the effective fluid density.
Definition: test/geomechanics/poroelastic/problem.hh:124
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/geomechanics/poroelastic/problem.hh:112
NumEqVector source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluates the source term for all phases within a given sub-control volume.
Definition: test/geomechanics/poroelastic/problem.hh:160
PoroElasticProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/geomechanics/poroelastic/problem.hh:103
static constexpr Scalar temperature()
Returns the temperature in the domain.
Definition: test/geomechanics/poroelastic/problem.hh:108
PrimaryVariables exactSolution(const GlobalPosition &globalPos) const
Evaluates the exact displacement to this problem at a given position.
Definition: test/geomechanics/poroelastic/problem.hh:202
Definition: test/geomechanics/poroelastic/problem.hh:48
std::tuple< PoroElastic, BoxModel > InheritsFrom
Definition: test/geomechanics/poroelastic/problem.hh:48
Dune::YaspGrid< 2 > type
Definition: test/geomechanics/poroelastic/problem.hh:52
Definition of the spatial parameters for the poro-elastic problem.
Definition: geomechanics/poroelastic/spatialparams.hh:42
Base class for all geomechanical problems.
Defines a type tag and some properties for the poroelastic geomechanical model.
Definition of the spatial parameters for the MaxwellStefan problem.