Line | Branch | Exec | Source |
---|---|---|---|
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-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder | ||
5 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
6 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup GeomechanicsTests | ||
10 | * \brief Definition of a test problem for the poro-elastic model. | ||
11 | */ | ||
12 | #ifndef DUMUX_POROELASTIC_PROBLEM_HH | ||
13 | #define DUMUX_POROELASTIC_PROBLEM_HH | ||
14 | |||
15 | #include <dune/common/fmatrix.hh> | ||
16 | #include <dumux/common/boundarytypes.hh> | ||
17 | #include <dumux/common/numeqvector.hh> | ||
18 | #include <dumux/geomechanics/fvproblem.hh> | ||
19 | |||
20 | namespace Dumux { | ||
21 | |||
22 | /*! | ||
23 | * \ingroup GeomechanicsTests | ||
24 | * \brief Problem definition for the deformation of a poro-elastic body. | ||
25 | */ | ||
26 | template<class TypeTag> | ||
27 | 3 | class PoroElasticProblem : public GeomechanicsFVProblem<TypeTag> | |
28 | { | ||
29 | using ParentType = GeomechanicsFVProblem<TypeTag>; | ||
30 | |||
31 | using Scalar = GetPropType<TypeTag, Properties::Scalar>; | ||
32 | using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; | ||
33 | using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; | ||
34 | using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; | ||
35 | using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; | ||
36 | using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; | ||
37 | |||
38 | using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; | ||
39 | using FVElementGeometry = typename GridGeometry::LocalView; | ||
40 | using SubControlVolume = typename GridGeometry::SubControlVolume; | ||
41 | using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace; | ||
42 | |||
43 | using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; | ||
44 | using Element = typename GridView::template Codim<0>::Entity; | ||
45 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
46 | |||
47 | static constexpr Scalar pi = M_PI; | ||
48 | |||
49 | public: | ||
50 | 1 | PoroElasticProblem(std::shared_ptr<const GridGeometry> gridGeometry) | |
51 |
5/14✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
3 | : ParentType(gridGeometry) |
52 | 1 | {} | |
53 | |||
54 | //! Evaluates the initial value for a control volume. | ||
55 | ✗ | PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const | |
56 | ✗ | { return PrimaryVariables(0.0); } | |
57 | |||
58 | //! Evaluates the boundary conditions for a Dirichlet boundary segment. | ||
59 | ✗ | PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const | |
60 | 304 | { return PrimaryVariables(0.0); } | |
61 | |||
62 | /*! | ||
63 | * \brief Specifies which kind of boundary condition should be | ||
64 | * used for which equation on a given boundary segment. | ||
65 | * | ||
66 | * \param globalPos The global position | ||
67 | */ | ||
68 | ✗ | BoundaryTypes boundaryTypesAtPos(const GlobalPosition& globalPos) const | |
69 | { | ||
70 | 152 | BoundaryTypes values; | |
71 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 80 times.
|
152 | values.setAllDirichlet(); |
72 | ✗ | return values; | |
73 | } | ||
74 | |||
75 | /*! | ||
76 | * \brief Evaluates the source term for all phases within a given | ||
77 | * sub-control volume. | ||
78 | */ | ||
79 | 7200 | NumEqVector source(const Element& element, | |
80 | const FVElementGeometry& fvGeometry, | ||
81 | const ElementVolumeVariables& elemVolVars, | ||
82 | const SubControlVolume& scv) const | ||
83 | { | ||
84 | using std::sin; | ||
85 | using std::cos; | ||
86 | |||
87 | 7200 | const auto ipGlobal = scv.center(); | |
88 | 7200 | const auto x = ipGlobal[0]; | |
89 | 7200 | const auto y = ipGlobal[1]; | |
90 | |||
91 | // the lame parameters (we know they only depend on position here) | ||
92 | 21600 | const auto& lameParams = this->spatialParams().lameParamsAtPos(scv.center()); | |
93 | 7200 | const auto lambda = lameParams.lambda(); | |
94 | 7200 | const auto mu = lameParams.mu(); | |
95 | |||
96 | // precalculated products | ||
97 | 7200 | const Scalar pi_2 = 2.0*pi; | |
98 | 7200 | const Scalar pi_2_square = pi_2*pi_2; | |
99 | 7200 | const Scalar cos_2pix = cos(pi_2*x); | |
100 | 7200 | const Scalar sin_2pix = sin(pi_2*x); | |
101 | 7200 | const Scalar cos_2piy = cos(pi_2*y); | |
102 | 7200 | const Scalar sin_2piy = sin(pi_2*y); | |
103 | |||
104 | 7200 | const Scalar dE11_dx = -2.0*sin_2piy; | |
105 | 7200 | const Scalar dE22_dx = pi_2_square*cos_2pix*cos_2piy; | |
106 | 7200 | const Scalar dE11_dy = pi_2*(1.0-2.0*x)*cos_2piy; | |
107 | 7200 | const Scalar dE22_dy = -1.0*pi_2_square*sin_2pix*sin_2piy; | |
108 | 7200 | const Scalar dE12_dy = 0.5*pi_2_square*(cos_2pix*cos_2piy - (x-x*x)*sin_2piy); | |
109 | 7200 | const Scalar dE21_dx = 0.5*((1.0-2*x)*pi_2*cos_2piy - pi_2_square*sin_2pix*sin_2piy); | |
110 | |||
111 | // The source term is composed of the divergence of the stress tensor | ||
112 | // resulting from the exact solution minus the pressure gradient | ||
113 | 7200 | PrimaryVariables divSigma(0.0); | |
114 | 7200 | divSigma[Indices::momentum(/*x-dir*/0)] = lambda*(dE11_dx + dE22_dx) + 2*mu*(dE11_dx + dE12_dy); | |
115 | 7200 | divSigma[Indices::momentum(/*y-dir*/1)] = lambda*(dE11_dy + dE22_dy) + 2*mu*(dE21_dx + dE22_dy); | |
116 | 14400 | divSigma -= this->spatialParams().effectivePorePressureGradient(ipGlobal); | |
117 | 7200 | return divSigma; | |
118 | } | ||
119 | |||
120 | /*! | ||
121 | * \brief Evaluates the exact displacement to this problem at a given position. | ||
122 | */ | ||
123 | 121 | PrimaryVariables exactDisplacement(const GlobalPosition& globalPos) const | |
124 | { | ||
125 | using std::sin; | ||
126 | |||
127 | 121 | const auto x = globalPos[0]; | |
128 | 121 | const auto y = globalPos[1]; | |
129 | |||
130 | 121 | PrimaryVariables exact(0.0); | |
131 | 242 | exact[Indices::momentum(/*x-dir*/0)] = (x-x*x)*sin(2*pi*y); | |
132 | 242 | exact[Indices::momentum(/*y-dir*/1)] = sin(2*pi*x)*sin(2*pi*y); | |
133 | 121 | return exact; | |
134 | } | ||
135 | |||
136 | private: | ||
137 | static constexpr Scalar eps_ = 3e-6; | ||
138 | }; | ||
139 | |||
140 | } // end namespace Dumux | ||
141 | |||
142 | #endif | ||
143 |