Commit ea6dd531 authored by Katharina Heck's avatar Katharina Heck Committed by Timo Koch
Browse files

[material][components] add liquid or gasmolardensity in components


Co-authored-by: default avatarSimon Scholz <simon.scholz@iws.uni-stuttgart.de>
Co-authored-by: Beatrix Becker's avatarBeatrix Becker <beatrix.becker@iws.uni-stuttgart.de>
parent 65003458
......@@ -87,6 +87,15 @@ public:
return IdealGas::density(molarMass(), temperature, pressure);
}
/*!
* \brief The molar density of air in \f$\mathrm{[mol/m^3]}\f$,
* depending on pressure and temperature.
* \param temperature The temperature of the gas
* \param pressure The pressure of the gas
*/
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
{ return IdealGas::molarDensity(temperature, pressure); }
/*!
* \brief Returns true, the gas phase is assumed to be compressible
*/
......
......@@ -45,7 +45,7 @@ class Benzene
, public Components::Liquid<Scalar, Benzene<Scalar> >
, public Components::Gas<Scalar, Benzene<Scalar> >
{
using IdealGas = Dumux::IdealGas<Scalar>;
public:
/*!
* \brief A human readable name for the benzene
......@@ -67,11 +67,20 @@ public:
*/
static Scalar gasDensity(Scalar temperature, Scalar pressure)
{
return IdealGas<Scalar>::density(molarMass(),
temperature,
pressure);
return IdealGas::density(molarMass(),
temperature,
pressure);
}
/*!
* \brief The molar density of steam in \f$\mathrm{[mol/m^3]}\f$,
* depending on pressure and temperature.
* \param temperature The temperature of the gas
* \param pressure The pressure of the gas
*/
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
{ return IdealGas::molarDensity(temperature, pressure); }
/*!
* \brief The density of pure benzene at a given pressure and temperature \f$\mathrm{[kg/m^3]}\f$.
*
......@@ -80,7 +89,18 @@ public:
*/
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
{
return 889.51; // [kg/m^3]
return 889.51;
}
/*!
* \brief The molar density of pure benzene at a given pressure and temperature \f$\mathrm{[mol/m^3]}\f$.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*/
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
{
return liquidDensity(temperature, pressure)/molarMass();
}
/*!
......
......@@ -57,6 +57,9 @@ public:
//HACK: If salinity is a pseudo-component, a constat value is used
static Scalar constantSalinity;
//! The ideal gas constant \f$\mathrm{[J/mol/K]}\f$
static constexpr Scalar R = Constants<Scalar>::R;
/*!
* \brief A human readable name for the brine.
*/
......@@ -72,8 +75,7 @@ public:
{
const Scalar M1 = H2O::molarMass();
const Scalar M2 = Components::NaCl<Scalar>::molarMass(); // molar mass of NaCl [kg/mol]
const Scalar X2 = salinity; // mass fraction of salt in brine
return M1*M2/(M2 + X2*(M1 - M2));
return M1*M2/(M2 + salinity*(M1 - M2));
};
/*!
......@@ -106,8 +108,19 @@ public:
*
* \param T temperature of component in \f$\mathrm{[K]}\f$
*/
static Scalar vaporPressure(Scalar T)
{ return H2O::vaporPressure(T); }
static Scalar vaporPressure(Scalar temperature, Scalar salinity = constantSalinity)
{
Scalar ps = H2O::vaporPressure(temperature); //Saturation vapor pressure for pure water
Scalar pi = 0;
using std::log;
if (salinity < 0.26) // here we have hard coded the solubility limit for NaCl
pi = (R * temperature * log(1- salinity)); // simplified version of Eq 2.29 in Vishal Jambhekar's Promo
else
pi = (R * temperature * log(0.74));
using std::exp;
ps *= exp((pi)/(R*temperature));// Kelvin's law for reduction in saturation vapor pressure due to osmotic potential
return ps;
}
/*!
* \brief Specific enthalpy of gaseous brine \f$\mathrm{[J/kg]}\f$.
......@@ -241,8 +254,8 @@ public:
Scalar pressure, Scalar salinity = constantSalinity)
{
return
liquidEnthalpy(temperature, pressure) -
pressure/liquidDensity(temperature, pressure);
liquidEnthalpy(temperature, pressure, salinity) -
pressure/liquidDensity(temperature, pressure, salinity);
}
/*!
......@@ -254,6 +267,17 @@ public:
static Scalar gasDensity(Scalar temperature, Scalar pressure)
{ return H2O::gasDensity(temperature, pressure); }
/*!
* \brief The molar density of steam in \f$\mathrm{[mol/m^3]}\f$ at a given pressure and temperature.
* We take the value of the H2O gas molar density here because salt is not in the gas phase.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*
*/
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
{ return H2O::gasMolarDensity(temperature, pressure); }
/*!
* \brief Returns true if the gas phase is assumed to be ideal
*/
......@@ -309,6 +333,16 @@ public:
return density;
}
/*!
* \brief The molar density of brine in \f$\mathrm{[mol/m^3]}\f$ at a given pressure and temperature.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*
*/
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure, Scalar salinity = constantSalinity)
{ return liquidDensity(temperature, pressure, salinity)/molarMass(salinity); }
/*!
* \brief The pressure of steam in \f$\mathrm{[Pa]}\f$ at a given density and temperature.
*
......@@ -331,18 +365,18 @@ public:
// We use the Newton method for this. For the initial value we
// assume the pressure to be 10% higher than the vapor
// pressure
Scalar pressure = 1.1*vaporPressure(temperature);
Scalar pressure = 1.1*vaporPressure(temperature, salinity);
const Scalar eps = pressure*1e-7;
Scalar deltaP = pressure*2;
using std::abs;
for (int i = 0; i < 5 && abs(pressure*1e-9) < abs(deltaP); ++i) {
Scalar f = liquidDensity(temperature, pressure) - density;
Scalar f = liquidDensity(temperature, pressure, salinity) - density;
Scalar df_dp;
df_dp = liquidDensity(temperature, pressure + eps);
df_dp -= liquidDensity(temperature, pressure - eps);
df_dp = liquidDensity(temperature, pressure + eps, salinity);
df_dp -= liquidDensity(temperature, pressure - eps, salinity);
df_dp /= 2*eps;
deltaP = - f/df_dp;
......
......@@ -69,6 +69,15 @@ public:
return 3370;
}
/*!
* \brief The molar density \f$\mathrm{[mol/m^3]}\f$ of CaO.
* Molar density at 293 K. Literature value from Shao et al. (2013).
*/
static Scalar solidMolarDensity(Scalar temperature)
{
return solidDensity(temperature)/molarMass();
}
/*!
* \brief The specific heat capacity \f$\mathrm{[J/kg K]}\f$ of CaO.
*/
......
......@@ -70,6 +70,15 @@ public:
return 2200.0; //at 293 K ; Shao et al. (2013)
}
/*!
* \brief The molar density \f$\mathrm{[mol/m^3]}\f$ of CaO2H2.
* Molar density at 293 K. Literature value from Shao et al. (2013).
*/
static Scalar solidMolarDensity(Scalar temperature)
{
return solidDensity(temperature)/molarMass();
}
/*!
* \brief The specific heat capacity \f$\mathrm{[J/kgK]}\f$ of CaO2H2.
*/
......
......@@ -110,6 +110,15 @@ public:
return IdealGas::density(molarMass(), temperature, pressure);
}
/*!
* \brief The molar density of \f$CH_4\f$ gas in \f$\mathrm{[mol/m^3]}\f$,
* depending on pressure and temperature.
* \param temperature The temperature of the gas
* \param pressure The pressure of the gas
*/
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
{ return IdealGas::molarDensity(temperature, pressure); }
/*!
* \brief Returns true if the gas phase is assumed to be ideal
*/
......
......@@ -227,6 +227,16 @@ public:
return CO2Tables::tabulatedDensity.at(temperature, pressure);
}
/*!
* \brief The molar density of CO2 gas in \f$\mathrm{[mol/m^3]}\f$ at a given pressure and temperature.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*
*/
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
{ return gasDensity(temperature, pressure)/molarMass(); }
/*!
* \brief The density of pure CO2 at a given pressure and temperature \f$\mathrm{[kg/m^3]}\f$.
* \param temperature the temperature \f$\mathrm{[K]}\f$
......@@ -242,6 +252,17 @@ public:
}
return CO2Tables::tabulatedDensity.at(temperature, pressure);
}
/*!
* \brief The molar density of CO2 in \f$\mathrm{[mol/m^3]}\f$ at a given pressure and temperature.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*
*/
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
{ return liquidDensity(temperature, pressure)/molarMass(); }
/*!
* \brief The pressure of steam in \f$\mathrm{[Pa]}\f$ at a given density and temperature.
*
......
......@@ -118,6 +118,16 @@ public:
return density;
}
/*!
* \brief The molar density in \f$\mathrm{[mol/m^3]}\f$ at a given pressure and temperature.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*
*/
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
{ return liquidDensity(temperature, pressure)/molarMass(); }
/*!
* \brief Sets the liquid dynamic viscosity in \f$\mathrm{[Pa*s]}\f$.
*
......@@ -145,6 +155,17 @@ public:
return density;
}
/*!
* \brief The molar density in \f$\mathrm{[mol/m^3]}\f$ at a given pressure and temperature.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*
*/
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
{ return gasDensity(temperature, pressure)/molarMass(); }
/*!
* \brief Sets the gas dynamic viscosity in \f$\mathrm{[Pa*s]}\f$.
*
......
......@@ -80,6 +80,20 @@ public:
DUNE_THROW(Dune::NotImplemented, "gasDensity(t,p)");
}
/*!
* \brief The molar density in \f$\mathrm{[mol/m^3]}\f$ of the component at a given pressure in
* \f$\mathrm{[Pa]}\f$ and temperature in \f$\mathrm{[K]}\f$.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*/
template<class C = Component>
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
{
static_assert(AlwaysFalse<C>::value, "Mandatory function not implemented: gasMolarDensity(t,p)");
DUNE_THROW(Dune::NotImplemented, "gasMolarDensity(t,p)");
}
/*!
* \brief Specific enthalpy \f$\mathrm{[J/kg]}\f$ of the pure component in gas.
*
......
......@@ -121,6 +121,15 @@ public:
return IdealGas::density(molarMass(), temperature, pressure);
}
/*!
* \brief The molar density of \f$H_2\f$ in \f$\mathrm{[mol/m^3]}\f$,
* depending on pressure and temperature.
* \param temperature The temperature of the gas
* \param pressure The pressure of the gas
*/
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
{ return IdealGas::molarDensity(temperature, pressure); }
/*!
* \brief Returns true if the gas phase is assumed to be compressible
*/
......
......@@ -545,6 +545,16 @@ public:
return 1.0/volumeRegion2_(temperature, pressure);
}
/*!
* \brief The molar density of steam in \f$\mathrm{[mol/m^3]}\f$ at a given pressure and temperature.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*
*/
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
{ return gasDensity(temperature, pressure)/molarMass(); }
/*!
* \brief Returns true if the gas phase is assumed to be ideal
*/
......@@ -650,6 +660,16 @@ public:
return 1/volumeRegion1_(temperature, pressure);
}
/*!
* \brief The molar density of water in \f$\mathrm{[mol/m^3]}\f$ at a given pressure and temperature.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*
*/
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
{ return liquidDensity(temperature, pressure)/molarMass(); }
/*!
* \brief The pressure of liquid water in \f$\mathrm{[Pa]}\f$ at a given density and
* temperature.
......
......@@ -48,7 +48,7 @@ class HeavyOil
, public Components::Gas<Scalar, HeavyOil<Scalar> >
{
using Consts = Dumux::Constants<Scalar>;
using IdealGas = Dumux::IdealGas<Scalar>;
public:
/*!
* \brief A human readable name for heavyoil
......@@ -340,11 +340,20 @@ public:
*/
static Scalar gasDensity(Scalar temperature, Scalar pressure)
{
return IdealGas<Scalar>::density(molarMass(),
return IdealGas::density(molarMass(),
temperature,
pressure);
}
/*!
* \brief The molar density of pure heavyoil in \f$\mathrm{[mol/m^3]}\f$,
* depending on pressure and temperature.
* \param temperature The temperature of the gas
* \param pressure The pressure of the gas
*/
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
{ return IdealGas::molarDensity(temperature, pressure); }
/*!
* \brief The density of pure heavyoil at a given pressure and temperature \f$\mathrm{[kg/m^3]}\f$.
*
......@@ -364,6 +373,16 @@ public:
return rho; // [kg/m^3]
}
/*!
* \brief The molar density of pure heavyoil in \f$\mathrm{[mol/m^3]}\f$ at a given pressure and temperature.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*
*/
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
{ return liquidDensity(temperature, pressure)/molarMass(); }
/*!
* \brief Returns true if the gas phase is assumed to be compressible
*/
......@@ -464,31 +483,6 @@ public:
{
return 0.127;
}
protected:
/*!
* \brief The molar density of pure heavyoil at a given pressure and temperature
* \f$\mathrm{[mol/m^3]}\f$.
*
* source : Reid et al. (fourth edition): Modified Racket technique (chap. 3-11, eq. 3-11.9)
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
*/
static Scalar molarLiquidDensity_(Scalar temperature)
{
using std::min;
using std::max;
temperature = min(temperature, 500.0); // regularization
temperature = max(temperature, 250.0);
using std::pow;
const Scalar Z_RA = 0.2556; // from equation
const Scalar expo = 1.0 + pow(1.0 - temperature/criticalTemperature(), 2.0/7.0);
Scalar V = Consts::R*criticalTemperature()/criticalPressure()*pow(Z_RA, expo); // liquid molar volume [cm^3/mol]
return 1.0/V; // molar density [mol/m^3]
}
};
} // end namespace Components
......
......@@ -70,6 +70,20 @@ public:
DUNE_THROW(Dune::NotImplemented, "liquidDensity(t,p)");
}
/*!
* \brief The molar density \f$\mathrm{[mole/m^3]}\f$ of the liquid component at a given pressure in
* \f$\mathrm{[Pa]}\f$ and temperature in \f$\mathrm{[K]}\f$.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*/
template<class C = Component>
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
{
static_assert(AlwaysFalse<C>::value, "Mandatory function not implemented: liquidMolarDensity(t,p)");
DUNE_THROW(Dune::NotImplemented, "Component::liquidMolarDensity(t,p)");
}
/*!
* \brief The dynamic liquid viscosity \f$\mathrm{[Pa*s]}\f$ of the pure component.
*
......
......@@ -48,7 +48,7 @@ class Mesitylene
, public Components::Gas<Scalar, Mesitylene<Scalar> >
{
using Consts = Constants<Scalar>;
using IdealGas = Dumux::IdealGas<Scalar>;
public:
/*!
* \brief A human readable name for the mesitylene
......@@ -206,11 +206,20 @@ public:
*/
static Scalar gasDensity(Scalar temperature, Scalar pressure)
{
return IdealGas<Scalar>::density(molarMass(),
temperature,
pressure);
return IdealGas::density(molarMass(),
temperature,
pressure);
}
/*!
* \brief The molar density of mesitylene in \f$\mathrm{[mol/m^3]}\f$,
* depending on pressure and temperature.
* \param temperature The temperature of the gas
* \param pressure The pressure of the gas
*/
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
{ return IdealGas::molarDensity(temperature, pressure); }
/*!
* \brief The density of pure mesitylene at a given pressure and temperature \f$\mathrm{[kg/m^3]}\f$.
*
......@@ -219,7 +228,31 @@ public:
*/
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
{
return molarLiquidDensity_(temperature)*molarMass(); // [kg/m^3]
return liquidMolarDensity(temperature, pressure)*molarMass();
}
/*!
* \brief The molar density of pure mesitylene at a given pressure and temperature
* \f$\mathrm{[mol/m^3]}\f$.
*
* source : Reid et al. (1987, Modified Racket technique (chap. 3-11, eq. 3-11.9)) \cite reid1987
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
*/
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
{
using std::min;
using std::max;
temperature = min(temperature, 500.0); // regularization
temperature = max(temperature, 250.0);
const Scalar Z_RA = 0.2556; // from equation
using std::pow;
const Scalar expo = 1.0 + pow(1.0 - temperature/criticalTemperature(), 2.0/7.0);
Scalar V = Consts::R*criticalTemperature()/criticalPressure()*pow(Z_RA, expo); // liquid molar volume [cm^3/mol]
return 1.0/V; // molar density [mol/m^3]
}
/*!
......@@ -347,32 +380,6 @@ public:
{
return 0.1351;
}
protected:
/*!
* \brief The molar density of pure mesitylene at a given pressure and temperature
* \f$\mathrm{[mol/m^3]}\f$.
*
* source : Reid et al. (1987, Modified Racket technique (chap. 3-11, eq. 3-11.9)) \cite reid1987
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
*/
static Scalar molarLiquidDensity_(Scalar temperature)
{
using std::min;
using std::max;
temperature = min(temperature, 500.0); // regularization
temperature = max(temperature, 250.0);
const Scalar Z_RA = 0.2556; // from equation
using std::pow;
const Scalar expo = 1.0 + pow(1.0 - temperature/criticalTemperature(), 2.0/7.0);
Scalar V = Consts::R*criticalTemperature()/criticalPressure()*pow(Z_RA, expo); // liquid molar volume [cm^3/mol]
return 1.0/V; // molar density [mol/m^3]
}
};
} // end namespace Components
......
......@@ -133,6 +133,16 @@ public:
return IdealGas::density(molarMass(), temperature, pressure);
}
/*!
* \brief The molar density of \f$N_2\f$ gas in \f$\mathrm{[mol/m^3]}\f$ at a given pressure and temperature.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
*
*/
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
{ return IdealGas::molarDensity(temperature, pressure); }
/*!
* \brief Returns true if the gas phase is assumed to be compressible
*/
......
......@@ -81,6 +81,14 @@ public:
return 2165.0;
}
/*!
* \brief The mass density \f$\mathrm{[kg/m^3]}\f$ of NaCl.
*/
static Scalar solidMolarDensity(Scalar temperature)
{
return solidDensity(temperature)/molarMass();
}
/*!
* \brief The specific heat capacity \f$\mathrm{[J/molK]}\f$ of NaCl.
*/
......
......@@ -137,6 +137,15 @@ public:
return IdealGas::density(molarMass(), temperature, pressure);
}
/*!
* \brief The molar density of pure \f$O_2\f$ in \f$\mathrm{[mol/m^3]}\f$,
* depending on pressure and temperature.