version 3.11-dev
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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-FileCopyrightText: 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::FluidSystems {
22
30template <class ScalarType, class Implementation>
31class Base
32{
33public:
35 using Scalar = ScalarType;
36
39
43 // \{
44
46 static constexpr bool isTracerFluidSystem()
47 { return false; }
48
58 template<class I = Implementation, std::enable_if_t<!I::isTracerFluidSystem(), int> = 0>
59 static constexpr int getMainComponent(int phaseIdx)
60 { return phaseIdx; }
61
71 template<class T = Implementation>
72 static constexpr bool isCompressible(int phaseIdx)
73 {
74 static_assert(AlwaysFalse<T>::value, "Mandatory function not implemented: isCompressible(phaseIdx)");
75 return true;
76 }
77
81 template<class T = Implementation>
82 static constexpr bool isMiscible()
83 {
84 static_assert(AlwaysFalse<T>::value, "Mandatory function not implemented: isMiscible()");
85 return true;
86 }
87
94 static constexpr bool viscosityIsConstant(int phaseIdx)
95 { return false; }
96
102 static std::string phaseName(int phaseIdx)
103 { return "DefaultPhaseName"; }
104
110 static std::string componentName(int phaseIdx)
111 { return "DefaultComponentName"; }
112
113 // \}
114
120 template <class FluidState>
121 static Scalar density(const FluidState &fluidState,
122 int phaseIdx)
123 {
124 DUNE_THROW(Dune::NotImplemented, "density() method not implemented by the fluid system.");
125 }
126
133 template <class FluidState>
134 static Scalar density(const FluidState &fluidState,
135 const ParameterCache &paramCache,
136 int phaseIdx)
137 {
138 return Implementation::density(fluidState, phaseIdx);
139 }
140
146 template <class FluidState>
147 static Scalar molarDensity(const FluidState &fluidState,
148 int phaseIdx)
149 {
150 DUNE_THROW(Dune::NotImplemented, "molarDensity() method not implemented by the fluid system.");
151 }
152
164 template <class FluidState>
165 static Scalar molarDensity(const FluidState &fluidState,
166 const ParameterCache &paramCache,
167 int phaseIdx)
168 {
169 return Implementation::molarDensity(fluidState, phaseIdx);
170 }
171
188 template <class FluidState>
189 static Scalar fugacityCoefficient(const FluidState &fluidState,
190 int phaseIdx,
191 int compIdx)
192 {
193 DUNE_THROW(Dune::NotImplemented, "fugacityCoefficient() method not implemented by the fluid system.");
194 }
195
213 template <class FluidState>
214 static Scalar fugacityCoefficient(const FluidState &fluidState,
215 const ParameterCache &paramCache,
216 int phaseIdx,
217 int compIdx)
218 {
219 return Implementation::fugacityCoefficient(fluidState, phaseIdx, compIdx);
220 }
221
227 template <class FluidState>
228 static Scalar viscosity(const FluidState &fluidState,
229 int phaseIdx)
230 {
231 DUNE_THROW(Dune::NotImplemented, "viscosity() method not implemented by the fluid system.");
232 }
233
240 template <class FluidState>
241 static Scalar viscosity(const FluidState &fluidState,
242 const ParameterCache &paramCache,
243 int phaseIdx)
244 {
245 return Implementation::viscosity(fluidState, phaseIdx);
246 }
247
270 template <class FluidState>
271 static Scalar diffusionCoefficient(const FluidState &fluidState,
272 int phaseIdx,
273 int compIdx)
274 {
275 DUNE_THROW(Dune::NotImplemented, "diffusionCoefficient() method not implemented by the fluid system.");
276 }
277
302 template <class FluidState>
303 static Scalar diffusionCoefficient(const FluidState &fluidState,
304 const ParameterCache &paramCache,
305 int phaseIdx,
306 int compIdx)
307 {
308 return Implementation::diffusionCoefficient(fluidState, phaseIdx, compIdx);
309 }
310
320 template <class FluidState>
321 static Scalar binaryDiffusionCoefficient(const FluidState &fluidState,
322 int phaseIdx,
323 int compIIdx,
324 int compJIdx)
325
326 {
327 DUNE_THROW(Dune::NotImplemented, "binaryDiffusionCoefficient() method not implemented by the fluid system.");
328 }
329
340 template <class FluidState>
341 static Scalar binaryDiffusionCoefficient(const FluidState &fluidState,
342 const ParameterCache &paramCache,
343 int phaseIdx,
344 int compIIdx,
345 int compJIdx)
346
347 {
348 return Implementation::binaryDiffusionCoefficient(fluidState, phaseIdx, compIIdx, compJIdx);
349 }
350
357 template <class FluidState>
358 static Scalar enthalpy(const FluidState &fluidState,
359 int phaseIdx)
360 {
361 DUNE_THROW(Dune::NotImplemented, "enthalpy() method not implemented by the fluid system.");
362 }
363
371 template <class FluidState>
372 static Scalar enthalpy(const FluidState &fluidState,
373 const ParameterCache &paramCache,
374 int phaseIdx)
375 {
376 return Implementation::enthalpy(fluidState, phaseIdx);
377 }
378
384 template <class FluidState>
385 static Scalar thermalConductivity(const FluidState &fluidState,
386 int phaseIdx)
387 {
388 DUNE_THROW(Dune::NotImplemented, "thermalConductivity() method not implemented by the fluid system.");
389 }
390
397 template <class FluidState>
398 static Scalar thermalConductivity(const FluidState &fluidState,
399 const ParameterCache &paramCache,
400 int phaseIdx)
401 {
402 return Implementation::thermalConductivity(fluidState, phaseIdx);
403 }
404
418 template <class FluidState>
419 static Scalar heatCapacity(const FluidState &fluidState,
420 int phaseIdx)
421 {
422 DUNE_THROW(Dune::NotImplemented, "heatCapacity() method not implemented by the fluid system.");
423 }
424
438 template <class FluidState>
439 static Scalar heatCapacity(const FluidState &fluidState,
440 const ParameterCache &paramCache,
441 int phaseIdx)
442 {
443 return Implementation::heatCapacity(fluidState, phaseIdx);
444 }
445};
446
447} // end namespace Dumux::FluidSystems
448
449#endif
Fluid system base class.
Definition: fluidsystems/base.hh:32
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:94
ScalarType Scalar
export the scalar type
Definition: fluidsystems/base.hh:35
static constexpr bool isTracerFluidSystem()
Some properties of the fluid system.
Definition: fluidsystems/base.hh:46
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:341
static Scalar density(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx)
Calculate the density of a fluid phase.
Definition: fluidsystems/base.hh:134
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:214
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: fluidsystems/base.hh:82
static Scalar density(const FluidState &fluidState, int phaseIdx)
Calculate the density of a fluid phase.
Definition: fluidsystems/base.hh:121
static Scalar heatCapacity(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: fluidsystems/base.hh:439
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: fluidsystems/base.hh:385
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: fluidsystems/base.hh:102
static Scalar molarDensity(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: fluidsystems/base.hh:165
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: fluidsystems/base.hh:72
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:189
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:271
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:321
static std::string componentName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: fluidsystems/base.hh:110
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:358
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: fluidsystems/base.hh:147
static constexpr int getMainComponent(int phaseIdx)
Get the main component of a given phase if possible.
Definition: fluidsystems/base.hh:59
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:372
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: fluidsystems/base.hh:228
static Scalar viscosity(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: fluidsystems/base.hh:241
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: fluidsystems/base.hh:419
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:303
static Scalar thermalConductivity(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: fluidsystems/base.hh:398
The a parameter cache which does nothing.
Definition: nullparametercache.hh:22
Type traits.
Definition: h2o.hh:901
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
The a parameter cache which does nothing.
Template which always yields a false value.
Definition: common/typetraits/typetraits.hh:24