3.5-git
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
29
30namespace Dumux {
31
39template<class Traits>
41{
42 using Scalar = typename Traits::PrimaryVariables::value_type;
43 using ModelTraits = typename Traits::ModelTraits;
44
45public:
47 using PrimaryVariables = typename Traits::PrimaryVariables;
49 using DisplacementVector = typename Traits::DisplacementVector;
51 using Indices = typename ModelTraits::Indices;
53 using SolidState = typename Traits::SolidState;
55 using SolidSystem = typename Traits::SolidSystem;
56
66 template<class ElemSol, class Problem, class Element, class Scv>
67 void update(const ElemSol& elemSol,
68 const Problem& problem,
69 const Element& element,
70 const Scv& scv)
71 {
72 priVars_ = elemSol[scv.localDofIndex()];
73 extrusionFactor_ = Deprecated::extrusionFactor(problem, element, scv, elemSol);
74
76 updateSolidVolumeFractions_(elemSol, problem, element, scv);
77 // set the temperature of the solid phase
78 setSolidTemperature_(problem, element, scv, elemSol);
79 // update the density of the solid phase
80 solidState_.setDensity(SolidSystem::density(solidState_));
81 }
82
84 Scalar solidDensity() const
85 { return solidState_.density(); }
86
88 Scalar porosity() const
89 { return solidState_.porosity(); }
90
92 Scalar displacement(unsigned int dir) const
93 { return priVars_[ Indices::momentum(dir) ]; }
94
97 {
99 for (int dir = 0; dir < d.size(); ++dir)
100 d[dir] = displacement(dir);
101 return d;
102 }
103
105 Scalar priVar(const int pvIdx) const
106 { return priVars_[pvIdx]; }
107
110 { return priVars_; }
111
113 static constexpr Scalar extrusionFactor()
114 { return 1.0; }
115
116private:
118 template<class ElemSol, class Problem, class Element, class Scv>
119 void updateSolidVolumeFractions_(const ElemSol& elemSol,
120 const Problem& problem,
121 const Element& element,
122 const Scv& scv)
123 {
124 static constexpr int numSolidComp = SolidState::numComponents;
125 static constexpr int numInertComp = SolidState::numInertComponents;
126
127 // first, set inert volume fractions from the spatial params
128 const auto& sp = problem.spatialParams();
129 for (int sCompIdx = numSolidComp-numInertComp; sCompIdx < numSolidComp; ++sCompIdx)
130 solidState_.setVolumeFraction(sCompIdx,
131 sp.template inertVolumeFraction<SolidSystem>(element, scv, elemSol, sCompIdx));
132
133 // second, set the volume fractions of the (possibly) reacting components
134 // these may come from a coupled flow model which considers mineralization,
135 // so we make reactiveVolumeFraction a params interface in which users can
136 // retrieve the current volume fractions from the flow model.
137 if (!(SolidState::isInert()))
138 for (int sCompIdx = 0; sCompIdx < numSolidComp-numInertComp; ++sCompIdx)
139 solidState_.setVolumeFraction(sCompIdx,
140 sp.template reactiveVolumeFraction<SolidSystem>(element, scv, elemSol, sCompIdx));
141 }
142
144 static constexpr bool enableEnergyBalance = ModelTraits::enableEnergyBalance();
145 template< class Problem, class Element, class Scv, class ElemSol,
146 bool enableEB = enableEnergyBalance, typename std::enable_if_t<enableEB, bool> = 0 >
147 void setSolidTemperature_(const Problem& problem, const Element& element, const Scv& scv, const ElemSol& elemSol)
148 { DUNE_THROW(Dune::NotImplemented, "Non-isothermal poroelastic model."); }
149
151 template< class Problem, class Element, class Scv, class ElemSol,
152 bool enableEB = enableEnergyBalance, typename std::enable_if_t<!enableEB, bool> = 0 >
153 void setSolidTemperature_(const Problem& problem, const Element& element, const Scv& scv, const ElemSol& elemSol)
154 { solidState_.setTemperature(Deprecated::temperature(problem, element, scv, elemSol)); }
155
156 // data members
157 Scalar extrusionFactor_;
158 PrimaryVariables priVars_;
159 SolidState solidState_;
160};
161} // end namespace Dumux
162
163#endif
Helpers for deprecation.
free functions for the evaluation of primary variable gradients inside elements.
Definition: adapt.hh:29
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
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:41
typename ModelTraits::Indices Indices
export the type encapsulating primary variable indices
Definition: geomechanics/poroelastic/volumevariables.hh:51
typename Traits::SolidSystem SolidSystem
export the solid system used
Definition: geomechanics/poroelastic/volumevariables.hh:55
Scalar priVar(const int pvIdx) const
Return a component of primary variable vector for a given index.
Definition: geomechanics/poroelastic/volumevariables.hh:105
Scalar solidDensity() const
Return the average porosity within the scv.
Definition: geomechanics/poroelastic/volumevariables.hh:84
typename Traits::SolidState SolidState
export type of solid state
Definition: geomechanics/poroelastic/volumevariables.hh:53
const PrimaryVariables & priVars() const
Return the vector of primary variables.
Definition: geomechanics/poroelastic/volumevariables.hh:109
Scalar displacement(unsigned int dir) const
Returns the permeability within the scv in .
Definition: geomechanics/poroelastic/volumevariables.hh:92
Scalar porosity() const
Return the average porosity within the scv.
Definition: geomechanics/poroelastic/volumevariables.hh:88
typename Traits::DisplacementVector DisplacementVector
export the type used for displacement vectors
Definition: geomechanics/poroelastic/volumevariables.hh:49
DisplacementVector displacement() const
Returns the displacement vector within the scv in .
Definition: geomechanics/poroelastic/volumevariables.hh:96
typename Traits::PrimaryVariables PrimaryVariables
export the type used for the primary variables
Definition: geomechanics/poroelastic/volumevariables.hh:47
static constexpr Scalar extrusionFactor()
TODO We don't know yet how to interpret extrusion for mechanics.
Definition: geomechanics/poroelastic/volumevariables.hh:113
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:67