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