version 3.8
fluidsystems/base.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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
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>
19#include "nullparametercache.hh"
20
21namespace Dumux {
22namespace FluidSystems {
23
31template <class ScalarType, class Implementation>
32class Base
33{
34public:
36 using Scalar = ScalarType;
37
40
44 // \{
45
47 static constexpr bool isTracerFluidSystem()
48 { return false; }
49
59 template<class I = Implementation, std::enable_if_t<!I::isTracerFluidSystem(), int> = 0>
60 static constexpr int getMainComponent(int phaseIdx)
61 { return phaseIdx; }
62
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
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
95 static constexpr bool viscosityIsConstant(int phaseIdx)
96 { return false; }
97
103 static std::string phaseName(int phaseIdx)
104 { return "DefaultPhaseName"; }
105
111 static std::string componentName(int phaseIdx)
112 { return "DefaultComponentName"; }
113
114 // \}
115
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
134 template <class FluidState>
135 static Scalar density(const FluidState &fluidState,
136 const ParameterCache &paramCache,
137 int phaseIdx)
138 {
139 return Implementation::density(fluidState, phaseIdx);
140 }
141
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
165 template <class FluidState>
166 static Scalar molarDensity(const FluidState &fluidState,
167 const ParameterCache &paramCache,
168 int phaseIdx)
169 {
170 return Implementation::molarDensity(fluidState, phaseIdx);
171 }
172
189 template <class FluidState>
190 static Scalar fugacityCoefficient(const FluidState &fluidState,
191 int phaseIdx,
192 int compIdx)
193 {
194 DUNE_THROW(Dune::NotImplemented, "fugacityCoefficient() method not implemented by the fluid system.");
195 }
196
214 template <class FluidState>
215 static Scalar fugacityCoefficient(const FluidState &fluidState,
216 const ParameterCache &paramCache,
217 int phaseIdx,
218 int compIdx)
219 {
220 return Implementation::fugacityCoefficient(fluidState, phaseIdx, compIdx);
221 }
222
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
241 template <class FluidState>
242 static Scalar viscosity(const FluidState &fluidState,
243 const ParameterCache &paramCache,
244 int phaseIdx)
245 {
246 return Implementation::viscosity(fluidState, phaseIdx);
247 }
248
271 template <class FluidState>
272 static Scalar diffusionCoefficient(const FluidState &fluidState,
273 int phaseIdx,
274 int compIdx)
275 {
276 DUNE_THROW(Dune::NotImplemented, "diffusionCoefficient() method not implemented by the fluid system.");
277 }
278
303 template <class FluidState>
304 static Scalar diffusionCoefficient(const FluidState &fluidState,
305 const ParameterCache &paramCache,
306 int phaseIdx,
307 int compIdx)
308 {
309 return Implementation::diffusionCoefficient(fluidState, phaseIdx, compIdx);
310 }
311
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
341 template <class FluidState>
342 static Scalar binaryDiffusionCoefficient(const FluidState &fluidState,
343 const ParameterCache &paramCache,
344 int phaseIdx,
345 int compIIdx,
346 int compJIdx)
347
348 {
349 return Implementation::binaryDiffusionCoefficient(fluidState, phaseIdx, compIIdx, compJIdx);
350 }
351
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
372 template <class FluidState>
373 static Scalar enthalpy(const FluidState &fluidState,
374 const ParameterCache &paramCache,
375 int phaseIdx)
376 {
377 return Implementation::enthalpy(fluidState, phaseIdx);
378 }
379
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
398 template <class FluidState>
399 static Scalar thermalConductivity(const FluidState &fluidState,
400 const ParameterCache &paramCache,
401 int phaseIdx)
402 {
403 return Implementation::thermalConductivity(fluidState, phaseIdx);
404 }
405
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
439 template <class FluidState>
440 static Scalar heatCapacity(const FluidState &fluidState,
441 const ParameterCache &paramCache,
442 int phaseIdx)
443 {
444 return Implementation::heatCapacity(fluidState, phaseIdx);
445 }
446};
447
448} // end namespace FluidSystems
449
450} // end namespace Dumux
451
452#endif
Fluid system base class.
Definition: fluidsystems/base.hh:33
static constexpr bool viscosityIsConstant(int phaseIdx)
Returns true if and only if a fluid phase is assumed to have a constant viscosity.
Definition: fluidsystems/base.hh:95
ScalarType Scalar
export the scalar type
Definition: fluidsystems/base.hh:36
static constexpr bool isTracerFluidSystem()
Some properties of the fluid system.
Definition: fluidsystems/base.hh:47
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, const ParameterCache &paramCache, 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:342
static Scalar density(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx)
Calculate the density of a fluid phase.
Definition: fluidsystems/base.hh:135
static Scalar fugacityCoefficient(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: fluidsystems/base.hh:215
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: fluidsystems/base.hh:83
static Scalar density(const FluidState &fluidState, int phaseIdx)
Calculate the density of a fluid phase.
Definition: fluidsystems/base.hh:122
static Scalar heatCapacity(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: fluidsystems/base.hh:440
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: fluidsystems/base.hh:386
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: fluidsystems/base.hh:103
static Scalar molarDensity(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: fluidsystems/base.hh:166
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: fluidsystems/base.hh:73
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:190
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:272
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:322
static std::string componentName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: fluidsystems/base.hh:111
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:359
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: fluidsystems/base.hh:148
static constexpr int getMainComponent(int phaseIdx)
Get the main component of a given phase if possible.
Definition: fluidsystems/base.hh:60
static Scalar enthalpy(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy .
Definition: fluidsystems/base.hh:373
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: fluidsystems/base.hh:229
static Scalar viscosity(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: fluidsystems/base.hh:242
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: fluidsystems/base.hh:420
static Scalar diffusionCoefficient(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition: fluidsystems/base.hh:304
static Scalar thermalConductivity(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: fluidsystems/base.hh:399
The a parameter cache which does nothing.
Definition: nullparametercache.hh:22
Type traits.
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:62
std::string molarDensity(int phaseIdx) noexcept
I/O name of molar density for multiphase systems.
Definition: name.hh:71
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:53
Definition: adapt.hh:17
The a parameter cache which does nothing.
Template which always yields a false value.
Definition: common/typetraits/typetraits.hh:24