version 3.8
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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_POROELASTIC_VOLUME_VARIABLES_HH
13#define DUMUX_POROELASTIC_VOLUME_VARIABLES_HH
14#include <type_traits>
15#include <dune/common/exceptions.hh>
16
17
18namespace Dumux {
19
27template<class Traits>
29{
30 using Scalar = typename Traits::PrimaryVariables::value_type;
31 using ModelTraits = typename Traits::ModelTraits;
32
33public:
35 using PrimaryVariables = typename Traits::PrimaryVariables;
37 using DisplacementVector = typename Traits::DisplacementVector;
39 using Indices = typename ModelTraits::Indices;
41 using SolidState = typename Traits::SolidState;
43 using SolidSystem = typename Traits::SolidSystem;
44
54 template<class ElemSol, class Problem, class Element, class Scv>
55 void update(const ElemSol& elemSol,
56 const Problem& problem,
57 const Element& element,
58 const Scv& scv)
59 {
60 priVars_ = elemSol[scv.localDofIndex()];
61 extrusionFactor_ = problem.spatialParams().extrusionFactor(element, scv, elemSol);
62
64 updateSolidVolumeFractions_(elemSol, problem, element, scv);
65 // set the temperature of the solid phase
66 setSolidTemperature_(problem, element, scv, elemSol);
67 // update the density of the solid phase
68 solidState_.setDensity(SolidSystem::density(solidState_));
69 }
70
72 Scalar solidDensity() const
73 { return solidState_.density(); }
74
76 Scalar porosity() const
77 { return solidState_.porosity(); }
78
80 Scalar displacement(unsigned int dir) const
81 { return priVars_[ Indices::momentum(dir) ]; }
82
85 {
87 for (int dir = 0; dir < d.size(); ++dir)
88 d[dir] = displacement(dir);
89 return d;
90 }
91
93 Scalar priVar(const int pvIdx) const
94 { return priVars_[pvIdx]; }
95
98 { return priVars_; }
99
101 static constexpr Scalar extrusionFactor()
102 { return 1.0; }
103
104private:
106 template<class ElemSol, class Problem, class Element, class Scv>
107 void updateSolidVolumeFractions_(const ElemSol& elemSol,
108 const Problem& problem,
109 const Element& element,
110 const Scv& scv)
111 {
112 static constexpr int numSolidComp = SolidState::numComponents;
113 static constexpr int numInertComp = SolidState::numInertComponents;
114
115 // first, set inert volume fractions from the spatial params
116 const auto& sp = problem.spatialParams();
117 for (int sCompIdx = numSolidComp-numInertComp; sCompIdx < numSolidComp; ++sCompIdx)
118 solidState_.setVolumeFraction(sCompIdx,
119 sp.template inertVolumeFraction<SolidSystem>(element, scv, elemSol, sCompIdx));
120
121 // second, set the volume fractions of the (possibly) reacting components
122 // these may come from a coupled flow model which considers mineralization,
123 // so we make reactiveVolumeFraction a params interface in which users can
124 // retrieve the current volume fractions from the flow model.
125 if (!(SolidState::isInert()))
126 for (int sCompIdx = 0; sCompIdx < numSolidComp-numInertComp; ++sCompIdx)
127 solidState_.setVolumeFraction(sCompIdx,
128 sp.template reactiveVolumeFraction<SolidSystem>(element, scv, elemSol, sCompIdx));
129 }
130
132 static constexpr bool enableEnergyBalance = ModelTraits::enableEnergyBalance();
133 template< class Problem, class Element, class Scv, class ElemSol,
134 bool enableEB = enableEnergyBalance, typename std::enable_if_t<enableEB, bool> = 0 >
135 void setSolidTemperature_(const Problem& problem, const Element& element, const Scv& scv, const ElemSol& elemSol)
136 { DUNE_THROW(Dune::NotImplemented, "Non-isothermal poroelastic model."); }
137
139 template< class Problem, class Element, class Scv, class ElemSol,
140 bool enableEB = enableEnergyBalance, typename std::enable_if_t<!enableEB, bool> = 0 >
141 void setSolidTemperature_(const Problem& problem, const Element& element, const Scv& scv, const ElemSol& elemSol)
142 { solidState_.setTemperature(problem.spatialParams().temperature(element, scv, elemSol)); }
143
144 // data members
145 Scalar extrusionFactor_;
146 PrimaryVariables priVars_;
147 SolidState solidState_;
148};
149} // end namespace Dumux
150
151#endif
Contains the quantities which are constant within a finite volume in the poroelastic model.
Definition: geomechanics/poroelastic/volumevariables.hh:29
typename ModelTraits::Indices Indices
export the type encapsulating primary variable indices
Definition: geomechanics/poroelastic/volumevariables.hh:39
typename Traits::SolidSystem SolidSystem
export the solid system used
Definition: geomechanics/poroelastic/volumevariables.hh:43
Scalar priVar(const int pvIdx) const
Return a component of primary variable vector for a given index.
Definition: geomechanics/poroelastic/volumevariables.hh:93
Scalar solidDensity() const
Return the average porosity within the scv.
Definition: geomechanics/poroelastic/volumevariables.hh:72
typename Traits::SolidState SolidState
export type of solid state
Definition: geomechanics/poroelastic/volumevariables.hh:41
const PrimaryVariables & priVars() const
Return the vector of primary variables.
Definition: geomechanics/poroelastic/volumevariables.hh:97
Scalar displacement(unsigned int dir) const
Returns the permeability within the scv in .
Definition: geomechanics/poroelastic/volumevariables.hh:80
Scalar porosity() const
Return the average porosity within the scv.
Definition: geomechanics/poroelastic/volumevariables.hh:76
typename Traits::DisplacementVector DisplacementVector
export the type used for displacement vectors
Definition: geomechanics/poroelastic/volumevariables.hh:37
DisplacementVector displacement() const
Returns the displacement vector within the scv in .
Definition: geomechanics/poroelastic/volumevariables.hh:84
typename Traits::PrimaryVariables PrimaryVariables
export the type used for the primary variables
Definition: geomechanics/poroelastic/volumevariables.hh:35
static constexpr Scalar extrusionFactor()
TODO We don't know yet how to interpret extrusion for mechanics.
Definition: geomechanics/poroelastic/volumevariables.hh:101
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:55
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:53
Definition: adapt.hh:17