version 3.8
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// 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_ELASTIC_VOLUME_VARIABLES_HH
13#define DUMUX_ELASTIC_VOLUME_VARIABLES_HH
14
15#include <type_traits>
16
17#include <dune/common/exceptions.hh>
18
20
21namespace Dumux {
22
30template<class Traits>
32{
33 using Scalar = typename Traits::PrimaryVariables::value_type;
34 using ModelTraits = typename Traits::ModelTraits;
35
37 static_assert(Traits::SolidSystem::isInert(), "Elastic model can only be used with inert solid systems");
38public:
40 using PrimaryVariables = typename Traits::PrimaryVariables;
42 using DisplacementVector = typename Traits::DisplacementVector;
44 using Indices = typename ModelTraits::Indices;
46 using SolidState = typename Traits::SolidState;
48 using SolidSystem = typename Traits::SolidSystem;
49
59 template<class ElemSol, class Problem, class Element, class Scv>
60 void update(const ElemSol& elemSol,
61 const Problem& problem,
62 const Element& element,
63 const Scv& scv)
64 {
65 priVars_ = elemSol[scv.localDofIndex()];
66 extrusionFactor_ = problem.spatialParams().extrusionFactor(element, scv, elemSol);
67
69 updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, /*numFluidComps=*/0);
70 // set the temperature of the solid phase
71 setSolidTemperature_(problem, element, scv, elemSol);
72 // update the density of the solid phase
73 solidState_.setDensity(SolidSystem::density(solidState_));
74 }
75
77 Scalar solidDensity() const
78 { return solidState_.density(); }
79
81 Scalar displacement(unsigned int dir) const
82 { return priVars_[ Indices::momentum(dir) ]; }
83
86 {
88 for (int dir = 0; dir < d.size(); ++dir)
89 d[dir] = displacement(dir);
90 return d;
91 }
92
94 Scalar priVar(const int pvIdx) const
95 { return priVars_[pvIdx]; }
96
99 { return priVars_; }
100
102 static constexpr Scalar extrusionFactor()
103 { return 1.0; }
104
105private:
107 static constexpr bool enableEnergyBalance = ModelTraits::enableEnergyBalance();
108 template< class Problem, class Element, class Scv, class ElemSol,
109 bool enableEB = enableEnergyBalance, typename std::enable_if_t<enableEB, bool> = 0 >
110 void setSolidTemperature_(const Problem& problem, const Element& element, const Scv& scv, const ElemSol& elemSol)
111 { DUNE_THROW(Dune::NotImplemented, "Non-isothermal elastic model."); }
112
114 template< class Problem, class Element, class Scv, class ElemSol,
115 bool enableEB = enableEnergyBalance, typename std::enable_if_t<!enableEB, bool> = 0 >
116 void setSolidTemperature_(const Problem& problem, const Element& element, const Scv& scv, const ElemSol& elemSol)
117 { solidState_.setTemperature(problem.spatialParams().temperature(element, scv, elemSol)); }
118
119 // data members
120 Scalar extrusionFactor_;
121 PrimaryVariables priVars_;
122 SolidState solidState_;
123};
124
125} // end namespace Dumux
126
127#endif
Contains the quantities which are constant within a finite volume in the elastic model.
Definition: geomechanics/elastic/volumevariables.hh:32
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:60
typename Traits::DisplacementVector DisplacementVector
export the type used for displacement vectors
Definition: geomechanics/elastic/volumevariables.hh:42
DisplacementVector displacement() const
Returns the displacement vector within the scv in .
Definition: geomechanics/elastic/volumevariables.hh:85
Scalar displacement(unsigned int dir) const
Returns the permeability within the control volume in .
Definition: geomechanics/elastic/volumevariables.hh:81
Scalar solidDensity() const
Return the average porosity within the control volume.
Definition: geomechanics/elastic/volumevariables.hh:77
typename Traits::SolidSystem SolidSystem
export the solid system used
Definition: geomechanics/elastic/volumevariables.hh:48
static constexpr Scalar extrusionFactor()
TODO We don't know yet how to interpret extrusion for mechanics.
Definition: geomechanics/elastic/volumevariables.hh:102
Scalar priVar(const int pvIdx) const
Return a component of primary variable vector for a given index.
Definition: geomechanics/elastic/volumevariables.hh:94
typename ModelTraits::Indices Indices
export the type encapsulating primary variable indices
Definition: geomechanics/elastic/volumevariables.hh:44
typename Traits::PrimaryVariables PrimaryVariables
The elastic model only makes sense with inert solid systems.
Definition: geomechanics/elastic/volumevariables.hh:40
typename Traits::SolidState SolidState
export type of solid state
Definition: geomechanics/elastic/volumevariables.hh:46
const PrimaryVariables & priVars() const
Return the vector of primary variables.
Definition: geomechanics/elastic/volumevariables.hh:98
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:24
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:53
Definition: adapt.hh:17
Update the solid volume fractions (inert and reacitve) and set them in the solidstate.