some const cleanups

- make the methods of the fluid systems and components which just
  return a parameter constexpr.
- don't use 'const' for call-by value parameters
This commit is contained in:
Andreas Lauser
2012-06-13 16:14:06 +02:00
committed by Andreas Lauser
parent 4e36f7bc0f
commit 713d126e24
28 changed files with 553 additions and 585 deletions

View File

@@ -55,15 +55,15 @@ inline Scalar henryIAPWS(Scalar E,
Scalar Tr = temperature/H2O::criticalTemperature();
Scalar tau = 1 - Tr;
static const Scalar c[6] = {
static constexpr Scalar c[6] = {
1.99274064, 1.09965342, -0.510839303,
-1.75493479,-45.5170352, -6.7469445e5
};
static const Scalar d[6] = {
static constexpr Scalar d[6] = {
1/3.0, 2/3.0, 5/3.0,
16/3.0, 43/3.0, 110/3.0
};
static const Scalar q = -0.023767;
static constexpr Scalar q = -0.023767;
Scalar f = 0;
for (int i = 0; i < 6; ++i) {

View File

@@ -65,19 +65,19 @@ public:
*
* Taken from constrelair.hh.
*/
static Scalar molarMass()
static constexpr Scalar molarMass()
{ return 0.02896; /* [kg/mol] */ }
/*!
* \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of \f$AIR\f$.
*/
static Scalar criticalTemperature()
static constexpr Scalar criticalTemperature()
{ return 132.531 ; /* [K] */ }
/*!
* \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of \f$AIR\f$.
*/
static Scalar criticalPressure()
static constexpr Scalar criticalPressure()
{ return 37.86e5; /* [Pa] */ }
/*!
@@ -95,13 +95,13 @@ public:
/*!
* \brief Returns true iff the gas phase is assumed to be compressible
*/
static bool gasIsCompressible()
static constexpr bool gasIsCompressible()
{ return true; }
/*!
* \brief Returns true iff the gas phase is assumed to be ideal
*/
static bool gasIsIdeal()
static constexpr bool gasIsIdeal()
{ return true; }
/*!

View File

@@ -79,43 +79,43 @@ public:
/*!
* \brief The molar mass in \f$\mathrm{[kg/mol]}\f$ of water.
*/
static Scalar molarMass()
static constexpr Scalar molarMass()
{ return Common::molarMass; }
/*!
* \brief The acentric factor \f$\mathrm{[-]}\f$ of water.
*/
static Scalar acentricFactor()
static constexpr Scalar acentricFactor()
{ return Common::acentricFactor; }
/*!
* \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of water
*/
static Scalar criticalTemperature()
static constexpr Scalar criticalTemperature()
{ return Common::criticalTemperature; }
/*!
* \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of water.
*/
static Scalar criticalPressure()
static constexpr Scalar criticalPressure()
{ return Common::criticalPressure; }
/*!
* \brief Returns the molar volume \f$\mathrm{[m^3/mol]}\f$ of water at the critical point
*/
static Scalar criticalMolarVolume()
static constexpr Scalar criticalMolarVolume()
{ return Common::criticalMolarVolume; }
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ at water's triple point.
*/
static Scalar tripleTemperature()
static constexpr Scalar tripleTemperature()
{ return Common::tripleTemperature; }
/*!
* \brief Returns the pressure \f$\mathrm{[Pa]}\f$ at water's triple point.
*/
static Scalar triplePressure()
static constexpr Scalar triplePressure()
{ return Common::triplePressure; }
/*!
@@ -152,8 +152,8 @@ public:
* 1997 for the Thermodynamic Properties of Water and Steam",
* http://www.iapws.org/relguide/IF97-Rev.pdf
*/
static const Scalar gasEnthalpy(Scalar temperature,
Scalar pressure)
static Scalar gasEnthalpy(Scalar temperature,
Scalar pressure)
{
if (!Region2::isValid(temperature, pressure))
{
@@ -202,8 +202,8 @@ public:
* 1997 for the Thermodynamic Properties of Water and Steam",
* http://www.iapws.org/relguide/IF97-Rev.pdf
*/
static const Scalar liquidEnthalpy(Scalar temperature,
Scalar pressure)
static Scalar liquidEnthalpy(Scalar temperature,
Scalar pressure)
{
if (!Region1::isValid(temperature, pressure))
{
@@ -243,8 +243,8 @@ public:
* 1997 for the Thermodynamic Properties of Water and Steam",
* http://www.iapws.org/relguide/IF97-Rev.pdf
*/
static const Scalar gasHeatCapacity(Scalar temperature,
Scalar pressure)
static Scalar gasHeatCapacity(Scalar temperature,
Scalar pressure)
{
if (!Region2::isValid(temperature, pressure))
{
@@ -279,8 +279,8 @@ public:
* 1997 for the Thermodynamic Properties of Water and Steam",
* http://www.iapws.org/relguide/IF97-Rev.pdf
*/
static const Scalar liquidHeatCapacity(Scalar temperature,
Scalar pressure)
static Scalar liquidHeatCapacity(Scalar temperature,
Scalar pressure)
{
if (!Region1::isValid(temperature, pressure))
{
@@ -312,8 +312,8 @@ public:
* 1997 for the Thermodynamic Properties of Water and Steam",
* http://www.iapws.org/relguide/IF97-Rev.pdf
*/
static const Scalar liquidInternalEnergy(Scalar temperature,
Scalar pressure)
static Scalar liquidInternalEnergy(Scalar temperature,
Scalar pressure)
{
if (!Region1::isValid(temperature, pressure))
{
@@ -340,14 +340,14 @@ public:
Scalar pi = Region1::pi(pv);
Scalar dpi_dp = Region1::dpi_dp(pv);
Scalar du_dp =
Rs*temperature*
(tau*dpi_dp*ddgamma_dtaudpi + dpi_dp*dpi_dp*dgamma_dpi + pi*dpi_dp*ddgamma_ddpi);
Rs*temperature*
(tau*dpi_dp*ddgamma_dtaudpi + dpi_dp*dpi_dp*dgamma_dpi + pi*dpi_dp*ddgamma_ddpi);
*/
// use a straight line for extrapolation. use forward
// differences to calculate the partial derivative to the
// pressure at the vapor pressure
static const Scalar eps = 1e-7;
Scalar eps = 1e-7;
Scalar uv = internalEnergyRegion1_(temperature, pv);
Scalar uvPEps = internalEnergyRegion1_(temperature, pv + eps);
Scalar du_dp = (uvPEps - uv)/eps;
@@ -368,7 +368,7 @@ public:
* IAPWS: "Revised Release on the IAPWS Industrial Formulation
* 1997 for the Thermodynamic Properties of Water and Steam",
* http://www.iapws.org/relguide/IF97-Rev.pdf
*/
*/
static Scalar gasInternalEnergy(Scalar temperature, Scalar pressure)
{
if (!Region2::isValid(temperature, pressure))
@@ -409,8 +409,8 @@ public:
Scalar pi = Region2::pi(pv);
Scalar dpi_dp = Region2::dpi_dp(pv);
Scalar du_dp =
Rs*temperature*
(tau*dpi_dp*ddgamma_dtaudpi + dpi_dp*dpi_dp*dgamma_dpi + pi*dpi_dp*ddgamma_ddpi);
Rs*temperature*
(tau*dpi_dp*ddgamma_dtaudpi + dpi_dp*dpi_dp*dgamma_dpi + pi*dpi_dp*ddgamma_ddpi);
// use a straight line for extrapolation
Scalar uv = internalEnergyRegion2_(temperature, pv);
@@ -420,7 +420,7 @@ public:
// use a straight line for extrapolation. use backward
// differences to calculate the partial derivative to the
// pressure at the vapor pressure
static const Scalar eps = 1e-7;
Scalar eps = 1e-7;
Scalar uv = internalEnergyRegion2_(temperature, pv);
Scalar uvMEps = internalEnergyRegion2_(temperature, pv - eps);
Scalar du_dp = (uv - uvMEps)/eps;
@@ -442,8 +442,8 @@ public:
* 1997 for the Thermodynamic Properties of Water and Steam",
* http://www.iapws.org/relguide/IF97-Rev.pdf
*/
static const Scalar liquidHeatCapacityConstVolume(Scalar temperature,
Scalar pressure)
static Scalar liquidHeatCapacityConstVolume(Scalar temperature,
Scalar pressure)
{
if (!Region1::isValid(temperature, pressure))
{
@@ -475,7 +475,7 @@ public:
* IAPWS: "Revised Release on the IAPWS Industrial Formulation
* 1997 for the Thermodynamic Properties of Water and Steam",
* http://www.iapws.org/relguide/IF97-Rev.pdf
*/
*/
static Scalar gasHeatCapacityConstVolume(Scalar temperature, Scalar pressure)
{
if (!Region2::isValid(temperature, pressure))
@@ -501,13 +501,13 @@ public:
/*!
* \brief Returns true iff the gas phase is assumed to be compressible
*/
static bool gasIsCompressible()
static constexpr bool gasIsCompressible()
{ return true; }
/*!
* \brief Returns true iff the liquid phase is assumed to be compressible
*/
static bool liquidIsCompressible()
static constexpr bool liquidIsCompressible()
{ return true; }
/*!
@@ -554,21 +554,21 @@ public:
// calculate the partial derivative of the specific volume
// to the pressure at the vapor pressure.
const Scalar eps = pv*1e-8;
Scalar eps = pv*1e-8;
Scalar v0 = volumeRegion2_(temperature, pv);
Scalar v1 = volumeRegion2_(temperature, pv + eps);
Scalar dv_dp = (v1 - v0)/eps;
/*
Scalar pi = Region2::pi(pv);
Scalar dp_dpi = Region2::dp_dpi(pv);
Scalar dgamma_dpi = Region2::dgamma_dpi(temperature, pv);
Scalar ddgamma_ddpi = Region2::ddgamma_ddpi(temperature, pv);
Scalar pi = Region2::pi(pv);
Scalar dp_dpi = Region2::dp_dpi(pv);
Scalar dgamma_dpi = Region2::dgamma_dpi(temperature, pv);
Scalar ddgamma_ddpi = Region2::ddgamma_ddpi(temperature, pv);
Scalar RT = Rs*temperature;
Scalar dv_dp =
RT/(dp_dpi*pv)
*
(dgamma_dpi + pi*ddgamma_ddpi - v0*dp_dpi/RT);
Scalar RT = Rs*temperature;
Scalar dv_dp =
RT/(dp_dpi*pv)
*
(dgamma_dpi + pi*ddgamma_ddpi - v0*dp_dpi/RT);
*/
// calculate the partial derivative of the density to the
@@ -585,7 +585,7 @@ public:
/*!
* \brief Returns true iff the gas phase is assumed to be ideal
*/
static bool gasIsIdeal()
static constexpr bool gasIsIdeal()
{ return false; }
/*!
@@ -660,23 +660,23 @@ public:
// calculate the partial derivative of the specific volume
// to the pressure at the vapor pressure.
const Scalar eps = pv*1e-8;
Scalar eps = pv*1e-8;
Scalar v0 = volumeRegion1_(temperature, pv);
Scalar v1 = volumeRegion1_(temperature, pv + eps);
Scalar dv_dp = (v1 - v0)/eps;
/*
Scalar v0 = volumeRegion1_(temperature, pv);
Scalar pi = Region1::pi(pv);
Scalar dp_dpi = Region1::dp_dpi(pv);
Scalar dgamma_dpi = Region1::dgamma_dpi(temperature, pv);
Scalar ddgamma_ddpi = Region1::ddgamma_ddpi(temperature, pv);
Scalar v0 = volumeRegion1_(temperature, pv);
Scalar pi = Region1::pi(pv);
Scalar dp_dpi = Region1::dp_dpi(pv);
Scalar dgamma_dpi = Region1::dgamma_dpi(temperature, pv);
Scalar ddgamma_ddpi = Region1::ddgamma_ddpi(temperature, pv);
Scalar RT = Rs*temperature;
Scalar dv_dp =
RT/(dp_dpi*pv)
*
(dgamma_dpi + pi*ddgamma_ddpi - v0*dp_dpi/RT);
Scalar RT = Rs*temperature;
Scalar dv_dp =
RT/(dp_dpi*pv)
*
(dgamma_dpi + pi*ddgamma_ddpi - v0*dp_dpi/RT);
*/
// calculate the partial derivative of the density to the
@@ -792,14 +792,14 @@ public:
* \param temperature absolute temperature in K
* \param pressure of the phase in Pa
*/
static Scalar liquidThermalConductivity( Scalar temperature, Scalar pressure)
static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure)
{
// Thermal conductivity of water is empirically fit.
// Evaluating that fitting-function outside the area of validity does not make sense.
assert( (pressure <= 400e6 and ((273.15<=temperature) and (temperature<=398.15)) )
or (pressure <= 200e6 and ((398.15<temperature) and (temperature<=523.15)) )
or (pressure <= 150e6 and ((523.15<temperature) and (temperature<=673.15)) )
or (pressure <= 100e6 and ((673.15<temperature) and (temperature<=1073.15)) ) );
or (pressure <= 200e6 and ((398.15<temperature) and (temperature<=523.15)) )
or (pressure <= 150e6 and ((523.15<temperature) and (temperature<=673.15)) )
or (pressure <= 100e6 and ((673.15<temperature) and (temperature<=1073.15)) ) );
Scalar rho = liquidDensity(temperature, pressure);
return Common::thermalConductivityIAPWS(temperature, rho);
@@ -818,14 +818,14 @@ public:
* \param temperature absolute temperature in K
* \param pressure of the phase in Pa
*/
static Scalar gasThermalConductivity(const Scalar temperature, const Scalar pressure)
static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
{
// Thermal conductivity of water is empirically fit.
// Evaluating that fitting-function outside the area of validity does not make sense.
assert( (pressure <= 400e6 and ((273.15<=temperature) and (temperature<=398.15)) )
or (pressure <= 200e6 and ((398.15<temperature) and (temperature<=523.15)) )
or (pressure <= 150e6 and ((523.15<temperature) and (temperature<=673.15)) )
or (pressure <= 100e6 and ((673.15<temperature) and (temperature<=1073.15)) ) );
or (pressure <= 200e6 and ((398.15<temperature) and (temperature<=523.15)) )
or (pressure <= 150e6 and ((523.15<temperature) and (temperature<=673.15)) )
or (pressure <= 100e6 and ((673.15<temperature) and (temperature<=1073.15)) ) );
Scalar rho = gasDensity(temperature, pressure);
return Common::thermalConductivityIAPWS(temperature, rho);

View File

@@ -77,7 +77,7 @@ public:
static constexpr Scalar criticalPressure = 22.064e6;
//! Density of water at the critical point \f$\mathrm{[kg/m^3]}\f$
static constexpr Scalar criticalDensity = 322.0;
static constexpr Scalar criticalDensity = 322.0;
//! Critical molar volume of water \f$\mathrm{[m^3/mol]}\f$
static constexpr Scalar criticalMolarVolume = molarMass/criticalDensity;
@@ -116,8 +116,8 @@ public:
{ 8.50895e-2, 9.99115e-1,-9.06851e-1, 2.57399e-1, 0, 0, 0 },
{-1.08374 , 1.88797 ,-7.72479e-1, 0, 0, 0, 0 },
{-2.89555e-1, 1.26613 ,-4.89837e-1, 0, 6.98452e-2, 0,-4.35673e-3 },
{ 0, 0,-2.57040e-1, 0, 0, 8.72102e-3, 0 },
{ 0, 1.20573e-1, 0, 0, 0, 0,-5.93264e-4 }
{0, 0,-2.57040e-1, 0, 0, 8.72102e-3, 0 },
{ 0, 1.20573e-1, 0, 0, 0, 0,-5.93264e-4 }
};
Scalar tmp, tmp2, tmp3 = 1;
@@ -164,30 +164,30 @@ public:
* \param T absolute temperature in K
* \param rho density of water in kg/m^3
*/
static Scalar thermalConductivityIAPWS(const Scalar T, const Scalar rho)
static Scalar thermalConductivityIAPWS(Scalar T, Scalar rho)
{
static constexpr Scalar thcond_tstar = 647.26 ;
static constexpr Scalar thcond_tstar = 647.26 ;
static constexpr Scalar thcond_rhostar = 317.7 ;
/*static constexpr Scalar thcond_kstar = 1.0 ;*/
/*static constexpr Scalar thcond_kstar = 1.0 ;*/
static constexpr Scalar thcond_b0 = -0.397070 ;
static constexpr Scalar thcond_b1 = 0.400302 ;
static constexpr Scalar thcond_b2 = 1.060000 ;
static constexpr Scalar thcond_B1 = -0.171587 ;
static constexpr Scalar thcond_B2 = 2.392190 ;
static constexpr Scalar thcond_b0 = -0.397070 ;
static constexpr Scalar thcond_b1 = 0.400302 ;
static constexpr Scalar thcond_b2 = 1.060000 ;
static constexpr Scalar thcond_B1 = -0.171587 ;
static constexpr Scalar thcond_B2 = 2.392190 ;
static constexpr Scalar thcond_c1 = 0.642857 ;
static constexpr Scalar thcond_c2 = -4.11717 ;
static constexpr Scalar thcond_c3 = -6.17937 ;
static constexpr Scalar thcond_c4 = 0.00308976 ;
static constexpr Scalar thcond_c5 = 0.0822994 ;
static constexpr Scalar thcond_c6 = 10.0932 ;
static constexpr Scalar thcond_c1 = 0.642857 ;
static constexpr Scalar thcond_c2 = -4.11717 ;
static constexpr Scalar thcond_c3 = -6.17937 ;
static constexpr Scalar thcond_c4 = 0.00308976 ;
static constexpr Scalar thcond_c5 = 0.0822994 ;
static constexpr Scalar thcond_c6 = 10.0932 ;
static constexpr Scalar thcond_d1 = 0.0701309 ;
static constexpr Scalar thcond_d2 = 0.0118520 ;
static constexpr Scalar thcond_d3 = 0.00169937 ;
static constexpr Scalar thcond_d4 = -1.0200 ;
static constexpr int thcond_a_count = 4;
static constexpr Scalar thcond_d1 = 0.0701309 ;
static constexpr Scalar thcond_d2 = 0.0118520 ;
static constexpr Scalar thcond_d3 = 0.00169937 ;
static constexpr Scalar thcond_d4 = -1.0200 ;
static constexpr int thcond_a_count = 4;
static constexpr Scalar thcond_a[thcond_a_count] = {
0.0102811
,0.0299621

View File

@@ -299,7 +299,7 @@ public:
private:
static Scalar n(int i)
{
static const Scalar n[34] = {
static constexpr Scalar n[34] = {
0.14632971213167, -0.84548187169114, -0.37563603672040e1,
0.33855169168385e1, -0.95791963387872, 0.15772038513228,
-0.16616417199501e-1, 0.81214629983568e-3, 0.28319080123804e-3,

View File

@@ -336,7 +336,7 @@ public:
private:
static Scalar n_g(int i)
{
static const Scalar n[9] = {
static constexpr Scalar n[9] = {
-0.96927686500217e1, 0.10086655968018e2, -0.56087911283020e-2,
0.71452738081455e-1, -0.40710498223928, 0.14240819171444e1,
-0.43839511319450e1, -0.28408632460772, 0.21268463753307e-1
@@ -346,7 +346,7 @@ private:
static Scalar n_r(int i)
{
static const Scalar n[43] = {
static constexpr Scalar n[43] = {
-0.17731742473213e-2, -0.17834862292358e-1, -0.45996013696365e-1,
-0.57581259083432e-1, -0.50325278727930e-1, -0.33032641670203e-4,
-0.18948987516315e-3, -0.39392777243355e-2, -0.43797295650573e-1,

View File

@@ -69,7 +69,7 @@ public:
*/
static Scalar saturationPressure(Scalar temperature)
{
static const Scalar n[10] = {
static constexpr Scalar n[10] = {
0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2,
0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2,
-0.48232657361591e4, 0.40511340542057e6, -0.23855557567849,

View File

@@ -55,36 +55,32 @@ public:
/*!
* \brief The molar mass in \f$\mathrm{[kg/mol]}\f$ of mesitylene
*/
static Scalar molarMass()
static constexpr Scalar molarMass()
{ return 0.120; }
/*!
* \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of mesitylene
*/
static Scalar criticalTemperature()
static constexpr Scalar criticalTemperature()
{ return 637.3; }
/*!
* \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of mesitylene
*/
static Scalar criticalPressure()
static constexpr Scalar criticalPressure()
{ return 31.3e5; }
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ at mesitylene's triple point.
*/
static Scalar tripleTemperature()
{
DUNE_THROW(Dune::NotImplemented, "tripleTemperature for mesitylene");
}
{ DUNE_THROW(Dune::NotImplemented, "tripleTemperature for mesitylene"); }
/*!
* \brief Returns the pressure \f$\mathrm{[Pa]}\f$ at mesitylene's triple point.
*/
static Scalar triplePressure()
{
DUNE_THROW(Dune::NotImplemented, "triplePressure for mesitylene");
}
{ DUNE_THROW(Dune::NotImplemented, "triplePressure for mesitylene"); }
/*!
* \brief The saturation vapor pressure in \f$\mathrm{[Pa]}\f$ of
@@ -153,19 +149,19 @@ public:
/*!
* \brief Returns true iff the gas phase is assumed to be compressible
*/
static bool gasIsCompressible()
static constexpr bool gasIsCompressible()
{ return true; }
/*!
* \brief Returns true iff the gas phase is assumed to be ideal
*/
static bool gasIsIdeal()
static constexpr bool gasIsIdeal()
{ return true; }
/*!
* \brief Returns true iff the liquid phase is assumed to be compressible
*/
static bool liquidIsCompressible()
static constexpr bool liquidIsCompressible()
{ return false; }
/*!

View File

@@ -60,31 +60,31 @@ public:
/*!
* \brief The molar mass in \f$\mathrm{[kg/mol]}\f$ of molecular nitrogen.
*/
static Scalar molarMass()
static constexpr Scalar molarMass()
{ return 28.0134e-3;}
/*!
* \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of molecular nitrogen
*/
static Scalar criticalTemperature()
static constexpr Scalar criticalTemperature()
{ return 126.192; /* [K] */ }
/*!
* \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of molecular nitrogen.
*/
static Scalar criticalPressure()
static constexpr Scalar criticalPressure()
{ return 3.39858e6; /* [N/m^2] */ }
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ at molecular nitrogen's triple point.
*/
static Scalar tripleTemperature()
static constexpr Scalar tripleTemperature()
{ return 63.151; /* [K] */ }
/*!
* \brief Returns the pressure \f$\mathrm{[Pa]}\f$ at molecular nitrogen's triple point.
*/
static Scalar triplePressure()
static constexpr Scalar triplePressure()
{ return 12.523e3; /* [N/m^2] */ }
/*!
@@ -140,13 +140,13 @@ public:
/*!
* \brief Returns true iff the gas phase is assumed to be compressible
*/
static bool gasIsCompressible()
static constexpr bool gasIsCompressible()
{ return true; }
/*!
* \brief Returns true iff the gas phase is assumed to be ideal
*/
static bool gasIsIdeal()
static constexpr bool gasIsIdeal()
{ return true; }
/*!

View File

@@ -52,7 +52,7 @@ public:
/*!
* \brief Returns true iff the liquid phase is assumed to be compressible
*/
static bool liquidIsCompressible()
static constexpr bool liquidIsCompressible()
{ return false; }
/*!

View File

@@ -53,41 +53,43 @@ public:
/*!
* \brief The molar mass in \f$\mathrm{[kg/mol]}\f$ of TCE.
*/
static Scalar molarMass()
{
return 131.39e-3; // kg/mol
}
static constexpr Scalar molarMass()
{ return 0.13139; } // kg/mol
/*!
* \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of TCE.
*/
static Scalar criticalTemperature()
static constexpr Scalar criticalTemperature()
{
DUNE_THROW(Dune::NotImplemented, "criticalTemperature for TCE");
//DUNE_THROW(Dune::NotImplemented, "criticalTemperature for TCE");
return 1e100;
}
/*!
* \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of TCE.
*/
static Scalar criticalPressure()
static constexpr Scalar criticalPressure()
{
DUNE_THROW(Dune::NotImplemented, "criticalPressure for TCE");
//DUNE_THROW(Dune::NotImplemented, "criticalPressure for TCE");
return 1e100;
}
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ at TCE's triple point.
*/
static Scalar tripleTemperature()
static constexpr Scalar tripleTemperature()
{
DUNE_THROW(Dune::NotImplemented, "tripleTemperature for TCE");
//DUNE_THROW(Dune::NotImplemented, "tripleTemperature for TCE");
return 1e100;
}
/*!
* \brief Returns the pressure \f$\mathrm{[Pa]}\f$ at TCE's triple point.
*/
static Scalar triplePressure()
static constexpr Scalar triplePressure()
{
DUNE_THROW(Dune::NotImplemented, "triplePressure for TCE");
//DUNE_THROW(Dune::NotImplemented, "triplePressure for TCE");
return 1e100;
}
/*!
@@ -97,20 +99,18 @@ public:
* \param T temperature of component in \f$\mathrm{[K]}\f$
*/
static Scalar vaporPressure(Scalar T)
{
return 3900; // [Pa] (at 20C)
}
{ return 3900; } // [Pa] (at 20C)
/*!
* \brief Returns true iff the gas phase is assumed to be compressible
*/
static bool gasIsCompressible()
static constexpr bool gasIsCompressible()
{ return true; }
/*!
* \brief Returns true iff the liquid phase is assumed to be compressible
*/
static bool liquidIsCompressible()
static constexpr bool liquidIsCompressible()
{ return false; }
/*!
@@ -129,7 +129,7 @@ public:
/*!
* \brief Returns true iff the gas phase is assumed to be ideal
*/
static bool gasIsIdeal()
static constexpr bool gasIsIdeal()
{ return true; }
/*!
@@ -139,9 +139,7 @@ public:
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*/
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
{
return 1460.0; // [kg/m^3]
}
{ return 1460.0; } // [kg/m^3]
/*!
* \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of pure TCE.
@@ -150,9 +148,7 @@ public:
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*/
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
{
return 5.7e-4;//[Pa s]
}
{ return 5.7e-4; } //[Pa s]
};
} // end namepace

View File

@@ -61,31 +61,31 @@ public:
/*!
* \brief The molar mass in \f$\mathrm{[kg/mol]}\f$ of water.
*/
static Scalar molarMass()
static constexpr Scalar molarMass()
{ return 18e-3; }
/*!
* \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of water.
*/
static Scalar criticalTemperature()
static constexpr Scalar criticalTemperature()
{ return 647.096; /* [K] */ }
/*!
* \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of water.
*/
static Scalar criticalPressure()
static constexpr Scalar criticalPressure()
{ return 22.064e6; /* [N/m^2] */ }
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ at water's triple point.
*/
static Scalar tripleTemperature()
static constexpr Scalar tripleTemperature()
{ return 273.16; /* [K] */ }
/*!
* \brief Returns the pressure \f$\mathrm{[Pa]}\f$ at water's triple point.
*/
static Scalar triplePressure()
static constexpr Scalar triplePressure()
{ return 611.657; /* [N/m^2] */ }
/*!
@@ -107,7 +107,7 @@ public:
if (T < tripleTemperature())
return 0; // water is solid: We don't take sublimation into account
static const Scalar n[10] = {
static constexpr Scalar n[10] = {
0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2,
0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2,
-0.48232657361591e4, 0.40511340542057e6, -0.23855557567849,
@@ -207,13 +207,13 @@ public:
/*!
* \brief Returns true iff the gas phase is assumed to be compressible
*/
static bool gasIsCompressible()
static constexpr bool gasIsCompressible()
{ return true; }
/*!
* \brief Returns true iff the liquid phase is assumed to be compressible
*/
static bool liquidIsCompressible()
static constexpr bool liquidIsCompressible()
{ return false; }
/*!
@@ -231,7 +231,7 @@ public:
/*!
* \brief Returns true iff the gas phase is assumed to be ideal
*/
static bool gasIsIdeal()
static constexpr bool gasIsIdeal()
{ return true; }
/*!

View File

@@ -235,31 +235,31 @@ public:
/*!
* \brief The molar mass in \f$\mathrm{[kg/mol]}\f$ of the component.
*/
static Scalar molarMass()
static constexpr Scalar molarMass()
{ return RawComponent::molarMass(); }
/*!
* \brief Returns the critical temperature in \f$\mathrm{[K]}\f$ of the component.
*/
static Scalar criticalTemperature()
static constexpr Scalar criticalTemperature()
{ return RawComponent::criticalTemperature(); }
/*!
* \brief Returns the critical pressure in \f$\mathrm{[Pa]}\f$ of the component.
*/
static Scalar criticalPressure()
static constexpr Scalar criticalPressure()
{ return RawComponent::criticalPressure(); }
/*!
* \brief Returns the temperature in \f$\mathrm{[K]}\f$ at the component's triple point.
*/
static Scalar tripleTemperature()
static constexpr Scalar tripleTemperature()
{ return RawComponent::tripleTemperature(); }
/*!
* \brief Returns the pressure in \f$\mathrm{[Pa]}\f$ at the component's triple point.
*/
static Scalar triplePressure()
static constexpr Scalar triplePressure()
{ return RawComponent::triplePressure(); }
/*!
@@ -416,7 +416,7 @@ public:
/*!
* \brief Returns true iff the gas phase is assumed to be compressible
*/
static bool gasIsCompressible()
static constexpr bool gasIsCompressible()
{ return RawComponent::gasIsCompressible(); }
/*!
@@ -428,7 +428,7 @@ public:
/*!
* \brief Returns true iff the gas phase is assumed to be ideal
*/
static bool gasIsIdeal()
static constexpr bool gasIsIdeal()
{ return RawComponent::gasIsIdeal(); }

View File

@@ -55,7 +55,7 @@ public:
/*!
* \brief Returns true iff the liquid phase is assumed to be compressible
*/
static bool liquidIsCompressible()
static constexpr bool liquidIsCompressible()
{ return false; }
/*!

View File

@@ -55,35 +55,37 @@ public:
/*!
* \brief The molar mass in \f$\mathrm{[kg/mol]}\f$ of xylene
*/
static Scalar molarMass()
static constexpr Scalar molarMass()
{ return 0.106; }
/*!
* \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of xylene
*/
static Scalar criticalTemperature()
static constexpr Scalar criticalTemperature()
{ return 617.1; }
/*!
* \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of xylene
*/
static Scalar criticalPressure()
static constexpr Scalar criticalPressure()
{ return 35.4e5; }
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ at xylene's triple point.
*/
static Scalar tripleTemperature()
static constexpr Scalar tripleTemperature()
{
DUNE_THROW(Dune::NotImplemented, "tripleTemperature for xylene");
//DUNE_THROW(Dune::NotImplemented, "tripleTemperature for xylene");
return 1e100;
}
/*!
* \brief Returns the pressure \f$\mathrm{[Pa]}\f$ at xylene's triple point.
*/
static Scalar triplePressure()
static constexpr Scalar triplePressure()
{
DUNE_THROW(Dune::NotImplemented, "triplePressure for xylene");
//DUNE_THROW(Dune::NotImplemented, "triplePressure for xylene");
return 1e100;
}
/*!
@@ -92,7 +94,6 @@ public:
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
*/
static Scalar vaporPressure(Scalar temperature)
{
const Scalar A = 7.00909;;
@@ -112,7 +113,7 @@ public:
* \param temp temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*/
static Scalar spHeatCapLiquidPhase(Scalar temp, Scalar pressure)
static Scalar spHeatCapLiquidPhase(Scalar temp, Scalar pressure)
{
Scalar CH3,C6H5,H;
// after Reid et al. : Missenard group contrib. method (s. example 5-8)
@@ -208,7 +209,7 @@ public:
static Scalar molarGasDensity(Scalar temperature, Scalar pressure)
{
return (gasDensity(temperature, pressure)*molarMass());
return gasDensity(temperature, pressure)*molarMass();
}
/*!
@@ -248,19 +249,19 @@ public:
/*!
* \brief Returns true iff the gas phase is assumed to be compressible
*/
static bool gasIsCompressible()
static constexpr bool gasIsCompressible()
{ return true; }
/*!
* \brief Returns true iff the gas phase is assumed to be ideal
*/
static bool gasIsIdeal()
static constexpr bool gasIsIdeal()
{ return true; }
/*!
* \brief Returns true iff the liquid phase is assumed to be compressible
*/
static bool liquidIsCompressible()
static constexpr bool liquidIsCompressible()
{ return false; }
/*!

View File

@@ -88,9 +88,9 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isLiquid(int phaseIdx)
static constexpr bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
return Fluid::isLiquid();
}
@@ -104,9 +104,9 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isCompressible(int phaseIdx)
static constexpr bool isCompressible(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
// let the fluid decide
return Fluid::isCompressible();
@@ -126,9 +126,9 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isIdealMixture(int phaseIdx)
static constexpr bool isIdealMixture(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
// we assume immisibility
return true;
@@ -140,9 +140,9 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isIdealGas(int phaseIdx)
static constexpr bool isIdealGas(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
// let the fluid decide
return Fluid::isIdealGas();
@@ -172,9 +172,9 @@ public:
*
* \param compIdx index of the component
*/
static Scalar molarMass(int compIdx)
static constexpr Scalar molarMass(int compIdx)
{
assert(0 <= compIdx && compIdx < numComponents);
//assert(0 <= compIdx && compIdx < numComponents);
return Fluid::molarMass();
}
@@ -184,9 +184,9 @@ public:
*
* \param compIdx The index of the component to consider
*/
static Scalar criticalTemperature(int compIdx)
static constexpr Scalar criticalTemperature(int compIdx)
{
assert(0 <= compIdx && compIdx < numComponents);
//assert(0 <= compIdx && compIdx < numComponents);
return Fluid::criticalTemperature();
}
@@ -196,9 +196,9 @@ public:
*
* \param compIdx The index of the component to consider
*/
static Scalar criticalPressure(int compIdx)
static constexpr Scalar criticalPressure(int compIdx)
{
assert(0 <= compIdx && compIdx < numComponents);
//assert(0 <= compIdx && compIdx < numComponents);
return Fluid::criticalPressure();
}
@@ -208,9 +208,9 @@ public:
*
* \param compIdx The index of the component to consider
*/
static Scalar acentricFactor(int compIdx)
static constexpr Scalar acentricFactor(int compIdx)
{
assert(0 <= compIdx && compIdx < numComponents);
//assert(0 <= compIdx && compIdx < numComponents);
return Fluid::acentricFactor();
}

View File

@@ -104,13 +104,13 @@ public:
/*!
* \brief Return whether a phase is liquid
*/
static bool isLiquid(int phaseIdx)
static constexpr bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
if (phaseIdx == wPhaseIdx)
return WettingPhase::isLiquid();
return NonwettingPhase::isLiquid();
//assert(0 <= phaseIdx && phaseIdx < numPhases);
return
(phaseIdx == wPhaseIdx)
? WettingPhase::isLiquid()
: NonwettingPhase::isLiquid();
}
/*!
@@ -125,9 +125,9 @@ public:
* only damage done will be (slightly) increased computation times
* in some cases.
*/
static bool isIdealMixture(int phaseIdx)
static constexpr bool isIdealMixture(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
// we assume immisibility
return true;
@@ -142,14 +142,14 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isCompressible(int phaseIdx)
static constexpr bool isCompressible(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
// let the fluids decide
if (phaseIdx == wPhaseIdx)
return WettingPhase::isCompressible();
return NonwettingPhase::isCompressible();
return
(phaseIdx == wPhaseIdx)
? WettingPhase::isCompressible()
: NonwettingPhase::isCompressible();
}
/*!
@@ -158,14 +158,15 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isIdealGas(int phaseIdx)
static constexpr bool isIdealGas(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
// let the fluids decide
if (phaseIdx == wPhaseIdx)
return WettingPhase::isIdealGas();
return NonwettingPhase::isIdealGas();
return
(phaseIdx == wPhaseIdx)
? WettingPhase::isIdealGas()
: NonwettingPhase::isIdealGas();
}
/****************************************
@@ -199,49 +200,54 @@ public:
*
* \param compIdx index of the component
*/
static Scalar molarMass(int compIdx)
static constexpr Scalar molarMass(int compIdx)
{
assert(0 <= compIdx && compIdx < numComponents);
//assert(0 <= compIdx && compIdx < numComponents);
if (compIdx == wCompIdx)
return WettingPhase::molarMass();
return NonwettingPhase::molarMass();
// let the fluids decide
return
(compIdx == wCompIdx)
? WettingPhase::molarMass()
: NonwettingPhase::molarMass();
}
/*!
* \brief Critical temperature of a component [K].
*/
static Scalar criticalTemperature(int compIdx)
static constexpr Scalar criticalTemperature(int compIdx)
{
assert(0 <= compIdx && compIdx < numComponents);
if (compIdx == wCompIdx)
return WettingPhase::criticalTemperature();
return NonwettingPhase::criticalTemperature();
//assert(0 <= compIdx && compIdx < numComponents);
// let the fluids decide
return
(compIdx == wCompIdx)
? WettingPhase::criticalTemperature()
: NonwettingPhase::criticalTemperature();
}
/*!
* \brief Critical pressure of a component [Pa].
*/
static Scalar criticalPressure(int compIdx)
static constexpr Scalar criticalPressure(int compIdx)
{
assert(0 <= compIdx && compIdx < numComponents);
if (compIdx == wCompIdx)
return WettingPhase::criticalPressure();
return NonwettingPhase::criticalPressure();
//assert(0 <= compIdx && compIdx < numComponents);
// let the fluids decide
return
(compIdx == wCompIdx)
? WettingPhase::criticalPressure()
: NonwettingPhase::criticalPressure();
}
/*!
* \brief The acentric factor of a component [].
*/
static Scalar acentricFactor(int compIdx)
static constexpr Scalar acentricFactor(int compIdx)
{
assert(0 <= compIdx && compIdx < numComponents);
if (compIdx == wCompIdx)
return WettingPhase::acentricFactor();
return NonwettingPhase::acentricFactor();
//assert(0 <= compIdx && compIdx < numComponents);
// let the fluids decide
return
(compIdx == wCompIdx)
? WettingPhase::acentricFactor()
: NonwettingPhase::acentricFactor();
}
/****************************************

View File

@@ -33,6 +33,7 @@
#include <dumux/material/constants.hh>
#include <dumux/material/components/h2o.hh>
#include <dumux/material/fluidsystems/basefluidsystem.hh>
#include <dumux/material/fluidsystems/nullparametercache.hh>
#include <array>
@@ -45,7 +46,8 @@ namespace FluidSystems {
* to calculate termodynamically meaningful quantities.
*/
template <class Scalar>
class BlackOil
class BlackOil
: public BaseFluidSystem<Scalar, BlackOil<Scalar> >
{
typedef Dumux::Spline<Scalar, -1> Spline;
typedef std::vector<std::pair<Scalar, Scalar> > SplineSamplingPoints;
@@ -66,6 +68,14 @@ public:
//! Index of the gas phase
static const int gPhaseIdx = 2;
static void init()
{
DUNE_THROW(Dune::InvalidStateException, "No generic init() method for this fluid system. The black-oil fluid system must be initialized with:\n"
<< " FluidSystem::initBegin()\n"
<< " // set black oil parameters\n"
<< " FluidSystem::initEnd()\n");
}
static void initBegin()
{}
@@ -262,9 +272,9 @@ public:
/*!
* \brief Return whether a phase is liquid
*/
static bool phaseIsLiquid(const int phaseIdx)
static constexpr bool isLiquid(const int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
// assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gPhaseIdx;
}
@@ -299,33 +309,6 @@ public:
static Scalar molarMass(const int compIdx)
{ return molarMass_[compIdx]; }
/*!
* \brief Critical temperature of a component [K].
*/
static Scalar criticalTemperature(const int compIdx)
{
DUNE_THROW(Dune::NotImplemented,
"Critical temperatures for components.");
}
/*!
* \brief Critical pressure of a component [Pa].
*/
static Scalar criticalPressure(const int compIdx)
{
DUNE_THROW(Dune::NotImplemented,
"Critical pressures for components.");
}
/*!
* \brief Molar volume of a component at the critical point [m^3/mol].
*/
static Scalar criticalMolarVolume(const int compIdx)
{
DUNE_THROW(Dune::NotImplemented,
"Critical molar volumes for components.");
}
/*!
* \brief Returns true if and only if a fluid phase is assumed to
* be an ideal mixture.
@@ -338,13 +321,33 @@ public:
* only damage done will be (slightly) increased computation times
* in some cases.
*/
static bool isIdealMixture(int phaseIdx)
static constexpr bool isIdealMixture(int phaseIdx)
{
// fugacity coefficients are only pressure dependent -> we
// have an ideal mixture
return true;
}
/*!
* \brief Returns true if and only if a fluid phase is assumed to
* be compressible.
*
* Compressible means that the partial derivative of the density
* to the fluid pressure is always larger than zero.
*
* \param phaseIdx The index of the fluid phase to consider
*/
static constexpr bool isCompressible(int phaseIdx)
{
return true; // all phases are compressible
}
/*!
* \brief Returns true iff a fluid is considered an ideal gas
*/
static constexpr bool isIdealGas(int phaseIdx)
{ return false; }
/*!
* \brief Calculate the densityy [kg/m^3] of a fluid phase
*/
@@ -461,62 +464,6 @@ public:
DUNE_THROW(Dune::InvalidStateException, "Unhandled phase index " << phaseIdx);
}
/*!
* \brief Calculate the binary molecular diffusion coefficient for
* a component in a fluid phase [mol^2 * s / (kg*m^3)]
*
* Molecular diffusion of a compoent $\kappa$ is caused by a
* gradient of the chemical potential and follows the law
*
* \f[ J = - D \grad mu_\kappa \f]
*
* where \f$\mu_\kappa\$ is the component's chemical potential,
* \f$D\f$ is the diffusion coefficient and \f$J\f$ is the
* diffusive flux. \f$mu_\kappa\f$ is connected to the component's
* fugacity \f$f_\kappa\f$ by the relation
*
* \f[ \mu_\kappa = R T_\alpha \mathrm{ln} \frac{f_\kappa}{p_\alpha} \f]
*
* where \f$p_\alpha\f$ and \f$T_\alpha\f$ are the fluid phase'
* pressure and temperature.
*/
template <class FluidState>
static Scalar diffusionCoefficient(const FluidState &fluidState,
const ParameterCache &paramCache,
int phaseIdx,
int compIdx)
{
DUNE_THROW(Dune::NotImplemented, "Diffusion coefficients");
}
/*!
* \brief Given a phase's composition, temperature and pressure,
* return the binary diffusion coefficient for components
* \f$i\f$ and \f$j\f$ in this phase.
*/
template <class FluidState>
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState,
const ParameterCache &paramCache,
int phaseIdx,
int compIIdx,
int compJIdx)
{
DUNE_THROW(Dune::NotImplemented, "Binary diffusion coefficients");
}
/*!
* \brief Given a phase's composition, temperature, pressure and
* density, calculate its specific enthalpy [J/kg].
*/
template <class FluidState>
static Scalar enthalpy(const FluidState &fluidState,
const ParameterCache &paramCache,
int phaseIdx)
{
DUNE_THROW(Dune::NotImplemented, "Enthalpy");
}
static Scalar surfaceDensity(int phaseIdx)
{ return surfaceDensity_[phaseIdx]; }

View File

@@ -49,49 +49,49 @@ public:
/*!
* \brief Returs whether the fluid is a liquid
*/
static bool isLiquid()
static constexpr bool isLiquid()
{ return false; }
/*!
* \brief Returns true iff the fluid is assumed to be compressible
*/
static bool isCompressible()
static constexpr bool isCompressible()
{ return Component::gasIsCompressible(); }
/*!
* \brief Returns true iff the fluid is assumed to be an ideal gas
*/
static bool isIdealGas()
static constexpr bool isIdealGas()
{ return Component::gasIsIdeal(); }
/*!
* \brief The mass in [kg] of one mole of the component.
*/
static Scalar molarMass()
static constexpr Scalar molarMass()
{ return Component::molarMass(); }
/*!
* \brief Returns the critical temperature of the component
*/
static Scalar criticalTemperature()
static constexpr Scalar criticalTemperature()
{ return Component::criticalTemperature(); }
/*!
* \brief Returns the critical pressure of the component
*/
static Scalar criticalPressure()
static constexpr Scalar criticalPressure()
{ return Component::criticalPressure(); }
/*!
* \brief Returns the temperature at the component's triple point.
*/
static Scalar tripleTemperature()
static constexpr Scalar tripleTemperature()
{ return Component::tripleTemperature(); }
/*!
* \brief Returns the pressure at the component's triple point.
*/
static Scalar triplePressure()
static constexpr Scalar triplePressure()
{ return Component::triplePressure(); }
/*!

View File

@@ -100,9 +100,9 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isLiquid(int phaseIdx)
static constexpr bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gPhaseIdx;
}
@@ -120,9 +120,9 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isIdealMixture(int phaseIdx)
static constexpr bool isIdealMixture(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
// we assume Henry's and Rault's laws for the water phase and
// and no interaction between gas molecules of different
// components, so all phases are ideal mixtures!
@@ -138,14 +138,15 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isCompressible(int phaseIdx)
static constexpr bool isCompressible(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
// ideal gases are always compressible
if (phaseIdx == gPhaseIdx)
return true;
// the water component decides for the liquid phase...
return H2O::liquidIsCompressible();
//assert(0 <= phaseIdx && phaseIdx < numPhases);
return (phaseIdx == gPhaseIdx)
// ideal gases are always compressible
? true
:
// the water component decides for the liquid phase...
H2O::liquidIsCompressible();
}
/*!
@@ -154,14 +155,12 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isIdealGas(int phaseIdx)
static constexpr bool isIdealGas(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
// let the fluids decide
if (phaseIdx == gPhaseIdx)
return H2O::gasIsIdeal() && Air::gasIsIdeal();
return false; // not a gas
return
(phaseIdx == gPhaseIdx)
? H2O::gasIsIdeal() && Air::gasIsIdeal()
: false;
}
/****************************************
@@ -194,15 +193,15 @@ public:
*
* \param compIdx index of the component
*/
static Scalar molarMass(int compIdx)
static constexpr Scalar molarMass(int compIdx)
{
switch (compIdx)
{
case H2OIdx: return H2O::molarMass();
case AirIdx: return Air::molarMass();
};
DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx);
}
return
(compIdx == H2OIdx)
? H2O::molarMass()
: (compIdx == AirIdx)
? Air::molarMass()
: 1e100;
}
/*!
@@ -210,15 +209,14 @@ public:
*
* \param compIdx The index of the component to consider
*/
static Scalar criticalTemperature(int compIdx)
static constexpr Scalar criticalTemperature(int compIdx)
{
static const Scalar Tcrit[] = {
H2O::criticalTemperature(),
Air::criticalTemperature()
};
assert(0 <= compIdx && compIdx < numComponents);
return Tcrit[compIdx];
return
(compIdx == H2OIdx)
? H2O::criticalTemperature()
: (compIdx == AirIdx)
? Air::criticalTemperature()
: 1e100;
}
/*!
@@ -226,15 +224,14 @@ public:
*
* \param compIdx The index of the component to consider
*/
static Scalar criticalPressure(int compIdx)
static constexpr Scalar criticalPressure(int compIdx)
{
static const Scalar pcrit[] = {
H2O::criticalPressure(),
Air::criticalPressure()
};
assert(0 <= compIdx && compIdx < numComponents);
return pcrit[compIdx];
return
(compIdx == H2OIdx)
? H2O::criticalPressure()
: (compIdx == AirIdx)
? Air::criticalPressure()
: 1e100;
}
/*!
@@ -242,15 +239,14 @@ public:
*
* \param compIdx The index of the component to consider
*/
static Scalar acentricFactor(int compIdx)
static constexpr Scalar acentricFactor(int compIdx)
{
static const Scalar accFac[] = {
H2O::acentricFactor(), // H2O (from Reid, et al.)
Air::acentricFactor()
};
assert(0 <= compIdx && compIdx < numComponents);
return accFac[compIdx];
return
(compIdx == H2OIdx)
? H2O::acentricFactor()
: (compIdx == AirIdx)
? Air::acentricFactor()
: 1e100;
}
/****************************************

View File

@@ -137,13 +137,16 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gPhaseIdx;
static constexpr bool isLiquid(int phaseIdx)
{
//assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gPhaseIdx;
}
static bool isIdealGas(int phaseIdx)
/*!
* \brief Returns true iff a fluid is considered an ideal gas
*/
static constexpr bool isIdealGas(int phaseIdx)
{ return phaseIdx == gPhaseIdx && H2O::gasIsIdeal() && Air::gasIsIdeal() && NAPL::gasIsIdeal(); }
/*!
@@ -160,9 +163,9 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isIdealMixture(int phaseIdx)
static constexpr bool isIdealMixture(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
// we assume Henry's and Rault's laws for the water phase and
// and no interaction between gas molecules of different
// components, so all phases are ideal mixtures!
@@ -178,18 +181,15 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isCompressible(int phaseIdx)
static constexpr bool isCompressible(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
// gases are always compressible
if (phaseIdx == gPhaseIdx)
return true;
else if (phaseIdx == wPhaseIdx)
// the water component decides for the water phase...
return H2O::liquidIsCompressible();
// the NAPL component decides for the napl phase...
return NAPL::liquidIsCompressible();
return (phaseIdx == gPhaseIdx)
? true
: (phaseIdx == wPhaseIdx)
? H2O::liquidIsCompressible()
: NAPL::liquidIsCompressible();
}
/*!
@@ -221,14 +221,17 @@ public:
/*!
* \brief Return the molar mass of a component in [kg/mol].
*/
static Scalar molarMass(int compIdx)
static constexpr Scalar molarMass(int compIdx)
{
switch (compIdx) {
case H2OIdx: return H2O::molarMass();
case airIdx: return Air::molarMass();
case NAPLIdx: return NAPL::molarMass();
};
DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx);
return
(compIdx == H2OIdx)
? H2O::molarMass()
: (compIdx == airIdx)
? Air::molarMass()
: (compIdx == NAPLIdx)
? NAPL::molarMass()
: -1e10;
//DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx);
}
/*!

View File

@@ -86,13 +86,13 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isLiquid(int phaseIdx)
static constexpr bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gPhaseIdx;
}
static bool isIdealGas(int phaseIdx)
static constexpr bool isIdealGas(int phaseIdx)
{ return phaseIdx == gPhaseIdx && H2O::gasIsIdeal() && Air::gasIsIdeal() && NAPL::gasIsIdeal(); }
/*!
@@ -109,9 +109,10 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isIdealMixture(int phaseIdx)
static constexpr bool isIdealMixture(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
// we assume Henry's and Rault's laws for the water phase and
// and no interaction between gas molecules of different
// components, so all phases are ideal mixtures!
@@ -127,18 +128,17 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isCompressible(int phaseIdx)
static constexpr bool isCompressible(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
// gases are always compressible
if (phaseIdx == gPhaseIdx)
return true;
else if (phaseIdx == wPhaseIdx)
return
(phaseIdx == gPhaseIdx)
// gases are always compressible
? true
: (phaseIdx == wPhaseIdx)
// the water component decides for the water phase...
return H2O::liquidIsCompressible();
// the NAPL component decides for the napl phase...
return NAPL::liquidIsCompressible();
? H2O::liquidIsCompressible()
// the NAPL component decides for the napl phase...
: NAPL::liquidIsCompressible();
}
/*!
@@ -170,14 +170,19 @@ public:
/*!
* \brief Return the molar mass of a component in [kg/mol].
*/
static Scalar molarMass(int compIdx)
static constexpr Scalar molarMass(int compIdx)
{
switch (compIdx) {
case H2OIdx: return H2O::molarMass();
case airIdx: return Air::molarMass();
case NAPLIdx: return NAPL::molarMass();
};
DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx);
return
(compIdx == H2OIdx)
// gases are always compressible
? H2O::molarMass()
: (compIdx == airIdx)
// the water component decides for the water comp...
? Air::molarMass()
// the NAPL component decides for the napl comp...
: (compIdx == NAPLIdx)
? NAPL::molarMass()
: 1e100;
}
/*!

View File

@@ -108,9 +108,9 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isLiquid(int phaseIdx)
static constexpr bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gPhaseIdx;
}
@@ -128,9 +128,9 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isIdealMixture(int phaseIdx)
static constexpr bool isIdealMixture(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
// we assume Henry's and Rault's laws for the water phase and
// and no interaction between gas molecules of different
// components, so all phases are ideal mixtures!
@@ -146,14 +146,14 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isCompressible(int phaseIdx)
static constexpr bool isCompressible(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
// gases are always compressible
if (phaseIdx == gPhaseIdx)
return true;
// the water component decides for the liquid phase...
return H2O::liquidIsCompressible();
return
(phaseIdx == gPhaseIdx)
? true
:H2O::liquidIsCompressible();// the water component decides for the liquid phase...
}
/*!
@@ -162,14 +162,14 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isIdealGas(int phaseIdx)
static constexpr bool isIdealGas(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
if (phaseIdx == gPhaseIdx)
// let the components decide
return H2O::gasIsIdeal() && N2::gasIsIdeal();
return false; // not a gas
return
(phaseIdx == gPhaseIdx)
? H2O::gasIsIdeal() && N2::gasIsIdeal() // let the components decide
: false; // not a gas
}
/****************************************
@@ -211,15 +211,14 @@ public:
*
* \param compIdx The index of the component to consider
*/
static Scalar molarMass(int compIdx)
static constexpr Scalar molarMass(int compIdx)
{
static const Scalar M[] = {
H2O::molarMass(),
N2::molarMass(),
};
assert(0 <= compIdx && compIdx < numComponents);
return M[compIdx];
//assert(0 <= compIdx && compIdx < numComponents);
return (compIdx == H2OIdx)
? H2O::molarMass()
: (compIdx == N2Idx)
? N2::molarMass()
: 1e100;
}
/*!
@@ -227,15 +226,13 @@ public:
*
* \param compIdx The index of the component to consider
*/
static Scalar criticalTemperature(int compIdx)
static constexpr Scalar criticalTemperature(int compIdx)
{
static const Scalar Tcrit[] = {
H2O::criticalTemperature(), // H2O
N2::criticalTemperature() // N2
};
assert(0 <= compIdx && compIdx < numComponents);
return Tcrit[compIdx];
return (compIdx == H2OIdx)
? H2O::criticalTemperature()
: (compIdx == N2Idx)
? N2::criticalTemperature()
: 1e100;
}
/*!
@@ -243,15 +240,13 @@ public:
*
* \param compIdx The index of the component to consider
*/
static Scalar criticalPressure(int compIdx)
static constexpr Scalar criticalPressure(int compIdx)
{
static const Scalar pcrit[] = {
H2O::criticalPressure(),
N2::criticalPressure()
};
assert(0 <= compIdx && compIdx < numComponents);
return pcrit[compIdx];
return (compIdx == H2OIdx)
? H2O::criticalPressure()
: (compIdx == N2Idx)
? N2::criticalPressure()
: 1e100;
}
/*!
@@ -259,15 +254,13 @@ public:
*
* \param compIdx The index of the component to consider
*/
static Scalar acentricFactor(int compIdx)
static constexpr Scalar acentricFactor(int compIdx)
{
static const Scalar accFac[] = {
H2O::acentricFactor(), // H2O (from Reid, et al.)
N2::acentricFactor()
};
assert(0 <= compIdx && compIdx < numComponents);
return accFac[compIdx];
return (compIdx == H2OIdx)
? H2O::acentricFactor()
: (compIdx == N2Idx)
? N2::acentricFactor()
: 1e100;
}
/****************************************

View File

@@ -103,9 +103,9 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isLiquid(int phaseIdx)
static constexpr bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
return true; //only water phase present
}
@@ -123,9 +123,9 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isIdealMixture(int phaseIdx)
static constexpr bool isIdealMixture(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
// we assume Henry's and Rault's laws for the water phase and
// and no interaction between gas molecules of different
// components, so all phases are ideal mixtures!
@@ -141,9 +141,9 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isCompressible(int phaseIdx)
static constexpr bool isCompressible(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
// the water component decides for the liquid phase...
return H2O::liquidIsCompressible();
}
@@ -154,9 +154,9 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isIdealGas(int phaseIdx)
static constexpr bool isIdealGas(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
return false; // not a gas (only liquid phase present)
}
@@ -199,15 +199,14 @@ public:
*
* \param compIdx The index of the component to consider
*/
static Scalar molarMass(int compIdx)
static constexpr Scalar molarMass(int compIdx)
{
static const Scalar M[] = {
H2O::molarMass(),
N2::molarMass(),
};
assert(0 <= compIdx && compIdx < numComponents);
return M[compIdx];
//assert(0 <= compIdx && compIdx < numComponents);
return (compIdx == H2OIdx)
? H2O::molarMass()
: (compIdx == N2Idx)
? N2::molarMass()
: 1e100;
}
/*!
@@ -215,15 +214,14 @@ public:
*
* \param compIdx The index of the component to consider
*/
static Scalar criticalTemperature(int compIdx)
static constexpr Scalar criticalTemperature(int compIdx)
{
static const Scalar Tcrit[] = {
H2O::criticalTemperature(), // H2O
N2::criticalTemperature() // N2
};
assert(0 <= compIdx && compIdx < numComponents);
return Tcrit[compIdx];
//assert(0 <= compIdx && compIdx < numComponents);
return (compIdx == H2OIdx)
? H2O::criticalTemperature()
: (compIdx == N2Idx)
? N2::criticalTemperature()
: 1e100;
}
/*!
@@ -231,15 +229,14 @@ public:
*
* \param compIdx The index of the component to consider
*/
static Scalar criticalPressure(int compIdx)
static constexpr Scalar criticalPressure(int compIdx)
{
static const Scalar pcrit[] = {
H2O::criticalPressure(),
N2::criticalPressure()
};
assert(0 <= compIdx && compIdx < numComponents);
return pcrit[compIdx];
//assert(0 <= compIdx && compIdx < numComponents);
return (compIdx == H2OIdx)
? H2O::criticalPressure()
: (compIdx == N2Idx)
? N2::criticalPressure()
: 1e100;
}
/*!
@@ -247,15 +244,14 @@ public:
*
* \param compIdx The index of the component to consider
*/
static Scalar acentricFactor(int compIdx)
static constexpr Scalar acentricFactor(int compIdx)
{
static const Scalar accFac[] = {
H2O::acentricFactor(), // H2O (from Reid, et al.)
N2::acentricFactor()
};
assert(0 <= compIdx && compIdx < numComponents);
return accFac[compIdx];
//assert(0 <= compIdx && compIdx < numComponents);
return (compIdx == H2OIdx)
? H2O::acentricFactor()
: (compIdx == N2Idx)
? N2::acentricFactor()
: 1e100;
}
/****************************************

View File

@@ -50,49 +50,49 @@ public:
/*!
* \brief Returs whether the fluid is a liquid
*/
static bool isLiquid()
static constexpr bool isLiquid()
{ return true; }
/*!
* \brief Returns true iff the fluid is assumed to be compressible
*/
static bool isCompressible()
static constexpr bool isCompressible()
{ return Component::liquidIsCompressible(); }
/*!
* \brief Returns true iff the fluid is assumed to be an ideal gas
*/
static bool isIdealGas()
static constexpr bool isIdealGas()
{ return false; /* we're a liquid! */ }
/*!
* \brief The mass in [kg] of one mole of the component.
*/
static Scalar molarMass()
static constexpr Scalar molarMass()
{ return Component::molarMass(); }
/*!
* \brief Returns the critical temperature of the component
*/
static Scalar criticalTemperature()
static constexpr Scalar criticalTemperature()
{ return Component::criticalTemperature(); }
/*!
* \brief Returns the critical pressure of the component
*/
static Scalar criticalPressure()
static constexpr Scalar criticalPressure()
{ return Component::criticalPressure(); }
/*!
* \brief Returns the temperature at the component's triple point.
*/
static Scalar tripleTemperature()
static constexpr Scalar tripleTemperature()
{ return Component::tripleTemperature(); }
/*!
* \brief Returns the pressure at the component's triple point.
*/
static Scalar triplePressure()
static constexpr Scalar triplePressure()
{ return Component::triplePressure(); }
/*!

View File

@@ -42,6 +42,7 @@
#include "spe5parametercache.hh"
#include <dumux/common/spline.hh>
#include <dumux/material/constants.hh>
#include <dumux/material/eos/pengrobinsonmixture.hh>
namespace Dumux
@@ -71,6 +72,8 @@ class Spe5
typedef typename Dumux::PengRobinsonMixture<Scalar, ThisType> PengRobinsonMixture;
typedef typename Dumux::PengRobinson<Scalar> PengRobinson;
static constexpr Scalar R = Dumux::Constants<Scalar>::R;
public:
typedef Dumux::Spe5ParameterCache<Scalar, ThisType> ParameterCache;
@@ -109,9 +112,9 @@ public:
/*!
* \brief Return whether a phase is liquid
*/
static bool isLiquid(int phaseIdx)
static constexpr bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gPhaseIdx;
}
@@ -120,9 +123,9 @@ public:
*
* In the SPE-5 problems all fluids are compressible...
*/
static bool isCompressible(int phaseIdx)
static constexpr bool isCompressible(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
return true;
}
@@ -138,7 +141,7 @@ public:
* only damage done will be (slightly) increased computation times
* in some cases.
*/
static bool isIdealMixture(int phaseIdx)
static constexpr bool isIdealMixture(int phaseIdx)
{
// always use the reference oil for the fugacity coefficents,
// so they cannot be dependent on composition and they the
@@ -152,9 +155,9 @@ public:
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isIdealGas(int phaseIdx)
static constexpr bool isIdealGas(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
//assert(0 <= phaseIdx && phaseIdx < numPhases);
return false; // gas is not ideal here!
}
@@ -195,58 +198,70 @@ public:
/*!
* \brief Return the molar mass of a component in [kg/mol].
*/
static Scalar molarMass(int compIdx)
static constexpr Scalar molarMass(int compIdx)
{
static const Scalar M[] = {
H2O::molarMass(),
16.04e-3, // C1
44.10e-3, // C3
86.18e-3, // C6
142.29e-3, // C10
206.00e-3, // C15
282.00e-3 // C20
};
assert(0 <= compIdx && compIdx < numComponents);
return M[compIdx];
return
(compIdx == H2OIdx)
? H2O::molarMass()
: (compIdx == C1Idx)
? 16.04e-3
: (compIdx == C3Idx)
? 44.10e-3
: (compIdx == C6Idx)
? 86.18e-3
: (compIdx == C10Idx)
? 142.29e-3
: (compIdx == C15Idx)
? 206.00e-3
: (compIdx == C20Idx)
? 282.00e-3
: 1e100;
}
/*!
* \brief Critical temperature of a component [K].
*/
static Scalar criticalTemperature(int compIdx)
static constexpr Scalar criticalTemperature(int compIdx)
{
static const Scalar Tcrit[] = {
H2O::criticalTemperature(), // H2O
343.0*5/9, // C1
665.7*5/9, // C3
913.4*5/9, // C6
1111.8*5/9, // C10
1270.0*5/9, // C15
1380.0*5/9 // C20
};
assert(0 <= compIdx && compIdx < numComponents);
return Tcrit[compIdx];
return
(compIdx == H2OIdx)
? H2O::criticalTemperature()
: (compIdx == C1Idx)
? 343.0*5/9
: (compIdx == C3Idx)
? 665.7*5/9
: (compIdx == C6Idx)
? 913.4*5/9
: (compIdx == C10Idx)
? 1111.8*5/9
: (compIdx == C15Idx)
? 1270.0*5/9
: (compIdx == C20Idx)
? 1380.0*5/9
: 1e100;
}
/*!
* \brief Critical pressure of a component [Pa].
*/
static Scalar criticalPressure(int compIdx)
static constexpr Scalar criticalPressure(int compIdx)
{
static const Scalar pcrit[] = {
H2O::criticalPressure(), // H2O
667.8 * 6894.7573, // C1
616.3 * 6894.7573, // C3
436.9 * 6894.7573, // C6
304.0 * 6894.7573, // C10
200.0 * 6894.7573, // C15
162.0 * 6894.7573 // C20
};
assert(0 <= compIdx && compIdx < numComponents);
return pcrit[compIdx];
return
(compIdx == H2OIdx)
? H2O::criticalPressure()
: (compIdx == C1Idx)
? 667.8 * 6894.7573
: (compIdx == C3Idx)
? 616.3 * 6894.7573
: (compIdx == C6Idx)
? 436.9 * 6894.7573
: (compIdx == C10Idx)
? 304.0 * 6894.7573
: (compIdx == C15Idx)
? 200.0 * 6894.7573
: (compIdx == C20Idx)
? 162.0 * 6894.7573
: 1e100;
}
/*!
@@ -254,38 +269,45 @@ public:
*/
static Scalar criticalMolarVolume(int compIdx)
{
static const Scalar R = 8.314472;
static const Scalar vcrit[] = {
H2O::criticalMolarVolume(), // H2O
0.290*R*criticalTemperature(1)/criticalPressure(1), // C1
0.277*R*criticalTemperature(2)/criticalPressure(2), // C3
0.264*R*criticalTemperature(3)/criticalPressure(3), // C6
0.257*R*criticalTemperature(4)/criticalPressure(4), // C10
0.245*R*criticalTemperature(5)/criticalPressure(5), // C15
0.235*R*criticalTemperature(6)/criticalPressure(6) // C20
};
assert(0 <= compIdx && compIdx < numComponents);
return vcrit[compIdx];
return
(compIdx == H2OIdx)
? H2O::criticalMolarVolume()
: (compIdx == C1Idx)
? 0.290*R*criticalTemperature(C1Idx)/criticalPressure(C1Idx)
: (compIdx == C3Idx)
? 0.277*R*criticalTemperature(C3Idx)/criticalPressure(C3Idx)
: (compIdx == C6Idx)
? 0.264*R*criticalTemperature(C6Idx)/criticalPressure(C6Idx)
: (compIdx == C10Idx)
? 0.257*R*criticalTemperature(C10Idx)/criticalPressure(C10Idx)
: (compIdx == C15Idx)
? 0.245*R*criticalTemperature(C15Idx)/criticalPressure(C15Idx)
: (compIdx == C20Idx)
? 0.235*R*criticalTemperature(C20Idx)/criticalPressure(C20Idx)
: 1e100;
}
/*!
* \brief The acentric factor of a component [].
*/
static Scalar acentricFactor(int compIdx)
static constexpr Scalar acentricFactor(int compIdx)
{
static const Scalar accFac[] = {
0.344, // H2O (from Reid, et al.)
0.0130, // C1
0.1524, // C3
0.3007, // C6
0.4885, // C10
0.6500, // C15
0.8500 // C20
};
assert(0 <= compIdx && compIdx < numComponents);
return accFac[compIdx];
return
(compIdx == H2OIdx)
? H2O::acentricFactor()
: (compIdx == C1Idx)
? 0.0130
: (compIdx == C3Idx)
? 0.1524
: (compIdx == C6Idx)
? 0.3007
: (compIdx == C10Idx)
? 0.4885
: (compIdx == C15Idx)
? 0.6500
: (compIdx == C20Idx)
? 0.8500
: 1e100;
}
/*!
@@ -295,6 +317,8 @@ public:
*/
static Scalar interactionCoefficient(int comp1Idx, int comp2Idx)
{
// TODO: make this a constexpr method !?
int i = std::min(comp1Idx, comp2Idx);
int j = std::max(comp1Idx, comp2Idx);
if (i == C1Idx && (j == C15Idx || j == C20Idx))

View File

@@ -285,7 +285,7 @@ void checkFluidSystem()
Scalar DUNE_UNUSED val;
// actually check the fluid system API
FluidSystem::init();
try { FluidSystem::init(); } catch (...) {};
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
fs.restrictToPhase(phaseIdx);
fs.allowPressure(FluidSystem::isCompressible(phaseIdx));

View File

@@ -36,6 +36,7 @@
// include all fluid systems in dumux-stable
#include <dumux/material/fluidsystems/1pfluidsystem.hh>
#include <dumux/material/fluidsystems/2pimmisciblefluidsystem.hh>
#include <dumux/material/fluidsystems/blackoilfluidsystem.hh>
#include <dumux/material/fluidsystems/h2on2fluidsystem.hh>
#include <dumux/material/fluidsystems/h2on2liquidphasefluidsystem.hh>
#include <dumux/material/fluidsystems/h2oairfluidsystem.hh>
@@ -91,6 +92,10 @@ int main()
checkFluidState<Scalar>(fs); }
}
// black-oil
{ typedef Dumux::FluidSystems::BlackOil<Scalar> FluidSystem;
if (false) checkFluidSystem<Scalar, FluidSystem>(); }
// H2O -- N2
{ typedef Dumux::FluidSystems::H2ON2<Scalar, /*enableComplexRelations=*/false> FluidSystem;
checkFluidSystem<Scalar, FluidSystem>(); }