3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porousmediumflow/solidenergy/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 2 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_SOLID_ENERGY_VOLUME_VARIABLES_HH
25#define DUMUX_SOLID_ENERGY_VOLUME_VARIABLES_HH
26
27#include <type_traits>
28
32
33namespace Dumux {
34
39template<class Traits>
41{
43 using Scalar = typename Traits::PrimaryVariables::value_type;
44 static constexpr int temperatureIdx = Traits::ModelTraits::Indices::temperatureIdx;
45
46public:
48 using SolidState = typename Traits::SolidState;
50 using SolidSystem = typename Traits::SolidSystem;
51
61 template<class ElemSol, class Problem, class Element, class Scv>
62 void update(const ElemSol& elemSol,
63 const Problem& problem,
64 const Element& element,
65 const Scv& scv)
66 {
67 ParentType::update(elemSol, problem, element, scv);
68 updateTemperature(elemSol, problem, element, scv, solidState_);
69 updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, 0);
70 updateSolidEnergyParams(elemSol, problem, element, scv, solidState_);
71 }
72
74 template<class ElemSol, class Problem, class Element, class Scv>
75 void updateTemperature(const ElemSol& elemSol,
76 const Problem& problem,
77 const Element& element,
78 const Scv& scv,
79 SolidState& solidState)
80 {
81 const Scalar T = elemSol[scv.localDofIndex()][temperatureIdx];
82 solidState.setTemperature(T);
83 }
84
86 template<class ElemSol, class Problem, class Element, class Scv>
87 void updateSolidEnergyParams(const ElemSol &elemSol,
88 const Problem& problem,
89 const Element &element,
90 const Scv &scv,
91 SolidState & solidState)
92 {
93 Scalar cs = solidHeatCapacity_(elemSol, problem, element, scv, solidState);
94 solidState.setHeatCapacity(cs);
95
96 Scalar rhos = solidDensity_(elemSol, problem, element, scv, solidState);
97 solidState.setDensity(rhos);
98
99 Scalar lambdas = solidThermalConductivity_(elemSol, problem, element, scv, solidState);
100 solidState.setThermalConductivity(lambdas);
101 }
102
106 Scalar temperatureSolid() const
107 { return solidState_.temperature(); }
108
112 Scalar temperature() const
113 { return solidState_.temperature(); }
114
119 Scalar solidHeatCapacity() const
120 { return solidState_.heatCapacity(); }
121
126 Scalar solidDensity() const
127 { return solidState_.density(); }
128
133 { return solidState_.thermalConductivity(); }
134
138 Scalar porosity() const
139 { return solidState_.porosity(); }
140
141private:
143 SolidState solidState_;
144
158 // \{
159
169 template<class ElemSol, class Problem, class Element, class Scv,
170 std::enable_if_t<!Detail::hasSolidHeatCapacity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0>
171 Scalar solidHeatCapacity_(const ElemSol& elemSol,
172 const Problem& problem,
173 const Element& element,
174 const Scv& scv,
175 const SolidState& solidState)
176 {
177 return SolidSystem::heatCapacity(solidState);
178 }
179
189 template<class ElemSol, class Problem, class Element, class Scv,
190 std::enable_if_t<!Detail::hasSolidDensity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0>
191 Scalar solidDensity_(const ElemSol& elemSol,
192 const Problem& problem,
193 const Element& element,
194 const Scv& scv,
195 const SolidState& solidState)
196 {
197 return SolidSystem::density(solidState);
198 }
199
209 template<class ElemSol, class Problem, class Element, class Scv,
210 std::enable_if_t<!Detail::hasSolidThermalConductivity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0>
211 Scalar solidThermalConductivity_(const ElemSol& elemSol,
212 const Problem& problem,
213 const Element& element,
214 const Scv& scv,
215 const SolidState& solidState)
216 {
217 return SolidSystem::thermalConductivity(solidState);
218 }
219
220 // \}
221
226 // \{
227
238 template<class ElemSol, class Problem, class Element, class Scv,
239 std::enable_if_t<Detail::hasSolidHeatCapacity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0>
240 Scalar solidHeatCapacity_(const ElemSol& elemSol,
241 const Problem& problem,
242 const Element& element,
243 const Scv& scv,
244 const SolidState& solidState)
245 {
246 static_assert(Detail::isInertSolidPhase<SolidSystem>::value,
247 "solidHeatCapacity can only be overwritten in the spatial params when the solid system is a simple InertSolidPhase\n"
248 "If you select a proper solid system, the solid heat capacity will be computed as stated in the solid system!");
249 return problem.spatialParams().solidHeatCapacity(element, scv, elemSol, solidState);
250 }
251
262 template<class ElemSol, class Problem, class Element, class Scv,
263 std::enable_if_t<Detail::hasSolidDensity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0>
264 Scalar solidDensity_(const ElemSol& elemSol,
265 const Problem& problem,
266 const Element& element,
267 const Scv& scv,
268 const SolidState& solidState)
269 {
270 static_assert(Detail::isInertSolidPhase<SolidSystem>::value,
271 "solidDensity can only be overwritten in the spatial params when the solid system is a simple InertSolidPhase\n"
272 "If you select a proper solid system, the solid density will be computed as stated in the solid system!");
273 return problem.spatialParams().solidDensity(element, scv, elemSol, solidState);
274 }
275
286 template<class ElemSol, class Problem, class Element, class Scv,
287 std::enable_if_t<Detail::hasSolidThermalConductivity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0>
288 Scalar solidThermalConductivity_(const ElemSol& elemSol,
289 const Problem& problem,
290 const Element& element,
291 const Scv& scv,
292 const SolidState& solidState)
293 {
294 static_assert(Detail::isInertSolidPhase<SolidSystem>::value,
295 "solidThermalConductivity can only be overwritten in the spatial params when the solid system is a simple InertSolidPhase\n"
296 "If you select a proper solid system, the solid thermal conductivity will be computed as stated in the solid system!");
297 return problem.spatialParams().solidThermalConductivity(element, scv, elemSol, solidState);
298 }
299
300 // \}
301
302};
303
304} // end namespace Dumux
305
306#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
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Class for computation of all volume averaged quantities.
Definition: porousmediumflow/solidenergy/volumevariables.hh:41
Scalar temperature() const
Returns the temperature in the sub-control volume.
Definition: porousmediumflow/solidenergy/volumevariables.hh:112
Scalar solidDensity() const
Returns the mass density of the rock matrix in the sub-control volume.
Definition: porousmediumflow/solidenergy/volumevariables.hh:126
Scalar solidHeatCapacity() const
Returns the total heat capacity of the rock matrix in the sub-control volume.
Definition: porousmediumflow/solidenergy/volumevariables.hh:119
void updateSolidEnergyParams(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv, SolidState &solidState)
Fill solid matrix parameters in the solid state.
Definition: porousmediumflow/solidenergy/volumevariables.hh:87
Scalar porosity() const
Return the average porosity within the control volume.
Definition: porousmediumflow/solidenergy/volumevariables.hh:138
typename Traits::SolidSystem SolidSystem
export the type used for the solid system
Definition: porousmediumflow/solidenergy/volumevariables.hh:50
Scalar temperatureSolid() const
Returns the temperature in the sub-control volume.
Definition: porousmediumflow/solidenergy/volumevariables.hh:106
Scalar solidThermalConductivity() const
Returns the thermal conductivity of the solid phase in the sub-control volume.
Definition: porousmediumflow/solidenergy/volumevariables.hh:132
typename Traits::SolidState SolidState
export the type used for the solid state
Definition: porousmediumflow/solidenergy/volumevariables.hh:48
void update(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv)
Update all quantities for a given control volume.
Definition: porousmediumflow/solidenergy/volumevariables.hh:62
void updateTemperature(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv, SolidState &solidState)
Fill temperature in the solid state.
Definition: porousmediumflow/solidenergy/volumevariables.hh:75
The isothermal base class.
Definition: porousmediumflow/volumevariables.hh:40
void update(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv)
Updates all quantities for a given control volume.
Definition: porousmediumflow/volumevariables.hh:64
Base class for the model specific class which provides access to all volume averaged quantities.
Base class for the model specific class which provides access to all volume averaged quantities.