3.4
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
geomechanics/elastic/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_ELASTIC_VOLUME_VARIABLES_HH
25#define DUMUX_ELASTIC_VOLUME_VARIABLES_HH
26
27#include <type_traits>
28
29#include <dune/common/exceptions.hh>
30
32
33namespace Dumux {
34
42template<class Traits>
44{
45 using Scalar = typename Traits::PrimaryVariables::value_type;
46 using ModelTraits = typename Traits::ModelTraits;
47
49 static_assert(Traits::SolidSystem::isInert(), "Elastic model can only be used with inert solid systems");
50public:
52 using PrimaryVariables = typename Traits::PrimaryVariables;
54 using DisplacementVector = typename Traits::DisplacementVector;
56 using Indices = typename ModelTraits::Indices;
58 using SolidState = typename Traits::SolidState;
60 using SolidSystem = typename Traits::SolidSystem;
61
71 template<class ElemSol, class Problem, class Element, class Scv>
72 void update(const ElemSol& elemSol,
73 const Problem& problem,
74 const Element& element,
75 const Scv& scv)
76 {
77 priVars_ = elemSol[scv.localDofIndex()];
78 extrusionFactor_ = problem.extrusionFactor(element, scv, elemSol);
79
81 updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, /*numFluidComps=*/0);
82 // set the temperature of the solid phase
83 setSolidTemperature_(problem, elemSol);
84 // update the density of the solid phase
85 solidState_.setDensity(SolidSystem::density(solidState_));
86 }
87
89 Scalar solidDensity() const
90 { return solidState_.density(); }
91
93 Scalar displacement(unsigned int dir) const
94 { return priVars_[ Indices::momentum(dir) ]; }
95
98 {
100 for (int dir = 0; dir < d.size(); ++dir)
101 d[dir] = displacement(dir);
102 return d;
103 }
104
106 Scalar priVar(const int pvIdx) const
107 { return priVars_[pvIdx]; }
108
111 { return priVars_; }
112
114 static constexpr Scalar extrusionFactor()
115 { return 1.0; }
116
117private:
119 static constexpr bool enableEnergyBalance = ModelTraits::enableEnergyBalance();
120 template< class Problem, class ElemSol,
121 bool enableEB = enableEnergyBalance, typename std::enable_if_t<enableEB, bool> = 0 >
122 void setSolidTemperature_(const Problem& problem, const ElemSol& elemSol)
123 { DUNE_THROW(Dune::InvalidStateException, "Non-isothermal elastic model."); }
124
126 template< class Problem, class ElemSol,
127 bool enableEB = enableEnergyBalance, typename std::enable_if_t<!enableEB, bool> = 0 >
128 void setSolidTemperature_(const Problem& problem, const ElemSol& elemSol)
129 { solidState_.setTemperature(problem.temperature()); }
130
131 // data members
132 Scalar extrusionFactor_;
133 PrimaryVariables priVars_;
134 SolidState solidState_;
135};
136
137} // end namespace Dumux
138
139#endif
Update the solid volume fractions (inert and reacitve) and set them in the solidstate.
void updateSolidVolumeFractions(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv, SolidState &solidState, const int solidVolFracOffset)
update the solid volume fractions (inert and reacitve) and set them in the solidstate
Definition: updatesolidvolumefractions.hh:36
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 elastic model.
Definition: geomechanics/elastic/volumevariables.hh:44
void update(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv)
Update all quantities for a given control volume.
Definition: geomechanics/elastic/volumevariables.hh:72
typename Traits::DisplacementVector DisplacementVector
export the type used for displacement vectors
Definition: geomechanics/elastic/volumevariables.hh:54
DisplacementVector displacement() const
Returns the displacement vector within the scv in .
Definition: geomechanics/elastic/volumevariables.hh:97
Scalar displacement(unsigned int dir) const
Returns the permeability within the control volume in .
Definition: geomechanics/elastic/volumevariables.hh:93
Scalar solidDensity() const
Return the average porosity within the control volume.
Definition: geomechanics/elastic/volumevariables.hh:89
typename Traits::SolidSystem SolidSystem
export the solid system used
Definition: geomechanics/elastic/volumevariables.hh:60
static constexpr Scalar extrusionFactor()
TODO We don't know yet how to interpret extrusion for mechanics.
Definition: geomechanics/elastic/volumevariables.hh:114
Scalar priVar(const int pvIdx) const
Return a component of primary variable vector for a given index.
Definition: geomechanics/elastic/volumevariables.hh:106
typename ModelTraits::Indices Indices
export the type encapsulating primary variable indices
Definition: geomechanics/elastic/volumevariables.hh:56
typename Traits::PrimaryVariables PrimaryVariables
The elastic model only makes sense with inert solid systems.
Definition: geomechanics/elastic/volumevariables.hh:52
typename Traits::SolidState SolidState
export type of solid state
Definition: geomechanics/elastic/volumevariables.hh:58
const PrimaryVariables & priVars() const
Return the vector of primary variables.
Definition: geomechanics/elastic/volumevariables.hh:110