3.5-git
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
140 static constexpr bool viscosityIsConstant(int phaseIdx)
141 { return Component::gasViscosityIsConstant(); }
142
146 static Scalar molarMass(int compIdx = 0)
147 { return Component::molarMass(); }
148
152 static Scalar criticalTemperature(int compIdx = 0)
153 { return Component::criticalTemperature(); }
154
158 static Scalar criticalPressure(int compIdx = 0)
159 { return Component::criticalPressure(); }
160
164 static Scalar tripleTemperature(int compIdx = 0)
165 { return Component::tripleTemperature(); }
166
170 static Scalar triplePressure(int compIdx = 0)
171 { return Component::triplePressure(); }
172
179 { return Component::vaporPressure(T); }
180
187 { return Component::gasDensity(temperature, pressure); }
188
189 using Base::density;
193 template <class FluidState>
194 static Scalar density(const FluidState &fluidState,
195 const int phaseIdx)
196 {
197 return density(fluidState.temperature(phaseIdx),
198 fluidState.pressure(phaseIdx));
199 }
200
211 { return Component::gasMolarDensity(temperature, pressure); }
212
222 using Base::molarDensity;
223 template <class FluidState>
224 static Scalar molarDensity(const FluidState &fluidState,
225 const int phaseIdx)
226 {
227 return molarDensity(fluidState.temperature(phaseIdx),
228 fluidState.pressure(phaseIdx));
229 }
230
237 { return Component::gasPressure(temperature, density); }
238
245 { return Component::gasEnthalpy(temperature, pressure); }
246
250 using Base::enthalpy;
251 template <class FluidState>
252 static Scalar enthalpy(const FluidState &fluidState,
253 const int phaseIdx)
254 {
255 return enthalpy(fluidState.temperature(phaseIdx),
256 fluidState.pressure(phaseIdx));
257 }
258
265 { return Component::gasInternalEnergy(temperature, pressure); }
266
273 { return Component::gasViscosity(temperature, pressure); }
274
275 using Base::viscosity;
279 template <class FluidState>
280 static Scalar viscosity(const FluidState &fluidState,
281 const int phaseIdx)
282 {
283 return viscosity(fluidState.temperature(phaseIdx),
284 fluidState.pressure(phaseIdx));
285 }
286
295 template <class FluidState>
296 static Scalar fugacityCoefficient(const FluidState &fluidState,
297 int phaseIdx,
298 int compIdx)
299 {
300 assert(0 <= phaseIdx && phaseIdx < numPhases);
301 assert(0 <= compIdx && compIdx < numComponents);
302
303 if (phaseIdx == compIdx)
304 // We could calculate the real fugacity coefficient of
305 // the component in the fluid. Probably that's not worth
306 // the effort, since the fugacity coefficient of the other
307 // component is infinite anyway...
308 return 1.0;
309 return std::numeric_limits<Scalar>::infinity();
310 }
311
320 template <class FluidState>
321 static Scalar diffusionCoefficient(const FluidState &fluidState,
322 int phaseIdx,
323 int compIdx)
324 {
325 DUNE_THROW(Dune::InvalidStateException, "Not applicable: Diffusion coefficients");
326 }
327
337 template <class FluidState>
338 static Scalar binaryDiffusionCoefficient(const FluidState &fluidState,
339 int phaseIdx,
340 int compIIdx,
341 int compJIdx)
342
343 {
344 DUNE_THROW(Dune::InvalidStateException, "Not applicable: Binary diffusion coefficients");
345 }
346
353 { return Component::gasThermalConductivity(temperature, pressure); }
354
359 template <class FluidState>
360 static Scalar thermalConductivity(const FluidState &fluidState,
361 const int phaseIdx)
362 {
363 return thermalConductivity(fluidState.temperature(phaseIdx),
364 fluidState.pressure(phaseIdx));
365 }
366
373 { return Component::gasHeatCapacity(temperature, pressure); }
374
375 using Base::heatCapacity;
379 template <class FluidState>
380 static Scalar heatCapacity(const FluidState &fluidState,
381 const int phaseIdx)
382 {
383 return heatCapacity(fluidState.temperature(phaseIdx),
384 fluidState.pressure(phaseIdx));
385 }
386};
387
388} // namespace FluidSystems
389} // namespace
390
391#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:186
static Scalar triplePressure(int compIdx=0)
Returns the pressure in at the component's triple point.
Definition: 1pgas.hh:170
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:296
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:360
static Scalar viscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of the pure component at a given pressure and temperature.
Definition: 1pgas.hh:272
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:210
static Scalar heatCapacity(const FluidState &fluidState, const int phaseIdx)
Specific isobaric heat capacity of the fluid .
Definition: 1pgas.hh:380
static Scalar molarMass(int compIdx=0)
The mass in of one mole of the component.
Definition: 1pgas.hh:146
static constexpr int numPhases
Number of phases in the fluid system.
Definition: 1pgas.hh:56
static constexpr bool viscosityIsConstant(int phaseIdx)
Returns true if and only if a fluid phase is assumed to have a constant viscosity.
Definition: 1pgas.hh:140
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:158
static Scalar tripleTemperature(int compIdx=0)
Returns the temperature in at the component's triple point.
Definition: 1pgas.hh:164
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:321
static const Scalar internalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of the pure component as a gas.
Definition: 1pgas.hh:264
static Scalar criticalTemperature(int compIdx=0)
Returns the critical temperature in of the component.
Definition: 1pgas.hh:152
static Scalar density(const FluidState &fluidState, const int phaseIdx)
The density of the component at a given pressure and temperature.
Definition: 1pgas.hh:194
static const Scalar enthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of the pure component as a gas.
Definition: 1pgas.hh:244
static Scalar molarDensity(const FluidState &fluidState, const int phaseIdx)
Definition: 1pgas.hh:224
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:280
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:338
static Scalar pressure(Scalar temperature, Scalar density)
The pressure of the component at a given density and temperature.
Definition: 1pgas.hh:236
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:352
static Scalar vaporPressure(Scalar T)
The vapor pressure in of the component at a given temperature.
Definition: 1pgas.hh:178
static Scalar heatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of the fluid .
Definition: 1pgas.hh:372
static Scalar enthalpy(const FluidState &fluidState, const int phaseIdx)
Definition: 1pgas.hh:252
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.