12 #include "libmesh/utility.h" 28 _p_critical(22.064e6),
164 const Real p,
const Real rho, Real & e, Real & de_dp, Real & de_drho)
const 301 dmu_dp = dmu_drho * drho_dp;
318 const Real mu_star = 1.0e-6;
325 Real sum0 = 0.0, dsum0_dTbar = 0.0;
326 for (std::size_t i = 0; i <
_mu_H0.size(); ++i)
333 const Real dmu0_dTbar =
337 Real sum1 = 0.0, dsum1_drhobar = 0.0, dsum1_dTbar = 0.0;
338 for (
unsigned int i = 0; i < 6; ++i)
343 for (
unsigned int j = 0;
j < 7; ++
j)
351 const Real mu1 = std::exp(rhobar * sum1);
352 const Real dmu1_drhobar = (sum1 + rhobar * dsum1_drhobar) * mu1;
353 const Real dmu1_dTbar = (rhobar * dsum1_dTbar) * mu1;
356 mu = mu_star * mu0 * mu1;
357 dmu_drho = mu_star * mu0 * dmu1_drhobar * drhobar_drho;
358 dmu_dT = mu_star * (dmu0_dTbar * mu1 + mu0 * dmu1_dTbar) * dTbar_dT + dmu_drho * ddensity_dT;
391 dmu_dp = dmu_drho * drho_dp;
409 mooseError(
"k_from_p_T() is not implemented.");
443 Water97FluidProperties::s_from_p_T(
493 if (temperature < 273.15 || temperature >
_T_critical)
494 mooseException(
name(),
495 ": vaporPressure(): Temperature ",
497 " is outside range 273.15 K <= T " 502 theta2 = theta * theta;
503 a = theta2 +
_n4[0] * theta +
_n4[1];
504 b =
_n4[2] * theta2 +
_n4[3] * theta +
_n4[4];
505 c =
_n4[5] * theta2 +
_n4[6] * theta +
_n4[7];
517 mooseException(
name() +
": vaporTemperature(): Pressure ",
519 " is outside range 611.213 Pa <= p <= 22.064 MPa");
548 dTsat_dp =
T.derivatives()[0];
556 if (temperature < 623.15 || temperature > 863.15)
557 mooseException(
name(),
558 ": b23p(): Temperature ",
560 " is outside range of 623.15 K <= T <= 863.15 K");
570 if (pressure < 16.529e6 || pressure > 100.0e6)
572 name(),
": b23T(): Pressure ",
pressure,
"is outside range 16.529 MPa <= p <= 100 MPa");
597 mooseException(
"Enthalpy ", enthalpy,
" is out of range in ",
name(),
": inRegionPH()");
612 mooseException(
"Enthalpy ", enthalpy,
" is out of range in ",
name(),
": inRegionPH()");
625 mooseException(
"Enthalpy ", enthalpy,
" is out of range in ",
name(),
": inRegionPH()");
628 mooseException(
"Pressure ",
pressure,
" is out of range in ",
name(),
": inRegionPH()");
636 unsigned int subregion;
656 unsigned int subregion;
670 if (pressure < 6.5467e6 || pressure > 100.0e6)
672 name(),
": b2bc(): Pressure ",
pressure,
" is outside range of 6.5467 MPa <= p <= 100 MPa");
676 return (0.26526571908428e4 +
std::sqrt((
pi - 0.45257578905948e1) / 0.12809002730136e-3)) * 1.0e3;
700 dT_dp =
T.derivatives()[0];
701 dT_dh =
T.derivatives()[1];
726 else if (subregion == 2)
746 mooseError(
"temperature_from_ph() not implemented for region 5");
750 mooseError(
"inRegionPH() has given an incorrect region");
764 for (std::size_t i = 0; i <
_nph1.size(); ++i)
781 for (std::size_t i = 0; i <
_nph2a.size(); ++i)
801 for (std::size_t i = 0; i <
_nph2b.size(); ++i)
819 for (std::size_t i = 0; i <
_nph2c.size(); ++i)
832 name(),
": b3ab(): Pressure ",
pressure,
"is outside range of 16.529 MPa <= p <= 100 MPa");
835 Real eta = 0.201464004206875e4 + 0.374696550136983e1 *
pi - 0.219921901054187e-1 *
pi *
pi +
836 0.87513168600995e-4 *
pi *
pi *
pi;
849 for (std::size_t i = 0; i <
_nph3a.size(); ++i)
863 for (std::size_t i = 0; i <
_nph3b.size(); ++i)
872 const Real A = coeffs[0];
873 const Real B = coeffs[1];
874 const Real C = coeffs[2];
877 const Real tau = 1.0 - Tr;
883 const std::vector<Real>
a{
884 -7.85951783, 1.84408259, -11.7866497, 22.6807411, -15.9618719, 1.80122502};
885 const std::vector<Real>
b{1.0, 1.5, 3.0, 3.5, 4.0, 7.5};
888 for (std::size_t i = 0; i <
a.size(); ++i)
891 return 22.064e6 * std::exp(sum / Tr) * std::exp(lnkh);
896 const std::vector<Real> & coeffs,
900 const Real A = coeffs[0];
901 const Real B = coeffs[1];
902 const Real C = coeffs[2];
904 const Real pc = 22.064e6;
905 const Real Tc = 647.096;
908 const Real tau = 1.0 - Tr;
912 const Real dlnkh_dT =
913 (-
A / Tr / Tr -
B *
std::pow(tau, 0.355) / Tr / Tr - 0.355 *
B *
std::pow(tau, -0.645) / Tr -
914 0.41 *
C *
std::pow(Tr, -1.41) * std::exp(tau) -
C *
std::pow(Tr, -0.41) * std::exp(tau)) /
918 const std::vector<Real>
a{
919 -7.85951783, 1.84408259, -11.7866497, 22.6807411, -15.9618719, 1.80122502};
920 const std::vector<Real>
b{1.0, 1.5, 3.0, 3.5, 4.0, 7.5};
924 for (std::size_t i = 0; i <
a.size(); ++i)
930 const Real p = pc * std::exp(sum / Tr);
931 const Real dp_dT = -
p / Tc / Tr * (sum / Tr + dsum);
934 Kh =
p * std::exp(lnkh);
935 dKh_dT = (
p * dlnkh_dT + dp_dT) * std::exp(lnkh);
940 const std::vector<Real> & coeffs)
const 944 Real dKh_dT_real = 0.0;
948 Kh.derivatives() =
temperature.derivatives() * dKh_dT_real;
957 const Real P3cd = 19.00881189173929;
958 unsigned int subregion = 0;
960 if (pMPa > 40.0 && pMPa <= 100.0)
967 else if (pMPa > 25.0 && pMPa <= 40.0)
978 else if (pMPa > 23.5 && pMPa <= 25.0)
993 else if (pMPa > 23.0 && pMPa <= 23.5)
1008 else if (pMPa > 22.5 && pMPa <= 23.0)
1036 if (pMPa > 22.11 && pMPa <= 22.5)
1047 else if (pMPa > 22.064 && pMPa <= 22.11)
1060 if (pMPa > 21.93161551 && pMPa <= 22.064)
1070 if (pMPa > 21.90096265 && pMPa <= 22.064)
1086 else if (pMPa > 20.5 &&
1098 else if (pMPa > P3cd && pMPa <= 20.5)
1107 else if (pMPa >
vaporPressure(623.15) * 1.0e-6 && pMPa <= P3cd)
1114 else if (pMPa > 22.11 && pMPa <= 22.5)
1125 else if (pMPa > 22.064 && pMPa <= 22.11)
1137 mooseError(
"subregion3(): Shouldn't have got here!");
1150 mooseException(
"Pressure ",
pressure,
" is out of range in ",
name(),
": inRegion()");
1154 if (pressure < 0.0 || pressure > 50.0e6)
1155 mooseException(
"Pressure ",
pressure,
" is out of range in ",
name(),
": inRegion()");
1158 mooseException(
"Temperature ",
temperature,
" is out of range in ",
name(),
": inRegion()");
1161 unsigned int region;
T v_from_p_T_template(const T &pressure, const T &temperature) const
const Real _T_critical
Critical temperature (K)
virtual Real mu_from_p_T(Real pressure, Real temperature) const override
e e e e s T T T T T rho T
static InputParameters validParams()
virtual void rho_mu_from_p_T(Real pressure, Real temperature, Real &rho, Real &mu) const override
Combined methods.
virtual Real triplePointTemperature() const override
Triple point temperature.
unsigned int inRegion(Real pressure, Real temperature) const
Determines the phase region that the given pressure and temperature values lie in.
const std::array< Real, 5 > _n23
Constants for the boundary between regions 2 and 3.
T tempXY(const T &pressure, subregionEnum xy) const
Boundaries between subregions in region 3.
std::pair< T, T > rho_T_from_v_e(const T &v, const T &e) const
Computes the density (first member of the pair) and temperature (second member of the pair) as functi...
Real vaporTemperature(Real pressure) const override
Saturation temperature as a function of pressure.
Real p_from_v_e(Real v, Real e) const override
const Real _p_critical
Critical pressure (Pa)
const std::array< int, 33 > _Jph3b
Real T_from_v_e(Real v, Real e) const override
const std::array< int, 20 > _Iph1
virtual Real e_from_p_T(Real pressure, Real temperature) const override
Real b2bc(Real pressure) const
Boundary between subregions b and c in region 2.
static InputParameters validParams()
virtual std::string fluidName() const override
const std::array< int, 23 > _Jph2c
const std::array< Real, 36 > _nph2a
T k_from_v_e_template(const T &v, const T &e) const
T e_from_p_T_template(const T &pressure, const T &temperature) const
registerMooseObject("FluidPropertiesApp", Water97FluidProperties)
virtual Real criticalDensity() const override
Critical density.
T k_from_p_T_template(const T &pressure, const T &temperature) const
Real b23T(Real pressure) const
Auxillary equation for the boundary between regions 2 and 3.
Water97FluidProperties(const InputParameters ¶meters)
virtual ADReal cv_from_v_e(const ADReal &v, const ADReal &e) const override
T c_from_p_T_template(const T &pressure, const T &temperature) const
T rho_from_p_T_template(const T &pressure, const T &temperature) const
DualNumber< Real, DNDerivativeType, true > DualReal
unsigned int subregion3(Real pressure, Real temperature) const
Provides the correct subregion index for a (P,T) point in region 3.
const std::array< int, 36 > _Jph2a
static const std::string density
FPDualReal temperature_from_ph1(const FPDualReal &pressure, const FPDualReal &enthalpy) const
Backwards equation T(p, h) in Region 1 Eq.
const std::array< std::array< Real, 7 >, 6 > _mu_Hij
int sgn(T val)
The sign function.
T h_from_p_T_template(const T &pressure, const T &temperature) const
const std::array< Real, 33 > _nph3b
static const std::string temperature
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
const std::array< Real, 38 > _nph2b
std::pair< T, T > p_T_from_v_h(const T &v, const T &h) const
Computes the pressure (first member of the pair) and temperature (second member of the pair) as funct...
virtual Real h_from_p_T(Real pressure, Real temperature) const override
FPDualReal vaporTemperature_ad(const FPDualReal &pressure) const
AD version of saturation temperature as a function of pressure (used internally)
virtual Real criticalTemperature() const override
Critical temperature.
const std::array< int, 33 > _Iph3b
virtual Real k_from_p_T(Real pressure, Real temperature) const override
ADReal mu_from_v_e(const ADReal &v, const ADReal &e) const override
unsigned int subregion2ph(Real pressure, Real enthalpy) const
Provides the correct subregion index for a (P,h) point in region 2.
const Real _T_triple
Triple point temperature (K)
DualNumber< Real, DNDerivativeSize< 5 > > FPDualReal
virtual const std::string & name() const
std::pair< T, T > p_T_from_v_e(const T &v, const T &e) const
Computes the pressure (first member of the pair) and temperature (second member of the pair) as funct...
const std::array< int, 23 > _Iph2c
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
FPDualReal temperature_from_ph2a(const FPDualReal &pressure, const FPDualReal &enthalpy) const
Backwards equation T(p, h) in Region 2a Eq.
T cv_from_p_T_template(const T &pressure, const T &temperature) const
const std::array< int, 20 > _Jph1
const std::array< int, 36 > _Iph2a
Real k_from_v_e(Real v, Real e) const override
const std::array< int, 38 > _Jph2b
Real f(Real x)
Test function for Brents method.
const std::array< int, 31 > _Jph3a
FPDualReal temperature_from_ph2b(const FPDualReal &pressure, const FPDualReal &enthalpy) const
Backwards equation T(p, h) in Region 2b Eq.
static const std::string mu
const std::array< int, 31 > _Iph3a
virtual Real v_from_p_T(Real pressure, Real temperature) const override
FPDualReal temperature_from_ph2c(const FPDualReal &pressure, const FPDualReal &enthalpy) const
Backwards equation T(p, h) in Region 2c Eq.
virtual Real triplePointPressure() const override
Triple point pressure.
Common class for single phase fluid properties.
const std::array< Real, 20 > _nph1
ADReal e_from_v_h(const ADReal &v, const ADReal &h) const override
FPDualReal T_from_p_h_ad(const FPDualReal &pressure, const FPDualReal &enthalpy) const
AD version of backwards equation T(p, h) (used internally) From Revised Release on the IAPWS Industri...
e e e e s T T T T T rho v v T h
unsigned int subregion3ph(Real pressure, Real enthalpy) const
Provides the correct subregion index for a (P,h) point in region 3.
virtual ~Water97FluidProperties()
virtual Real T_from_p_h(Real pressure, Real enthalpy) const override
Backwards equation T(p, h) From Revised Release on the IAPWS Industrial Formulation 1997 for the Ther...
T mu_from_rho_T_template(const T &density, const T &temperature) const
virtual Real c_from_p_T(Real pressure, Real temperature) const override
T p_from_v_e_template(const T &v, const T &e) const
const std::array< Real, 31 > _nph3a
T k_from_rho_T_template(const T &density, const T &temperature) const
Real b23p(Real temperature) const
Auxillary equation for the boundary between regions 2 and 3.
const Real _rho_critical
Critical density (kg/m^3)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
const std::array< int, 38 > _Iph2b
virtual Real e_from_p_rho(Real p, Real rho) const override
virtual Real criticalPressure() const override
Critical pressure.
Real b3ab(Real pressure) const
Boundary between subregions a and b in region 3.
Water (H2O) fluid properties as a function of pressure (Pa) and temperature (K) from IAPWS-IF97: Revi...
static const std::string pressure
virtual Real vaporPressure(Real temperature) const override
Vapor pressure.
Real henryConstant(Real temperature, const std::vector< Real > &coeffs) const
IAPWS formulation of Henry's law constant for dissolution in water From Guidelines on the Henry's con...
FPDualReal temperature_from_ph3b(const FPDualReal &pressure, const FPDualReal &enthalpy) const
Backwards equation T(p, h) in Region 3b Eq.
FPDualReal temperature_from_ph3a(const FPDualReal &pressure, const FPDualReal &enthalpy) const
Backwards equation T(p, h) in Region 3a Eq.
void mooseError(Args &&... args) const
unsigned int inRegionPH(Real pressure, Real enthalpy) const
Determines the phase region that the given pressure and enthaply values lie in.
virtual Real k_from_rho_T(Real density, Real temperature) const override
T cp_from_p_T_template(const T &pressure, const T &temperature) const
void derivInsert(NumberArray< N, Real > &derivs, dof_id_type index, Real value)
virtual Real rho_from_p_T(Real pressure, Real temperature) const override
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const Real _p_triple
Triple point pressure (Pa)
T mu_from_p_T_template(const T &pressure, const T &temperature) const
T e_from_p_rho_template(const T &p, const T &rho) const
virtual ADReal c_from_v_e(const ADReal &v, const ADReal &e) const override
virtual Real cv_from_p_T(Real pressure, Real temperature) const override
virtual Real mu_from_rho_T(Real density, Real temperature) const override
const std::array< Real, 23 > _nph2c
virtual Real cp_from_p_T(Real pressure, Real temperature) const override
const Real _Mh2o
Water molar mass (kg/mol)
MooseUnits pow(const MooseUnits &, int)
static const std::string C
virtual ADReal cp_from_v_e(const ADReal &v, const ADReal &e) const override
virtual Real molarMass() const override
Fluid name.
const std::array< Real, 10 > _n4
Constants for region 4 (the saturation curve up to the critical point)
const std::array< Real, 4 > _mu_H0
Constants from Release on the IAPWS Formulation 2008 for the Viscosity of Ordinary Water Substance...