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 Components | ||
10 | * \brief Setting constant fluid properties via the input file. | ||
11 | */ | ||
12 | #ifndef DUMUX_COMPONENTS_CONSTANT_HH | ||
13 | #define DUMUX_COMPONENTS_CONSTANT_HH | ||
14 | |||
15 | #include <dune/common/exceptions.hh> | ||
16 | #include <dumux/common/parameters.hh> | ||
17 | |||
18 | #include <dumux/material/idealgas.hh> | ||
19 | |||
20 | #include <dumux/material/components/base.hh> | ||
21 | #include <dumux/material/components/liquid.hh> | ||
22 | #include <dumux/material/components/gas.hh> | ||
23 | #include <dumux/material/components/solid.hh> | ||
24 | |||
25 | namespace Dumux { | ||
26 | namespace Components { | ||
27 | |||
28 | /*! | ||
29 | * \ingroup Components | ||
30 | * \brief A component which returns run time specified values | ||
31 | * for all fluid properties. | ||
32 | * | ||
33 | * \tparam id The id used to read from the input file / parametertree | ||
34 | * \tparam Scalar The type used for scalar values | ||
35 | * | ||
36 | * \note For the constant component with id=1 you would specify the parameters in the input file as follows | ||
37 | * \code{.ini} | ||
38 | * [1.Component] | ||
39 | * MolarMass = 0.018 # kg/mol | ||
40 | * \endcode | ||
41 | * \note If you only have one component you can also omit the "1.". | ||
42 | */ | ||
43 | template<int id, class Scalar> | ||
44 | class Constant | ||
45 | : public Components::Base<Scalar, Constant<id, Scalar> > | ||
46 | , public Components::Liquid<Scalar, Constant<id, Scalar> > | ||
47 | , public Components::Gas<Scalar, Constant<id, Scalar> > | ||
48 | , public Components::Solid<Scalar, Constant<id, Scalar> > | ||
49 | { | ||
50 | using IdealGas = Dumux::IdealGas<Scalar>; | ||
51 | |||
52 | public: | ||
53 | /*! | ||
54 | * \brief Returns true if the gas phase is assumed to be compressible | ||
55 | */ | ||
56 | static constexpr bool gasIsCompressible() | ||
57 | { return false; } | ||
58 | |||
59 | /*! | ||
60 | * \brief Returns true if the gas phase viscosity is constant | ||
61 | */ | ||
62 | static constexpr bool gasViscosityIsConstant() | ||
63 | { return true; } | ||
64 | |||
65 | /*! | ||
66 | * \brief Returns true if the gas phase is assumed to be ideal | ||
67 | */ | ||
68 | static constexpr bool gasIsIdeal() | ||
69 | { return true; } | ||
70 | |||
71 | /*! | ||
72 | * \brief Returns true if the liquid phase is assumed to be compressible | ||
73 | */ | ||
74 | static constexpr bool liquidIsCompressible() | ||
75 | { return false; } | ||
76 | |||
77 | /*! | ||
78 | * \brief Returns true if the liquid phase viscosity is constant | ||
79 | */ | ||
80 | static constexpr bool liquidViscosityIsConstant() | ||
81 | { return true; } | ||
82 | |||
83 | /*! | ||
84 | * \brief A human readable name for the component. | ||
85 | */ | ||
86 | 29 | static const std::string& name() | |
87 | { | ||
88 |
6/12✓ Branch 0 taken 11 times.
✓ Branch 1 taken 14 times.
✓ Branch 3 taken 11 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 11 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 11 times.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 11 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
|
29 | static const std::string name = getParamFromGroup<std::string>(std::to_string(id), "Component.Name", "component"); |
89 | 29 | return name; | |
90 | } | ||
91 | |||
92 | /*! | ||
93 | * \brief The mass in \f$\mathrm{[kg]}\f$ of one mole of the component. | ||
94 | */ | ||
95 | 93680219 | static Scalar molarMass() | |
96 | { | ||
97 |
7/12✓ Branch 0 taken 75 times.
✓ Branch 1 taken 93500920 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 65 times.
✓ Branch 6 taken 10 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 10 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 10 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
93680219 | static const Scalar molarMass = getParamFromGroup<Scalar>(std::to_string(id), "Component.MolarMass"); |
98 | 93680219 | return molarMass; | |
99 | } | ||
100 | |||
101 | /*! | ||
102 | * \brief Returns the temperature \f$\mathrm{[K]}\f$ at the components's triple point. | ||
103 | */ | ||
104 | 179220 | static Scalar tripleTemperature() | |
105 | { | ||
106 |
7/12✓ Branch 0 taken 9 times.
✓ Branch 1 taken 179211 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 7 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
179220 | static const Scalar tripleTemperature = getParamFromGroup<Scalar>(std::to_string(id), "Component.TripleTemperature"); |
107 | 179220 | return tripleTemperature; | |
108 | } | ||
109 | |||
110 | /*! | ||
111 | * \brief Returns the pressure \f$\mathrm{[Pa]}\f$ at the component's triple point. | ||
112 | */ | ||
113 | 179220 | static Scalar triplePressure() | |
114 | { | ||
115 |
7/12✓ Branch 0 taken 29 times.
✓ Branch 1 taken 179191 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 27 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
179220 | static const Scalar triplePressure = getParamFromGroup<Scalar>(std::to_string(id), "Component.TriplePressure"); |
116 | 179220 | return triplePressure; | |
117 | } | ||
118 | |||
119 | /*! | ||
120 | * \brief The vaporization enthalpy in \f$\mathrm{[J/kg]}\f$ needed to vaporize one kilogram of the liquid component to the gaseous state | ||
121 | */ | ||
122 | 1314641 | static Scalar vaporizationEnthalpy() | |
123 | { | ||
124 |
7/12✓ Branch 0 taken 55 times.
✓ Branch 1 taken 752926 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 48 times.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 7 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 7 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
1314641 | static const Scalar vaporizationEnthalpy = getParamFromGroup<Scalar>(std::to_string(id), "Component.EnthalpyOfVaporization"); |
125 | 1314641 | return vaporizationEnthalpy; | |
126 | } | ||
127 | |||
128 | |||
129 | /*! | ||
130 | * \brief Sets the liquid density in \f$\mathrm{[kg/m^3]}\f$. | ||
131 | * | ||
132 | * \param temperature phase temperature in \f$\mathrm{[K]}\f$ | ||
133 | * \param pressure phase pressure in \f$\mathrm{[Pa]}\f$ | ||
134 | */ | ||
135 | 58918315 | static Scalar liquidDensity(Scalar temperature, Scalar pressure) | |
136 | { | ||
137 |
7/12✓ Branch 0 taken 1852 times.
✓ Branch 1 taken 58916463 times.
✓ Branch 3 taken 182 times.
✓ Branch 4 taken 1670 times.
✓ Branch 6 taken 182 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 182 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 182 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
58918315 | static const Scalar density = getParamFromGroup<Scalar>(std::to_string(id), "Component.LiquidDensity"); |
138 | 58918315 | return density; | |
139 | } | ||
140 | |||
141 | /*! | ||
142 | * \brief The molar density in \f$\mathrm{[mol/m^3]}\f$ at a given pressure and temperature. | ||
143 | * | ||
144 | * \param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
145 | * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ | ||
146 | * | ||
147 | */ | ||
148 | static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure) | ||
149 | { return liquidDensity(temperature, pressure)/molarMass(); } | ||
150 | |||
151 | /*! | ||
152 | * \brief Sets the liquid dynamic viscosity in \f$\mathrm{[Pa*s]}\f$. | ||
153 | * | ||
154 | * \note We look for Component.LiquidKinematicViscosity or Component.LiquidDynamicViscosity. | ||
155 | * If both parameters are specified, it is considered a configuration error because it can | ||
156 | * be ambiguous if defaults are specified for several constant components in the plain | ||
157 | * "Component" group (without ID-prefix). | ||
158 | * | ||
159 | * \param temperature phase temperature in \f$\mathrm{[K]}\f$ | ||
160 | * \param pressure phase pressure in \f$\mathrm{[Pa]}\f$ | ||
161 | */ | ||
162 | 51714660 | static Scalar liquidViscosity(Scalar temperature, Scalar pressure) | |
163 | { | ||
164 |
4/4✓ Branch 0 taken 1958 times.
✓ Branch 1 taken 51712702 times.
✓ Branch 3 taken 182 times.
✓ Branch 4 taken 1776 times.
|
51714842 | static const Scalar dynamicViscosity = [&] |
165 | { | ||
166 |
11/22✓ Branch 1 taken 182 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 182 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 182 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 182 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 182 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 182 times.
✓ Branch 17 taken 182 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 169 times.
✓ Branch 20 taken 13 times.
✓ Branch 21 taken 169 times.
✓ Branch 22 taken 13 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
910 | if (hasParamInGroup(std::to_string(id), "Component.LiquidKinematicViscosity")) |
167 | { | ||
168 |
8/20✓ Branch 1 taken 169 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 169 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 169 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 169 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 169 times.
✓ Branch 14 taken 169 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 169 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 169 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
|
845 | if (hasParamInGroup(std::to_string(id), "Component.LiquidDynamicViscosity")) |
169 | ✗ | DUNE_THROW(Dune::InvalidStateException, "Found both Component.LiquidKinematicViscosity and Component.LiquidDynamicViscosity." | |
170 | << " Please only specify either the kinematic or the dynamic viscosity for all constant components to avoid ambiguities."); | ||
171 | |||
172 |
3/8✓ Branch 2 taken 169 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 169 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 169 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
169 | return getParamFromGroup<Scalar>(std::to_string(id), "Component.LiquidKinematicViscosity") * liquidDensity(temperature, pressure); |
173 | } | ||
174 | else | ||
175 |
2/6✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 13 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
13 | return getParamFromGroup<Scalar>(std::to_string(id), "Component.LiquidDynamicViscosity"); |
176 |
1/2✓ Branch 1 taken 182 times.
✗ Branch 2 not taken.
|
364 | }(); |
177 | |||
178 | 51714660 | return dynamicViscosity; | |
179 | } | ||
180 | |||
181 | /*! | ||
182 | * \brief Thermal conductivity of the component \f$\mathrm{[W/(m*K)]}\f$ as a liquid. | ||
183 | * \param temperature temperature of phase in \f$\mathrm{[K]}\f$ | ||
184 | * \param pressure pressure of phase in \f$\mathrm{[Pa]}\f$ | ||
185 | */ | ||
186 | 7031691 | static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure) | |
187 | { | ||
188 |
7/12✓ Branch 0 taken 10 times.
✓ Branch 1 taken 7031681 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 6 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
7031691 | static const Scalar thermalConductivity = getParamFromGroup<Scalar>(std::to_string(id), "Component.LiquidThermalConductivity"); |
189 | 7031691 | return thermalConductivity; | |
190 | } | ||
191 | |||
192 | /*! | ||
193 | * \brief Specific internal energy of the component \f$\mathrm{[J/kg]}\f$ as a liquid. | ||
194 | * \param temperature temperature of phase in \f$\mathrm{[K]}\f$ | ||
195 | * \param pressure pressure of phase in \f$\mathrm{[Pa]}\f$ | ||
196 | */ | ||
197 | 7024266 | static Scalar liquidInternalEnergy(Scalar temperature, Scalar pressure) | |
198 | { | ||
199 | // u = c * dT for incompressible fluids | ||
200 | 7024266 | const Scalar heatCapacity = liquidHeatCapacity(temperature, pressure); | |
201 |
7/12✓ Branch 0 taken 5 times.
✓ Branch 1 taken 7024261 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 1 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
7024266 | static const Scalar tRef = getParamFromGroup<Scalar>(std::to_string(id), "Component.ReferenceTemperature", 293.15); |
202 | 7024266 | return heatCapacity * (temperature - tRef); | |
203 | } | ||
204 | |||
205 | /*! | ||
206 | * \brief Specific enthalpy of the component \f$\mathrm{[J/kg]}\f$ as a liquid. | ||
207 | * | ||
208 | * \param temperature temperature of phase in \f$\mathrm{[K]}\f$ | ||
209 | * \param pressure pressure of phase in \f$\mathrm{[Pa]}\f$ | ||
210 | */ | ||
211 | 7024266 | static Scalar liquidEnthalpy(Scalar temperature, Scalar pressure) | |
212 | { | ||
213 | 7024266 | const Scalar u = liquidInternalEnergy(temperature, pressure); | |
214 | 7024266 | const Scalar rho = liquidDensity(temperature, pressure); | |
215 | 7024266 | return u + pressure / rho; | |
216 | } | ||
217 | |||
218 | /*! | ||
219 | * \brief Specific isobaric heat capacity of the component \f$\mathrm{[J/(kg*K)]}\f$ as a liquid. | ||
220 | * | ||
221 | * \param temperature temperature of phase in \f$\mathrm{[K]}\f$ | ||
222 | * \param pressure pressure of phase in \f$\mathrm{[Pa]}\f$ | ||
223 | */ | ||
224 | 7024367 | static Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure) | |
225 | { | ||
226 |
7/12✓ Branch 0 taken 12 times.
✓ Branch 1 taken 7024355 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 8 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
7024367 | static const Scalar heatCapacity = getParamFromGroup<Scalar>(std::to_string(id), "Component.LiquidHeatCapacity"); |
227 | 7024367 | return heatCapacity; | |
228 | } | ||
229 | |||
230 | /*! | ||
231 | * \brief Sets the gas density in \f$\mathrm{[kg/m^3]}\f$. | ||
232 | * | ||
233 | * \param temperature phase temperature in \f$\mathrm{[K]}\f$ | ||
234 | * \param pressure phase pressure in \f$\mathrm{[Pa]}\f$ | ||
235 | */ | ||
236 | 716986 | static Scalar gasDensity(Scalar temperature, Scalar pressure) | |
237 | { | ||
238 |
7/12✓ Branch 0 taken 35 times.
✓ Branch 1 taken 716951 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 30 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 5 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 5 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
716986 | static const Scalar density = getParamFromGroup<Scalar>(std::to_string(id), "Component.GasDensity"); |
239 | 716986 | return density; | |
240 | } | ||
241 | |||
242 | /*! | ||
243 | * \brief The molar density in \f$\mathrm{[mol/m^3]}\f$ at a given pressure and temperature. | ||
244 | * | ||
245 | * \param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
246 | * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ | ||
247 | * | ||
248 | */ | ||
249 | static Scalar gasMolarDensity(Scalar temperature, Scalar pressure) | ||
250 | { return gasDensity(temperature, pressure)/molarMass(); } | ||
251 | |||
252 | |||
253 | /*! | ||
254 | * \brief Sets the gas dynamic viscosity in \f$\mathrm{[Pa*s]}\f$. | ||
255 | * | ||
256 | * \note We look for Component.GasKinematicViscosity or Component.GasDynamicViscosity. | ||
257 | * If both parameters are specified, it is considered a configuration error because it can | ||
258 | * be ambiguous if defaults are specified for several constant components in the plain | ||
259 | * "Component" group (without ID-prefix). | ||
260 | * | ||
261 | * \param temperature phase temperature in \f$\mathrm{[K]}\f$ | ||
262 | * \param pressure phase pressure in \f$\mathrm{[Pa]}\f$ | ||
263 | */ | ||
264 | 358541 | static Scalar gasViscosity(Scalar temperature, Scalar pressure) | |
265 | { | ||
266 |
4/4✓ Branch 0 taken 46 times.
✓ Branch 1 taken 358495 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 41 times.
|
358546 | static const Scalar dynamicViscosity = [&] |
267 | { | ||
268 |
8/20✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 5 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 5 times.
✓ Branch 14 taken 5 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
|
25 | if (hasParamInGroup(std::to_string(id), "Component.GasKinematicViscosity")) |
269 | { | ||
270 |
8/20✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 5 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 5 times.
✓ Branch 14 taken 5 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 5 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 5 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
|
25 | if (hasParamInGroup(std::to_string(id), "Component.GasDynamicViscosity")) |
271 | ✗ | DUNE_THROW(Dune::InvalidStateException, "Found both Component.GasKinematicViscosity and Component.GasDynamicViscosity." | |
272 | << " Please only specify either the kinematic or the dynamic viscosity for all constant components to avoid ambiguities."); | ||
273 | |||
274 |
3/8✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 5 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
5 | return getParamFromGroup<Scalar>(std::to_string(id), "Component.GasKinematicViscosity") * gasDensity(temperature, pressure); |
275 | } | ||
276 | else | ||
277 | ✗ | return getParamFromGroup<Scalar>(std::to_string(id), "Component.GasDynamicViscosity"); | |
278 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | }(); |
279 | |||
280 | 358541 | return dynamicViscosity; | |
281 | } | ||
282 | |||
283 | /*! | ||
284 | * \brief Thermal conductivity of the component \f$\mathrm{[W/(m*K)]}\f$ as a gas. | ||
285 | * \param temperature temperature of phase in \f$\mathrm{[K]}\f$ | ||
286 | * \param pressure pressure of phase in \f$\mathrm{[Pa]}\f$ | ||
287 | */ | ||
288 | 382541 | static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure) | |
289 | { | ||
290 |
7/12✓ Branch 0 taken 17 times.
✓ Branch 1 taken 382524 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 12 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 5 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 5 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
382541 | static const Scalar thermalConductivity = getParamFromGroup<Scalar>(std::to_string(id), "Component.GasThermalConductivity"); |
291 | 382541 | return thermalConductivity; | |
292 | } | ||
293 | |||
294 | /*! | ||
295 | * \brief Specific internal energy of the component \f$\mathrm{[J/kg]}\f$ as a gas. | ||
296 | * | ||
297 | * Definition of enthalpy: \f$h= u + pv = u + p / \rho\f$. | ||
298 | * | ||
299 | * Rearranging for internal energy yields: \f$u = h - pv\f$. | ||
300 | * | ||
301 | * Exploiting the Ideal Gas assumption (\f$pv = R_{\textnormal{specific}} T\f$)gives: \f$u = h - R / M T \f$. | ||
302 | * | ||
303 | * The universal gas constant can only be used in the case of molar formulations. | ||
304 | * \param temperature temperature of phase in \f$\mathrm{[K]}\f$ | ||
305 | * \param pressure pressure of phase in \f$\mathrm{[Pa]}\f$ | ||
306 | */ | ||
307 | static Scalar gasInternalEnergy(Scalar temperature, Scalar pressure) | ||
308 | { | ||
309 | // 1/molarMass: conversion from [J/(mol K)] to [J/(kg K)] | ||
310 | // R*T/molarMass: pressure *spec. volume for an ideal gas | ||
311 | return gasEnthalpy(temperature, pressure) - 1/molarMass()* IdealGas::R*temperature; | ||
312 | |||
313 | } | ||
314 | |||
315 | /*! | ||
316 | * \brief Specific enthalpy of the component \f$\mathrm{[J/kg]}\f$ as a gas. | ||
317 | * | ||
318 | * \param temperature temperature of phase in \f$\mathrm{[K]}\f$ | ||
319 | * \param pressure pressure of phase in \f$\mathrm{[Pa]}\f$ | ||
320 | */ | ||
321 | 956201 | static Scalar gasEnthalpy(Scalar temperature, Scalar pressure) | |
322 | { | ||
323 |
7/12✓ Branch 0 taken 15 times.
✓ Branch 1 taken 573746 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 8 times.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 7 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 7 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
956201 | static const Scalar tRef = getParamFromGroup<Scalar>(std::to_string(id), "Component.ReferenceTemperature", 293.15); |
324 | 956201 | return gasHeatCapacity(temperature, pressure)*(temperature - tRef) + vaporizationEnthalpy(); | |
325 | } | ||
326 | |||
327 | /*! | ||
328 | * \brief Specific isobaric heat capacity of the component \f$\mathrm{[J/(kg*K)]}\f$ as a gas. | ||
329 | * | ||
330 | * \param temperature temperature of phase in \f$\mathrm{[K]}\f$ | ||
331 | * \param pressure pressure of phase in \f$\mathrm{[Pa]}\f$ | ||
332 | */ | ||
333 | 956302 | static Scalar gasHeatCapacity(Scalar temperature, Scalar pressure) | |
334 | { | ||
335 |
7/12✓ Branch 0 taken 19 times.
✓ Branch 1 taken 573843 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 12 times.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 7 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 7 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
956302 | static const Scalar heatCapacity = getParamFromGroup<Scalar>(std::to_string(id), "Component.GasHeatCapacity"); |
336 | 956302 | return heatCapacity; | |
337 | } | ||
338 | |||
339 | /*! | ||
340 | * \brief The vapor pressure in \f$\mathrm{[Pa]}\f$ of a the component | ||
341 | * at a given temperature. | ||
342 | * | ||
343 | *\param T temperature of component in \f$\mathrm{[K]}\f$ | ||
344 | * | ||
345 | * We use the Clausius-Clapeyron Equation to estimate the vapor pressure. Vapor pressure depends on the enthalpy of vaporization. We use the triple point pressure and temperature as a reference point. | ||
346 | */ | ||
347 | 179220 | static Scalar vaporPressure(Scalar T) | |
348 | { | ||
349 | 179220 | const Scalar p2 = triplePressure(); | |
350 | 179220 | const Scalar T2 = tripleTemperature(); | |
351 | 179220 | const Scalar exponent = -(vaporizationEnthalpy()*molarMass())/IdealGas::R*(1/T - 1/T2); | |
352 | |||
353 | using std::exp; | ||
354 | 179220 | const Scalar vaporPressure = p2*exp(exponent); | |
355 | 179220 | return vaporPressure; | |
356 | } | ||
357 | |||
358 | /*! | ||
359 | * \brief The density in \f$\mathrm{[kg/m^3]}\f$ of the component at a given pressure in | ||
360 | * \f$\mathrm{[Pa]}\f$ and temperature in \f$\mathrm{[K]}\f$. | ||
361 | * | ||
362 | * \param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
363 | */ | ||
364 | 94595726 | static Scalar solidDensity(Scalar temperature) | |
365 | { | ||
366 |
7/12✓ Branch 0 taken 134 times.
✓ Branch 1 taken 94595592 times.
✓ Branch 3 taken 88 times.
✓ Branch 4 taken 46 times.
✓ Branch 6 taken 88 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 88 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 88 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
94595726 | static const Scalar density = getParamFromGroup<Scalar>(std::to_string(id), "Component.SolidDensity"); |
367 | 94595726 | return density; | |
368 | } | ||
369 | |||
370 | /*! | ||
371 | * \brief Thermal conductivity of the component \f$\mathrm{[W/(m*K)]}\f$ as a solid. | ||
372 | * \param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
373 | */ | ||
374 | 94366686 | static Scalar solidThermalConductivity(Scalar temperature) | |
375 | { | ||
376 |
7/12✓ Branch 0 taken 150 times.
✓ Branch 1 taken 94366536 times.
✓ Branch 3 taken 83 times.
✓ Branch 4 taken 67 times.
✓ Branch 6 taken 83 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 83 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 83 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
94366686 | static const Scalar solidThermalConductivity = getParamFromGroup<Scalar>(std::to_string(id), "Component.SolidThermalConductivity"); |
377 | 94366686 | return solidThermalConductivity; | |
378 | } | ||
379 | |||
380 | /*! | ||
381 | * \brief Specific isobaric heat capacity of the component \f$\mathrm{[J/(kg*K)]}\f$ as a solid. | ||
382 | * \param temperature temperature of component in \f$\mathrm{[K]}\f$ | ||
383 | */ | ||
384 | 91070029 | static Scalar solidHeatCapacity(Scalar temperature) | |
385 | { | ||
386 |
7/12✓ Branch 0 taken 141 times.
✓ Branch 1 taken 91069888 times.
✓ Branch 3 taken 81 times.
✓ Branch 4 taken 60 times.
✓ Branch 6 taken 81 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 81 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 81 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
91070029 | static const Scalar solidHeatCapacity = getParamFromGroup<Scalar>(std::to_string(id), "Component.SolidHeatCapacity"); |
387 | 91070029 | return solidHeatCapacity; | |
388 | } | ||
389 | }; | ||
390 | |||
391 | } // end namespace Components | ||
392 | |||
393 | } // end namespace Dumux | ||
394 | |||
395 | #endif | ||
396 |