3.4
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
1pgas.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*****************************************************************************
4 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_GAS_PHASE_HH
25#define DUMUX_GAS_PHASE_HH
26
27#include <cassert>
28#include <limits>
29
30#include <dune/common/exceptions.hh>
31
34#include <dumux/io/name.hh>
35
36namespace Dumux {
37namespace FluidSystems {
38
43template <class Scalar, class ComponentT>
45: public Base<Scalar, OnePGas<Scalar, ComponentT> >
46{
49
50 static_assert(ComponentTraits<ComponentT>::hasGasState, "The component does not implement a gas state!");
51
52public:
53 using Component = ComponentT;
55
56 static constexpr int numPhases = 1;
57 static constexpr int numComponents = 1;
58
59 static constexpr int phase0Idx = 0;
60 static constexpr int comp0Idx = 0;
61
65 static void init()
66 { }
67
68 /****************************************
69 * Fluid phase related static parameters
70 ****************************************/
76 static std::string phaseName(int phaseIdx = 0)
77 { return IOName::gaseousPhase(); }
78
84 static std::string componentName(int compIdx = 0)
85 { return Component::name(); }
86
90 static std::string name()
91 { return Component::name(); }
92
96 static constexpr bool isMiscible()
97 { return false; }
98
102 static constexpr bool isGas(int phaseIdx = 0)
103 { return true; }
104
119 static constexpr bool isIdealMixture(int phaseIdx = 0)
120 { return true; }
121
125 static constexpr bool isCompressible(int phaseIdx = 0)
126 { return Component::gasIsCompressible(); }
127
131 static constexpr bool isIdealGas(int phaseIdx = 0)
132 { return Component::gasIsIdeal(); }
133
137 static Scalar molarMass(int compIdx = 0)
138 { return Component::molarMass(); }
139
143 static Scalar criticalTemperature(int compIdx = 0)
144 { return Component::criticalTemperature(); }
145
149 static Scalar criticalPressure(int compIdx = 0)
150 { return Component::criticalPressure(); }
151
155 static Scalar tripleTemperature(int compIdx = 0)
156 { return Component::tripleTemperature(); }
157
161 static Scalar triplePressure(int compIdx = 0)
162 { return Component::triplePressure(); }
163
170 { return Component::vaporPressure(T); }
171
178 { return Component::gasDensity(temperature, pressure); }
179
180 using Base::density;
184 template <class FluidState>
185 static Scalar density(const FluidState &fluidState,
186 const int phaseIdx)
187 {
188 return density(fluidState.temperature(phaseIdx),
189 fluidState.pressure(phaseIdx));
190 }
191
202 { return Component::gasMolarDensity(temperature, pressure); }
203
213 using Base::molarDensity;
214 template <class FluidState>
215 static Scalar molarDensity(const FluidState &fluidState,
216 const int phaseIdx)
217 {
218 return molarDensity(fluidState.temperature(phaseIdx),
219 fluidState.pressure(phaseIdx));
220 }
221
228 { return Component::gasPressure(temperature, density); }
229
236 { return Component::gasEnthalpy(temperature, pressure); }
237
241 using Base::enthalpy;
242 template <class FluidState>
243 static Scalar enthalpy(const FluidState &fluidState,
244 const int phaseIdx)
245 {
246 return enthalpy(fluidState.temperature(phaseIdx),
247 fluidState.pressure(phaseIdx));
248 }
249
256 { return Component::gasInternalEnergy(temperature, pressure); }
257
264 { return Component::gasViscosity(temperature, pressure); }
265
266 using Base::viscosity;
270 template <class FluidState>
271 static Scalar viscosity(const FluidState &fluidState,
272 const int phaseIdx)
273 {
274 return viscosity(fluidState.temperature(phaseIdx),
275 fluidState.pressure(phaseIdx));
276 }
277
286 template <class FluidState>
287 static Scalar fugacityCoefficient(const FluidState &fluidState,
288 int phaseIdx,
289 int compIdx)
290 {
291 assert(0 <= phaseIdx && phaseIdx < numPhases);
292 assert(0 <= compIdx && compIdx < numComponents);
293
294 if (phaseIdx == compIdx)
295 // We could calculate the real fugacity coefficient of
296 // the component in the fluid. Probably that's not worth
297 // the effort, since the fugacity coefficient of the other
298 // component is infinite anyway...
299 return 1.0;
300 return std::numeric_limits<Scalar>::infinity();
301 }
302
311 template <class FluidState>
312 static Scalar diffusionCoefficient(const FluidState &fluidState,
313 int phaseIdx,
314 int compIdx)
315 {
316 DUNE_THROW(Dune::InvalidStateException, "Not applicable: Diffusion coefficients");
317 }
318
328 template <class FluidState>
329 static Scalar binaryDiffusionCoefficient(const FluidState &fluidState,
330 int phaseIdx,
331 int compIIdx,
332 int compJIdx)
333
334 {
335 DUNE_THROW(Dune::InvalidStateException, "Not applicable: Binary diffusion coefficients");
336 }
337
344 { return Component::gasThermalConductivity(temperature, pressure); }
345
350 template <class FluidState>
351 static Scalar thermalConductivity(const FluidState &fluidState,
352 const int phaseIdx)
353 {
354 return thermalConductivity(fluidState.temperature(phaseIdx),
355 fluidState.pressure(phaseIdx));
356 }
357
364 { return Component::gasHeatCapacity(temperature, pressure); }
365
366 using Base::heatCapacity;
370 template <class FluidState>
371 static Scalar heatCapacity(const FluidState &fluidState,
372 const int phaseIdx)
373 {
374 return heatCapacity(fluidState.temperature(phaseIdx),
375 fluidState.pressure(phaseIdx));
376 }
377};
378
379} // namespace FluidSystems
380} // namespace
381
382#endif
A collection of input/output field names for common physical quantities.
Component traits, i.e. information extracted from components.
Definition: adapt.hh:29
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
std::string gaseousPhase() noexcept
I/O name of gaseous phase.
Definition: name.hh:123
Component traits, i.e. information extracted from components.
Definition: componenttraits.hh:43
A gaseous phase consisting of a single component.
Definition: 1pgas.hh:46
static Scalar density(Scalar temperature, Scalar pressure)
The density of the component at a given pressure and temperature.
Definition: 1pgas.hh:177
static Scalar triplePressure(int compIdx=0)
Returns the pressure in at the component's triple point.
Definition: 1pgas.hh:161
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: 1pgas.hh:287
static std::string componentName(int compIdx=0)
A human readable name for the component.
Definition: 1pgas.hh:84
static Scalar thermalConductivity(const FluidState &fluidState, const int phaseIdx)
Thermal conductivity of the fluid .
Definition: 1pgas.hh:351
static Scalar viscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of the pure component at a given pressure and temperature.
Definition: 1pgas.hh:263
static constexpr bool isGas(int phaseIdx=0)
Returns whether the fluid is gaseous.
Definition: 1pgas.hh:102
ComponentT Component
Definition: 1pgas.hh:53
static Scalar molarDensity(Scalar temperature, Scalar pressure)
The molar density of a fluid phase in .
Definition: 1pgas.hh:201
static Scalar heatCapacity(const FluidState &fluidState, const int phaseIdx)
Specific isobaric heat capacity of the fluid .
Definition: 1pgas.hh:371
static Scalar molarMass(int compIdx=0)
The mass in of one mole of the component.
Definition: 1pgas.hh:137
static constexpr int numPhases
Number of phases in the fluid system.
Definition: 1pgas.hh:56
static constexpr int comp0Idx
index of the only component
Definition: 1pgas.hh:60
static constexpr int numComponents
Number of components in the fluid system.
Definition: 1pgas.hh:57
static Scalar criticalPressure(int compIdx=0)
Returns the critical pressure in of the component.
Definition: 1pgas.hh:149
static Scalar tripleTemperature(int compIdx=0)
Returns the temperature in at the component's triple point.
Definition: 1pgas.hh:155
static std::string name()
A human readable name for the component.
Definition: 1pgas.hh:90
static constexpr bool isIdealGas(int phaseIdx=0)
Returns true if the fluid is assumed to be an ideal gas.
Definition: 1pgas.hh:131
static constexpr int phase0Idx
index of the only phase
Definition: 1pgas.hh:59
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition: 1pgas.hh:312
static const Scalar internalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of the pure component as a gas.
Definition: 1pgas.hh:255
static Scalar criticalTemperature(int compIdx=0)
Returns the critical temperature in of the component.
Definition: 1pgas.hh:143
static Scalar density(const FluidState &fluidState, const int phaseIdx)
The density of the component at a given pressure and temperature.
Definition: 1pgas.hh:185
static const Scalar enthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of the pure component as a gas.
Definition: 1pgas.hh:235
static Scalar molarDensity(const FluidState &fluidState, const int phaseIdx)
Definition: 1pgas.hh:215
static std::string phaseName(int phaseIdx=0)
Return the human readable name of a fluid phase.
Definition: 1pgas.hh:76
static constexpr bool isIdealMixture(int phaseIdx=0)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: 1pgas.hh:119
static Scalar viscosity(const FluidState &fluidState, const int phaseIdx)
The dynamic liquid viscosity of the pure component.
Definition: 1pgas.hh:271
static constexpr bool isCompressible(int phaseIdx=0)
Returns true if the fluid is assumed to be compressible.
Definition: 1pgas.hh:125
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIIdx, int compJIdx)
Given a phase's composition, temperature and pressure, return the binary diffusion coefficient for c...
Definition: 1pgas.hh:329
static Scalar pressure(Scalar temperature, Scalar density)
The pressure of the component at a given density and temperature.
Definition: 1pgas.hh:227
static constexpr bool isMiscible()
There is only one phase, so not mass transfer between phases can occur.
Definition: 1pgas.hh:96
static void init()
Initialize the fluid system's static parameters generically.
Definition: 1pgas.hh:65
static Scalar thermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of the fluid .
Definition: 1pgas.hh:343
static Scalar vaporPressure(Scalar T)
The vapor pressure in of the component at a given temperature.
Definition: 1pgas.hh:169
static Scalar heatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of the fluid .
Definition: 1pgas.hh:363
static Scalar enthalpy(const FluidState &fluidState, const int phaseIdx)
Definition: 1pgas.hh:243
Fluid system base class.
Definition: fluidsystems/base.hh:45
Scalar Scalar
export the scalar type
Definition: fluidsystems/base.hh:48
static Scalar density(const FluidState &fluidState, int phaseIdx)
Calculate the density of a fluid phase.
Definition: fluidsystems/base.hh:134
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: fluidsystems/base.hh:390
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: fluidsystems/base.hh:197
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition: fluidsystems/base.hh:278
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIIdx, int compJIdx)
Given a phase's composition, temperature and pressure, return the binary diffusion coefficient for c...
Definition: fluidsystems/base.hh:326
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy .
Definition: fluidsystems/base.hh:363
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: fluidsystems/base.hh:160
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: fluidsystems/base.hh:236
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: fluidsystems/base.hh:424
The a parameter cache which does nothing.
Definition: nullparametercache.hh:34
Fluid system base class.