12#ifndef DUMUX_H2O_N2_FLUID_SYSTEM_HH 
   13#define DUMUX_H2O_N2_FLUID_SYSTEM_HH 
   37template<
bool fastButSimplifiedRelations = false>
 
   53template <
class Scalar, 
class Policy = H2ON2DefaultPolicy<>>
 
   55    : 
public Base<Scalar, H2ON2<Scalar, Policy> >
 
   65    using H2O = TabulatedH2O; 
 
   93        assert(0 <= phaseIdx && phaseIdx < 
numPhases);
 
   99        DUNE_THROW(Dune::InvalidStateException, 
"Invalid phase index " << phaseIdx);
 
 
  113    static constexpr bool isGas(
int phaseIdx)
 
  115        assert(0 <= phaseIdx && phaseIdx < 
numPhases);
 
 
  135        assert(0 <= phaseIdx && phaseIdx < 
numPhases);
 
 
  153        assert(0 <= phaseIdx && phaseIdx < 
numPhases);
 
 
  169        assert(0 <= phaseIdx && phaseIdx < 
numPhases);
 
 
  193        DUNE_THROW(Dune::InvalidStateException, 
"Invalid component index " << compIdx);
 
 
  203        static const Scalar M[] = {
 
 
  219        static const Scalar Tcrit[] = {
 
  225        return Tcrit[compIdx];
 
 
  235        static const Scalar pcrit[] = {
 
  241        return pcrit[compIdx];
 
 
  253    template <
class Flu
idState>
 
  262               * fluidState.pressure(phaseIdx)
 
  264                       / 
density(fluidState, phaseIdx)
 
  266                       / fluidState.temperature());
 
 
  276        DUNE_THROW(Dune::NotImplemented,
 
  277                   "H2ON2FluidSystem::criticalMolarVolume()");
 
 
  287        static const Scalar accFac[] = {
 
  288            H2O::acentricFactor(),
 
  293        return accFac[compIdx];
 
 
  330        std::cout << 
"The H2O-N2 fluid system was configured with the following policy:\n";
 
  331        std::cout << 
" - use H2O density as liquid mixture density: " << std::boolalpha << Policy::useH2ODensityAsLiquidMixtureDensity() << 
"\n";
 
  332        std::cout << 
" - use ideal gas density: " << std::boolalpha << Policy::useIdealGasDensity() << 
"\n";
 
  333        std::cout << 
" - use N2 viscosity as gas mixture viscosity: " << std::boolalpha << Policy::useN2ViscosityAsGasMixtureViscosity() << 
"\n";
 
  334        std::cout << 
" - use N2 heat conductivity as gas mixture heat conductivity: " << std::boolalpha << Policy::useN2HeatConductivityAsGasMixtureHeatConductivity() << 
"\n";
 
  335        std::cout << 
" - use ideal gas heat capacities: " << std::boolalpha << Policy::useIdealGasHeatCapacities() << std::endl;
 
  338            H2O::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress);
 
 
  354    template <
class Flu
idState>
 
  358        assert(0 <= phaseIdx  && phaseIdx < 
numPhases);
 
  360        Scalar T = fluidState.temperature(phaseIdx);
 
  361        Scalar p = fluidState.pressure(phaseIdx);
 
  365            if (Policy::useH2ODensityAsLiquidMixtureDensity())
 
  381        if (Policy::useIdealGasDensity())
 
  391        return (rho_gH2O + rho_gN2);
 
 
  396    template <
class Flu
idState>
 
  399        assert(0 <= phaseIdx  && phaseIdx < 
numPhases);
 
  401        Scalar T = fluidState.temperature(phaseIdx);
 
  402        Scalar p = fluidState.pressure(phaseIdx);
 
  414        if (Policy::useIdealGasDensity())
 
  423        return rho_gH2O + rho_gN2;
 
 
  439    template <
class Flu
idState>
 
  443        assert(0 <= phaseIdx  && phaseIdx < 
numPhases);
 
  445        Scalar T = fluidState.temperature(phaseIdx);
 
  446        Scalar p = fluidState.pressure(phaseIdx);
 
  455        if (Policy::useN2ViscosityAsGasMixtureViscosity())
 
  472                sumx += fluidState.moleFraction(phaseIdx, compIdx);
 
  473            sumx = max(1e-10, sumx);
 
  483                    divisor += fluidState.moleFraction(phaseIdx, j)/sumx * phiIJ;
 
  485                muResult += fluidState.moleFraction(phaseIdx, i)/sumx * mu[i] / divisor;
 
 
  494    template <
class Flu
idState>
 
  499        assert(0 <= phaseIdx  && phaseIdx < 
numPhases);
 
  502        Scalar T = fluidState.temperature(phaseIdx);
 
  503        Scalar p = fluidState.pressure(phaseIdx);
 
 
  519    template <
class Flu
idState>
 
  524        DUNE_THROW(Dune::NotImplemented, 
"Diffusion coefficients");
 
 
  529    template <
class Flu
idState>
 
  536        if (compIIdx > compJIdx)
 
  539            swap(compIIdx, compJIdx);
 
  542        const Scalar T = fluidState.temperature(phaseIdx);
 
  543        const Scalar p = fluidState.pressure(phaseIdx);
 
  552            DUNE_THROW(Dune::InvalidStateException,
 
  553                   "Binary diffusion coefficient of components " 
  554                    << compIIdx << 
" and " << compJIdx
 
  555                    << 
" in phase " << phaseIdx << 
" is unavailable!\n");
 
 
  571    template <
class Flu
idState>
 
  575        const Scalar T = fluidState.temperature(phaseIdx);
 
  576        const Scalar p = fluidState.pressure(phaseIdx);
 
 
  603    template <
class Flu
idState>
 
  608        const Scalar T = fluidState.temperature(phaseIdx);
 
  609        const Scalar p = fluidState.pressure(phaseIdx);
 
  613            if (componentIdx == 
H2OIdx)
 
  615            else if (componentIdx == 
N2Idx)
 
  616                DUNE_THROW(Dune::NotImplemented, 
"Component enthalpy of nitrogen in liquid phase");
 
  618                DUNE_THROW(Dune::InvalidStateException, 
"Invalid component index " << componentIdx);
 
  622            if (componentIdx == 
H2OIdx)
 
  624            else if (componentIdx == 
N2Idx)
 
  627                DUNE_THROW(Dune::InvalidStateException, 
"Invalid component index " << componentIdx);
 
  630            DUNE_THROW(Dune::InvalidStateException, 
"Invalid phase index " << phaseIdx);
 
 
  642    template <
class Flu
idState>
 
  646        assert(0 <= phaseIdx  && phaseIdx < 
numPhases);
 
  648        const Scalar temperature  = fluidState.temperature(phaseIdx) ;
 
  649        const Scalar pressure = fluidState.pressure(phaseIdx);
 
  657            if (!Policy::useN2HeatConductivityAsGasMixtureHeatConductivity())
 
  659                Scalar xN2 = fluidState.moleFraction(phaseIdx, 
N2Idx);
 
  660                Scalar xH2O = fluidState.moleFraction(phaseIdx, 
H2OIdx);
 
  661                Scalar lambdaN2 = xN2 * lambdaPureN2;
 
  662                Scalar partialPressure  = pressure * xH2O;
 
  664                return lambdaN2 + lambdaH2O;
 
 
  673    template <
class Flu
idState>
 
  679                                           fluidState.pressure(phaseIdx));
 
  686        if (!Policy::useIdealGasHeatCapacities()) {
 
  688                                        fluidState.pressure(phaseIdx)
 
  689                                        * fluidState.moleFraction(phaseIdx, 
N2Idx));
 
  692                                          fluidState.pressure(phaseIdx)
 
  693                                          * fluidState.moleFraction(phaseIdx, 
H2OIdx));
 
 
 
static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure)
Diffusion coefficient  for molecular nitrogen in liquid water.
Definition h2o_n2.hh:84
static Scalar henry(Scalar temperature)
Henry coefficient  for molecular nitrogen in liquid water.
Definition h2o_n2.hh:35
static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient  for molecular water and nitrogen.
Definition h2o_n2.hh:53
Properties of pure molecular nitrogen .
Definition n2.hh:35
static Scalar criticalTemperature()
Returns the critical temperature  of molecular nitrogen.
Definition n2.hh:56
static Scalar criticalPressure()
Returns the critical pressure  of molecular nitrogen.
Definition n2.hh:62
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity  of  at a given pressure and temperature.
Definition n2.hh:220
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
The molar density of  gas in  at a given pressure and temperature.
Definition n2.hh:133
static std::string name()
A human readable name for nitrogen.
Definition n2.hh:44
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density  of  gas at a given pressure and temperature.
Definition n2.hh:120
static constexpr Scalar molarMass()
The molar mass in  of molecular nitrogen.
Definition n2.hh:50
static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity  of nitrogen.
Definition n2.hh:258
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition n2.hh:145
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:167
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:200
Tabulates all thermodynamic properties of a given component.
Definition tabulatedcomponent.hh:672
static const Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
Definition tabulatedcomponent.hh:817
static Scalar criticalTemperature()
Definition tabulatedcomponent.hh:763
static const Scalar gasHeatCapacity(Scalar temperature, Scalar pressure)
Definition tabulatedcomponent.hh:853
static std::string name()
Definition tabulatedcomponent.hh:751
static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure)
Definition tabulatedcomponent.hh:1081
static Scalar gasDensity(Scalar temperature, Scalar pressure)
Definition tabulatedcomponent.hh:967
static const Scalar liquidEnthalpy(Scalar temperature, Scalar pressure)
Definition tabulatedcomponent.hh:835
static Scalar criticalPressure()
Definition tabulatedcomponent.hh:769
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
Definition tabulatedcomponent.hh:1018
static constexpr Scalar molarMass()
Definition tabulatedcomponent.hh:757
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
Definition tabulatedcomponent.hh:1045
static constexpr bool liquidIsCompressible()
Definition tabulatedcomponent.hh:950
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
Definition tabulatedcomponent.hh:997
static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
Definition tabulatedcomponent.hh:1063
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
Definition tabulatedcomponent.hh:987
static constexpr bool isTabulated
Definition tabulatedcomponent.hh:716
static Scalar vaporPressure(Scalar T)
Definition tabulatedcomponent.hh:790
static void init(Scalar tempMin, Scalar tempMax, std::size_t nTemp, Scalar pressMin, Scalar pressMax, std::size_t nPress)
Definition tabulatedcomponent.hh:728
static constexpr bool gasIsIdeal()
Definition tabulatedcomponent.hh:956
static const Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
Definition tabulatedcomponent.hh:871
static constexpr Scalar R
The ideal gas constant .
Definition constants.hh:32
Fluid system base class.
Definition fluidsystems/base.hh:32
Scalar Scalar
Definition fluidsystems/base.hh:35
A two-phase fluid system with two components water  Nitrogen  for non-equilibrium models.
Definition h2on2.hh:56
static constexpr bool isGas(int phaseIdx)
Return whether a phase is gaseous.
Definition h2on2.hh:113
static constexpr int liquidPhaseIdx
Definition h2on2.hh:71
static bool isIdealMixture(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition h2on2.hh:133
static Scalar molarMass(int compIdx)
Return the molar mass of a component in .
Definition h2on2.hh:201
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity  of a fluid phase .
Definition h2on2.hh:674
static Scalar thermalConductivity(const FluidState &fluidState, const int phaseIdx)
Thermal conductivity of a fluid phase .
Definition h2on2.hh:643
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 h2on2.hh:530
static constexpr int phase1Idx
Definition h2on2.hh:74
static constexpr int liquidCompIdx
Definition h2on2.hh:80
static Scalar criticalMolarVolume(int compIdx)
Molar volume of a component at the critical point .
Definition h2on2.hh:274
static constexpr int N2Idx
Definition h2on2.hh:77
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition h2on2.hh:151
static constexpr int comp1Idx
Definition h2on2.hh:79
static constexpr int gasPhaseIdx
Definition h2on2.hh:72
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition h2on2.hh:185
static constexpr int H2OIdx
Definition h2on2.hh:76
TabulatedH2O H2O
Definition h2on2.hh:65
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 h2on2.hh:327
static void init()
Initialize the fluid system's static parameters generically.
Definition h2on2.hh:306
static constexpr int comp0Idx
Definition h2on2.hh:78
static Scalar componentEnthalpy(const FluidState &fluidState, int phaseIdx, int componentIdx)
Returns the specific enthalpy  of a component in the specified phase.
Definition h2on2.hh:604
static Scalar acentricFactor(int compIdx)
The acentric factor of a component .
Definition h2on2.hh:285
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient  of an individual component in a fluid phase.
Definition h2on2.hh:495
static constexpr int phase0Idx
Definition h2on2.hh:73
static Scalar density(const FluidState &fluidState, int phaseIdx)
Definition h2on2.hh:355
static Scalar kelvinVaporPressure(const FluidState &fluidState, const int phaseIdx, const int compIdx)
Vapor pressure including the Kelvin equation in .
Definition h2on2.hh:254
static Scalar criticalPressure(int compIdx)
Critical pressure of a component .
Definition h2on2.hh:233
static constexpr int numComponents
Definition h2on2.hh:69
static constexpr int numPhases
Definition h2on2.hh:68
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition h2on2.hh:105
SimpleN2 N2
Definition h2on2.hh:66
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density  of a fluid phase.
Definition h2on2.hh:397
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy .
Definition h2on2.hh:572
static constexpr int gasCompIdx
Definition h2on2.hh:81
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition h2on2.hh:520
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition h2on2.hh:440
static bool isIdealGas(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition h2on2.hh:167
static Scalar criticalTemperature(int compIdx)
Critical temperature of a component .
Definition h2on2.hh:217
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition h2on2.hh:91
Relations valid for an ideal gas.
Definition idealgas.hh:25
static constexpr Scalar density(Scalar avgMolarMass, Scalar temperature, Scalar pressure)
The density of the gas in , depending on pressure, temperature and average molar mass of the gas.
Definition idealgas.hh:37
static constexpr Scalar molarDensity(Scalar temperature, Scalar pressure)
The molar density of the gas , depending on pressure and temperature.
Definition idealgas.hh:58
Some exceptions thrown in DuMux
Material properties of pure water .
Binary coefficients for water and nitrogen.
Relations valid for an ideal gas.
Properties of pure molecular nitrogen .
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:964
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
Policy for the H2O-N2 fluid system.
Definition h2on2.hh:39
static constexpr bool useIdealGasHeatCapacities()
Definition h2on2.hh:44
static constexpr bool useN2HeatConductivityAsGasMixtureHeatConductivity()
Definition h2on2.hh:43
static constexpr bool useIdealGasDensity()
Definition h2on2.hh:41
static constexpr bool useH2ODensityAsLiquidMixtureDensity()
Definition h2on2.hh:40
static constexpr bool useN2ViscosityAsGasMixtureViscosity()
Definition h2on2.hh:42
Tabulates all thermodynamic properties of a given untabulated chemical species.