version 3.8
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// 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_SOLID_ENERGY_VOLUME_VARIABLES_HH
13#define DUMUX_SOLID_ENERGY_VOLUME_VARIABLES_HH
14
15#include <type_traits>
16
20
21namespace Dumux {
22
27template<class Traits>
29{
31 using Scalar = typename Traits::PrimaryVariables::value_type;
32 static constexpr int temperatureIdx = Traits::ModelTraits::Indices::temperatureIdx;
33
34public:
36 using SolidState = typename Traits::SolidState;
38 using SolidSystem = typename Traits::SolidSystem;
39
49 template<class ElemSol, class Problem, class Element, class Scv>
50 void update(const ElemSol& elemSol,
51 const Problem& problem,
52 const Element& element,
53 const Scv& scv)
54 {
55 ParentType::update(elemSol, problem, element, scv);
56 updateTemperature(elemSol, problem, element, scv, solidState_);
57 updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, 0);
58 updateSolidEnergyParams(elemSol, problem, element, scv, solidState_);
59 }
60
62 template<class ElemSol, class Problem, class Element, class Scv>
63 void updateTemperature(const ElemSol& elemSol,
64 const Problem& problem,
65 const Element& element,
66 const Scv& scv,
67 SolidState& solidState)
68 {
69 const Scalar T = elemSol[scv.localDofIndex()][temperatureIdx];
70 solidState.setTemperature(T);
71 }
72
74 template<class ElemSol, class Problem, class Element, class Scv>
75 void updateSolidEnergyParams(const ElemSol &elemSol,
76 const Problem& problem,
77 const Element &element,
78 const Scv &scv,
79 SolidState & solidState)
80 {
81 Scalar cs = solidHeatCapacity_(elemSol, problem, element, scv, solidState);
82 solidState.setHeatCapacity(cs);
83
84 Scalar rhos = solidDensity_(elemSol, problem, element, scv, solidState);
85 solidState.setDensity(rhos);
86
87 Scalar lambdas = solidThermalConductivity_(elemSol, problem, element, scv, solidState);
88 solidState.setThermalConductivity(lambdas);
89 }
90
94 Scalar temperatureSolid() const
95 { return solidState_.temperature(); }
96
100 Scalar temperature() const
101 { return solidState_.temperature(); }
102
107 Scalar solidHeatCapacity() const
108 { return solidState_.heatCapacity(); }
109
114 Scalar solidDensity() const
115 { return solidState_.density(); }
116
121 { return solidState_.thermalConductivity(); }
122
128 { return solidThermalConductivity(); }
129
133 Scalar porosity() const
134 { return solidState_.porosity(); }
135
136private:
138 SolidState solidState_;
139
153 // \{
154
164 template<class ElemSol, class Problem, class Element, class Scv,
165 std::enable_if_t<!Detail::hasSolidHeatCapacity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0>
166 Scalar solidHeatCapacity_(const ElemSol& elemSol,
167 const Problem& problem,
168 const Element& element,
169 const Scv& scv,
170 const SolidState& solidState)
171 {
172 return SolidSystem::heatCapacity(solidState);
173 }
174
184 template<class ElemSol, class Problem, class Element, class Scv,
185 std::enable_if_t<!Detail::hasSolidDensity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0>
186 Scalar solidDensity_(const ElemSol& elemSol,
187 const Problem& problem,
188 const Element& element,
189 const Scv& scv,
190 const SolidState& solidState)
191 {
192 return SolidSystem::density(solidState);
193 }
194
204 template<class ElemSol, class Problem, class Element, class Scv,
205 std::enable_if_t<!Detail::hasSolidThermalConductivity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0>
206 Scalar solidThermalConductivity_(const ElemSol& elemSol,
207 const Problem& problem,
208 const Element& element,
209 const Scv& scv,
210 const SolidState& solidState)
211 {
212 return SolidSystem::thermalConductivity(solidState);
213 }
214
215 // \}
216
221 // \{
222
233 template<class ElemSol, class Problem, class Element, class Scv,
234 std::enable_if_t<Detail::hasSolidHeatCapacity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0>
235 Scalar solidHeatCapacity_(const ElemSol& elemSol,
236 const Problem& problem,
237 const Element& element,
238 const Scv& scv,
239 const SolidState& solidState)
240 {
241 static_assert(Detail::isInertSolidPhase<SolidSystem>::value,
242 "solidHeatCapacity can only be overwritten in the spatial params when the solid system is a simple InertSolidPhase\n"
243 "If you select a proper solid system, the solid heat capacity will be computed as stated in the solid system!");
244 return problem.spatialParams().solidHeatCapacity(element, scv, elemSol, solidState);
245 }
246
257 template<class ElemSol, class Problem, class Element, class Scv,
258 std::enable_if_t<Detail::hasSolidDensity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0>
259 Scalar solidDensity_(const ElemSol& elemSol,
260 const Problem& problem,
261 const Element& element,
262 const Scv& scv,
263 const SolidState& solidState)
264 {
265 static_assert(Detail::isInertSolidPhase<SolidSystem>::value,
266 "solidDensity can only be overwritten in the spatial params when the solid system is a simple InertSolidPhase\n"
267 "If you select a proper solid system, the solid density will be computed as stated in the solid system!");
268 return problem.spatialParams().solidDensity(element, scv, elemSol, solidState);
269 }
270
281 template<class ElemSol, class Problem, class Element, class Scv,
282 std::enable_if_t<Detail::hasSolidThermalConductivity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0>
283 Scalar solidThermalConductivity_(const ElemSol& elemSol,
284 const Problem& problem,
285 const Element& element,
286 const Scv& scv,
287 const SolidState& solidState)
288 {
289 static_assert(Detail::isInertSolidPhase<SolidSystem>::value,
290 "solidThermalConductivity can only be overwritten in the spatial params when the solid system is a simple InertSolidPhase\n"
291 "If you select a proper solid system, the solid thermal conductivity will be computed as stated in the solid system!");
292 return problem.spatialParams().solidThermalConductivity(element, scv, elemSol, solidState);
293 }
294
295 // \}
296
297};
298
299} // end namespace Dumux
300
301#endif
The isothermal base class.
Definition: porousmediumflow/volumevariables.hh:28
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:52
Class for computation of all volume averaged quantities.
Definition: porousmediumflow/solidenergy/volumevariables.hh:29
Scalar temperature() const
Returns the temperature in the sub-control volume.
Definition: porousmediumflow/solidenergy/volumevariables.hh:100
Scalar solidDensity() const
Returns the mass density of the rock matrix in the sub-control volume.
Definition: porousmediumflow/solidenergy/volumevariables.hh:114
Scalar solidHeatCapacity() const
Returns the total heat capacity of the rock matrix in the sub-control volume.
Definition: porousmediumflow/solidenergy/volumevariables.hh:107
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:75
Scalar porosity() const
Return the average porosity within the control volume.
Definition: porousmediumflow/solidenergy/volumevariables.hh:133
Scalar effectiveThermalConductivity() const
Returns the effective thermal conductivity of the solid phase in the sub-control volume....
Definition: porousmediumflow/solidenergy/volumevariables.hh:127
typename Traits::SolidSystem SolidSystem
export the type used for the solid system
Definition: porousmediumflow/solidenergy/volumevariables.hh:38
Scalar temperatureSolid() const
Returns the temperature in the sub-control volume.
Definition: porousmediumflow/solidenergy/volumevariables.hh:94
Scalar solidThermalConductivity() const
Returns the thermal conductivity of the solid phase in the sub-control volume.
Definition: porousmediumflow/solidenergy/volumevariables.hh:120
typename Traits::SolidState SolidState
export the type used for the solid state
Definition: porousmediumflow/solidenergy/volumevariables.hh:36
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:50
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:63
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
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.
Update the solid volume fractions (inert and reacitve) and set them in the solidstate.