3.4
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
geomechanics/poroelastic/volumevariables.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 *****************************************************************************/
24#ifndef DUMUX_POROELASTIC_VOLUME_VARIABLES_HH
25#define DUMUX_POROELASTIC_VOLUME_VARIABLES_HH
26
28
29namespace Dumux {
30
38template<class Traits>
40{
41 using Scalar = typename Traits::PrimaryVariables::value_type;
42 using ModelTraits = typename Traits::ModelTraits;
43
44public:
46 using PrimaryVariables = typename Traits::PrimaryVariables;
48 using DisplacementVector = typename Traits::DisplacementVector;
50 using Indices = typename ModelTraits::Indices;
52 using SolidState = typename Traits::SolidState;
54 using SolidSystem = typename Traits::SolidSystem;
55
65 template<class ElemSol, class Problem, class Element, class Scv>
66 void update(const ElemSol& elemSol,
67 const Problem& problem,
68 const Element& element,
69 const Scv& scv)
70 {
71 priVars_ = elemSol[scv.localDofIndex()];
72 extrusionFactor_ = problem.extrusionFactor(element, scv, elemSol);
73
75 updateSolidVolumeFractions_(elemSol, problem, element, scv);
76 // set the temperature of the solid phase
77 setSolidTemperature_(problem, elemSol);
78 // update the density of the solid phase
79 solidState_.setDensity(SolidSystem::density(solidState_));
80 }
81
83 Scalar solidDensity() const
84 { return solidState_.density(); }
85
87 Scalar porosity() const
88 { return solidState_.porosity(); }
89
91 Scalar displacement(unsigned int dir) const
92 { return priVars_[ Indices::momentum(dir) ]; }
93
96 {
98 for (int dir = 0; dir < d.size(); ++dir)
99 d[dir] = displacement(dir);
100 return d;
101 }
102
104 Scalar priVar(const int pvIdx) const
105 { return priVars_[pvIdx]; }
106
109 { return priVars_; }
110
112 static constexpr Scalar extrusionFactor()
113 { return 1.0; }
114
115private:
117 template<class ElemSol, class Problem, class Element, class Scv>
118 void updateSolidVolumeFractions_(const ElemSol& elemSol,
119 const Problem& problem,
120 const Element& element,
121 const Scv& scv)
122 {
123 static constexpr int numSolidComp = SolidState::numComponents;
124 static constexpr int numInertComp = SolidState::numInertComponents;
125
126 // first, set inert volume fractions from the spatial params
127 const auto& sp = problem.spatialParams();
128 for (int sCompIdx = numSolidComp-numInertComp; sCompIdx < numSolidComp; ++sCompIdx)
129 solidState_.setVolumeFraction(sCompIdx,
130 sp.template inertVolumeFraction<SolidSystem>(element, scv, elemSol, sCompIdx));
131
132 // second, set the volume fractions of the (possibly) reacting components
133 if (!(SolidState::isInert()))
134 for (int sCompIdx = 0; sCompIdx < numSolidComp-numInertComp; ++sCompIdx)
135 solidState_.setVolumeFraction(sCompIdx,
136 sp.template reactiveVolumeFraction<SolidSystem>(element, scv, elemSol, sCompIdx));
137 }
138
140 static constexpr bool enableEnergyBalance = ModelTraits::enableEnergyBalance();
141 template< class Problem, class ElemSol,
142 bool enableEB = enableEnergyBalance, typename std::enable_if_t<enableEB, bool> = 0 >
143 void setSolidTemperature_(const Problem& problem, const ElemSol& elemSol)
144 { DUNE_THROW(Dune::InvalidStateException, "Non-isothermal elastic model."); }
145
147 template< class Problem, class ElemSol,
148 bool enableEB = enableEnergyBalance, typename std::enable_if_t<!enableEB, bool> = 0 >
149 void setSolidTemperature_(const Problem& problem, const ElemSol& elemSol)
150 { solidState_.setTemperature(problem.temperature()); }
151
152 // data members
153 Scalar extrusionFactor_;
154 PrimaryVariables priVars_;
155 SolidState solidState_;
156};
157} // end namespace Dumux
158
159#endif
free functions for the evaluation of primary variable gradients inside elements.
Definition: adapt.hh:29
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Contains the quantities which are constant within a finite volume in the poroelastic model.
Definition: geomechanics/poroelastic/volumevariables.hh:40
typename ModelTraits::Indices Indices
export the type encapsulating primary variable indices
Definition: geomechanics/poroelastic/volumevariables.hh:50
typename Traits::SolidSystem SolidSystem
export the solid system used
Definition: geomechanics/poroelastic/volumevariables.hh:54
Scalar priVar(const int pvIdx) const
Return a component of primary variable vector for a given index.
Definition: geomechanics/poroelastic/volumevariables.hh:104
Scalar solidDensity() const
Return the average porosity within the scv.
Definition: geomechanics/poroelastic/volumevariables.hh:83
typename Traits::SolidState SolidState
export type of solid state
Definition: geomechanics/poroelastic/volumevariables.hh:52
const PrimaryVariables & priVars() const
Return the vector of primary variables.
Definition: geomechanics/poroelastic/volumevariables.hh:108
Scalar displacement(unsigned int dir) const
Returns the permeability within the scv in .
Definition: geomechanics/poroelastic/volumevariables.hh:91
Scalar porosity() const
Return the average porosity within the scv.
Definition: geomechanics/poroelastic/volumevariables.hh:87
typename Traits::DisplacementVector DisplacementVector
export the type used for displacement vectors
Definition: geomechanics/poroelastic/volumevariables.hh:48
DisplacementVector displacement() const
Returns the displacement vector within the scv in .
Definition: geomechanics/poroelastic/volumevariables.hh:95
typename Traits::PrimaryVariables PrimaryVariables
export the type used for the primary variables
Definition: geomechanics/poroelastic/volumevariables.hh:46
static constexpr Scalar extrusionFactor()
TODO We don't know yet how to interpret extrusion for mechanics.
Definition: geomechanics/poroelastic/volumevariables.hh:112
void update(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv)
Update all quantities for a given control volume.
Definition: geomechanics/poroelastic/volumevariables.hh:66