Line | Branch | Exec | Source |
---|---|---|---|
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 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup NIModel | ||
10 | * \brief Base class for the model specific class which provides | ||
11 | * access to all volume averaged quantities. | ||
12 | */ | ||
13 | |||
14 | #ifndef DUMUX_ENERGY_VOLUME_VARIABLES_HH | ||
15 | #define DUMUX_ENERGY_VOLUME_VARIABLES_HH | ||
16 | |||
17 | #include <type_traits> | ||
18 | #include <dune/common/std/type_traits.hh> | ||
19 | |||
20 | #include <dumux/material/solidsystems/1csolid.hh> | ||
21 | #include <dumux/porousmediumflow/volumevariables.hh> | ||
22 | |||
23 | namespace Dumux { | ||
24 | |||
25 | #ifndef DOXYGEN | ||
26 | namespace Detail { | ||
27 | // helper structs and functions detecting if the user-defined spatial params class has user-specified functions | ||
28 | // for solidHeatCapacity, solidDensity, and solidThermalConductivity. | ||
29 | |||
30 | template <typename T, typename ...Ts> | ||
31 | using SolidHeatCapacityDetector = decltype(std::declval<T>().solidHeatCapacity(std::declval<Ts>()...)); | ||
32 | |||
33 | template<class T, typename ...Args> | ||
34 | static constexpr bool hasSolidHeatCapacity() | ||
35 | { return Dune::Std::is_detected<SolidHeatCapacityDetector, T, Args...>::value; } | ||
36 | |||
37 | template <typename T, typename ...Ts> | ||
38 | using SolidDensityDetector = decltype(std::declval<T>().solidDensity(std::declval<Ts>()...)); | ||
39 | |||
40 | template<class T, typename ...Args> | ||
41 | static constexpr bool hasSolidDensity() | ||
42 | { return Dune::Std::is_detected<SolidDensityDetector, T, Args...>::value; } | ||
43 | |||
44 | template <typename T, typename ...Ts> | ||
45 | using SolidThermalConductivityDetector = decltype(std::declval<T>().solidThermalConductivity(std::declval<Ts>()...)); | ||
46 | |||
47 | template<class T, typename ...Args> | ||
48 | static constexpr bool hasSolidThermalConductivity() | ||
49 | { return Dune::Std::is_detected<SolidThermalConductivityDetector, T, Args...>::value; } | ||
50 | |||
51 | template<class SolidSystem> | ||
52 | struct isInertSolidPhase : public std::false_type {}; | ||
53 | |||
54 | template<class Scalar, class Component> | ||
55 | struct isInertSolidPhase<SolidSystems::InertSolidPhase<Scalar, Component>> : public std::true_type {}; | ||
56 | |||
57 | } // end namespace Detail | ||
58 | #endif | ||
59 | |||
60 | |||
61 | // forward declaration | ||
62 | template <class IsothermalTraits, class Impl, bool enableEnergyBalance> | ||
63 | class EnergyVolumeVariablesImplementation; | ||
64 | |||
65 | /*! | ||
66 | * \ingroup NIModel | ||
67 | * \brief Base class for the model specific class which provides | ||
68 | * access to all volume averaged quantities. | ||
69 | * | ||
70 | * The volume variables base class is specialized for isothermal and non-isothermal models. | ||
71 | */ | ||
72 | template<class IsothermalTraits, class Impl> | ||
73 | using EnergyVolumeVariables = EnergyVolumeVariablesImplementation<IsothermalTraits,Impl, IsothermalTraits::ModelTraits::enableEnergyBalance()>; | ||
74 | |||
75 | /*! | ||
76 | * \ingroup NIModel | ||
77 | * \brief The isothermal base class | ||
78 | */ | ||
79 | template<class IsothermalTraits, class Impl> | ||
80 | class EnergyVolumeVariablesImplementation<IsothermalTraits, Impl, false> | ||
81 | { | ||
82 | using Scalar = typename IsothermalTraits::PrimaryVariables::value_type; | ||
83 | |||
84 | public: | ||
85 | using FluidState = typename IsothermalTraits::FluidState; | ||
86 | using SolidState = typename IsothermalTraits::SolidState; | ||
87 | using FluidSystem = typename IsothermalTraits::FluidSystem; | ||
88 | |||
89 | //! The temperature is obtained from the problem as a constant for isothermal models | ||
90 | template<class ElemSol, class Problem, class Element, class Scv> | ||
91 | ✗ | void updateTemperature(const ElemSol& elemSol, | |
92 | const Problem& problem, | ||
93 | const Element& element, | ||
94 | const Scv& scv, | ||
95 | FluidState& fluidState, | ||
96 | SolidState& solidState) | ||
97 | { | ||
98 | // retrieve temperature from solution vector, all phases have the same temperature | ||
99 |
8/27✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2940 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 2940 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 12160 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✓ Branch 18 taken 12160 times.
✗ Branch 19 not taken.
✓ Branch 23 taken 80 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 80 times.
✗ Branch 27 not taken.
✓ Branch 29 taken 80 times.
✗ Branch 30 not taken.
✓ Branch 32 taken 80 times.
✗ Branch 33 not taken.
|
217620365 | Scalar T = problem.spatialParams().temperature(element, scv, elemSol); |
100 |
5/5✓ Branch 0 taken 39257424 times.
✓ Branch 1 taken 19628712 times.
✓ Branch 2 taken 178173407 times.
✓ Branch 3 taken 227747520 times.
✓ Branch 4 taken 69444352 times.
|
540997403 | for(int phaseIdx=0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) |
101 | { | ||
102 |
4/8✓ Branch 0 taken 329394 times.
✓ Branch 1 taken 80 times.
✓ Branch 2 taken 2940 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 80 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
727407774 | fluidState.setTemperature(phaseIdx, T); |
103 | } | ||
104 |
8/15✓ Branch 0 taken 5534426 times.
✓ Branch 1 taken 89420529 times.
✓ Branch 2 taken 5534426 times.
✓ Branch 3 taken 89423389 times.
✓ Branch 4 taken 80 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2940 times.
✓ Branch 7 taken 80 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 80 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
385401168 | solidState.setTemperature(T); |
105 | ✗ | } | |
106 | |||
107 | template<class ElemSol, class Problem, class Element, class Scv> | ||
108 | ✗ | void updateSolidEnergyParams(const ElemSol &elemSol, | |
109 | const Problem& problem, | ||
110 | const Element &element, | ||
111 | const Scv &scv, | ||
112 | SolidState & solidState) | ||
113 | ✗ | {} | |
114 | |||
115 | //! The phase enthalpy is zero for isothermal models | ||
116 | //! This is needed for completing the fluid state | ||
117 | template<class FluidState, class ParameterCache> | ||
118 | ✗ | static Scalar enthalpy(const FluidState& fluidState, | |
119 | const ParameterCache& paramCache, | ||
120 | const int phaseIdx) | ||
121 | { | ||
122 | ✗ | return 0; | |
123 | } | ||
124 | |||
125 | //! The effective thermal conductivity is zero for isothermal models | ||
126 | ✗ | void updateEffectiveThermalConductivity() | |
127 | ✗ | {} | |
128 | |||
129 | }; | ||
130 | |||
131 | //! The non-isothermal implicit volume variables base class | ||
132 | template<class Traits, class Impl> | ||
133 | class EnergyVolumeVariablesImplementation<Traits, Impl, true> | ||
134 | { | ||
135 | using Scalar = typename Traits::PrimaryVariables::value_type; | ||
136 | using Idx = typename Traits::ModelTraits::Indices; | ||
137 | using ParentType = PorousMediumFlowVolumeVariables<Traits>; | ||
138 | using EffCondModel = typename Traits::EffectiveThermalConductivityModel; | ||
139 | |||
140 | static constexpr int temperatureIdx = Idx::temperatureIdx; | ||
141 | static constexpr int numEnergyEq = Traits::ModelTraits::numEnergyEq(); | ||
142 | |||
143 | static constexpr bool fullThermalEquilibrium = (numEnergyEq == 1); | ||
144 | static constexpr bool fluidThermalEquilibrium = (numEnergyEq == 2); | ||
145 | |||
146 | public: | ||
147 | // export the fluidstate | ||
148 | using FluidState = typename Traits::FluidState; | ||
149 | //! export the underlying fluid system | ||
150 | using FluidSystem = typename Traits::FluidSystem; | ||
151 | //! Export the indices | ||
152 | using Indices = Idx; | ||
153 | // export the solidstate | ||
154 | using SolidState = typename Traits::SolidState; | ||
155 | //! export the underlying solid system | ||
156 | using SolidSystem = typename Traits::SolidSystem; | ||
157 | |||
158 | //! The temperature is obtained from the problem as a constant for isothermal models | ||
159 | template<class ElemSol, class Problem, class Element, class Scv> | ||
160 | ✗ | void updateTemperature(const ElemSol& elemSol, | |
161 | const Problem& problem, | ||
162 | const Element& element, | ||
163 | const Scv& scv, | ||
164 | FluidState& fluidState, | ||
165 | SolidState& solidState) | ||
166 | { | ||
167 | if constexpr (fullThermalEquilibrium) | ||
168 | { | ||
169 | // retrieve temperature from solution vector, all phases have the same temperature | ||
170 |
0/4✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
137618050 | const Scalar T = elemSol[scv.localDofIndex()][temperatureIdx]; |
171 |
6/6✓ Branch 0 taken 1070182 times.
✓ Branch 1 taken 535091 times.
✓ Branch 2 taken 139140872 times.
✓ Branch 3 taken 66977341 times.
✓ Branch 4 taken 7142 times.
✓ Branch 5 taken 3571 times.
|
215952631 | for(int phaseIdx=0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) |
172 | { | ||
173 |
0/2✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
289955688 | fluidState.setTemperature(phaseIdx, T); |
174 | } | ||
175 |
4/6✓ Branch 0 taken 4555987 times.
✓ Branch 1 taken 1689964 times.
✓ Branch 2 taken 4555987 times.
✓ Branch 3 taken 1689964 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
154070598 | solidState.setTemperature(T); |
176 | } | ||
177 | |||
178 | else | ||
179 | { | ||
180 | // this means we have 1 temp for fluid phase, one for solid | ||
181 | if constexpr (fluidThermalEquilibrium) | ||
182 | { | ||
183 | 2783646 | const Scalar T = elemSol[scv.localDofIndex()][temperatureIdx]; | |
184 | ✗ | for(int phaseIdx=0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) | |
185 | { | ||
186 | 1391823 | fluidState.setTemperature(phaseIdx, T); | |
187 | } | ||
188 | } | ||
189 | // this is for numEnergyEqFluid > 1 | ||
190 | else | ||
191 | { | ||
192 |
2/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1572480 times.
✓ Branch 3 taken 786240 times.
|
2358720 | for(int phaseIdx=0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) |
193 | { | ||
194 | // retrieve temperatures from solution vector, phases might have different temperature | ||
195 | 3144960 | const Scalar T = elemSol[scv.localDofIndex()][temperatureIdx + phaseIdx]; | |
196 | 3144960 | fluidState.setTemperature(phaseIdx, T); | |
197 | } | ||
198 | } | ||
199 | 4356126 | const Scalar solidTemperature = elemSol[scv.localDofIndex()][temperatureIdx+numEnergyEq-1]; | |
200 | 4356126 | solidState.setTemperature(solidTemperature); | |
201 | } | ||
202 | ✗ | } | |
203 | |||
204 | template<class ElemSol, class Problem, class Element, class Scv> | ||
205 | ✗ | void updateSolidEnergyParams(const ElemSol &elemSol, | |
206 | const Problem& problem, | ||
207 | const Element &element, | ||
208 | const Scv &scv, | ||
209 | SolidState & solidState) | ||
210 | { | ||
211 | 222296 | Scalar cs = solidHeatCapacity_(elemSol, problem, element, scv, solidState); | |
212 | 111148 | solidState.setHeatCapacity(cs); | |
213 | |||
214 | 222296 | Scalar rhos = solidDensity_(elemSol, problem, element, scv, solidState); | |
215 | 111148 | solidState.setDensity(rhos); | |
216 | |||
217 | 222296 | Scalar lambdas = solidThermalConductivity_(elemSol, problem, element, scv, solidState); | |
218 | 222296 | solidState.setThermalConductivity(lambdas); | |
219 | ✗ | } | |
220 | |||
221 | // updates the effective thermal conductivity | ||
222 | 2178063 | void updateEffectiveThermalConductivity() | |
223 | { | ||
224 | if constexpr (fullThermalEquilibrium) | ||
225 | { | ||
226 | // Full Thermal Equilibirum: One effectiveThermalConductivity value for all phases (solid & fluid). | ||
227 |
2/2✓ Branch 1 taken 19221 times.
✓ Branch 2 taken 13 times.
|
83617928 | lambdaEff_[0] = EffCondModel::effectiveThermalConductivity(asImp_()); |
228 | } | ||
229 | else if constexpr (fluidThermalEquilibrium) | ||
230 | { | ||
231 | // Fluid Thermal Equilibrium (Partial Nonequilibrium): One effectiveThermalConductivity for the fluids, one for the solids. | ||
232 | 1391823 | Scalar fluidLambda = 0.0; | |
233 |
2/2✓ Branch 0 taken 1391823 times.
✓ Branch 1 taken 1391823 times.
|
2783646 | for (int phaseIdx = 0; phaseIdx < FluidSystem::numPhases; phaseIdx++) |
234 | 1391823 | fluidLambda += fluidThermalConductivity(phaseIdx) * asImp_().saturation(phaseIdx) * asImp_().porosity(); | |
235 | |||
236 | 2783646 | lambdaEff_[0] = fluidLambda; | |
237 | 6959115 | lambdaEff_[numEnergyEq-1] = solidThermalConductivity() * (1.0 - asImp_().porosity()); | |
238 | } | ||
239 | else | ||
240 | { | ||
241 | // Full Thermal Nonequilibrium: One effectiveThermal Conductivity per phase (solid & fluid). | ||
242 |
2/2✓ Branch 0 taken 1572480 times.
✓ Branch 1 taken 786240 times.
|
2358720 | for (int phaseIdx = 0; phaseIdx < FluidSystem::numPhases; phaseIdx++) |
243 | 3144960 | lambdaEff_[phaseIdx] = fluidThermalConductivity(phaseIdx) * asImp_().saturation(phaseIdx) * asImp_().porosity(); | |
244 | 3931200 | lambdaEff_[numEnergyEq-1] = solidThermalConductivity() * (1.0 - asImp_().porosity()); | |
245 | } | ||
246 | 2178063 | } | |
247 | |||
248 | /*! | ||
249 | * \brief Returns the total internal energy of a phase in the | ||
250 | * sub-control volume. | ||
251 | * | ||
252 | * \param phaseIdx The phase index | ||
253 | */ | ||
254 | Scalar internalEnergy(const int phaseIdx) const | ||
255 | 1623591936 | { return asImp_().fluidState().internalEnergy(phaseIdx); } | |
256 | |||
257 | /*! | ||
258 | * \brief Returns the total enthalpy of a phase in the sub-control | ||
259 | * volume. | ||
260 | * | ||
261 | * \param phaseIdx The phase index | ||
262 | */ | ||
263 | ✗ | Scalar enthalpy(const int phaseIdx) const | |
264 |
12/12✓ Branch 0 taken 862069 times.
✓ Branch 1 taken 72 times.
✓ Branch 2 taken 862069 times.
✓ Branch 3 taken 72 times.
✓ Branch 4 taken 862069 times.
✓ Branch 5 taken 72 times.
✓ Branch 6 taken 1135459 times.
✓ Branch 7 taken 48356 times.
✓ Branch 8 taken 1135459 times.
✓ Branch 9 taken 48356 times.
✓ Branch 10 taken 1135459 times.
✓ Branch 11 taken 48356 times.
|
2289279850 | { return asImp_().fluidState().enthalpy(phaseIdx); } |
265 | |||
266 | /*! | ||
267 | * \brief Returns the temperature in fluid / solid phase(s) | ||
268 | * the sub-control volume. | ||
269 | */ | ||
270 | Scalar temperatureSolid() const | ||
271 |
0/4✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
48667820 | { return asImp_().solidState().temperature(); } |
272 | |||
273 | |||
274 | /*! | ||
275 | * \brief Returns the temperature of a fluid phase assuming thermal nonequilibrium | ||
276 | * the sub-control volume. | ||
277 | * \param phaseIdx The local index of the phases | ||
278 | */ | ||
279 | ✗ | Scalar temperatureFluid(const int phaseIdx) const | |
280 |
0/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
95909420 | { return asImp_().fluidState().temperature(phaseIdx); } |
281 | |||
282 | /*! | ||
283 | * \brief Returns the total heat capacity \f$\mathrm{[J/(kg K)]}\f$ of the rock matrix in | ||
284 | * the sub-control volume. | ||
285 | */ | ||
286 | Scalar solidHeatCapacity() const | ||
287 |
2/4✓ Branch 1 taken 327 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 327 times.
✗ Branch 5 not taken.
|
556597918 | { return asImp_().solidState().heatCapacity(); } |
288 | |||
289 | /*! | ||
290 | * \brief Returns the mass density \f$\mathrm{[kg/m^3]}\f$ of the rock matrix in | ||
291 | * the sub-control volume. | ||
292 | */ | ||
293 | Scalar solidDensity() const | ||
294 |
2/4✓ Branch 1 taken 327 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 327 times.
✗ Branch 5 not taken.
|
556597918 | { return asImp_().solidState().density(); } |
295 | |||
296 | /*! | ||
297 | * \brief Returns the thermal conductivity \f$\mathrm{[W/(m*K)]}\f$ | ||
298 | * of the solid phase in the sub-control volume. | ||
299 | */ | ||
300 | Scalar solidThermalConductivity() const | ||
301 |
2/4✓ Branch 0 taken 2362080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2362080 times.
✗ Branch 3 not taken.
|
185963394 | { return asImp_().solidState().thermalConductivity(); } |
302 | |||
303 | /*! | ||
304 | * \brief Returns the thermal conductivity \f$\mathrm{[W/(m*K)]}\f$ | ||
305 | * of a fluid phase in the sub-control volume. | ||
306 | */ | ||
307 | ✗ | Scalar fluidThermalConductivity(const int phaseIdx) const | |
308 |
8/16✓ Branch 0 taken 506352 times.
✓ Branch 1 taken 506352 times.
✓ Branch 2 taken 506352 times.
✓ Branch 3 taken 506352 times.
✓ Branch 4 taken 1012704 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1012704 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1012704 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1012704 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
198297134 | { return FluidSystem::thermalConductivity(asImp_().fluidState(), phaseIdx); } |
309 | |||
310 | /*! | ||
311 | * \brief Returns the effective thermal conductivity \f$\mathrm{[W/(m*K)]}\f$ in | ||
312 | * the sub-control volume. Specific to equilibirum models (case fullThermalEquilibrium). | ||
313 | */ | ||
314 | template< bool enable = fullThermalEquilibrium, | ||
315 | std::enable_if_t<enable, int> = 0> | ||
316 | Scalar effectiveThermalConductivity() const | ||
317 |
12/16✓ Branch 0 taken 134722764 times.
✓ Branch 1 taken 788 times.
✓ Branch 2 taken 134722764 times.
✓ Branch 3 taken 788 times.
✓ Branch 4 taken 134722764 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 134722764 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 10976 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 38948 times.
✓ Branch 11 taken 4634448 times.
✓ Branch 12 taken 38948 times.
✓ Branch 13 taken 27972 times.
✓ Branch 14 taken 4617452 times.
✗ Branch 15 not taken.
|
833172140 | { return lambdaEff_[0]; } |
318 | |||
319 | /*! | ||
320 | * \brief Returns the effective thermal conductivity \f$\mathrm{[W/(m*K)]}\f$ of the fluids in | ||
321 | * the sub-control volume. Specific to partially nonequilibrium models (case fluidThermalEquilibrium). | ||
322 | */ | ||
323 | template< bool enable = fluidThermalEquilibrium, | ||
324 | std::enable_if_t<enable, int> = 0> | ||
325 | Scalar effectiveFluidThermalConductivity() const | ||
326 | 12001180 | { return lambdaEff_[0]; } | |
327 | |||
328 | /*! | ||
329 | * \brief Returns the effective thermal conductivity \f$\mathrm{[W/(m*K)]}\f$ | ||
330 | * of the solid phase in the sub-control volume. | ||
331 | * Specific to partially nonequilibrium models (case fluidThermalEquilibrium) | ||
332 | */ | ||
333 | template< bool enable = fluidThermalEquilibrium, | ||
334 | std::enable_if_t<enable, int> = 0> | ||
335 | Scalar effectiveSolidThermalConductivity() const | ||
336 | 12001180 | { return lambdaEff_[numEnergyEq-1]; } | |
337 | |||
338 | /*! | ||
339 | * \brief Returns the effective thermal conductivity \f$\mathrm{[W/(m*K)]}\f$ | ||
340 | * per fluid phase in the sub-control volume. | ||
341 | * Specific to nonequilibrium models (case full non-equilibrium) | ||
342 | */ | ||
343 | template< bool enable = (!fullThermalEquilibrium && !fluidThermalEquilibrium), | ||
344 | std::enable_if_t<enable, int> = 0> | ||
345 | Scalar effectivePhaseThermalConductivity(const int phaseIdx) const | ||
346 |
4/8✓ Branch 0 taken 7086240 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7086240 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7086240 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7086240 times.
✗ Branch 7 not taken.
|
28344960 | { return lambdaEff_[phaseIdx]; } |
347 | |||
348 | //! The phase enthalpy is zero for isothermal models | ||
349 | //! This is needed for completing the fluid state | ||
350 | template<class ParameterCache> | ||
351 | ✗ | static Scalar enthalpy(const FluidState& fluidState, | |
352 | const ParameterCache& paramCache, | ||
353 | const int phaseIdx) | ||
354 | { | ||
355 |
1/2✓ Branch 2 taken 1921396 times.
✗ Branch 3 not taken.
|
150051784 | return FluidSystem::enthalpy(fluidState, paramCache, phaseIdx); |
356 | } | ||
357 | |||
358 | protected: | ||
359 | const Impl &asImp_() const { return *static_cast<const Impl*>(this); } | ||
360 | 5037183 | Impl &asImp_() { return *static_cast<Impl*>(this); } | |
361 | |||
362 | private: | ||
363 | /*! | ||
364 | * It has to be decided if the full solid system / solid state interface is used (general option, but more complicated), | ||
365 | * or the simple nonisothermal spatial params interface (simpler but less general). | ||
366 | * In the simple nonisothermal spatial params interface the functions solidHeatCapacity, solidDensity, and solidThermalConductivity | ||
367 | * in the spatial params overwrite the parameters given in the solid system. This only makes sense in combination | ||
368 | * with the simplest solid system InertSolidPhase, and can be used to quickly change parameters in certain domain regions. | ||
369 | * For setups with more general solids with several components these functions should not exist. Instead, the solid system | ||
370 | * determines the values for solidHeatCapacity, solidDensity, and solidThermalConductivity depending on the given composition. | ||
371 | */ | ||
372 | |||
373 | /*! | ||
374 | * \name Access functions for the solidsystem / solidstate interface | ||
375 | */ | ||
376 | // \{ | ||
377 | |||
378 | /*! | ||
379 | * \brief Gets the solid heat capacity in an scv. | ||
380 | * | ||
381 | * \param elemSol the element solution vector | ||
382 | * \param problem the problem to solve | ||
383 | * \param element the element (codim-0-entity) the scv belongs to | ||
384 | * \param scv the sub control volume | ||
385 | * \param solidState the solid state | ||
386 | * \note this gets selected if the user uses the solidsystem / solidstate interface | ||
387 | */ | ||
388 | template<class ElemSol, class Problem, class Element, class Scv, | ||
389 | std::enable_if_t<!Detail::hasSolidHeatCapacity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0> | ||
390 | ✗ | Scalar solidHeatCapacity_(const ElemSol& elemSol, | |
391 | const Problem& problem, | ||
392 | const Element& element, | ||
393 | const Scv& scv, | ||
394 | const SolidState& solidState) | ||
395 | { | ||
396 | 111148 | return SolidSystem::heatCapacity(solidState); | |
397 | } | ||
398 | |||
399 | /*! | ||
400 | * \brief Gets the solid density in an scv. | ||
401 | * | ||
402 | * \param elemSol the element solution vector | ||
403 | * \param problem the problem to solve | ||
404 | * \param element the element (codim-0-entity) the scv belongs to | ||
405 | * \param scv the sub control volume | ||
406 | * \param solidState the solid state | ||
407 | * \note this gets selected if the user uses the solidsystem / solidstate interface | ||
408 | */ | ||
409 | template<class ElemSol, class Problem, class Element, class Scv, | ||
410 | std::enable_if_t<!Detail::hasSolidDensity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0> | ||
411 | ✗ | Scalar solidDensity_(const ElemSol& elemSol, | |
412 | const Problem& problem, | ||
413 | const Element& element, | ||
414 | const Scv& scv, | ||
415 | const SolidState& solidState) | ||
416 | { | ||
417 | 111148 | return SolidSystem::density(solidState); | |
418 | } | ||
419 | |||
420 | /*! | ||
421 | * \brief Gets the solid's thermal conductivity in an scv. | ||
422 | * | ||
423 | * \param elemSol the element solution vector | ||
424 | * \param problem the problem to solve | ||
425 | * \param element the element (codim-0-entity) the scv belongs to | ||
426 | * \param scv the sub control volume | ||
427 | * \param solidState the solid state | ||
428 | * \note this gets selected if the user uses the solidsystem / solidstate interface | ||
429 | */ | ||
430 | template<class ElemSol, class Problem, class Element, class Scv, | ||
431 | std::enable_if_t<!Detail::hasSolidThermalConductivity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0> | ||
432 | ✗ | Scalar solidThermalConductivity_(const ElemSol& elemSol, | |
433 | const Problem& problem, | ||
434 | const Element& element, | ||
435 | const Scv& scv, | ||
436 | const SolidState& solidState) | ||
437 | { | ||
438 | 111148 | return SolidSystem::thermalConductivity(solidState); | |
439 | } | ||
440 | |||
441 | // \} | ||
442 | |||
443 | /*! | ||
444 | * \name Access functions for the simple nonisothermal spatial params interface in | ||
445 | * combination with an InertSolidPhase as solid system | ||
446 | */ | ||
447 | // \{ | ||
448 | |||
449 | /*! | ||
450 | * \brief Gets the solid heat capacity in an scv. | ||
451 | * | ||
452 | * \param elemSol the element solution vector | ||
453 | * \param problem the problem to solve | ||
454 | * \param element the element (codim-0-entity) the scv belongs to | ||
455 | * \param scv the sub control volume | ||
456 | * \param solidState the solid state | ||
457 | * \note this gets selected if the user uses the simple spatial params interface in | ||
458 | * combination with an InertSolidPhase as solid system | ||
459 | */ | ||
460 | template<class ElemSol, class Problem, class Element, class Scv, | ||
461 | std::enable_if_t<Detail::hasSolidHeatCapacity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0> | ||
462 | ✗ | Scalar solidHeatCapacity_(const ElemSol& elemSol, | |
463 | const Problem& problem, | ||
464 | const Element& element, | ||
465 | const Scv& scv, | ||
466 | const SolidState& solidState) | ||
467 | { | ||
468 | static_assert(Detail::isInertSolidPhase<SolidSystem>::value, | ||
469 | "solidHeatCapacity can only be overwritten in the spatial params when the solid system is a simple InertSolidPhase\n" | ||
470 | "If you select a proper solid system, the solid heat capacity will be computed as stated in the solid system!"); | ||
471 | ✗ | return problem.spatialParams().solidHeatCapacity(element, scv, elemSol, solidState); | |
472 | } | ||
473 | |||
474 | /*! | ||
475 | * \brief Gets the solid density in an scv. | ||
476 | * | ||
477 | * \param elemSol the element solution vector | ||
478 | * \param problem the problem to solve | ||
479 | * \param element the element (codim-0-entity) the scv belongs to | ||
480 | * \param scv the sub control volume | ||
481 | * \param solidState the solid state | ||
482 | * \note this gets selected if the user uses the simple spatial params interface in | ||
483 | * combination with an InertSolidPhase as solid system | ||
484 | */ | ||
485 | template<class ElemSol, class Problem, class Element, class Scv, | ||
486 | std::enable_if_t<Detail::hasSolidDensity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0> | ||
487 | Scalar solidDensity_(const ElemSol& elemSol, | ||
488 | const Problem& problem, | ||
489 | const Element& element, | ||
490 | const Scv& scv, | ||
491 | const SolidState& solidState) | ||
492 | { | ||
493 | static_assert(Detail::isInertSolidPhase<SolidSystem>::value, | ||
494 | "solidDensity can only be overwritten in the spatial params when the solid system is a simple InertSolidPhase\n" | ||
495 | "If you select a proper solid system, the solid density will be computed as stated in the solid system!"); | ||
496 | return problem.spatialParams().solidDensity(element, scv, elemSol, solidState); | ||
497 | } | ||
498 | |||
499 | /*! | ||
500 | * \brief Gets the solid's heat capacity in an scv. | ||
501 | * | ||
502 | * \param elemSol the element solution vector | ||
503 | * \param problem the problem to solve | ||
504 | * \param element the element (codim-0-entity) the scv belongs to | ||
505 | * \param scv the sub control volume | ||
506 | * \param solidState the solid state | ||
507 | * \note this gets selected if the user uses the simple spatial params interface in | ||
508 | * combination with an InertSolidPhase as solid system | ||
509 | */ | ||
510 | template<class ElemSol, class Problem, class Element, class Scv, | ||
511 | std::enable_if_t<Detail::hasSolidThermalConductivity<typename Problem::SpatialParams, Element, Scv, ElemSol, SolidState>(), int> = 0> | ||
512 | Scalar solidThermalConductivity_(const ElemSol& elemSol, | ||
513 | const Problem& problem, | ||
514 | const Element& element, | ||
515 | const Scv& scv, | ||
516 | const SolidState& solidState) | ||
517 | { | ||
518 | static_assert(Detail::isInertSolidPhase<SolidSystem>::value, | ||
519 | "solidThermalConductivity can only be overwritten in the spatial params when the solid system is a simple InertSolidPhase\n" | ||
520 | "If you select a proper solid system, the solid thermal conductivity will be computed as stated in the solid system!"); | ||
521 | return problem.spatialParams().solidThermalConductivity(element, scv, elemSol, solidState); | ||
522 | } | ||
523 | |||
524 | std::array<Scalar, numEnergyEq> lambdaEff_; | ||
525 | // \} | ||
526 | |||
527 | }; | ||
528 | |||
529 | } // end namespace Dumux | ||
530 | |||
531 | #endif | ||
532 |