13#ifndef DUMUX_H2O_N2_O2_FLUID_SYSTEM_HH
14#define DUMUX_H2O_N2_O2_FLUID_SYSTEM_HH
37namespace FluidSystems {
42template<
bool fastButSimplifiedRelations = false>
62template <
class Scalar,
class Policy = H2ON2O2DefaultPolicy<>>
64 :
public Base<Scalar, H2ON2O2<Scalar, Policy> >
112 assert(0 <= phaseIdx && phaseIdx <
numPhases);
118 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index " << phaseIdx);
126 static constexpr bool isGas(
int phaseIdx)
128 assert(0 <= phaseIdx && phaseIdx <
numPhases);
148 assert(0 <= phaseIdx && phaseIdx <
numPhases);
166 assert(0 <= phaseIdx && phaseIdx <
numPhases);
182 assert(0 <= phaseIdx && phaseIdx <
numPhases);
212 DUNE_THROW(Dune::InvalidStateException,
"Invalid component index " << compIdx);
222 static const Scalar M[] = {
239 static const Scalar Tcrit[] = {
246 return Tcrit[compIdx];
256 static const Scalar pcrit[] = {
263 return pcrit[compIdx];
273 DUNE_THROW(Dune::NotImplemented,
274 "H2ON2O2FluidSystem::criticalMolarVolume()");
284 static const Scalar accFac[] = {
285 H2O::acentricFactor(),
286 N2::acentricFactor(),
291 return accFac[compIdx];
305 template <
class Flu
idState>
314 Scalar T = fluidState.temperature(phaseIdx);
334 template <
class Flu
idState>
343 * fluidState.pressure(phaseIdx)
345 /
density(fluidState, phaseIdx)
347 / fluidState.temperature());
357 template <
class Flu
idState>
360 const Scalar T = fluidState.temperature();
404 std::cout <<
"The H2O-N2-O2 fluid system was configured with the following policy:\n";
405 std::cout <<
" - use H2O density as liquid mixture density: " << std::boolalpha << Policy::useH2ODensityAsLiquidMixtureDensity() <<
"\n";
406 std::cout <<
" - use ideal gas density: " << std::boolalpha << Policy::useIdealGasDensity() <<
"\n";
407 std::cout <<
" - use N2 viscosity as gas mixture viscosity: " << std::boolalpha << Policy::useN2ViscosityAsGasMixtureViscosity() <<
"\n";
408 std::cout <<
" - use N2 heat conductivity as gas mixture heat conductivity: " << std::boolalpha << Policy::useN2HeatConductivityAsGasMixtureHeatConductivity() <<
"\n";
409 std::cout <<
" - use ideal gas heat capacities: " << std::boolalpha << Policy::useIdealGasHeatCapacities() << std::endl;
414 pressMin, pressMax, nPress);
431 template <
class Flu
idState>
435 assert(0 <= phaseIdx && phaseIdx <
numPhases);
437 Scalar T = fluidState.temperature(phaseIdx);
438 Scalar p = fluidState.pressure(phaseIdx);
444 if (Policy::useH2ODensityAsLiquidMixtureDensity())
463 if (Policy::useIdealGasDensity())
473 DUNE_THROW(Dune::InvalidStateException,
"Unknown phase index " << phaseIdx);
478 template <
class Flu
idState>
481 const Scalar T = fluidState.temperature(phaseIdx);
482 const Scalar p = fluidState.pressure(phaseIdx);
492 if (Policy::useIdealGasDensity())
516 template <
class Flu
idState>
520 assert(0 <= phaseIdx && phaseIdx <
numPhases);
522 Scalar T = fluidState.temperature(phaseIdx);
523 Scalar p = fluidState.pressure(phaseIdx);
532 if (Policy::useN2ViscosityAsGasMixtureViscosity())
550 sumx += fluidState.moleFraction(phaseIdx, compIdx);
551 sumx = max(1e-10, sumx);
561 divisor += fluidState.moleFraction(phaseIdx, j)/sumx * phiIJ;
563 muResult += fluidState.moleFraction(phaseIdx, i)/sumx * mu[i] / divisor;
591 template <
class Flu
idState>
596 assert(0 <= phaseIdx && phaseIdx <
numPhases);
599 Scalar T = fluidState.temperature(phaseIdx);
600 Scalar p = fluidState.pressure(phaseIdx);
619 template <
class Flu
idState>
624 DUNE_THROW(Dune::NotImplemented,
"Diffusion coefficients");
629 template <
class Flu
idState>
636 if (compIIdx > compJIdx)
639 swap(compIIdx, compJIdx);
643 if (compIIdx == compJIdx ||
647 DUNE_THROW(Dune::InvalidStateException,
648 "Binary diffusion coefficient of components "
649 << compIIdx <<
" and " << compJIdx
650 <<
" in phase " << phaseIdx <<
" is undefined!\n");
654 Scalar T = fluidState.temperature(phaseIdx);
655 Scalar p = fluidState.pressure(phaseIdx);
663 DUNE_THROW(Dune::InvalidStateException,
664 "Binary diffusion coefficient of components "
665 << compIIdx <<
" and " << compJIdx
666 <<
" in phase " << phaseIdx <<
" is undefined!\n");
676 DUNE_THROW(Dune::InvalidStateException,
677 "Binary diffusion coefficient of components "
678 << compIIdx <<
" and " << compJIdx
679 <<
" in phase " << phaseIdx <<
" is undefined!\n");
682 DUNE_THROW(Dune::InvalidStateException,
683 "Binary diffusion coefficient of components "
684 << compIIdx <<
" and " << compJIdx
685 <<
" in phase " << phaseIdx <<
" is undefined!\n");
701 template <
class Flu
idState>
705 Scalar T = fluidState.temperature(phaseIdx);
706 Scalar p = fluidState.pressure(phaseIdx);
727 return hH2O + hN2 + hO2;
730 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index " << phaseIdx);
739 template <
class Flu
idState>
744 const Scalar T = fluidState.temperature(phaseIdx);
745 const Scalar p = fluidState.pressure(phaseIdx);
749 if (componentIdx ==
H2OIdx)
751 else if (componentIdx ==
N2Idx)
752 DUNE_THROW(Dune::NotImplemented,
"Component enthalpy of nitrogen in liquid phase");
753 else if (componentIdx ==
O2Idx)
754 DUNE_THROW(Dune::NotImplemented,
"Component enthalpy of oxygen in liquid phase");
756 DUNE_THROW(Dune::InvalidStateException,
"Invalid component index " << componentIdx);
760 if (componentIdx ==
H2OIdx)
762 else if (componentIdx ==
N2Idx)
764 else if (componentIdx ==
O2Idx)
766 DUNE_THROW(Dune::InvalidStateException,
"Invalid component index " << componentIdx);
768 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index " << phaseIdx);
781 template <
class Flu
idState>
785 assert(0 <= phaseIdx && phaseIdx <
numPhases);
797 if (!Policy::useN2HeatConductivityAsGasMixtureHeatConductivity())
799 Scalar xN2 = fluidState.moleFraction(phaseIdx,
N2Idx);
800 Scalar xO2 = fluidState.moleFraction(phaseIdx,
O2Idx);
801 Scalar xH2O = fluidState.moleFraction(phaseIdx,
H2OIdx);
802 Scalar lambdaN2 = xN2 * lambdaPureN2;
803 Scalar lambdaO2 = xO2 * lambdaPureO2;
806 return lambdaN2 + lambdaH2O + lambdaO2;
815 template <
class Flu
idState>
821 fluidState.pressure(phaseIdx));
828 if (!Policy::useIdealGasHeatCapacities()) {
830 fluidState.pressure(phaseIdx)
831 * fluidState.moleFraction(phaseIdx,
N2Idx));
834 fluidState.pressure(phaseIdx)
835 * fluidState.moleFraction(phaseIdx,
H2OIdx));
837 fluidState.pressure(phaseIdx)
838 * fluidState.moleFraction(phaseIdx,
O2Idx));
static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure)
Diffusion coefficient for molecular nitrogen in liquid water.
Definition: h2o_n2.hh:85
static Scalar henry(Scalar temperature)
Henry coefficient for molecular nitrogen in liquid water.
Definition: h2o_n2.hh:36
static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient for molecular water and nitrogen.
Definition: h2o_n2.hh:54
static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient for molecular water and oxygen.
Definition: h2o_o2.hh:54
static Scalar henry(Scalar temperature)
Henry coefficient for molecular oxygen in liquid water.
Definition: h2o_o2.hh:36
static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure)
Diffusion coefficient for molecular oxygen in liquid water.
Definition: h2o_o2.hh:85
static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient for molecular oxygen in liquid nitrogen.
Definition: n2_o2.hh:49
Properties of pure molecular nitrogen .
Definition: n2.hh:36
static Scalar criticalTemperature()
Returns the critical temperature of molecular nitrogen.
Definition: n2.hh:57
static Scalar criticalPressure()
Returns the critical pressure of molecular nitrogen.
Definition: n2.hh:63
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of at a given pressure and temperature.
Definition: n2.hh:221
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
The molar density of gas in at a given pressure and temperature.
Definition: n2.hh:134
static std::string name()
A human readable name for nitrogen.
Definition: n2.hh:45
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of gas at a given pressure and temperature.
Definition: n2.hh:121
static constexpr Scalar molarMass()
The molar mass in of molecular nitrogen.
Definition: n2.hh:51
static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of nitrogen.
Definition: n2.hh:259
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: n2.hh:146
static const Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of pure nitrogen gas. Shomate Equation is used for a temperature range of 100K to ...
Definition: n2.hh:168
static const Scalar gasHeatCapacity(Scalar T, Scalar pressure)
Specific isobaric heat capacity of pure nitrogen gas. Shomate Equation is used for a temperature ran...
Definition: n2.hh:201
Properties of pure molecular oxygen .
Definition: o2.hh:36
static Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of pure oxygen gas. Shomate Equation is used for a temperature range of 100K to 60...
Definition: o2.hh:166
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
The molar density of pure in , depending on pressure and temperature.
Definition: o2.hh:138
static constexpr Scalar criticalTemperature()
Returns the critical temperature in of molecular oxygen.
Definition: o2.hh:58
static std::string name()
A human readable name for the .
Definition: o2.hh:46
static constexpr Scalar molarMass()
The molar mass in of molecular oxygen.
Definition: o2.hh:52
static Scalar gasHeatCapacity(Scalar T, Scalar pressure)
Specific isobaric heat capacity of pure oxygen gas. Shomate Equation is used for a temperature range...
Definition: o2.hh:182
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of at a given pressure and temperature.
Definition: o2.hh:199
static constexpr Scalar criticalPressure()
Returns the critical pressure in of molecular oxygen.
Definition: o2.hh:64
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: o2.hh:144
static constexpr Scalar gasDensity(Scalar temperature, Scalar pressure)
The density in of pure at a given pressure and temperature.
Definition: o2.hh:126
static constexpr Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of nitrogen.
Definition: o2.hh:238
Tabulates all thermodynamic properties of a given component.
Definition: tabulatedcomponent.hh:672
static const Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of the gas .
Definition: tabulatedcomponent.hh:817
static Scalar criticalTemperature()
Returns the critical temperature in of the component.
Definition: tabulatedcomponent.hh:763
static const Scalar gasHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of the gas .
Definition: tabulatedcomponent.hh:853
static std::string name()
A human readable name for the component.
Definition: tabulatedcomponent.hh:751
static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure)
The thermal conductivity of liquid water .
Definition: tabulatedcomponent.hh:1081
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of gas at a given pressure and temperature .
Definition: tabulatedcomponent.hh:967
static const Scalar liquidEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of the liquid .
Definition: tabulatedcomponent.hh:835
static Scalar criticalPressure()
Returns the critical pressure in of the component.
Definition: tabulatedcomponent.hh:769
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
The molar density of liquid in at a given pressure and temperature.
Definition: tabulatedcomponent.hh:1018
static constexpr Scalar molarMass()
The molar mass in of the component.
Definition: tabulatedcomponent.hh:757
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of liquid.
Definition: tabulatedcomponent.hh:1045
static constexpr bool liquidIsCompressible()
Returns true if the liquid phase is assumed to be compressible.
Definition: tabulatedcomponent.hh:950
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
The density of liquid at a given pressure and temperature .
Definition: tabulatedcomponent.hh:997
static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
The thermal conductivity of gaseous water .
Definition: tabulatedcomponent.hh:1063
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
The molar density of gas in at a given pressure and temperature.
Definition: tabulatedcomponent.hh:987
static constexpr bool isTabulated
state that we are tabulated
Definition: tabulatedcomponent.hh:716
static Scalar vaporPressure(Scalar T)
The vapor pressure in of the component at a given temperature.
Definition: tabulatedcomponent.hh:790
static void init(Scalar tempMin, Scalar tempMax, std::size_t nTemp, Scalar pressMin, Scalar pressMax, std::size_t nPress)
Initialize the tables.
Definition: tabulatedcomponent.hh:728
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: tabulatedcomponent.hh:956
static const Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of the liquid .
Definition: tabulatedcomponent.hh:871
A central place for various physical constants occurring in some equations.
Definition: constants.hh:27
static constexpr Scalar R
The ideal gas constant .
Definition: constants.hh:32
Fluid system base class.
Definition: fluidsystems/base.hh:33
Scalar Scalar
export the scalar type
Definition: fluidsystems/base.hh:36
A two-phase (water and air) fluid system with water, nitrogen and oxygen as components.
Definition: h2on2o2.hh:65
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: h2on2o2.hh:110
static constexpr int comp1Idx
Definition: h2on2o2.hh:95
static Scalar criticalTemperature(int compIdx)
Critical temperature of a component .
Definition: h2on2o2.hh:237
static constexpr int numSPhases
Definition: h2on2o2.hh:83
static constexpr bool isGas(int phaseIdx)
Return whether a phase is gaseous.
Definition: h2on2o2.hh:126
static constexpr int N2Idx
Definition: h2on2o2.hh:91
static constexpr int H2OIdx
Definition: h2on2o2.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: h2on2o2.hh:630
static Scalar componentEnthalpy(const FluidState &fluidState, int phaseIdx, int componentIdx)
Returns the specific enthalpy of a component in a specific phase.
Definition: h2on2o2.hh:740
static Scalar molarMass(int compIdx)
Return the molar mass of a component in .
Definition: h2on2o2.hh:220
static bool isIdealGas(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: h2on2o2.hh:180
static constexpr int phase1Idx
index of the second phase
Definition: h2on2o2.hh:88
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: h2on2o2.hh:192
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: h2on2o2.hh:203
static constexpr int liquidPhaseIdx
index of the liquid phase
Definition: h2on2o2.hh:85
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Returns the fugacity coefficient of a component in a phase.
Definition: h2on2o2.hh:592
static constexpr int gasPhaseMainCompIdx
Definition: h2on2o2.hh:100
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: h2on2o2.hh:164
static Scalar kelvinVaporPressure(const FluidState &fluidState, const int phaseIdx, const int compIdx, const Scalar radius)
Kelvin equation in .
Definition: h2on2o2.hh:306
static Scalar density(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature, pressure, and the partial pressures of all components,...
Definition: h2on2o2.hh:432
static Scalar acentricFactor(int compIdx)
The acentric factor of a component .
Definition: h2on2o2.hh:282
static constexpr int phase0Idx
index of the first phase
Definition: h2on2o2.hh:87
static void init()
Initialize the fluid system's static parameters generically.
Definition: h2on2o2.hh:380
static constexpr int numPhases
Number of phases in the fluid system.
Definition: h2on2o2.hh:81
static constexpr int liquidPhaseMainCompIdx
Definition: h2on2o2.hh:99
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: h2on2o2.hh:479
static Scalar kelvinVaporPressure(const FluidState &fluidState, const int phaseIdx, const int compIdx)
Vapor pressure including the Kelvin equation in .
Definition: h2on2o2.hh:335
static bool isIdealMixture(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: h2on2o2.hh:146
static constexpr int gasPhaseIdx
index of the gas phase
Definition: h2on2o2.hh:86
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: h2on2o2.hh:816
static Scalar thermalConductivity(const FluidState &fluidState, const int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: h2on2o2.hh:782
static Scalar criticalPressure(int compIdx)
Critical pressure of a component .
Definition: h2on2o2.hh:254
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition: h2on2o2.hh:620
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: h2on2o2.hh:517
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy .
Definition: h2on2o2.hh:702
static constexpr int O2Idx
Definition: h2on2o2.hh:92
static constexpr int comp0Idx
Definition: h2on2o2.hh:94
static Scalar surfaceTension(const FluidState &fluidState)
Calculate the surface tension between water and air in , according to IAPWS Release on Surface Tensio...
Definition: h2on2o2.hh:358
static void init(Scalar tempMin, Scalar tempMax, unsigned nTemp, Scalar pressMin, Scalar pressMax, unsigned nPress)
Initialize the fluid system's static parameters using problem specific temperature and pressure range...
Definition: h2on2o2.hh:401
static constexpr int comp2Idx
Definition: h2on2o2.hh:96
static constexpr int numComponents
Number of components in the fluid system.
Definition: h2on2o2.hh:82
static Scalar criticalMolarVolume(int compIdx)
Molar volume of a component at the critical point .
Definition: h2on2o2.hh:271
Relations valid for an ideal gas.
Definition: idealgas.hh:25
static constexpr Scalar molarDensity(Scalar temperature, Scalar pressure)
The molar density of the gas , depending on pressure and temperature.
Definition: idealgas.hh:58
A central place for various physical constants occurring in some equations.
Some exceptions thrown in DuMux
Material properties of pure water .
Binary coefficients for water and nitrogen.
Binary coefficients for water and oxygen.
Relations valid for an ideal gas.
Properties of pure molecular nitrogen .
Binary coefficients for nitrogen and oxygen.
A collection of input/output field names for common physical quantities.
Scalar h2oGasViscosityInMixture(Scalar temperature, Scalar pressure)
The dynamic viscosity of steam in a gas mixture.
Definition: h2o.hh:961
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:39
std::string gaseousPhase() noexcept
I/O name of gaseous phase.
Definition: name.hh:111
std::string liquidPhase() noexcept
I/O name of liquid phase.
Definition: name.hh:107
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:22
Properties of pure molecular oxygen .
Policy for the H2O-N2-O2 fluid system.
Definition: h2on2o2.hh:44
static constexpr bool useIdealGasDensity()
Definition: h2on2o2.hh:46
static constexpr bool useIdealGasHeatCapacities()
Definition: h2on2o2.hh:49
static constexpr bool useH2ODensityAsLiquidMixtureDensity()
Definition: h2on2o2.hh:45
static constexpr bool useN2ViscosityAsGasMixtureViscosity()
Definition: h2on2o2.hh:47
static constexpr bool useN2HeatConductivityAsGasMixtureHeatConductivity()
Definition: h2on2o2.hh:48
Tabulates all thermodynamic properties of a given untabulated chemical species.