3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
1pliquid.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_LIQUID_PHASE_HH
25#define DUMUX_LIQUID_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, OnePLiquid<Scalar, ComponentT> >
46{
49
50 static_assert(ComponentTraits<ComponentT>::hasLiquidState, "The component does not implement a liquid 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::liquidPhase(); }
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 false; }
104
119 static constexpr bool isIdealMixture(int phaseIdx = 0)
120 { return true; }
121
125 static constexpr bool isCompressible(int phaseIdx = 0)
126 { return Component::liquidIsCompressible(); }
127
131 static constexpr bool viscosityIsConstant(int phaseIdx = 0)
132 { return Component::liquidViscosityIsConstant(); }
133
137 static constexpr bool isIdealGas(int phaseIdx = 0)
138 { return false; /* we're a liquid! */ }
139
143 static Scalar molarMass(int compIdx = 0)
144 { return Component::molarMass(); }
145
149 static Scalar criticalTemperature(int compIdx = 0)
150 { return Component::criticalTemperature(); }
151
155 static Scalar criticalPressure(int compIdx = 0)
156 { return Component::criticalPressure(); }
157
161 static Scalar tripleTemperature(int compIdx = 0)
162 { return Component::tripleTemperature(); }
163
167 static Scalar triplePressure(int compIdx = 0)
168 { return Component::triplePressure(); }
169
175 { return Component::vaporPressure(T); }
176
181 { return Component::liquidDensity(temperature, pressure); }
182
183 using Base::density;
187 template <class FluidState>
188 static Scalar density(const FluidState &fluidState,
189 const int phaseIdx)
190 {
191 return density(fluidState.temperature(phaseIdx),
192 fluidState.pressure(phaseIdx));
193 }
194
195 using Base::molarDensity;
205 template <class FluidState>
206 static Scalar molarDensity(const FluidState &fluidState, const int phaseIdx)
207 {
208 return molarDensity(fluidState.temperature(phaseIdx),
209 fluidState.pressure(phaseIdx));
210 }
211
216 { return Component::liquidMolarDensity(temperature, pressure); }
217
222 { return Component::liquidPressure(temperature, density); }
223
228 { return Component::liquidEnthalpy(temperature, pressure); }
229
230 using Base::enthalpy;
234 template <class FluidState>
235 static Scalar enthalpy(const FluidState &fluidState,
236 const int phaseIdx)
237 {
238 return enthalpy(fluidState.temperature(phaseIdx),
239 fluidState.pressure(phaseIdx));
240 }
241
246 { return Component::liquidInternalEnergy(temperature, pressure); }
247
252 { return Component::liquidViscosity(temperature, pressure); }
253
254 using Base::viscosity;
258 template <class FluidState>
259 static Scalar viscosity(const FluidState &fluidState,
260 const int phaseIdx)
261 {
262 return viscosity(fluidState.temperature(phaseIdx),
263 fluidState.pressure(phaseIdx));
264 }
265
274 template <class FluidState>
275 static Scalar fugacityCoefficient(const FluidState &fluidState,
276 int phaseIdx,
277 int compIdx)
278 {
279 assert(0 <= phaseIdx && phaseIdx < numPhases);
280 assert(0 <= compIdx && compIdx < numComponents);
281
282 if (phaseIdx == compIdx)
283 // We could calculate the real fugacity coefficient of
284 // the component in the fluid. Probably that's not worth
285 // the effort, since the fugacity coefficient of the other
286 // component is infinite anyway...
287 return 1.0;
288 return std::numeric_limits<Scalar>::infinity();
289 }
290
299 template <class FluidState>
300 static Scalar diffusionCoefficient(const FluidState &fluidState,
301 int phaseIdx,
302 int compIdx)
303 {
304 DUNE_THROW(Dune::InvalidStateException, "Not applicable: Diffusion coefficients");
305 }
306
316 template <class FluidState>
317 static Scalar binaryDiffusionCoefficient(const FluidState &fluidState,
318 int phaseIdx,
319 int compIIdx,
320 int compJIdx)
321 {
322 DUNE_THROW(Dune::InvalidStateException, "Not applicable: Binary diffusion coefficients");
323 }
324
329 { return Component::liquidThermalConductivity(temperature, pressure); }
330
335 template <class FluidState>
336 static Scalar thermalConductivity(const FluidState &fluidState,
337 const int phaseIdx)
338 {
339 return thermalConductivity(fluidState.temperature(phaseIdx),
340 fluidState.pressure(phaseIdx));
341 }
342
347 { return Component::liquidHeatCapacity(temperature, pressure); }
348
349 using Base::heatCapacity;
353 template <class FluidState>
354 static Scalar heatCapacity(const FluidState &fluidState,
355 const int phaseIdx)
356 {
357 return heatCapacity(fluidState.temperature(phaseIdx),
358 fluidState.pressure(phaseIdx));
359 }
360};
361
362} // namespace FluidSystems
363} // namespace
364
365#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 liquidPhase() noexcept
I/O name of liquid phase.
Definition: name.hh:119
Component traits, i.e. information extracted from components.
Definition: componenttraits.hh:43
A liquid phase consisting of a single component.
Definition: 1pliquid.hh:46
static constexpr int numComponents
Number of components in the fluid system.
Definition: 1pliquid.hh:57
static constexpr bool isCompressible(int phaseIdx=0)
Returns true if the fluid is assumed to be compressible.
Definition: 1pliquid.hh:125
static const Scalar enthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy the pure component as a liquid.
Definition: 1pliquid.hh:227
static Scalar molarDensity(const FluidState &fluidState, const int phaseIdx)
The molar density of a fluid phase in .
Definition: 1pliquid.hh:206
static Scalar enthalpy(const FluidState &fluidState, const int phaseIdx)
Specific enthalpy the pure component as a liquid.
Definition: 1pliquid.hh:235
static std::string phaseName(int phaseIdx=0)
Return the human readable name of a fluid phase.
Definition: 1pliquid.hh:76
static constexpr bool isGas(int phaseIdx=0)
Returns whether the fluid is a liquid.
Definition: 1pliquid.hh:102
static constexpr bool isIdealGas(int phaseIdx=0)
Returns true if the fluid is assumed to be an ideal gas.
Definition: 1pliquid.hh:137
static constexpr bool isIdealMixture(int phaseIdx=0)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: 1pliquid.hh:119
static void init()
Initialize the fluid system's static parameters generically.
Definition: 1pliquid.hh:65
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition: 1pliquid.hh:300
static Scalar molarMass(int compIdx=0)
The mass in of one mole of the component.
Definition: 1pliquid.hh:143
static Scalar triplePressure(int compIdx=0)
Returns the pressure at the component's triple point.
Definition: 1pliquid.hh:167
static Scalar criticalPressure(int compIdx=0)
Returns the critical pressure of the component.
Definition: 1pliquid.hh:155
static Scalar thermalConductivity(const FluidState &fluidState, const int phaseIdx)
Thermal conductivity of the fluid .
Definition: 1pliquid.hh:336
static Scalar density(const FluidState &fluidState, const int phaseIdx)
The density of the component at a given pressure and temperature.
Definition: 1pliquid.hh:188
static std::string name()
A human readable name for the component.
Definition: 1pliquid.hh:90
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: 1pliquid.hh:317
static constexpr bool isMiscible()
There is only one phase, so not mass transfer between phases can occur.
Definition: 1pliquid.hh:96
static Scalar viscosity(const FluidState &fluidState, const int phaseIdx)
The dynamic liquid viscosity of the pure component.
Definition: 1pliquid.hh:259
static Scalar density(Scalar temperature, Scalar pressure)
The density of the component at a given pressure and temperature.
Definition: 1pliquid.hh:180
static Scalar pressure(Scalar temperature, Scalar density)
The pressure of the component at a given density and temperature.
Definition: 1pliquid.hh:221
static Scalar thermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of the fluid .
Definition: 1pliquid.hh:328
static Scalar vaporPressure(Scalar T)
The vapor pressure in of the component at a given temperature.
Definition: 1pliquid.hh:174
static Scalar heatCapacity(const FluidState &fluidState, const int phaseIdx)
Specific isobaric heat capacity of the fluid .
Definition: 1pliquid.hh:354
static const Scalar internalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy the pure component as a liquid.
Definition: 1pliquid.hh:245
static Scalar viscosity(Scalar temperature, Scalar pressure)
The dynamic liquid viscosity of the pure component.
Definition: 1pliquid.hh:251
static Scalar heatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of the fluid .
Definition: 1pliquid.hh:346
static Scalar tripleTemperature(int compIdx=0)
Returns the temperature at the component's triple point.
Definition: 1pliquid.hh:161
static constexpr int comp0Idx
index of the only component
Definition: 1pliquid.hh:60
static Scalar criticalTemperature(int compIdx=0)
Returns the critical temperature of the component.
Definition: 1pliquid.hh:149
static constexpr int phase0Idx
index of the only phase
Definition: 1pliquid.hh:59
static Scalar molarDensity(Scalar temperature, Scalar pressure)
The density of the component at a given pressure and temperature.
Definition: 1pliquid.hh:215
static constexpr bool viscosityIsConstant(int phaseIdx=0)
Returns true if the fluid viscosity is constant.
Definition: 1pliquid.hh:131
ComponentT Component
Definition: 1pliquid.hh:53
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: 1pliquid.hh:275
static std::string componentName(int compIdx=0)
A human readable name for the component.
Definition: 1pliquid.hh:84
static constexpr int numPhases
Number of phases in the fluid system.
Definition: 1pliquid.hh:56
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.