3.5-git
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
33
34namespace Dumux {
35
43template<class Traits>
45{
46 using Scalar = typename Traits::PrimaryVariables::value_type;
47 using ModelTraits = typename Traits::ModelTraits;
48
50 static_assert(Traits::SolidSystem::isInert(), "Elastic model can only be used with inert solid systems");
51public:
53 using PrimaryVariables = typename Traits::PrimaryVariables;
55 using DisplacementVector = typename Traits::DisplacementVector;
57 using Indices = typename ModelTraits::Indices;
59 using SolidState = typename Traits::SolidState;
61 using SolidSystem = typename Traits::SolidSystem;
62
72 template<class ElemSol, class Problem, class Element, class Scv>
73 void update(const ElemSol& elemSol,
74 const Problem& problem,
75 const Element& element,
76 const Scv& scv)
77 {
78 priVars_ = elemSol[scv.localDofIndex()];
79 extrusionFactor_ = Deprecated::extrusionFactor(problem, element, scv, elemSol);
80
82 updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, /*numFluidComps=*/0);
83 // set the temperature of the solid phase
84 setSolidTemperature_(problem, element, scv, elemSol);
85 // update the density of the solid phase
86 solidState_.setDensity(SolidSystem::density(solidState_));
87 }
88
90 Scalar solidDensity() const
91 { return solidState_.density(); }
92
94 Scalar displacement(unsigned int dir) const
95 { return priVars_[ Indices::momentum(dir) ]; }
96
99 {
101 for (int dir = 0; dir < d.size(); ++dir)
102 d[dir] = displacement(dir);
103 return d;
104 }
105
107 Scalar priVar(const int pvIdx) const
108 { return priVars_[pvIdx]; }
109
112 { return priVars_; }
113
115 static constexpr Scalar extrusionFactor()
116 { return 1.0; }
117
118private:
120 static constexpr bool enableEnergyBalance = ModelTraits::enableEnergyBalance();
121 template< class Problem, class Element, class Scv, class ElemSol,
122 bool enableEB = enableEnergyBalance, typename std::enable_if_t<enableEB, bool> = 0 >
123 void setSolidTemperature_(const Problem& problem, const Element& element, const Scv& scv, const ElemSol& elemSol)
124 { DUNE_THROW(Dune::NotImplemented, "Non-isothermal elastic model."); }
125
127 template< class Problem, class Element, class Scv, class ElemSol,
128 bool enableEB = enableEnergyBalance, typename std::enable_if_t<!enableEB, bool> = 0 >
129 void setSolidTemperature_(const Problem& problem, const Element& element, const Scv& scv, const ElemSol& elemSol)
130 { solidState_.setTemperature(Deprecated::temperature(problem, element, scv, elemSol)); }
131
132 // data members
133 Scalar extrusionFactor_;
134 PrimaryVariables priVars_;
135 SolidState solidState_;
136};
137
138} // end namespace Dumux
139
140#endif
Helpers for deprecation.
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 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 elastic model.
Definition: geomechanics/elastic/volumevariables.hh:45
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:73
typename Traits::DisplacementVector DisplacementVector
export the type used for displacement vectors
Definition: geomechanics/elastic/volumevariables.hh:55
DisplacementVector displacement() const
Returns the displacement vector within the scv in .
Definition: geomechanics/elastic/volumevariables.hh:98
Scalar displacement(unsigned int dir) const
Returns the permeability within the control volume in .
Definition: geomechanics/elastic/volumevariables.hh:94
Scalar solidDensity() const
Return the average porosity within the control volume.
Definition: geomechanics/elastic/volumevariables.hh:90
typename Traits::SolidSystem SolidSystem
export the solid system used
Definition: geomechanics/elastic/volumevariables.hh:61
static constexpr Scalar extrusionFactor()
TODO We don't know yet how to interpret extrusion for mechanics.
Definition: geomechanics/elastic/volumevariables.hh:115
Scalar priVar(const int pvIdx) const
Return a component of primary variable vector for a given index.
Definition: geomechanics/elastic/volumevariables.hh:107
typename ModelTraits::Indices Indices
export the type encapsulating primary variable indices
Definition: geomechanics/elastic/volumevariables.hh:57
typename Traits::PrimaryVariables PrimaryVariables
The elastic model only makes sense with inert solid systems.
Definition: geomechanics/elastic/volumevariables.hh:53
typename Traits::SolidState SolidState
export type of solid state
Definition: geomechanics/elastic/volumevariables.hh:59
const PrimaryVariables & priVars() const
Return the vector of primary variables.
Definition: geomechanics/elastic/volumevariables.hh:111