23 "Density of the fluid at standard (surface) conditions (kg/m^3)");
25 "pressure",
"Tabulated pressures (Pa). Must be strictly increasing");
27 "formation_volume_factor",
28 "Formation volume factor B (reservoir volume / standard volume) at each tabulated pressure");
30 "Dynamic viscosity (Pa.s) at each tabulated pressure");
32 "cv", 2000.0,
"cv>0",
"Constant specific heat capacity at constant volume (J/kg/K)");
34 "molar_mass",
"molar_mass>0",
"Molar mass of the fluid (kg/mol). Only needed if requested");
36 MooseEnum OOBBehavior(
"ignore throw declare_invalid warn_invalid set_to_closest_bound",
"throw");
38 "out_of_bounds_behavior",
40 "Property evaluation behavior when evaluated outside the tabulated pressure range. "
41 "'ignore': 1/B and 1/(B mu) are extrapolated linearly from the end intervals of the table; "
42 "'throw': an exception is thrown, so the time step is cut; 'set_to_closest_bound': the "
43 "pressure is moved to the closest bound of the table; 'declare_invalid' and 'warn_invalid': "
44 "as 'set_to_closest_bound', but the solution is also marked as invalid or a warning is "
45 "recorded. Results computed outside the table should be used with care");
47 "Isothermal fluid properties from a table of pressure, formation volume factor and "
48 "viscosity (PVDO/PVDG style). 1/B and 1/(B mu) are interpolated linearly in pressure.");
54 _density_sc(getParam<Real>(
"density_sc")),
55 _p(getParam<
std::vector<Real>>(
"pressure")),
56 _cv(getParam<Real>(
"cv")),
59 const auto &
B = getParam<std::vector<Real>>(
"formation_volume_factor");
60 const auto &
mu = getParam<std::vector<Real>>(
"viscosity");
63 paramError(
"pressure",
"At least two tabulated pressures are required");
64 if (
B.size() !=
_p.size())
65 paramError(
"formation_volume_factor",
"Must have the same number of entries as 'pressure'");
66 if (
mu.size() !=
_p.size())
67 paramError(
"viscosity",
"Must have the same number of entries as 'pressure'");
69 for (std::size_t i = 1; i <
_p.size(); ++i)
70 if (
_p[i] <=
_p[i - 1])
71 paramError(
"pressure",
"Tabulated pressures must be strictly increasing");
73 std::vector<Real> inv_B(
_p.size());
74 std::vector<Real> inv_B_mu(
_p.size());
75 for (std::size_t i = 0; i <
_p.size(); ++i)
78 paramError(
"formation_volume_factor",
"All entries must be positive");
80 paramError(
"viscosity",
"All entries must be positive");
81 inv_B[i] = 1.0 /
B[i];
82 inv_B_mu[i] = 1.0 / (
B[i] *
mu[i]);
88 const bool extrapolate =
97 return "tabulated_pvt";
105 "molar_mass must be provided because it is required by another object");
106 return getParam<Real>(
"molar_mass");
113 Real & dvalue_dp)
const
115 if (
p <
_p.front() ||
p >
_p.back())
124 "Pressure " +
Moose::stringify(
p) +
" is outside the range of tabulated pressure (" +
130 flagInvalidSolution(
"Pressure outside the tabulated range: set to the closest bound");
134 flagSolutionWarning(
"Pressure outside the tabulated range: set to the closest bound "
146 Real
rho, drho_dp, drho_dT;
153 Real
p, Real , Real &
rho, Real & drho_dp, Real & drho_dT)
const
155 Real inv_B, dinv_B_dp;
160 ": the formation volume factor is non-positive at pressure ",
162 ", which is outside the tabulated range. Extend the table.");
172 Real
mu, dmu_dp, dmu_dT;
179 Real
p, Real , Real &
mu, Real & dmu_dp, Real & dmu_dT)
const
181 Real inv_B, dinv_B_dp, inv_B_mu, dinv_B_mu_dp;
185 if (inv_B <= 0.0 || inv_B_mu <= 0.0)
187 ": the viscosity is non-positive at pressure ",
189 ", which is outside the tabulated range. Extend the table.");
192 mu = inv_B / inv_B_mu;
193 dmu_dp = (dinv_B_dp * inv_B_mu - inv_B * dinv_B_mu_dp) / (inv_B_mu * inv_B_mu);
214 Real
h, dh_dp, dh_dT;
222 Real
rho, drho_dp, drho_dT;
227 dh_dp = 1.0 /
rho -
p * drho_dp / (
rho *
rho);
registerMooseObject("PorousFlowApp", TabulatedPVTFluidProperties)
T sampleDerivative(const T &x) const
T sample(const T &x) const
const std::string & name() const
void paramError(const std::string ¶m, Args... args) const
bool isParamValid(const std::string &name) const
Common class for single phase fluid properties.
static InputParameters validParams()
e e e e s T T T T T rho T
e e e e s T T T T T rho v v T e h
Fluid properties from a table of pressure, formation volume factor and viscosity (PVDO/PVDG style)
OOBBehavior
Property evaluation behavior outside the tabulated pressure range (as in TabulatedFluidProperties).
static InputParameters validParams()
virtual std::string fluidName() const override
Fluid name.
LinearInterpolation _inv_B_mu_table
Interpolation of the reciprocal of the product of formation volume factor and viscosity,...
TabulatedPVTFluidProperties(const InputParameters ¶meters)
virtual Real e_from_p_T(Real p, Real T) const override
const Real _density_sc
Density at standard (surface) conditions (kg/m^3)
const OOBBehavior _OOBBehavior
virtual Real rho_from_p_T(Real p, Real T) const override
virtual Real molarMass() const override
Molar mass [kg/mol].
LinearInterpolation _inv_B_table
Interpolation of the reciprocal of the formation volume factor, 1/B, in pressure.
const Real _cv
Constant specific heat capacity at constant volume (J/kg/K)
virtual Real h_from_p_T(Real p, Real T) const override
const std::vector< Real > _p
Tabulated pressures (Pa), strictly increasing.
void interpolate(Real p, const LinearInterpolation &table, Real &value, Real &dvalue_dp) const
Interpolate a tabulated quantity in pressure, applying the out-of-bounds behavior.
virtual Real mu_from_p_T(Real p, Real T) const override
std::string stringify(const T &t)