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-FileCopyrightText: 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 FluidSystems | ||
10 | * \brief @copybrief Dumux::FluidSystems::Base | ||
11 | */ | ||
12 | #ifndef DUMUX_BASE_FLUID_SYSTEM_HH | ||
13 | #define DUMUX_BASE_FLUID_SYSTEM_HH | ||
14 | |||
15 | #include <string> | ||
16 | |||
17 | #include <dune/common/exceptions.hh> | ||
18 | #include <dumux/common/typetraits/typetraits.hh> | ||
19 | #include "nullparametercache.hh" | ||
20 | |||
21 | namespace Dumux::FluidSystems { | ||
22 | |||
23 | /*! | ||
24 | * \ingroup FluidSystems | ||
25 | * \brief Fluid system base class. | ||
26 | * | ||
27 | * \note Always derive your fluid system from this class to be sure | ||
28 | * that all basic functionality is available! | ||
29 | */ | ||
30 | template <class ScalarType, class Implementation> | ||
31 | class Base | ||
32 | { | ||
33 | public: | ||
34 | //! export the scalar type | ||
35 | using Scalar = ScalarType; | ||
36 | |||
37 | //! The type of parameter cache objects | ||
38 | using ParameterCache = NullParameterCache; | ||
39 | |||
40 | /*! | ||
41 | * \brief Some properties of the fluid system | ||
42 | */ | ||
43 | // \{ | ||
44 | |||
45 | //! If the fluid system only contains tracer components | ||
46 | static constexpr bool isTracerFluidSystem() | ||
47 | { return false; } | ||
48 | |||
49 | /*! | ||
50 | * \brief Get the main component of a given phase if possible | ||
51 | * | ||
52 | * \param phaseIdx The index of the fluid phase to consider | ||
53 | * \todo Unfortunately we currently still have the assumption in some volume variables (e.g. 1pnc, 2pnc) | ||
54 | * that the main component index of a phase is equal to the phase index of that phase. This means | ||
55 | * changing this only works if the volume variables are written accordingly. | ||
56 | * \note This only makes sense if this is not a tracer fluid system (then the bulk component is not balanced) | ||
57 | */ | ||
58 | template<class I = Implementation, std::enable_if_t<!I::isTracerFluidSystem(), int> = 0> | ||
59 | static constexpr int getMainComponent(int phaseIdx) | ||
60 | { return phaseIdx; } | ||
61 | |||
62 | /*! | ||
63 | * \brief Returns true if and only if a fluid phase is assumed to | ||
64 | * be compressible. | ||
65 | * | ||
66 | * Compressible means that the partial derivative of the density | ||
67 | * to the fluid pressure is always larger than zero. | ||
68 | * | ||
69 | * \param phaseIdx The index of the fluid phase to consider | ||
70 | */ | ||
71 | template<class T = Implementation> | ||
72 | static constexpr bool isCompressible(int phaseIdx) | ||
73 | { | ||
74 | static_assert(AlwaysFalse<T>::value, "Mandatory function not implemented: isCompressible(phaseIdx)"); | ||
75 | return true; | ||
76 | } | ||
77 | |||
78 | /*! | ||
79 | * \brief Returns whether the fluids are miscible | ||
80 | */ | ||
81 | template<class T = Implementation> | ||
82 | static constexpr bool isMiscible() | ||
83 | { | ||
84 | static_assert(AlwaysFalse<T>::value, "Mandatory function not implemented: isMiscible()"); | ||
85 | return true; | ||
86 | } | ||
87 | |||
88 | /*! | ||
89 | * \brief Returns true if and only if a fluid phase is assumed to | ||
90 | * have a constant viscosity. | ||
91 | * | ||
92 | * \param phaseIdx The index of the fluid phase to consider | ||
93 | */ | ||
94 | static constexpr bool viscosityIsConstant(int phaseIdx) | ||
95 | { return false; } | ||
96 | |||
97 | /*! | ||
98 | * \brief Return the human readable name of a fluid phase | ||
99 | * | ||
100 | * \param phaseIdx The index of the fluid phase to consider | ||
101 | */ | ||
102 | 51 | static std::string phaseName(int phaseIdx) | |
103 | 51 | { return "DefaultPhaseName"; } | |
104 | |||
105 | /*! | ||
106 | * \brief Return the human readable name of a fluid phase | ||
107 | * | ||
108 | * \param phaseIdx The index of the fluid phase to consider | ||
109 | */ | ||
110 | static std::string componentName(int phaseIdx) | ||
111 | { return "DefaultComponentName"; } | ||
112 | |||
113 | // \} | ||
114 | |||
115 | /*! | ||
116 | * \brief Calculate the density \f$\mathrm{[kg/m^3]}\f$ of a fluid phase | ||
117 | * \param fluidState The fluid state | ||
118 | * \param phaseIdx Index of the fluid phase | ||
119 | */ | ||
120 | template <class FluidState> | ||
121 | static Scalar density(const FluidState &fluidState, | ||
122 | int phaseIdx) | ||
123 | { | ||
124 | DUNE_THROW(Dune::NotImplemented, "density() method not implemented by the fluid system."); | ||
125 | } | ||
126 | |||
127 | /*! | ||
128 | * \brief Calculate the density \f$\mathrm{[kg/m^3]}\f$ of a fluid phase | ||
129 | * \param fluidState The fluid state | ||
130 | * \param paramCache mutable parameters | ||
131 | * \param phaseIdx Index of the fluid phase | ||
132 | */ | ||
133 | template <class FluidState> | ||
134 |
2/5✓ Branch 1 taken 60891342 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 0 taken 60891342 times.
|
704446340 | static Scalar density(const FluidState &fluidState, |
135 | const ParameterCache ¶mCache, | ||
136 | int phaseIdx) | ||
137 | { | ||
138 |
38/76✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 2 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 2 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 2 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 2 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 2 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 2 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 3 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 3 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 3 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 2 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 2 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 2 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 2 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 2 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 2 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 2 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 2 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 2 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 2 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 2 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 2 times.
✗ Branch 83 not taken.
✓ Branch 85 taken 2 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 2 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 2 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 2 times.
✗ Branch 95 not taken.
✓ Branch 97 taken 1 times.
✗ Branch 98 not taken.
✓ Branch 100 taken 3 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 2 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 2 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 2 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 2 times.
✗ Branch 113 not taken.
|
626913159 | return Implementation::density(fluidState, phaseIdx); |
139 | } | ||
140 | |||
141 | /*! | ||
142 | * \brief Calculate the molar density \f$\mathrm{[mol/m^3]}\f$ of a fluid phase | ||
143 | * \param fluidState The fluid state | ||
144 | * \param phaseIdx Index of the fluid phase | ||
145 | */ | ||
146 | template <class FluidState> | ||
147 | static Scalar molarDensity(const FluidState &fluidState, | ||
148 | int phaseIdx) | ||
149 | { | ||
150 | DUNE_THROW(Dune::NotImplemented, "molarDensity() method not implemented by the fluid system."); | ||
151 | } | ||
152 | |||
153 | /*! | ||
154 | * \brief Calculate the molar density \f$\mathrm{[mol/m^3]}\f$ of a fluid phase. | ||
155 | * | ||
156 | * The molar density is defined by the | ||
157 | * mass density \f$\rho_\alpha\f$ and the component molar mass \f$M_\alpha\f$ after | ||
158 | * \f[\rho_{mol,\alpha} = \frac{\rho_\alpha}{M_\alpha} \;.\f] | ||
159 | * | ||
160 | * \param fluidState The fluid state | ||
161 | * \param paramCache mutable parameters | ||
162 | * \param phaseIdx Index of the fluid phase | ||
163 | */ | ||
164 | template <class FluidState> | ||
165 | 144518890 | static Scalar molarDensity(const FluidState &fluidState, | |
166 | const ParameterCache ¶mCache, | ||
167 | int phaseIdx) | ||
168 | { | ||
169 |
38/76✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 2 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 2 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 2 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 2 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 2 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 2 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 3 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 3 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 3 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 2 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 2 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 2 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 2 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 2 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 2 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 2 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 2 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 2 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 2 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 2 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 2 times.
✗ Branch 83 not taken.
✓ Branch 85 taken 2 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 2 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 2 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 2 times.
✗ Branch 95 not taken.
✓ Branch 97 taken 1 times.
✗ Branch 98 not taken.
✓ Branch 100 taken 3 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 2 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 2 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 2 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 2 times.
✗ Branch 113 not taken.
|
144909194 | return Implementation::molarDensity(fluidState, phaseIdx); |
170 | } | ||
171 | |||
172 | /*! | ||
173 | * \brief Calculate the fugacity coefficient \f$\mathrm{[Pa]}\f$ of an individual | ||
174 | * component in a fluid phase | ||
175 | * | ||
176 | * The fugacity coefficient \f$\mathrm{\phi^\kappa_\alpha}\f$ is connected to the | ||
177 | * fugacity \f$\mathrm{f^\kappa_\alpha}\f$ and the component's mole | ||
178 | * fraction \f$\mathrm{x^\kappa_\alpha}\f$ by means of the relation | ||
179 | * | ||
180 | * \f[ | ||
181 | f^\kappa_\alpha = \phi^\kappa_\alpha\;x^\kappa_\alpha\;p_\alpha | ||
182 | * \f] | ||
183 | * | ||
184 | * \param fluidState The fluid state | ||
185 | * \param phaseIdx Index of the fluid phase | ||
186 | * \param compIdx Index of the component | ||
187 | */ | ||
188 | template <class FluidState> | ||
189 | 6 | static Scalar fugacityCoefficient(const FluidState &fluidState, | |
190 | int phaseIdx, | ||
191 | int compIdx) | ||
192 | { | ||
193 |
10/20✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 6 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 6 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 6 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 6 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 6 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 6 times.
✗ Branch 29 not taken.
|
24 | DUNE_THROW(Dune::NotImplemented, "fugacityCoefficient() method not implemented by the fluid system."); |
194 | } | ||
195 | |||
196 | /*! | ||
197 | * \brief Calculate the fugacity coefficient \f$\mathrm{[Pa]}\f$ of an individual | ||
198 | * component in a fluid phase | ||
199 | * | ||
200 | * The fugacity coefficient \f$\mathrm{\phi^\kappa_\alpha}\f$ is connected to the | ||
201 | * fugacity \f$\mathrm{f^\kappa_\alpha}\f$ and the component's mole | ||
202 | * fraction \f$\mathrm{x^\kappa_\alpha}\f$ by means of the relation | ||
203 | * | ||
204 | * \f[ | ||
205 | f^\kappa_\alpha = \phi^\kappa_\alpha\;x^\kappa_\alpha\;p_\alpha | ||
206 | * \f] | ||
207 | * | ||
208 | * \param fluidState The fluid state | ||
209 | * \param paramCache mutable parameters | ||
210 | * \param phaseIdx Index of the fluid phase | ||
211 | * \param compIdx Index of the component | ||
212 | */ | ||
213 | template <class FluidState> | ||
214 |
2/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 27207726 times.
✓ Branch 5 taken 27207726 times.
|
189261089 | static Scalar fugacityCoefficient(const FluidState &fluidState, |
215 | const ParameterCache ¶mCache, | ||
216 | int phaseIdx, | ||
217 | int compIdx) | ||
218 | { | ||
219 |
27/54✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 11 taken 6 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 6 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 4 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 4 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 4 times.
✗ Branch 27 not taken.
✓ Branch 30 taken 9 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 9 times.
✗ Branch 34 not taken.
✓ Branch 37 taken 4 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 4 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 4 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 4 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 4 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 4 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 6 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 4 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 6 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 4 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 6 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 4 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 6 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 4 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 6 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 6 times.
✗ Branch 83 not taken.
✓ Branch 90 taken 2 times.
✗ Branch 91 not taken.
|
189261089 | return Implementation::fugacityCoefficient(fluidState, phaseIdx, compIdx); |
220 | } | ||
221 | |||
222 | /*! | ||
223 | * \brief Calculate the dynamic viscosity of a fluid phase \f$\mathrm{[Pa*s]}\f$ | ||
224 | * \param fluidState The fluid state | ||
225 | * \param phaseIdx Index of the fluid phase | ||
226 | */ | ||
227 | template <class FluidState> | ||
228 | static Scalar viscosity(const FluidState &fluidState, | ||
229 | int phaseIdx) | ||
230 | { | ||
231 | DUNE_THROW(Dune::NotImplemented, "viscosity() method not implemented by the fluid system."); | ||
232 | } | ||
233 | |||
234 | /*! | ||
235 | * \brief Calculate the dynamic viscosity of a fluid phase \f$\mathrm{[Pa*s]}\f$ | ||
236 | * \param fluidState The fluid state | ||
237 | * \param paramCache mutable parameters | ||
238 | * \param phaseIdx Index of the fluid phase | ||
239 | */ | ||
240 | template <class FluidState> | ||
241 |
2/2✓ Branch 0 taken 60891342 times.
✓ Branch 1 taken 60891342 times.
|
688669071 | static Scalar viscosity(const FluidState &fluidState, |
242 | const ParameterCache ¶mCache, | ||
243 | int phaseIdx) | ||
244 | { | ||
245 |
39/77✓ Branch 1 taken 60974663 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 2 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 2 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 2 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 2 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 2 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 2 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 3 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 3 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 3 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 2 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 2 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 2 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 2 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 2 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 2 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 2 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 2 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 2 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 2 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 2 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 2 times.
✗ Branch 83 not taken.
✓ Branch 85 taken 2 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 2 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 2 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 2 times.
✗ Branch 95 not taken.
✓ Branch 97 taken 1 times.
✗ Branch 98 not taken.
✓ Branch 100 taken 3 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 2 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 2 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 2 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 2 times.
✗ Branch 113 not taken.
✓ Branch 0 taken 60891342 times.
|
634216887 | return Implementation::viscosity(fluidState, phaseIdx); |
246 | } | ||
247 | |||
248 | /*! | ||
249 | * \brief Calculate the binary molecular diffusion coefficient for | ||
250 | * a component in a fluid phase \f$\mathrm{[mol^2 * s / (kg*m^3)]}\f$ | ||
251 | * | ||
252 | * Molecular diffusion of a component \f$\mathrm{\kappa}\f$ is caused by a | ||
253 | * gradient of the chemical potential and follows the law | ||
254 | * | ||
255 | * \f[ J = - D \nabla \mu_\kappa \f] | ||
256 | * | ||
257 | * where \f$\mathrm{\mu_\kappa}\f$ is the component's chemical potential, | ||
258 | * \f$\mathrm{D}\f$ is the diffusion coefficient and \f$\mathrm{J}\f$ is the | ||
259 | * diffusive flux. \f$\mathrm{\mu_\kappa}\f$ is connected to the component's | ||
260 | * fugacity \f$\mathrm{f_\kappa}\f$ by the relation | ||
261 | * | ||
262 | * \f[ \mu_\kappa = R T_\alpha \mathrm{ln} \frac{f_\kappa}{p_\alpha} \f] | ||
263 | * | ||
264 | * where \f$\mathrm{p_\alpha}\f$ and \f$\mathrm{T_\alpha}\f$ are the fluid phase' | ||
265 | * pressure and temperature. | ||
266 | * \param fluidState The fluid state | ||
267 | * \param phaseIdx Index of the fluid phase | ||
268 | * \param compIdx Index of the component | ||
269 | */ | ||
270 | template <class FluidState> | ||
271 | 6 | static Scalar diffusionCoefficient(const FluidState &fluidState, | |
272 | int phaseIdx, | ||
273 | int compIdx) | ||
274 | { | ||
275 |
10/20✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 6 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 6 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 6 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 6 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 6 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 6 times.
✗ Branch 29 not taken.
|
24 | DUNE_THROW(Dune::NotImplemented, "diffusionCoefficient() method not implemented by the fluid system."); |
276 | } | ||
277 | |||
278 | /*! | ||
279 | * \brief Calculate the binary molecular diffusion coefficient for | ||
280 | * a component in a fluid phase \f$\mathrm{[mol^2 * s / (kg*m^3)]}\f$ | ||
281 | * | ||
282 | * Molecular diffusion of a component \f$\mathrm{\kappa}\f$ is caused by a | ||
283 | * gradient of the chemical potential and follows the law | ||
284 | * | ||
285 | * \f[ J = - D \nabla \mu_\kappa \f] | ||
286 | * | ||
287 | * where \f$\mathrm{\mu_\kappa}\f$ is the component's chemical potential, | ||
288 | * \f$\mathrm{D}\f$ is the diffusion coefficient and \f$\mathrm{J}\f$ is the | ||
289 | * diffusive flux. \f$\mathrm{\mu_\kappa}\f$ is connected to the component's | ||
290 | * fugacity \f$\mathrm{f_\kappa}\f$ by the relation | ||
291 | * | ||
292 | * \f[ \mu_\kappa = R T_\alpha \mathrm{ln} \frac{f_\kappa}{p_\alpha} \f] | ||
293 | * | ||
294 | * where \f$\mathrm{p_\alpha}\f$ and \f$\mathrm{T_\alpha}\f$ are the fluid phase' | ||
295 | * pressure and temperature. | ||
296 | * | ||
297 | * \param fluidState The fluid state | ||
298 | * \param paramCache mutable parameters | ||
299 | * \param phaseIdx Index of the fluid phase | ||
300 | * \param compIdx Index of the component | ||
301 | */ | ||
302 | template <class FluidState> | ||
303 | 28072514 | static Scalar diffusionCoefficient(const FluidState &fluidState, | |
304 | const ParameterCache ¶mCache, | ||
305 | int phaseIdx, | ||
306 | int compIdx) | ||
307 | { | ||
308 |
4/4✓ Branch 14 taken 2 times.
✓ Branch 15 taken 7 times.
✓ Branch 17 taken 2 times.
✓ Branch 18 taken 7 times.
|
28072514 | return Implementation::diffusionCoefficient(fluidState, phaseIdx, compIdx); |
309 | } | ||
310 | |||
311 | /*! | ||
312 | * \brief Given a phase's composition, temperature and pressure, | ||
313 | * return the binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for components | ||
314 | * \f$\mathrm{i}\f$ and \f$\mathrm{j}\f$ in this phase. | ||
315 | * \param fluidState The fluid state | ||
316 | * \param phaseIdx Index of the fluid phase | ||
317 | * \param compIIdx Index of the component i | ||
318 | * \param compJIdx Index of the component j | ||
319 | */ | ||
320 | template <class FluidState> | ||
321 | static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, | ||
322 | int phaseIdx, | ||
323 | int compIIdx, | ||
324 | int compJIdx) | ||
325 | |||
326 | { | ||
327 | DUNE_THROW(Dune::NotImplemented, "binaryDiffusionCoefficient() method not implemented by the fluid system."); | ||
328 | } | ||
329 | |||
330 | /*! | ||
331 | * \brief Given a phase's composition, temperature and pressure, | ||
332 | * return the binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for components | ||
333 | * \f$\mathrm{i}\f$ and \f$\mathrm{j}\f$ in this phase. | ||
334 | * \param fluidState The fluid state | ||
335 | * \param paramCache mutable parameters | ||
336 | * \param phaseIdx Index of the fluid phase | ||
337 | * \param compIIdx Index of the component i | ||
338 | * \param compJIdx Index of the component j | ||
339 | */ | ||
340 | template <class FluidState> | ||
341 | 284453403 | static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, | |
342 | const ParameterCache ¶mCache, | ||
343 | int phaseIdx, | ||
344 | int compIIdx, | ||
345 | int compJIdx) | ||
346 | |||
347 | { | ||
348 |
53/54✓ Branch 1 taken 6 times.
✓ Branch 2 taken 3 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 2 times.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
✓ Branch 13 taken 10 times.
✓ Branch 14 taken 8 times.
✓ Branch 16 taken 10 times.
✓ Branch 17 taken 8 times.
✓ Branch 19 taken 4 times.
✓ Branch 20 taken 4 times.
✓ Branch 22 taken 4 times.
✓ Branch 23 taken 4 times.
✓ Branch 25 taken 4 times.
✓ Branch 26 taken 4 times.
✓ Branch 28 taken 4 times.
✓ Branch 29 taken 4 times.
✓ Branch 31 taken 8 times.
✓ Branch 32 taken 4 times.
✓ Branch 37 taken 4 times.
✓ Branch 38 taken 4 times.
✓ Branch 40 taken 4 times.
✓ Branch 41 taken 4 times.
✓ Branch 43 taken 4 times.
✓ Branch 44 taken 4 times.
✓ Branch 46 taken 4 times.
✓ Branch 47 taken 4 times.
✓ Branch 49 taken 4 times.
✓ Branch 50 taken 4 times.
✓ Branch 52 taken 4 times.
✓ Branch 53 taken 4 times.
✓ Branch 55 taken 8 times.
✓ Branch 56 taken 10 times.
✓ Branch 58 taken 4 times.
✓ Branch 59 taken 4 times.
✓ Branch 61 taken 8 times.
✓ Branch 62 taken 10 times.
✓ Branch 64 taken 4 times.
✓ Branch 65 taken 4 times.
✓ Branch 67 taken 8 times.
✓ Branch 68 taken 10 times.
✓ Branch 70 taken 4 times.
✓ Branch 71 taken 4 times.
✓ Branch 73 taken 8 times.
✓ Branch 74 taken 10 times.
✓ Branch 76 taken 4 times.
✓ Branch 77 taken 4 times.
✓ Branch 79 taken 8 times.
✓ Branch 80 taken 10 times.
✓ Branch 82 taken 8 times.
✓ Branch 83 taken 10 times.
✓ Branch 85 taken 3 times.
✓ Branch 86 taken 1 times.
|
284125687 | return Implementation::binaryDiffusionCoefficient(fluidState, phaseIdx, compIIdx, compJIdx); |
349 | } | ||
350 | |||
351 | /*! | ||
352 | * \brief Given a phase's composition, temperature, pressure and | ||
353 | * density, calculate its specific enthalpy \f$\mathrm{[J/kg]}\f$. | ||
354 | * \param fluidState The fluid state | ||
355 | * \param phaseIdx Index of the fluid phase | ||
356 | */ | ||
357 | template <class FluidState> | ||
358 | static Scalar enthalpy(const FluidState &fluidState, | ||
359 | int phaseIdx) | ||
360 | { | ||
361 | DUNE_THROW(Dune::NotImplemented, "enthalpy() method not implemented by the fluid system."); | ||
362 | } | ||
363 | |||
364 | /*! | ||
365 | * \brief Given a phase's composition, temperature, pressure and | ||
366 | * density, calculate its specific enthalpy \f$\mathrm{[J/kg]}\f$. | ||
367 | * \param fluidState The fluid state | ||
368 | * \param paramCache mutable parameters | ||
369 | * \param phaseIdx Index of the fluid phase | ||
370 | */ | ||
371 | template <class FluidState> | ||
372 |
1/2✓ Branch 3 taken 3800 times.
✗ Branch 4 not taken.
|
219127122 | static Scalar enthalpy(const FluidState &fluidState, |
373 | const ParameterCache ¶mCache, | ||
374 | int phaseIdx) | ||
375 | { | ||
376 |
39/77✓ Branch 1 taken 1921397 times.
✓ Branch 2 taken 3800 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 2 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 2 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 2 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 2 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 2 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 2 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 3 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 3 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 3 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 2 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 2 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 2 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 2 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 2 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 2 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 2 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 2 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 2 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 2 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 2 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 2 times.
✗ Branch 83 not taken.
✓ Branch 85 taken 2 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 2 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 2 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 2 times.
✗ Branch 95 not taken.
✓ Branch 97 taken 1 times.
✗ Branch 98 not taken.
✓ Branch 100 taken 3 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 2 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 2 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 2 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 2 times.
✗ Branch 113 not taken.
✗ Branch 3 not taken.
|
216369591 | return Implementation::enthalpy(fluidState, phaseIdx); |
377 | } | ||
378 | |||
379 | /*! | ||
380 | * \brief Thermal conductivity \f$\lambda_\alpha \f$ of a fluid phase \f$\mathrm{[W/(m K)]}\f$. | ||
381 | * \param fluidState The fluid state | ||
382 | * \param phaseIdx Index of the fluid phase | ||
383 | */ | ||
384 | template <class FluidState> | ||
385 | static Scalar thermalConductivity(const FluidState &fluidState, | ||
386 | int phaseIdx) | ||
387 | { | ||
388 | DUNE_THROW(Dune::NotImplemented, "thermalConductivity() method not implemented by the fluid system."); | ||
389 | } | ||
390 | |||
391 | /*! | ||
392 | * \brief Thermal conductivity \f$\lambda_\alpha \f$ of a fluid phase \f$\mathrm{[W/(m K)]}\f$. | ||
393 | * \param fluidState The fluid state | ||
394 | * \param paramCache mutable parameters | ||
395 | * \param phaseIdx Index of the fluid phase | ||
396 | */ | ||
397 | template <class FluidState> | ||
398 | 2964375 | static Scalar thermalConductivity(const FluidState &fluidState, | |
399 | const ParameterCache ¶mCache, | ||
400 | int phaseIdx) | ||
401 | { | ||
402 |
38/76✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 2 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 2 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 2 times.
✗ Branch 28 not taken.
✓ Branch 29 taken 2 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 2 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 2 times.
✗ Branch 37 not taken.
✓ Branch 38 taken 3 times.
✗ Branch 40 not taken.
✓ Branch 41 taken 3 times.
✗ Branch 43 not taken.
✓ Branch 44 taken 3 times.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✓ Branch 50 taken 2 times.
✗ Branch 52 not taken.
✓ Branch 53 taken 2 times.
✗ Branch 55 not taken.
✓ Branch 56 taken 2 times.
✗ Branch 58 not taken.
✓ Branch 59 taken 2 times.
✓ Branch 61 taken 2 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 2 times.
✗ Branch 65 not taken.
✗ Branch 67 not taken.
✓ Branch 68 taken 2 times.
✗ Branch 70 not taken.
✓ Branch 71 taken 2 times.
✗ Branch 73 not taken.
✓ Branch 74 taken 2 times.
✗ Branch 76 not taken.
✓ Branch 77 taken 2 times.
✗ Branch 79 not taken.
✓ Branch 80 taken 2 times.
✗ Branch 82 not taken.
✓ Branch 83 taken 2 times.
✗ Branch 85 not taken.
✓ Branch 86 taken 2 times.
✗ Branch 88 not taken.
✓ Branch 89 taken 2 times.
✓ Branch 91 taken 2 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 2 times.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✓ Branch 98 taken 1 times.
✓ Branch 100 taken 3 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 2 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 2 times.
✗ Branch 107 not taken.
✗ Branch 109 not taken.
✓ Branch 110 taken 2 times.
✓ Branch 112 taken 2 times.
✗ Branch 113 not taken.
|
2964375 | return Implementation::thermalConductivity(fluidState, phaseIdx); |
403 | } | ||
404 | |||
405 | /*! | ||
406 | * \brief Specific isobaric heat capacity \f$c_{p,\alpha}\f$ of a fluid phase \f$\mathrm{[J/(kg*K)]}\f$. | ||
407 | * | ||
408 | * \param fluidState represents all relevant thermodynamic quantities of a fluid system | ||
409 | * \param phaseIdx Index of the fluid phase | ||
410 | * | ||
411 | * Given a fluid state, an up-to-date parameter cache and a phase index, this method | ||
412 | * computes the isobaric heat capacity \f$c_{p,\alpha}\f$ of the fluid phase. The isobaric | ||
413 | * heat capacity is defined as the partial derivative of the specific enthalpy \f$h_\alpha\f$ | ||
414 | * to the fluid pressure \f$p_\alpha\f$: | ||
415 | * | ||
416 | * \f$ c_{p,\alpha} = \frac{\partial h_\alpha}{\partial p_\alpha} \f$ | ||
417 | */ | ||
418 | template <class FluidState> | ||
419 | static Scalar heatCapacity(const FluidState &fluidState, | ||
420 | int phaseIdx) | ||
421 | { | ||
422 | DUNE_THROW(Dune::NotImplemented, "heatCapacity() method not implemented by the fluid system."); | ||
423 | } | ||
424 | |||
425 | /*! | ||
426 | * \brief Specific isobaric heat capacity \f$c_{p,\alpha}\f$ of a fluid phase \f$\mathrm{[J/(kg*K)]}\f$. | ||
427 | * | ||
428 | * Given a fluid state, an up-to-date parameter cache and a phase index, this method | ||
429 | * computes the isobaric heat capacity \f$c_{p,\alpha}\f$ of the fluid phase. The isobaric | ||
430 | * heat capacity is defined as the partial derivative of the specific enthalpy \f$h_\alpha\f$ | ||
431 | * to the fluid pressure \f$p_\alpha\f$: | ||
432 | * | ||
433 | * \f$ c_{p,\alpha} = \frac{\partial h_\alpha}{\partial p_\alpha} \f$ | ||
434 | * \param fluidState represents all relevant thermodynamic quantities of a fluid system | ||
435 | * \param paramCache mutable parameters | ||
436 | * \param phaseIdx Index of the fluid phase | ||
437 | */ | ||
438 | template <class FluidState> | ||
439 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
2964375 | static Scalar heatCapacity(const FluidState &fluidState, |
440 | const ParameterCache ¶mCache, | ||
441 | int phaseIdx) | ||
442 | { | ||
443 |
35/71✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 2 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 2 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 2 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 2 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 2 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 2 times.
✗ Branch 35 not taken.
✓ Branch 40 taken 1 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 2 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 2 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 2 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 2 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 2 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 2 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 2 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 2 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 2 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 2 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 2 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 2 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 2 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 2 times.
✗ Branch 83 not taken.
✓ Branch 85 taken 2 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 2 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 1 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 3 times.
✗ Branch 95 not taken.
✓ Branch 97 taken 2 times.
✗ Branch 98 not taken.
✓ Branch 100 taken 2 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 2 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 2 times.
✗ Branch 107 not taken.
✗ Branch 0 not taken.
|
2964375 | return Implementation::heatCapacity(fluidState, phaseIdx); |
444 | } | ||
445 | }; | ||
446 | |||
447 | } // end namespace Dumux::FluidSystems | ||
448 | |||
449 | #endif | ||
450 |