www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TabulatedFluidProperties Class Reference

Class for fluid properties read from a file. More...

#include <TabulatedFluidProperties.h>

Inheritance diagram for TabulatedFluidProperties:
[legend]

Public Member Functions

 TabulatedFluidProperties (const InputParameters &parameters)
 
virtual ~TabulatedFluidProperties ()
 
virtual void initialSetup () override
 
virtual std::string fluidName () const override
 Fluid name. More...
 
virtual Real molarMass () const override
 Molar mass [kg/mol]. More...
 
virtual Real rho_from_p_T (Real pressure, Real temperature) const override
 Density from pressure and temperature. More...
 
virtual void rho_from_p_T (Real pressure, Real temperature, Real &rho, Real &drho_dp, Real &drho_dT) const override
 Density and its derivatives from pressure and temperature. More...
 
virtual Real e_from_p_T (Real pressure, Real temperature) const override
 Internal energy from pressure and temperature. More...
 
virtual void e_from_p_T (Real pressure, Real temperature, Real &e, Real &de_dp, Real &de_dT) const override
 Internal energy and its derivatives from pressure and temperature. More...
 
virtual void rho_e_dpT (Real pressure, Real temperature, Real &rho, Real &drho_dp, Real &drho_dT, Real &e, Real &de_dp, Real &de_dT) const override
 Density and internal energy and their derivatives wrt pressure and temperature. More...
 
virtual Real h_from_p_T (Real p, Real T) const override
 Specific enthalpy from pressure and temperature. More...
 
virtual void h_from_p_T (Real pressure, Real temperature, Real &h, Real &dh_dp, Real &dh_dT) const override
 Specific enthalpy and its derivatives from pressure and temperature. More...
 
virtual Real mu_from_p_T (Real pressure, Real temperature) const override
 
virtual void mu_from_p_T (Real pressure, Real temperature, Real &mu, Real &dmu_dp, Real &dmu_dT) const override
 
virtual void rho_mu (Real pressure, Real temperature, Real &rho, Real &mu) const override
 Density and viscosity. More...
 
virtual void rho_mu_dpT (Real pressure, Real temperature, Real &rho, Real &drho_dp, Real &drho_dT, Real &mu, Real &dmu_dp, Real &dmu_dT) const override
 Density and viscosity and their derivatives wrt pressure and temperature. More...
 
virtual Real cp_from_p_T (Real pressure, Real temperature) const override
 Isobaric specific heat capacity. More...
 
virtual Real cv_from_p_T (Real pressure, Real temperature) const override
 Isochoric specific heat. More...
 
virtual Real c_from_p_T (Real pressure, Real temperature) const override
 Speed of sound. More...
 
virtual Real k_from_p_T (Real pressure, Real temperature) const override
 Thermal conductivity. More...
 
virtual void k_from_p_T (Real pressure, Real temperature, Real &k, Real &dk_dp, Real &dk_dT) const override
 Thermal conductivity and its derivatives wrt pressure and temperature. More...
 
virtual Real s_from_p_T (Real pressure, Real temperature) const override
 Specific entropy from pressure and temperature. More...
 
virtual void s_from_p_T (Real p, Real T, Real &s, Real &ds_dp, Real &ds_dT) const override
 Specific entropy and its derivatives from pressure and temperature. More...
 
virtual Real henryConstant (Real temperature) const override
 Henry's law constant for dissolution in water. More...
 
virtual void henryConstant_dT (Real temperature, Real &Kh, Real &dKh_dT) const override
 Henry's law constant for dissolution in water and derivative wrt temperature. More...
 
virtual Real p_from_v_e (Real v, Real e) const
 Pressure from specific volume and specific internal energy. More...
 
virtual void p_from_v_e (Real v, Real e, Real &p, Real &dp_dv, Real &dp_de) const
 Pressure and its derivatives from specific volume and specific internal energy. More...
 
virtual Real T_from_v_e (Real v, Real e) const
 Temperature from specific volume and specific internal energy. More...
 
virtual void T_from_v_e (Real v, Real e, Real &T, Real &dT_dv, Real &dT_de) const
 Temperature and its derivatives from specific volume and specific internal energy. More...
 
virtual Real c_from_v_e (Real v, Real e) const
 Sound speed from specific volume and specific internal energy. More...
 
virtual void c_from_v_e (Real v, Real e, Real &c, Real &dc_dv, Real &dc_de) const
 Sound speed and its derivatives from specific volume and specific internal energy. More...
 
virtual Real cp_from_v_e (Real v, Real e) const
 Isobaric (constant-pressure) specific heat from specific volume and specific internal energy. More...
 
virtual Real cv_from_v_e (Real v, Real e) const
 Isochoric (constant-volume) specific heat from specific volume and specific internal energy. More...
 
virtual Real mu_from_v_e (Real v, Real e) const
 Dynamic viscosity from specific volume and specific internal energy. More...
 
virtual Real k_from_v_e (Real v, Real e) const
 Thermal conductivity from specific volume and specific internal energy. More...
 
virtual Real s_from_v_e (Real v, Real e) const
 Specific entropy from specific volume and specific internal energy. More...
 
virtual void s_from_v_e (Real v, Real e, Real &s, Real &ds_dv, Real &ds_de) const
 Specific entropy and its derivatives from specific volume and specific internal energy. More...
 
virtual Real s (Real pressure, Real temperature) const
 
virtual Real s_from_h_p (Real h, Real p) const
 Specific entropy from specific enthalpy and pressure. More...
 
virtual void s_from_h_p (Real h, Real p, Real &s, Real &ds_dh, Real &ds_dp) const
 Specific entropy and its derivatives from specific enthalpy and pressure. More...
 
virtual Real rho_from_p_s (Real p, Real s) const
 Density from pressure and specific entropy. More...
 
virtual void rho_from_p_s (Real p, Real s, Real &rho, Real &drho_dp, Real &drho_ds) const
 Density and its derivatives from pressure and specific entropy. More...
 
virtual Real e_from_v_h (Real v, Real h) const
 Specific internal energy as a function of specific volume and specific enthalpy. More...
 
virtual void e_from_v_h (Real v, Real h, Real &e, Real &de_dv, Real &de_dh) const
 Specific internal energy and derivatives as a function of specific volume and specific enthalpy. More...
 
virtual Real rho (Real p, Real T) const
 
virtual void rho_dpT (Real pressure, Real temperature, Real &rho, Real &drho_dp, Real &drho_dT) const
 
virtual Real v_from_p_T (Real p, Real T) const
 Specific volume from pressure and temperature. More...
 
virtual void v_from_p_T (Real p, Real T, Real &v, Real &dv_dp, Real &dv_dT) const
 Specific volume and its derivatives from pressure and temperature. More...
 
virtual Real e_from_p_rho (Real p, Real rho) const
 Specific internal energy from pressure and density. More...
 
virtual void e_from_p_rho (Real p, Real rho, Real &e, Real &de_dp, Real &de_drho) const
 Specific internal energy and its derivatives from pressure and density. More...
 
virtual Real e_spndl_from_v (Real v) const
 Specific internal energy from temperature and specific volume. More...
 
virtual void v_e_spndl_from_T (Real T, Real &v, Real &e) const
 Specific internal energy from temperature and specific volume. More...
 
virtual Real e_from_T_v (Real T, Real v) const
 Specific volume and specific internal energy from temerature at the vapor spinodal. More...
 
virtual void e_from_T_v (Real T, Real v, Real &e, Real &de_dT, Real &de_dv) const
 Specific internal energy and its derivatives from temperature and specific volume. More...
 
virtual Real p_from_T_v (Real T, Real v) const
 Pressure from temperature and specific volume. More...
 
virtual void p_from_T_v (Real T, Real v, Real &p, Real &dp_dT, Real &dp_dv) const
 Pressure and its derivatives from temperature and specific volume. More...
 
virtual Real h_from_T_v (Real T, Real v) const
 Specific enthalpy from temperature and specific volume. More...
 
virtual void h_from_T_v (Real T, Real v, Real &h, Real &dh_dT, Real &dh_dv) const
 Specific enthalpy and its derivatives from temperature and specific volume. More...
 
virtual Real s_from_T_v (Real T, Real v) const
 Specific entropy from temperature and specific volume. More...
 
virtual void s_from_T_v (Real T, Real v, Real &s, Real &ds_dT, Real &ds_dv) const
 Specific entropy and its derivatives from temperature and specific volume. More...
 
virtual Real cv_from_T_v (Real T, Real v) const
 Specific isochoric heat capacity from temperature and specific volume. More...
 
virtual Real h (Real p, Real T) const
 
virtual void h_dpT (Real pressure, Real temperature, Real &h, Real &dh_dp, Real &dh_dT) const
 
virtual Real e (Real pressure, Real temperature) const
 
virtual void e_dpT (Real pressure, Real temperature, Real &e, Real &de_dp, Real &de_dT) const
 
virtual Real p_from_h_s (Real h, Real s) const
 Pressure from specific enthalpy and specific entropy. More...
 
virtual void p_from_h_s (Real h, Real s, Real &p, Real &dp_dh, Real &dp_ds) const
 Pressure and its derivatives from specific enthalpy and specific entropy. More...
 
virtual Real g_from_v_e (Real v, Real e) const
 Gibbs free energy from specific volume and specific internal energy. More...
 
virtual Real beta_from_p_T (Real p, Real T) const
 Thermal expansion coefficient from pressure and temperature. More...
 
virtual Real beta (Real pressure, Real temperature) const
 
virtual Real pp_sat_from_p_T (Real p, Real T) const
 Partial pressure at saturation in a gas mixture. More...
 
virtual Real T_from_p_h (Real pressure, Real enthalpy) const
 Temperature from pressure and specific enthalpy. More...
 
virtual Real criticalPressure () const
 Critical pressure. More...
 
virtual Real criticalTemperature () const
 Critical temperature. More...
 
virtual Real criticalDensity () const
 Critical density. More...
 
virtual Real criticalInternalEnergy () const
 Critical specific internal energy. More...
 
virtual Real triplePointPressure () const
 Triple point pressure. More...
 
virtual Real triplePointTemperature () const
 Triple point temperature. More...
 
virtual Real c (Real pressure, Real temperature) const
 
virtual Real gamma_from_p_T (Real pressure, Real temperature) const
 Adiabatic index - ratio of specific heats. More...
 
virtual Real mu (Real pressure, Real temperature) const
 Dynamic viscosity. More...
 
virtual void mu_dpT (Real pressure, Real temperature, Real &mu, Real &dmu_dp, Real &dmu_dT) const
 Dynamic viscosity and its derivatives wrt pressure and temperature. More...
 
virtual Real mu_from_rho_T (Real density, Real temperature) const
 Dynamic viscosity as a function of density and temperature. More...
 
virtual void mu_drhoT_from_rho_T (Real density, Real temperature, Real ddensity_dT, Real &mu, Real &dmu_drho, Real &dmu_dT) const
 Dynamic viscosity and its derivatives wrt density and temperature. More...
 
virtual Real k (Real pressure, Real temperature) const
 
virtual void k_dpT (Real pressure, Real temperature, Real &k, Real &dk_dp, Real &dk_dT) const
 
virtual Real k_from_rho_T (Real density, Real temperature) const
 Thermal conductivity as a function of density and temperature. More...
 
virtual Real vaporPressure (Real temperature) const
 Vapor pressure. More...
 
virtual void vaporPressure_dT (Real temperature, Real &psat, Real &dpsat_dT) const
 Vapor pressure. More...
 
virtual void execute () final
 
virtual void initialize () final
 
virtual void finalize () final
 
virtual void threadJoin (const UserObject &) final
 
virtual void subdomainSetup () final
 

Protected Member Functions

void writeTabulatedData (std::string file_name)
 Writes tabulated data to a file. More...
 
virtual void checkInputVariables (Real &pressure, Real &temperature) const
 Checks that the inputs are within the range of the tabulated data, and throws an error if they are not. More...
 
virtual void generateTabulatedData ()
 Generates a table of fluid properties by looping over pressure and temperature and calculating properties using the FluidProperties UserObject _fp. More...
 
void reshapeData2D (unsigned int nrow, unsigned int ncol, const std::vector< Real > &vec, std::vector< std::vector< Real >> &mat)
 Forms a 2D matrix from a single std::vector. More...
 
virtual Real henryConstantIAPWS (Real temperature, Real A, Real B, Real C) const
 IAPWS formulation of Henry's law constant for dissolution in water From Guidelines on the Henry's constant and vapour liquid distribution constant for gases in H20 and D20 at high temperatures, IAPWS (2004) More...
 
virtual void henryConstantIAPWS_dT (Real temperature, Real &Kh, Real &dKh_dT, Real A, Real B, Real C) const
 IAPWS formulation of Henry's law constant for dissolution in water and derivative wrt temperature. More...
 

Protected Attributes

FileName _file_name
 File name of tabulated data file. More...
 
std::vector< Real > _pressure
 Pressure vector. More...
 
std::vector< Real > _temperature
 Temperature vector. More...
 
std::vector< std::vector< Real > > _properties
 Tabulated fluid properties. More...
 
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
 Interpolated fluid property. More...
 
Real _temperature_min
 Minimum temperature in tabulated data. More...
 
Real _temperature_max
 Maximum temperature in tabulated data. More...
 
Real _pressure_min
 Minimum pressure in tabulated data. More...
 
Real _pressure_max
 Maximum pressure in tabulated data. More...
 
unsigned int _num_T
 Number of temperature points in the tabulated data. More...
 
unsigned int _num_p
 Number of pressure points in the tabulated data. More...
 
const SinglePhaseFluidProperties_fp
 SinglePhaseFluidPropertiesPT UserObject. More...
 
const std::vector< std::string > _required_columns {"pressure", "temperature"}
 List of required column names to be read. More...
 
const std::vector< std::string > _property_columns
 List of possible property column names to be read. More...
 
MultiMooseEnum _interpolated_properties_enum
 Properties to be interpolated entered in the input file. More...
 
std::vector< std::string > _interpolated_properties
 List of properties to be interpolated. More...
 
bool _interpolate_density
 Set of flags to note whether a property is to be interpolated. More...
 
bool _interpolate_enthalpy
 
bool _interpolate_internal_energy
 
bool _interpolate_viscosity
 
bool _interpolate_k
 
bool _interpolate_cp
 
bool _interpolate_cv
 
bool _interpolate_entropy
 
unsigned int _density_idx
 Index of each property. More...
 
unsigned int _enthalpy_idx
 
unsigned int _internal_energy_idx
 
unsigned int _viscosity_idx
 
unsigned int _k_idx
 
unsigned int _cp_idx
 
unsigned int _cv_idx
 
unsigned int _entropy_idx
 
MooseUtils::DelimitedFileReader _csv_reader
 The MOOSE delimited file reader. More...
 
const Real _R
 Universal gas constant (J/mol/K) More...
 
const Real _T_c2k
 Conversion of temperature from Celsius to Kelvin. More...
 

Detailed Description

Class for fluid properties read from a file.

Property values are read from a CSV file containing property data. Monotonically increasing values of pressure and temperature must be included in the data file, specifying the phase space where tabulated fluid properties will be defined. An error is thrown if either temperature or pressure data is not included or not monotonic, and an error is also thrown if this UserObject is requested to provide a fluid property outside this phase space.

This class is intended to be used when complicated formulations for fluid properties (for example, density or enthalpy) are required, which can be computationally expensive. This is particularly the case where the fluid equation of state is based on a Helmholtz free energy that is a function of density and temperature, like that used in CO2FluidProperties. In this case, density must be solved iteratively using pressure and temperature, which increases the computational burden.

Using interpolation to calculate these fluid properties can significantly reduce the computational time for these cases.

The expected file format for the tabulated fluid properties is now described. The first line must be the header containing the required column names "pressure" and "temperature", and the names of the fluid properties to be read. Available fluid property names are: "density", "enthalpy", "internal_energy", "viscosity", "k" (thermal conductivity), "cp" (isobaric specific heat capacity), "cv" (isochoric specific heat capacity), and "entropy". Note: the order is not important, although having pressure and temperature first makes the data easier for a human to read).

The data in the pressure and temperature columns must be monotonically increasing. This file format does require duplication of the pressure and temperature data - each pressure value must be included num_T times, while each temperature value is repeated num_p times, where num_T and num_p are the number of temperature and pressure points, respectively. This class will check that the required number of data points have been entered (num_T * num_p).

An example of a valid fluid properties file is provided below:

pressure, temperature, density, enthalpy, internal_energy 200000, 275, 3.90056, -21487, -72761.7 200000, 277, 3.86573, -19495.4, -71232.0 200000, 280, 3.83155, -17499.1, -69697.3 300000, 275, 6.07273, -22728.3, -73626.5 300000, 277, 6.01721, -20711.5, -72079.3 300000, 280, 5.96277, -18691.0, -70527.7

and so on.

If no tabulated fluid property data file exists, then data for the fluid supplied by the required FluidProperties UserObject will be generated using the pressure and temperature ranges specified in the input file at the beginning of the simulation. The properties to be tabulated are provided in the "interpolated_properties" input parameter (the properties that can be tabulated are listed above).

This tabulated data will be written to file in the correct format, enabling suitable data files to be created for future use. There is an upfront computational expense required for this initial data generation, depending on the required number of pressure and temperature points. However, provided that the number of data points required to generate the tabulated data is smaller than the number of times the property members in the FluidProperties UserObject are used, the initial time to generate the data and the subsequent interpolation time can be much less than using the original FluidProperties UserObject.

Properties specified in the data file or listed in the input file (and their derivatives wrt pressure and temperature) will be calculated using bicubic interpolation, while all remaining fluid properties are calculated using the supplied FluidProperties UserObject.

Definition at line 90 of file TabulatedFluidProperties.h.

Constructor & Destructor Documentation

◆ TabulatedFluidProperties()

TabulatedFluidProperties::TabulatedFluidProperties ( const InputParameters &  parameters)

Definition at line 58 of file TabulatedFluidProperties.C.

59  : SinglePhaseFluidProperties(parameters),
60  _file_name(getParam<FileName>("fluid_property_file")),
61  _temperature_min(getParam<Real>("temperature_min")),
62  _temperature_max(getParam<Real>("temperature_max")),
63  _pressure_min(getParam<Real>("pressure_min")),
64  _pressure_max(getParam<Real>("pressure_max")),
65  _num_T(getParam<unsigned int>("num_T")),
66  _num_p(getParam<unsigned int>("num_p")),
67  _fp(getUserObject<SinglePhaseFluidProperties>("fp")),
68  _interpolated_properties_enum(getParam<MultiMooseEnum>("interpolated_properties")),
70  _interpolate_density(false),
71  _interpolate_enthalpy(false),
74  _interpolate_k(false),
75  _interpolate_cp(false),
76  _interpolate_cv(false),
77  _interpolate_entropy(false),
78  _density_idx(0),
79  _enthalpy_idx(0),
81  _viscosity_idx(0),
82  _k_idx(0),
83  _cp_idx(0),
84  _cv_idx(0),
85  _entropy_idx(0),
86  _csv_reader(_file_name, &_communicator)
87 {
88  // Sanity check on minimum and maximum temperatures and pressures
90  mooseError(name(), ": temperature_max must be greater than temperature_min");
92  mooseError(name(), ": pressure_max must be greater than pressure_min");
93 
94  // Lines starting with # in the data file are treated as comments
95  _csv_reader.setComment("#");
96 }
Real _temperature_max
Maximum temperature in tabulated data.
Real _pressure_max
Maximum pressure in tabulated data.
MooseUtils::DelimitedFileReader _csv_reader
The MOOSE delimited file reader.
SinglePhaseFluidProperties(const InputParameters &parameters)
MultiMooseEnum _interpolated_properties_enum
Properties to be interpolated entered in the input file.
Real _temperature_min
Minimum temperature in tabulated data.
const std::string name
Definition: Setup.h:22
std::vector< std::string > _interpolated_properties
List of properties to be interpolated.
unsigned int _num_T
Number of temperature points in the tabulated data.
Real _pressure_min
Minimum pressure in tabulated data.
unsigned int _num_p
Number of pressure points in the tabulated data.
unsigned int _density_idx
Index of each property.
bool _interpolate_density
Set of flags to note whether a property is to be interpolated.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.
FileName _file_name
File name of tabulated data file.

◆ ~TabulatedFluidProperties()

TabulatedFluidProperties::~TabulatedFluidProperties ( )
virtual

Definition at line 98 of file TabulatedFluidProperties.C.

98 {}

Member Function Documentation

◆ beta()

Real SinglePhaseFluidProperties::beta ( Real  pressure,
Real  temperature 
) const
virtualinherited

Definition at line 256 of file SinglePhaseFluidProperties.C.

Referenced by Water97FluidProperties::vaporTemperature().

257 {
259 }
virtual Real beta_from_p_T(Real p, Real T) const
Thermal expansion coefficient from pressure and temperature.
const std::string temperature
Definition: NS.h:27
const std::string pressure
Definition: NS.h:26

◆ beta_from_p_T()

Real SinglePhaseFluidProperties::beta_from_p_T ( Real  p,
Real  T 
) const
virtualinherited

Thermal expansion coefficient from pressure and temperature.

Parameters
[in]ppressure (Pa)
[in]Ttemperature (K)
Returns
beta (1/K)

Reimplemented in SimpleFluidProperties.

Definition at line 171 of file SinglePhaseFluidProperties.C.

Referenced by SinglePhaseFluidProperties::beta().

172 {
173  // The volumetric thermal expansion coefficient is defined as
174  // 1/v dv/dT)_p
175  // It is the fractional change rate of volume with respect to temperature change
176  // at constant pressure. Here it is coded as
177  // - 1/rho drho/dT)_p
178  // using chain rule with v = v(rho)
179 
180  Real rho, drho_dp, drho_dT;
181  rho_from_p_T(p, T, rho, drho_dp, drho_dT);
182  return -drho_dT / rho;
183 }
virtual Real rho(Real p, Real T) const
virtual Real rho_from_p_T(Real p, Real T) const
Density from pressure and temperature.

◆ c()

Real SinglePhaseFluidProperties::c ( Real  pressure,
Real  temperature 
) const
virtualinherited

◆ c_from_p_T()

Real TabulatedFluidProperties::c_from_p_T ( Real  pressure,
Real  temperature 
) const
overridevirtual

Speed of sound.

Parameters
pressurefluid pressure (Pa)
temperaturefluid temperature (K)
Returns
speed of sound (m/s)

Reimplemented from SinglePhaseFluidProperties.

Definition at line 448 of file TabulatedFluidProperties.C.

449 {
451 }
virtual Real c_from_p_T(Real pressure, Real temperature) const
Speed of sound.
const std::string temperature
Definition: NS.h:27
const std::string pressure
Definition: NS.h:26
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ c_from_v_e() [1/2]

Real SinglePhaseFluidProperties::c_from_v_e ( Real  v,
Real  e 
) const
virtualinherited

Sound speed from specific volume and specific internal energy.

Parameters
[in]vspecific volume
[in]especific internal energy

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 50 of file SinglePhaseFluidProperties.C.

Referenced by FluidPropertiesMaterial::computeQpProperties(), and NSMachAux::computeValue().

51 {
52  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
53 }
const std::string name
Definition: Setup.h:22

◆ c_from_v_e() [2/2]

void SinglePhaseFluidProperties::c_from_v_e ( Real  v,
Real  e,
Real &  c,
Real &  dc_dv,
Real &  dc_de 
) const
virtualinherited

Sound speed and its derivatives from specific volume and specific internal energy.

Parameters
[in]vspecific volume
[in]especific internal energy
[out]dc_dvderivative of sound speed w.r.t. specific volume
[out]dc_dederivative of sound speed w.r.t. specific internal energy

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 56 of file SinglePhaseFluidProperties.C.

57 {
58  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
59 }
const std::string name
Definition: Setup.h:22

◆ checkInputVariables()

void TabulatedFluidProperties::checkInputVariables ( Real &  pressure,
Real &  temperature 
) const
protectedvirtual

Checks that the inputs are within the range of the tabulated data, and throws an error if they are not.

Parameters
pressureinput pressure (Pa)
temperatureinput temperature (K)

Definition at line 657 of file TabulatedFluidProperties.C.

Referenced by cp_from_p_T(), cv_from_p_T(), e_from_p_T(), h_from_p_T(), k_from_p_T(), mu_from_p_T(), rho_from_p_T(), and s_from_p_T().

658 {
659  if (pressure < _pressure_min || pressure > _pressure_max)
660  throw MooseException(
661  "Pressure " + Moose::stringify(pressure) + " is outside the range of tabulated pressure (" +
662  Moose::stringify(_pressure_min) + ", " + Moose::stringify(_pressure_max) + ").");
663 
664  if (temperature < _temperature_min || temperature > _temperature_max)
665  throw MooseException("Temperature " + Moose::stringify(temperature) +
666  " is outside the range of tabulated temperature (" +
667  Moose::stringify(_temperature_min) + ", " +
668  Moose::stringify(_temperature_max) + ").");
669 }
Real _temperature_max
Maximum temperature in tabulated data.
Real _pressure_max
Maximum pressure in tabulated data.
const std::string temperature
Definition: NS.h:27
Real _temperature_min
Minimum temperature in tabulated data.
Real _pressure_min
Minimum pressure in tabulated data.
const std::string pressure
Definition: NS.h:26

◆ cp_from_p_T()

Real TabulatedFluidProperties::cp_from_p_T ( Real  pressure,
Real  temperature 
) const
overridevirtual

Isobaric specific heat capacity.

Parameters
pressurefluid pressure (Pa)
temperaturefluid temperature (K)
Returns
cp (J/kg/K)

Reimplemented from SinglePhaseFluidProperties.

Definition at line 454 of file TabulatedFluidProperties.C.

455 {
456  if (_interpolate_cp)
457  {
459  return _property_ipol[_cp_idx]->sample(pressure, temperature);
460  }
461  else
463 }
const std::string temperature
Definition: NS.h:27
virtual void checkInputVariables(Real &pressure, Real &temperature) const
Checks that the inputs are within the range of the tabulated data, and throws an error if they are no...
virtual Real cp_from_p_T(Real pressure, Real temperature) const
Isobaric specific heat capacity.
const std::string pressure
Definition: NS.h:26
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
Interpolated fluid property.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ cp_from_v_e()

Real SinglePhaseFluidProperties::cp_from_v_e ( Real  v,
Real  e 
) const
virtualinherited

Isobaric (constant-pressure) specific heat from specific volume and specific internal energy.

Parameters
[in]vspecific volume
[in]especific internal energy

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 61 of file SinglePhaseFluidProperties.C.

Referenced by FluidPropertiesMaterial::computeQpProperties(), and GeneralVaporMixtureFluidProperties::cp_from_p_T().

62 {
63  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
64 }
const std::string name
Definition: Setup.h:22

◆ criticalDensity()

Real SinglePhaseFluidProperties::criticalDensity ( ) const
virtualinherited

◆ criticalInternalEnergy()

Real SinglePhaseFluidProperties::criticalInternalEnergy ( ) const
virtualinherited

Critical specific internal energy.

Returns
specific internal energy (J/kg)

Reimplemented in StiffenedGasFluidProperties.

Definition at line 232 of file SinglePhaseFluidProperties.C.

Referenced by IdealRealGasMixtureFluidProperties::p_T_from_v_e().

233 {
234  mooseError(name(), ": criticalInternalEnergy() is not implemented");
235 }
const std::string name
Definition: Setup.h:22

◆ criticalPressure()

Real SinglePhaseFluidProperties::criticalPressure ( ) const
virtualinherited

Critical pressure.

Returns
critical pressure (Pa)

Reimplemented in HydrogenFluidProperties, CO2FluidProperties, NitrogenFluidProperties, MethaneFluidProperties, NaClFluidProperties, and Water97FluidProperties.

Definition at line 214 of file SinglePhaseFluidProperties.C.

215 {
216  mooseError(name(), ": criticalPressure() is not implemented");
217 }
const std::string name
Definition: Setup.h:22

◆ criticalTemperature()

Real SinglePhaseFluidProperties::criticalTemperature ( ) const
virtualinherited

◆ cv_from_p_T()

Real TabulatedFluidProperties::cv_from_p_T ( Real  pressure,
Real  temperature 
) const
overridevirtual

Isochoric specific heat.

Parameters
pressurefluid pressure (Pa)
temperaturefluid temperature (K)
Returns
cv (J/kg/K)

Reimplemented from SinglePhaseFluidProperties.

Definition at line 466 of file TabulatedFluidProperties.C.

467 {
468  if (_interpolate_cv)
469  {
471  return _property_ipol[_cv_idx]->sample(pressure, temperature);
472  }
473  else
475 }
virtual Real cv_from_p_T(Real pressure, Real temperature) const
Isochoric specific heat.
const std::string temperature
Definition: NS.h:27
virtual void checkInputVariables(Real &pressure, Real &temperature) const
Checks that the inputs are within the range of the tabulated data, and throws an error if they are no...
const std::string pressure
Definition: NS.h:26
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
Interpolated fluid property.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ cv_from_T_v()

Real SinglePhaseFluidProperties::cv_from_T_v ( Real  T,
Real  v 
) const
virtualinherited

Specific isochoric heat capacity from temperature and specific volume.

Parameters
[in]Ttemperature
[in]vspecific volume

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 568 of file SinglePhaseFluidProperties.C.

Referenced by IdealRealGasMixtureFluidProperties::cv_from_p_T(), and IdealRealGasMixtureFluidProperties::cv_from_T_v().

569 {
570  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
571 }
const std::string name
Definition: Setup.h:22

◆ cv_from_v_e()

Real SinglePhaseFluidProperties::cv_from_v_e ( Real  v,
Real  e 
) const
virtualinherited

Isochoric (constant-volume) specific heat from specific volume and specific internal energy.

Parameters
[in]vspecific volume
[in]especific internal energy

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 66 of file SinglePhaseFluidProperties.C.

Referenced by FluidPropertiesMaterial::computeQpProperties(), and GeneralVaporMixtureFluidProperties::cv_from_p_T().

67 {
68  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
69 }
const std::string name
Definition: Setup.h:22

◆ e()

Real SinglePhaseFluidProperties::e ( Real  pressure,
Real  temperature 
) const
virtualinherited

Definition at line 366 of file SinglePhaseFluidProperties.C.

Referenced by Water97FluidProperties::b2bc(), IdealGasFluidProperties::c_from_v_e(), StiffenedGasFluidProperties::c_from_v_e(), NaClFluidProperties::cp_from_p_T(), Water97FluidProperties::densityRegion3(), SinglePhaseFluidProperties::e_dpT(), StiffenedGasFluidProperties::e_from_p_rho(), IdealGasFluidProperties::e_from_p_rho(), HelmholtzFluidProperties::e_from_p_T(), IdealGasFluidPropertiesPT::e_from_p_T(), Water97FluidProperties::e_from_p_T(), IdealGasFluidProperties::e_from_p_T(), NaClFluidProperties::e_from_p_T(), StiffenedGasFluidProperties::e_from_p_T(), SimpleFluidProperties::e_from_p_T(), e_from_p_T(), SinglePhaseFluidProperties::e_from_p_T(), StiffenedGasFluidProperties::e_from_T_v(), IdealGasFluidProperties::e_from_T_v(), IdealGasFluidProperties::e_from_v_h(), StiffenedGasFluidProperties::e_from_v_h(), IdealGasFluidProperties::g_from_v_e(), StiffenedGasFluidProperties::g_from_v_e(), IdealGasFluidProperties::h_from_p_T(), NaClFluidProperties::h_from_p_T(), NitrogenFluidProperties::mu_drhoT_from_rho_T(), HydrogenFluidProperties::mu_drhoT_from_rho_T(), CO2FluidProperties::mu_drhoT_from_rho_T(), StiffenedGasFluidProperties::p_from_T_v(), StiffenedGasFluidProperties::p_from_v_e(), IdealGasFluidProperties::p_from_v_e(), HelmholtzFluidProperties::rho_e_dpT(), IdealGasFluidPropertiesPT::rho_e_dpT(), Water97FluidProperties::rho_e_dpT(), NaClFluidProperties::rho_e_dpT(), SimpleFluidProperties::rho_e_dpT(), rho_e_dpT(), StiffenedGasFluidProperties::s_from_T_v(), StiffenedGasFluidProperties::s_from_v_e(), IdealGasFluidProperties::s_from_v_e(), Water97FluidProperties::subregion3(), Water97FluidProperties::subregionVolume(), SinglePhaseFluidProperties::T_from_p_h(), StiffenedGasFluidProperties::T_from_v_e(), IdealGasFluidProperties::T_from_v_e(), StiffenedGasFluidProperties::v_e_spndl_from_T(), and Water97FluidProperties::vaporTemperature().

367 {
368  return e_from_p_T(p, T);
369 }
virtual Real e_from_p_T(Real p, Real T) const
Internal energy from pressure and temperature.

◆ e_dpT()

void SinglePhaseFluidProperties::e_dpT ( Real  pressure,
Real  temperature,
Real &  e,
Real &  de_dp,
Real &  de_dT 
) const
virtualinherited

Definition at line 372 of file SinglePhaseFluidProperties.C.

374 {
375  e_from_p_T(pressure, temperature, e, de_dp, de_dT);
376 }
const std::string temperature
Definition: NS.h:27
virtual Real e_from_p_T(Real p, Real T) const
Internal energy from pressure and temperature.
const std::string pressure
Definition: NS.h:26
virtual Real e(Real pressure, Real temperature) const

◆ e_from_p_rho() [1/2]

Real SinglePhaseFluidProperties::e_from_p_rho ( Real  p,
Real  rho 
) const
virtualinherited

Specific internal energy from pressure and density.

Parameters
[in]ppressure
[in]rhodensity

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 502 of file SinglePhaseFluidProperties.C.

Referenced by StagnationTemperatureAux::computeValue(), InternalEnergyAux::computeValue(), and SinglePhaseFluidProperties::e_from_p_T().

503 {
504  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
505 }
const std::string name
Definition: Setup.h:22

◆ e_from_p_rho() [2/2]

void SinglePhaseFluidProperties::e_from_p_rho ( Real  p,
Real  rho,
Real &  e,
Real &  de_dp,
Real &  de_drho 
) const
virtualinherited

Specific internal energy and its derivatives from pressure and density.

Parameters
[in]ppressure
[in]rhodensity
[out]especific internal energy
[out]de_dpderivative of specific internal energy w.r.t. pressure
[out]de_drhoderivative of specific internal energy w.r.t. density

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 508 of file SinglePhaseFluidProperties.C.

509 {
510  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
511 }
const std::string name
Definition: Setup.h:22

◆ e_from_p_T() [1/2]

Real TabulatedFluidProperties::e_from_p_T ( Real  p,
Real  T 
) const
overridevirtual

Internal energy from pressure and temperature.

Parameters
[in]ppressure (Pa)
[in]Ttemperature (K)
Returns
internal energy (J/kg)

Reimplemented from SinglePhaseFluidProperties.

Definition at line 335 of file TabulatedFluidProperties.C.

Referenced by rho_e_dpT().

336 {
338  {
341  }
342  else
344 }
const std::string temperature
Definition: NS.h:27
virtual Real e_from_p_T(Real p, Real T) const
Internal energy from pressure and temperature.
virtual void checkInputVariables(Real &pressure, Real &temperature) const
Checks that the inputs are within the range of the tabulated data, and throws an error if they are no...
const std::string pressure
Definition: NS.h:26
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
Interpolated fluid property.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ e_from_p_T() [2/2]

void TabulatedFluidProperties::e_from_p_T ( Real  p,
Real  T,
Real &  e,
Real &  de_dp,
Real &  de_dT 
) const
overridevirtual

Internal energy and its derivatives from pressure and temperature.

Parameters
[in]ppressure (Pa)
[in]Ttemperature (K)
[out]einternal energy (J/kg)
[out]de_dpderivative of internal energy w.r.t. pressure
[out]de_dTderivative of internal energy w.r.t. temperature

Reimplemented from SinglePhaseFluidProperties.

Definition at line 347 of file TabulatedFluidProperties.C.

349 {
351  {
353  _property_ipol[_internal_energy_idx]->sampleValueAndDerivatives(
354  pressure, temperature, e, de_dp, de_dT);
355  }
356  else
357  _fp.e_from_p_T(pressure, temperature, e, de_dp, de_dT);
358 }
const std::string temperature
Definition: NS.h:27
virtual Real e_from_p_T(Real p, Real T) const
Internal energy from pressure and temperature.
virtual void checkInputVariables(Real &pressure, Real &temperature) const
Checks that the inputs are within the range of the tabulated data, and throws an error if they are no...
const std::string pressure
Definition: NS.h:26
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
Interpolated fluid property.
virtual Real e(Real pressure, Real temperature) const
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ e_from_T_v() [1/2]

Real SinglePhaseFluidProperties::e_from_T_v ( Real  T,
Real  v 
) const
virtualinherited

Specific volume and specific internal energy from temerature at the vapor spinodal.

Parameters
[in]Ttemerature

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 513 of file SinglePhaseFluidProperties.C.

Referenced by IdealRealGasMixtureFluidProperties::e_from_T_v(), IdealRealGasMixtureFluidProperties::k_from_p_T(), IdealRealGasMixtureFluidProperties::k_from_T_v(), IdealRealGasMixtureFluidProperties::mu_from_p_T(), and IdealRealGasMixtureFluidProperties::mu_from_T_v().

514 {
515  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
516 }
const std::string name
Definition: Setup.h:22

◆ e_from_T_v() [2/2]

void SinglePhaseFluidProperties::e_from_T_v ( Real  T,
Real  v,
Real &  e,
Real &  de_dT,
Real &  de_dv 
) const
virtualinherited

Specific internal energy and its derivatives from temperature and specific volume.

Parameters
[in]Ttemperature
[in]vspecific volume
[out]especific internal energy (J/kg)
[out]de_dTderivative of specific internal energy w.r.t. temperature
[out]de_dvderivative of specific internal energy w.r.t. specific volume

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 530 of file SinglePhaseFluidProperties.C.

531 {
532  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
533 }
const std::string name
Definition: Setup.h:22

◆ e_from_v_h() [1/2]

Real SinglePhaseFluidProperties::e_from_v_h ( Real  v,
Real  h 
) const
virtualinherited

Specific internal energy as a function of specific volume and specific enthalpy.

Parameters
[in]vspecific volume
[in]hspecific enthalpy

Reimplemented in StiffenedGasFluidProperties, and IdealGasFluidProperties.

Definition at line 114 of file SinglePhaseFluidProperties.C.

Referenced by SinglePhaseFluidProperties::T_from_p_h().

115 {
116  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
117 }
const std::string name
Definition: Setup.h:22

◆ e_from_v_h() [2/2]

void SinglePhaseFluidProperties::e_from_v_h ( Real  v,
Real  h,
Real &  e,
Real &  de_dv,
Real &  de_dh 
) const
virtualinherited

Specific internal energy and derivatives as a function of specific volume and specific enthalpy.

Parameters
[in]vspecific volume
[in]hspecific enthalpy
[out]de_dvderivative of specific internal energy w.r.t. specific volume
[out]de_dhderivative of specific internal energy w.r.t. specific enthalpy

Reimplemented in StiffenedGasFluidProperties, and IdealGasFluidProperties.

Definition at line 120 of file SinglePhaseFluidProperties.C.

121 {
122  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
123 }
const std::string name
Definition: Setup.h:22

◆ e_spndl_from_v()

Real SinglePhaseFluidProperties::e_spndl_from_v ( Real  v) const
virtualinherited

Specific internal energy from temperature and specific volume.

Parameters
[in]Ttemperature
[in]vspecific volume

Reimplemented in StiffenedGasFluidProperties.

Definition at line 518 of file SinglePhaseFluidProperties.C.

Referenced by IdealRealGasMixtureFluidProperties::p_T_from_v_e().

519 {
520  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
521 }
const std::string name
Definition: Setup.h:22

◆ execute()

virtual void FluidProperties::execute ( )
inlinefinalvirtualinherited

Definition at line 27 of file FluidProperties.h.

27 {}

◆ finalize()

virtual void FluidProperties::finalize ( )
inlinefinalvirtualinherited

Definition at line 29 of file FluidProperties.h.

29 {}

◆ fluidName()

std::string TabulatedFluidProperties::fluidName ( ) const
overridevirtual

Fluid name.

Returns
string representing fluid name

Reimplemented from SinglePhaseFluidProperties.

Definition at line 297 of file TabulatedFluidProperties.C.

298 {
299  return _fp.fluidName();
300 }
virtual std::string fluidName() const
Fluid name.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ g_from_v_e()

Real SinglePhaseFluidProperties::g_from_v_e ( Real  v,
Real  e 
) const
virtualinherited

Gibbs free energy from specific volume and specific internal energy.

Parameters
[in]vspecific volume
[in]especific internal energy

Reimplemented in StiffenedGasFluidProperties, and IdealGasFluidProperties.

Definition at line 595 of file SinglePhaseFluidProperties.C.

Referenced by FluidPropertiesMaterial::computeQpProperties().

596 {
597  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
598 }
const std::string name
Definition: Setup.h:22

◆ gamma_from_p_T()

Real SinglePhaseFluidProperties::gamma_from_p_T ( Real  pressure,
Real  temperature 
) const
virtualinherited

Adiabatic index - ratio of specific heats.

Parameters
pressurefluid pressure (Pa)
temperaturefluid temperature (K)
Returns
gamma (-)

Definition at line 250 of file SinglePhaseFluidProperties.C.

251 {
253 }
virtual Real cv_from_p_T(Real pressure, Real temperature) const
Isochoric specific heat.
const std::string temperature
Definition: NS.h:27
virtual Real cp_from_p_T(Real pressure, Real temperature) const
Isobaric specific heat capacity.
const std::string pressure
Definition: NS.h:26

◆ generateTabulatedData()

void TabulatedFluidProperties::generateTabulatedData ( )
protectedvirtual

Generates a table of fluid properties by looping over pressure and temperature and calculating properties using the FluidProperties UserObject _fp.

Definition at line 566 of file TabulatedFluidProperties.C.

Referenced by initialSetup().

567 {
568  _pressure.resize(_num_p);
569  _temperature.resize(_num_T);
570 
571  // Generate data for all properties entered in input file
574 
575  for (std::size_t i = 0; i < _interpolated_properties_enum.size(); ++i)
577 
578  for (std::size_t i = 0; i < _properties.size(); ++i)
579  _properties[i].resize(_num_p * _num_T);
580 
581  // Temperature is divided equally into _num_T segments
582  Real delta_T = (_temperature_max - _temperature_min) / static_cast<Real>(_num_T - 1);
583 
584  for (unsigned int j = 0; j < _num_T; ++j)
585  _temperature[j] = _temperature_min + j * delta_T;
586 
587  // Divide the pressure into _num_p equal segments
588  Real delta_p = (_pressure_max - _pressure_min) / static_cast<Real>(_num_p - 1);
589 
590  for (unsigned int i = 0; i < _num_p; ++i)
591  _pressure[i] = _pressure_min + i * delta_p;
592 
593  // Generate the tabulated data at the pressure and temperature points
594  for (std::size_t i = 0; i < _properties.size(); ++i)
595  {
596  if (_interpolated_properties[i] == "density")
597  for (unsigned int p = 0; p < _num_p; ++p)
598  for (unsigned int t = 0; t < _num_T; ++t)
600 
601  if (_interpolated_properties[i] == "enthalpy")
602  for (unsigned int p = 0; p < _num_p; ++p)
603  for (unsigned int t = 0; t < _num_T; ++t)
604  _properties[i][p * _num_T + t] = _fp.h_from_p_T(_pressure[p], _temperature[t]);
605 
606  if (_interpolated_properties[i] == "internal_energy")
607  for (unsigned int p = 0; p < _num_p; ++p)
608  for (unsigned int t = 0; t < _num_T; ++t)
609  _properties[i][p * _num_T + t] = _fp.e_from_p_T(_pressure[p], _temperature[t]);
610 
611  if (_interpolated_properties[i] == "viscosity")
612  for (unsigned int p = 0; p < _num_p; ++p)
613  for (unsigned int t = 0; t < _num_T; ++t)
614  _properties[i][p * _num_T + t] = _fp.mu_from_p_T(_pressure[p], _temperature[t]);
615 
616  if (_interpolated_properties[i] == "k")
617  for (unsigned int p = 0; p < _num_p; ++p)
618  for (unsigned int t = 0; t < _num_T; ++t)
619  _properties[i][p * _num_T + t] = _fp.k_from_p_T(_pressure[p], _temperature[t]);
620 
621  if (_interpolated_properties[i] == "cv")
622  for (unsigned int p = 0; p < _num_p; ++p)
623  for (unsigned int t = 0; t < _num_T; ++t)
624  _properties[i][p * _num_T + t] = _fp.cv_from_p_T(_pressure[p], _temperature[t]);
625 
626  if (_interpolated_properties[i] == "cp")
627  for (unsigned int p = 0; p < _num_p; ++p)
628  for (unsigned int t = 0; t < _num_T; ++t)
629  _properties[i][p * _num_T + t] = _fp.cp_from_p_T(_pressure[p], _temperature[t]);
630 
631  if (_interpolated_properties[i] == "entropy")
632  for (unsigned int p = 0; p < _num_p; ++p)
633  for (unsigned int t = 0; t < _num_T; ++t)
634  _properties[i][p * _num_T + t] = _fp.s_from_p_T(_pressure[p], _temperature[t]);
635  }
636 }
virtual Real cv_from_p_T(Real pressure, Real temperature) const
Isochoric specific heat.
Real _temperature_max
Maximum temperature in tabulated data.
virtual Real mu_from_p_T(Real pressure, Real temperature) const
Real _pressure_max
Maximum pressure in tabulated data.
MultiMooseEnum _interpolated_properties_enum
Properties to be interpolated entered in the input file.
virtual Real e_from_p_T(Real p, Real T) const
Internal energy from pressure and temperature.
virtual Real rho_from_p_T(Real p, Real T) const
Density from pressure and temperature.
Real _temperature_min
Minimum temperature in tabulated data.
std::vector< std::string > _interpolated_properties
List of properties to be interpolated.
virtual Real k_from_p_T(Real pressure, Real temperature) const
Thermal conductivity.
std::vector< Real > _pressure
Pressure vector.
std::vector< Real > _temperature
Temperature vector.
unsigned int _num_T
Number of temperature points in the tabulated data.
Real _pressure_min
Minimum pressure in tabulated data.
std::vector< std::vector< Real > > _properties
Tabulated fluid properties.
virtual Real s_from_p_T(Real p, Real T) const
Specific entropy from pressure and temperature.
unsigned int _num_p
Number of pressure points in the tabulated data.
virtual Real cp_from_p_T(Real pressure, Real temperature) const
Isobaric specific heat capacity.
virtual Real h_from_p_T(Real p, Real T) const
Specific enthalpy from pressure and temperature.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ h()

Real SinglePhaseFluidProperties::h ( Real  p,
Real  T 
) const
virtualinherited

◆ h_dpT()

void SinglePhaseFluidProperties::h_dpT ( Real  pressure,
Real  temperature,
Real &  h,
Real &  dh_dp,
Real &  dh_dT 
) const
virtualinherited

Definition at line 480 of file SinglePhaseFluidProperties.C.

481 {
482  h_from_p_T(p, T, h, dh_dp, dh_dT);
483 }
virtual Real h(Real p, Real T) const
virtual Real h_from_p_T(Real p, Real T) const
Specific enthalpy from pressure and temperature.

◆ h_from_p_T() [1/2]

Real TabulatedFluidProperties::h_from_p_T ( Real  p,
Real  T 
) const
overridevirtual

Specific enthalpy from pressure and temperature.

Parameters
[in]ppressure (Pa)
[in]Ttemperature (K)
Returns
h (J/kg)

Reimplemented from SinglePhaseFluidProperties.

Definition at line 375 of file TabulatedFluidProperties.C.

376 {
378  {
381  }
382  else
384 }
const std::string temperature
Definition: NS.h:27
virtual void checkInputVariables(Real &pressure, Real &temperature) const
Checks that the inputs are within the range of the tabulated data, and throws an error if they are no...
const std::string pressure
Definition: NS.h:26
virtual Real h_from_p_T(Real p, Real T) const
Specific enthalpy from pressure and temperature.
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
Interpolated fluid property.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ h_from_p_T() [2/2]

void TabulatedFluidProperties::h_from_p_T ( Real  p,
Real  T,
Real &  h,
Real &  dh_dp,
Real &  dh_dT 
) const
overridevirtual

Specific enthalpy and its derivatives from pressure and temperature.

Parameters
[in]ppressure (Pa)
[in]Ttemperature (K)
[out]hspecific enthalpy (J/kg)
[out]dh_dpderivative of specific enthalpy w.r.t. pressure
[out]dh_dTderivative of specific enthalpy w.r.t. temperature

Reimplemented from SinglePhaseFluidProperties.

Definition at line 387 of file TabulatedFluidProperties.C.

389 {
391  {
393  _property_ipol[_enthalpy_idx]->sampleValueAndDerivatives(
394  pressure, temperature, h, dh_dp, dh_dT);
395  }
396  else
397  _fp.h_from_p_T(pressure, temperature, h, dh_dp, dh_dT);
398 }
virtual Real h(Real p, Real T) const
const std::string temperature
Definition: NS.h:27
virtual void checkInputVariables(Real &pressure, Real &temperature) const
Checks that the inputs are within the range of the tabulated data, and throws an error if they are no...
const std::string pressure
Definition: NS.h:26
virtual Real h_from_p_T(Real p, Real T) const
Specific enthalpy from pressure and temperature.
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
Interpolated fluid property.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ h_from_T_v() [1/2]

Real SinglePhaseFluidProperties::h_from_T_v ( Real  T,
Real  v 
) const
virtualinherited

Specific enthalpy from temperature and specific volume.

Parameters
[in]Ttemperature
[in]vspecific volume

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 546 of file SinglePhaseFluidProperties.C.

Referenced by IdealRealGasMixtureFluidProperties::cp_from_p_T(), and IdealRealGasMixtureFluidProperties::cp_from_T_v().

547 {
548  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
549 }
const std::string name
Definition: Setup.h:22

◆ h_from_T_v() [2/2]

void SinglePhaseFluidProperties::h_from_T_v ( Real  T,
Real  v,
Real &  h,
Real &  dh_dT,
Real &  dh_dv 
) const
virtualinherited

Specific enthalpy and its derivatives from temperature and specific volume.

Parameters
[in]Ttemperature
[in]vspecific volume
[out]hspecific enthalpy (J/kg)
[out]dh_dTderivative of specific enthalpy w.r.t. temperature
[out]dh_dvderivative of specific enthalpy w.r.t. specific volume

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 552 of file SinglePhaseFluidProperties.C.

553 {
554  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
555 }
const std::string name
Definition: Setup.h:22

◆ henryConstant()

Real TabulatedFluidProperties::henryConstant ( Real  temperature) const
overridevirtual

Henry's law constant for dissolution in water.

Parameters
temperaturefluid temperature (K)
Returns
Henry's constant

Reimplemented from SinglePhaseFluidProperties.

Definition at line 522 of file TabulatedFluidProperties.C.

523 {
524  return _fp.henryConstant(temperature);
525 }
const std::string temperature
Definition: NS.h:27
virtual Real henryConstant(Real temperature) const
Henry&#39;s law constant for dissolution in water.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ henryConstant_dT()

void TabulatedFluidProperties::henryConstant_dT ( Real  temperature,
Real &  Kh,
Real &  dKh_dT 
) const
overridevirtual

Henry's law constant for dissolution in water and derivative wrt temperature.

Parameters
temperaturefluid temperature (K)
[out]KhHenry's constant
[out]dKh_dTderivative of Kh wrt temperature

Reimplemented from SinglePhaseFluidProperties.

Definition at line 528 of file TabulatedFluidProperties.C.

529 {
530  _fp.henryConstant_dT(temperature, Kh, dKh_dT);
531 }
virtual void henryConstant_dT(Real temperature, Real &Kh, Real &dKh_dT) const
Henry&#39;s law constant for dissolution in water and derivative wrt temperature.
const std::string temperature
Definition: NS.h:27
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ henryConstantIAPWS()

Real SinglePhaseFluidProperties::henryConstantIAPWS ( Real  temperature,
Real  A,
Real  B,
Real  C 
) const
protectedvirtualinherited

IAPWS formulation of Henry's law constant for dissolution in water From Guidelines on the Henry's constant and vapour liquid distribution constant for gases in H20 and D20 at high temperatures, IAPWS (2004)

Definition at line 262 of file SinglePhaseFluidProperties.C.

Referenced by MethaneFluidProperties::henryConstant(), NitrogenFluidProperties::henryConstant(), HydrogenFluidProperties::henryConstant(), and CO2FluidProperties::henryConstant().

263 {
264  Real Tr = temperature / 647.096;
265  Real tau = 1.0 - Tr;
266 
267  Real lnkh = A / Tr + B * std::pow(tau, 0.355) / Tr + C * std::pow(Tr, -0.41) * std::exp(tau);
268 
269  // The vapor pressure used in this formulation
270  std::vector<Real> a{-7.85951783, 1.84408259, -11.7866497, 22.6807411, -15.9618719, 1.80122502};
271  std::vector<Real> b{1.0, 1.5, 3.0, 3.5, 4.0, 7.5};
272  Real sum = 0.0;
273 
274  for (std::size_t i = 0; i < a.size(); ++i)
275  sum += a[i] * std::pow(tau, b[i]);
276 
277  return 22.064e6 * std::exp(sum / Tr) * std::exp(lnkh);
278 }
const std::string temperature
Definition: NS.h:27
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)

◆ henryConstantIAPWS_dT()

void SinglePhaseFluidProperties::henryConstantIAPWS_dT ( Real  temperature,
Real &  Kh,
Real &  dKh_dT,
Real  A,
Real  B,
Real  C 
) const
protectedvirtualinherited

IAPWS formulation of Henry's law constant for dissolution in water and derivative wrt temperature.

Definition at line 281 of file SinglePhaseFluidProperties.C.

Referenced by MethaneFluidProperties::henryConstant_dT(), NitrogenFluidProperties::henryConstant_dT(), HydrogenFluidProperties::henryConstant_dT(), and CO2FluidProperties::henryConstant_dT().

283 {
284  Real pc = 22.064e6;
285  Real Tc = 647.096;
286 
287  Real Tr = temperature / Tc;
288  Real tau = 1.0 - Tr;
289 
290  Real lnkh = A / Tr + B * std::pow(tau, 0.355) / Tr + C * std::pow(Tr, -0.41) * std::exp(tau);
291  Real dlnkh_dT =
292  (-A / Tr / Tr - B * std::pow(tau, 0.355) / Tr / Tr - 0.355 * B * std::pow(tau, -0.645) / Tr -
293  0.41 * C * std::pow(Tr, -1.41) * std::exp(tau) - C * std::pow(Tr, -0.41) * std::exp(tau)) /
294  Tc;
295 
296  // The vapor pressure used in this formulation
297  std::vector<Real> a{-7.85951783, 1.84408259, -11.7866497, 22.6807411, -15.9618719, 1.80122502};
298  std::vector<Real> b{1.0, 1.5, 3.0, 3.5, 4.0, 7.5};
299  Real sum = 0.0;
300  Real dsum = 0.0;
301 
302  for (std::size_t i = 0; i < a.size(); ++i)
303  {
304  sum += a[i] * std::pow(tau, b[i]);
305  dsum += a[i] * b[i] * std::pow(tau, b[i] - 1.0);
306  }
307 
308  Real p = pc * std::exp(sum / Tr);
309  Real dp_dT = -p / Tc / Tr * (sum / Tr + dsum);
310 
311  // Henry's constant and its derivative wrt temperature
312  Kh = p * std::exp(lnkh);
313  dKh_dT = (p * dlnkh_dT + dp_dT) * std::exp(lnkh);
314 }
const std::string temperature
Definition: NS.h:27
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)

◆ initialize()

virtual void FluidProperties::initialize ( )
inlinefinalvirtualinherited

Definition at line 28 of file FluidProperties.h.

28 {}

◆ initialSetup()

void TabulatedFluidProperties::initialSetup ( )
overridevirtual

Definition at line 101 of file TabulatedFluidProperties.C.

102 {
103  // Check to see if _file_name supplied exists. If it does, that data
104  // will be used. If it does not exist, data will be generated and then
105  // written to _file_name.
106  std::ifstream file(_file_name.c_str());
107  if (file.good())
108  {
109  _console << "Reading tabulated properties from " << _file_name << "\n";
110  _csv_reader.read();
111 
112  const std::vector<std::string> & column_names = _csv_reader.getNames();
113 
114  // Check that all required columns are present
115  for (std::size_t i = 0; i < _required_columns.size(); ++i)
116  {
117  if (std::find(column_names.begin(), column_names.end(), _required_columns[i]) ==
118  column_names.end())
119  mooseError(name(),
120  ": no ",
122  " data read in ",
123  _file_name,
124  ". A column named ",
126  " must be present");
127  }
128 
129  // Check that any property names read from the file are present in the list of possible
130  // properties, and if they are, add them to the list of read properties
131  for (std::size_t i = 0; i < column_names.size(); ++i)
132  {
133  // Only check properties not in _required_columns
134  if (std::find(_required_columns.begin(), _required_columns.end(), column_names[i]) ==
135  _required_columns.end())
136  {
137  if (std::find(_property_columns.begin(), _property_columns.end(), column_names[i]) ==
138  _property_columns.end())
139  mooseError(name(),
140  ": ",
141  column_names[i],
142  " read in ",
143  _file_name,
144  " is not one of the properties that TabulatedFluidProperties understands");
145  else
146  _interpolated_properties.push_back(column_names[i]);
147  }
148  }
149 
150  std::map<std::string, unsigned int> data_index;
151  for (std::size_t i = 0; i < column_names.size(); ++i)
152  {
153  auto it = std::find(column_names.begin(), column_names.end(), column_names[i]);
154  data_index[column_names[i]] = std::distance(column_names.begin(), it);
155  }
156 
157  const std::vector<std::vector<Real>> & column_data = _csv_reader.getData();
158 
159  // Extract the pressure and temperature data vectors
160  _pressure = column_data[data_index.find("pressure")->second];
161  _temperature = column_data[data_index.find("temperature")->second];
162 
163  // Pressure and temperature data contains duplicates due to the csv format.
164  // First, check that pressure is monotonically increasing
165  if (!std::is_sorted(_pressure.begin(), _pressure.end()))
166  mooseError(
167  name(), ": the column data for pressure is not monotonically increasing in ", _file_name);
168 
169  // The first pressure value is repeated for each temperature value. Counting the
170  // number of repeats provides the number of temperature values
171  auto num_T = std::count(_pressure.begin(), _pressure.end(), _pressure.front());
172 
173  // Now remove the duplicates in the pressure vector
174  auto last_unique = std::unique(_pressure.begin(), _pressure.end());
175  _pressure.erase(last_unique, _pressure.end());
176  _num_p = _pressure.size();
177 
178  // Check that the number of rows in the csv file is equal to _num_p * _num_T
179  if (column_data[0].size() != _num_p * static_cast<unsigned int>(num_T))
180  mooseError(name(),
181  ": the number of rows in ",
182  _file_name,
183  " is not equal to the number of unique pressure values ",
184  _num_p,
185  " multiplied by the number of unique temperature values ",
186  num_T);
187 
188  // Need to make sure that the temperature values are provided in ascending order
189  // as well as duplicated for each pressure value
190  std::vector<Real> temp0(_temperature.begin(), _temperature.begin() + num_T);
191  if (!std::is_sorted(temp0.begin(), temp0.end()))
192  mooseError(name(),
193  ": the column data for temperature is not monotonically increasing in ",
194  _file_name);
195 
196  auto it_temp = _temperature.begin() + num_T;
197  for (std::size_t i = 1; i < _pressure.size(); ++i)
198  {
199  std::vector<Real> temp(it_temp, it_temp + num_T);
200  if (temp != temp0)
201  mooseError(name(),
202  ": temperature values for pressure ",
203  _pressure[i],
204  " are not identical to values for ",
205  _pressure[0]);
206 
207  std::advance(it_temp, num_T);
208  }
209 
210  // At this point, all temperature data has been provided in ascending order
211  // identically for each pressure value, so we can just keep the first range
212  _temperature.erase(_temperature.begin() + num_T, _temperature.end());
213  _num_T = _temperature.size();
214 
215  // Minimum and maximum pressure and temperature. Note that _pressure and
216  // _temperature are sorted
217  _pressure_min = _pressure.front();
218  _pressure_max = _pressure.back();
219  _temperature_min = _temperature.front();
221 
222  // Extract the fluid property data from the file
223  for (std::size_t i = 0; i < _interpolated_properties.size(); ++i)
224  _properties.push_back(column_data[data_index.find(_interpolated_properties[i])->second]);
225  }
226  else
227  {
228  _console << "No tabulated properties file named " << _file_name << " exists.\n"
229  << "Generating tabulated data and writing output to " << _file_name << "\n";
230 
232 
233  // Write tabulated data to file
235  }
236 
237  // At this point, all properties read or generated are able to be used by
238  // TabulatedFluidProperties. Now set flags and indexes for each property in
239  //_interpolated_properties to use in property calculations
240  for (std::size_t i = 0; i < _interpolated_properties.size(); ++i)
241  {
242  if (_interpolated_properties[i] == "density")
243  {
244  _interpolate_density = true;
245  _density_idx = i;
246  }
247  if (_interpolated_properties[i] == "enthalpy")
248  {
249  _interpolate_enthalpy = true;
250  _enthalpy_idx = i;
251  }
252  if (_interpolated_properties[i] == "internal_energy")
253  {
256  }
257  if (_interpolated_properties[i] == "viscosity")
258  {
259  _interpolate_viscosity = true;
260  _viscosity_idx = i;
261  }
262  if (_interpolated_properties[i] == "k")
263  {
264  _interpolate_k = true;
265  _k_idx = i;
266  }
267  if (_interpolated_properties[i] == "cp")
268  {
269  _interpolate_cp = true;
270  _cp_idx = i;
271  }
272  if (_interpolated_properties[i] == "cv")
273  {
274  _interpolate_cv = true;
275  _cv_idx = i;
276  }
277  if (_interpolated_properties[i] == "entropy")
278  {
279  _interpolate_entropy = true;
280  _entropy_idx = i;
281  }
282  }
283 
284  // Construct bicubic interpolants from tabulated data
285  std::vector<std::vector<Real>> data_matrix;
286  _property_ipol.resize(_properties.size());
287 
288  for (std::size_t i = 0; i < _property_ipol.size(); ++i)
289  {
290  reshapeData2D(_num_p, _num_T, _properties[i], data_matrix);
291  _property_ipol[i] =
292  libmesh_make_unique<BicubicInterpolation>(_pressure, _temperature, data_matrix);
293  }
294 }
Real _temperature_max
Maximum temperature in tabulated data.
const std::vector< std::string > _required_columns
List of required column names to be read.
Real _pressure_max
Maximum pressure in tabulated data.
MooseUtils::DelimitedFileReader _csv_reader
The MOOSE delimited file reader.
Real _temperature_min
Minimum temperature in tabulated data.
const std::string name
Definition: Setup.h:22
std::vector< std::string > _interpolated_properties
List of properties to be interpolated.
std::vector< Real > _pressure
Pressure vector.
std::vector< Real > _temperature
Temperature vector.
unsigned int _num_T
Number of temperature points in the tabulated data.
Real _pressure_min
Minimum pressure in tabulated data.
std::vector< std::vector< Real > > _properties
Tabulated fluid properties.
unsigned int _num_p
Number of pressure points in the tabulated data.
const std::vector< std::string > _property_columns
List of possible property column names to be read.
unsigned int _density_idx
Index of each property.
bool _interpolate_density
Set of flags to note whether a property is to be interpolated.
void reshapeData2D(unsigned int nrow, unsigned int ncol, const std::vector< Real > &vec, std::vector< std::vector< Real >> &mat)
Forms a 2D matrix from a single std::vector.
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
Interpolated fluid property.
virtual void generateTabulatedData()
Generates a table of fluid properties by looping over pressure and temperature and calculating proper...
void writeTabulatedData(std::string file_name)
Writes tabulated data to a file.
FileName _file_name
File name of tabulated data file.

◆ k()

Real SinglePhaseFluidProperties::k ( Real  pressure,
Real  temperature 
) const
virtualinherited

◆ k_dpT()

void SinglePhaseFluidProperties::k_dpT ( Real  pressure,
Real  temperature,
Real &  k,
Real &  dk_dp,
Real &  dk_dT 
) const
virtualinherited

Definition at line 461 of file SinglePhaseFluidProperties.C.

463 {
464  k_from_p_T(pressure, temperature, k, dk_dp, dk_dT);
465 }
const std::string temperature
Definition: NS.h:27
virtual Real k(Real pressure, Real temperature) const
virtual Real k_from_p_T(Real pressure, Real temperature) const
Thermal conductivity.
const std::string pressure
Definition: NS.h:26

◆ k_from_p_T() [1/2]

Real TabulatedFluidProperties::k_from_p_T ( Real  pressure,
Real  temperature 
) const
overridevirtual

Thermal conductivity.

Parameters
pressurefluid pressure (Pa)
temperaturefluid temperature (K)
Returns
thermal conductivity (W/m/K)

Reimplemented from SinglePhaseFluidProperties.

Definition at line 478 of file TabulatedFluidProperties.C.

479 {
480  if (_interpolate_k)
481  {
483  return _property_ipol[_k_idx]->sample(pressure, temperature);
484  }
485  else
487 }
const std::string temperature
Definition: NS.h:27
virtual void checkInputVariables(Real &pressure, Real &temperature) const
Checks that the inputs are within the range of the tabulated data, and throws an error if they are no...
virtual Real k_from_p_T(Real pressure, Real temperature) const
Thermal conductivity.
const std::string pressure
Definition: NS.h:26
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
Interpolated fluid property.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ k_from_p_T() [2/2]

void TabulatedFluidProperties::k_from_p_T ( Real  pressure,
Real  temperature,
Real &  k,
Real &  dk_dp,
Real &  dk_dT 
) const
overridevirtual

Thermal conductivity and its derivatives wrt pressure and temperature.

Parameters
pressurefluid pressure (Pa)
temperaturefluid temperature (K)
[out]thermalconductivity (W/m/K)
[out]derivativeof thermal conductivity wrt pressure
[out]derivativeof thermal conductivity wrt temperature

Reimplemented from SinglePhaseFluidProperties.

Definition at line 490 of file TabulatedFluidProperties.C.

492 {
493  if (_interpolate_k)
494  {
496  return _property_ipol[_k_idx]->sampleValueAndDerivatives(
497  pressure, temperature, k, dk_dp, dk_dT);
498  }
499  else
500  return _fp.k_from_p_T(pressure, temperature, k, dk_dp, dk_dT);
501 }
const std::string temperature
Definition: NS.h:27
virtual Real k(Real pressure, Real temperature) const
virtual void checkInputVariables(Real &pressure, Real &temperature) const
Checks that the inputs are within the range of the tabulated data, and throws an error if they are no...
virtual Real k_from_p_T(Real pressure, Real temperature) const
Thermal conductivity.
const std::string pressure
Definition: NS.h:26
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
Interpolated fluid property.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ k_from_rho_T()

Real SinglePhaseFluidProperties::k_from_rho_T ( Real  density,
Real  temperature 
) const
virtualinherited

Thermal conductivity as a function of density and temperature.

Parameters
densityfluid density (kg/m^3)
temperaturefluid temperature (K)
Returns
thermal conductivity (W/m/K)

Reimplemented in CO2FluidProperties, Water97FluidProperties, HydrogenFluidProperties, and NitrogenFluidProperties.

Definition at line 327 of file SinglePhaseFluidProperties.C.

328 {
329  mooseError(name(), ": k_from_rho_T is not implemented.");
330 }
const std::string name
Definition: Setup.h:22

◆ k_from_v_e()

Real SinglePhaseFluidProperties::k_from_v_e ( Real  v,
Real  e 
) const
virtualinherited

Thermal conductivity from specific volume and specific internal energy.

Parameters
[in]vspecific volume
[in]especific internal energy

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 76 of file SinglePhaseFluidProperties.C.

Referenced by FluidPropertiesMaterial::computeQpProperties(), GeneralVaporMixtureFluidProperties::k_from_p_T(), IdealRealGasMixtureFluidProperties::k_from_p_T(), and IdealRealGasMixtureFluidProperties::k_from_T_v().

77 {
78  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
79 }
const std::string name
Definition: Setup.h:22

◆ molarMass()

Real TabulatedFluidProperties::molarMass ( ) const
overridevirtual

Molar mass [kg/mol].

Returns
molar mass

Reimplemented from SinglePhaseFluidProperties.

Definition at line 303 of file TabulatedFluidProperties.C.

304 {
305  return _fp.molarMass();
306 }
virtual Real molarMass() const
Molar mass [kg/mol].
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ mu()

Real SinglePhaseFluidProperties::mu ( Real  pressure,
Real  temperature 
) const
virtualinherited

◆ mu_dpT()

void SinglePhaseFluidProperties::mu_dpT ( Real  pressure,
Real  temperature,
Real &  mu,
Real &  dmu_dp,
Real &  dmu_dT 
) const
virtualinherited

Dynamic viscosity and its derivatives wrt pressure and temperature.

Parameters
pressurefluid pressure (Pa)
temperaturefluid temperature (K)
[out]muviscosity (Pa.s)
[out]dmu_dpderivative of viscosity wrt pressure
[out]dmu_dTderivative of viscosity wrt temperature

Definition at line 418 of file SinglePhaseFluidProperties.C.

420 {
421  mu_from_p_T(pressure, temperature, mu, dmu_dp, dmu_dT);
422 }
virtual Real mu_from_p_T(Real pressure, Real temperature) const
virtual Real mu(Real pressure, Real temperature) const
Dynamic viscosity.
const std::string temperature
Definition: NS.h:27
const std::string pressure
Definition: NS.h:26

◆ mu_drhoT_from_rho_T()

void SinglePhaseFluidProperties::mu_drhoT_from_rho_T ( Real  density,
Real  temperature,
Real  ddensity_dT,
Real &  mu,
Real &  dmu_drho,
Real &  dmu_dT 
) const
virtualinherited

Dynamic viscosity and its derivatives wrt density and temperature.

Parameters
densityfluid density (kg/m^3)
temperaturefluid temperature (K)
ddensity_dTderivative of density wrt temperature
[out]muviscosity (Pa.s)
[out]dmu_drhoderivative of viscosity wrt density
[out]dmu_dTderivative of viscosity wrt temperature

Reimplemented in Water97FluidProperties, CO2FluidProperties, HydrogenFluidProperties, and NitrogenFluidProperties.

Definition at line 322 of file SinglePhaseFluidProperties.C.

323 {
324  mooseError(name(), ": mu_drhoT_from_rho_T is not implemented.");
325 }
const std::string name
Definition: Setup.h:22

◆ mu_from_p_T() [1/2]

Real TabulatedFluidProperties::mu_from_p_T ( Real  pressure,
Real  temperature 
) const
overridevirtual

Reimplemented from SinglePhaseFluidProperties.

Definition at line 401 of file TabulatedFluidProperties.C.

Referenced by rho_mu(), and rho_mu_dpT().

402 {
404  {
407  }
408  else
410 }
virtual Real mu_from_p_T(Real pressure, Real temperature) const
const std::string temperature
Definition: NS.h:27
virtual void checkInputVariables(Real &pressure, Real &temperature) const
Checks that the inputs are within the range of the tabulated data, and throws an error if they are no...
const std::string pressure
Definition: NS.h:26
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
Interpolated fluid property.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ mu_from_p_T() [2/2]

void TabulatedFluidProperties::mu_from_p_T ( Real  pressure,
Real  temperature,
Real &  mu,
Real &  dmu_dp,
Real &  dmu_dT 
) const
overridevirtual

Reimplemented from SinglePhaseFluidProperties.

Definition at line 413 of file TabulatedFluidProperties.C.

415 {
417  {
419  _property_ipol[_viscosity_idx]->sampleValueAndDerivatives(
420  pressure, temperature, mu, dmu_dp, dmu_dT);
421  }
422  else
423  return _fp.mu_from_p_T(pressure, temperature, mu, dmu_dp, dmu_dT);
424 }
virtual Real mu_from_p_T(Real pressure, Real temperature) const
virtual Real mu(Real pressure, Real temperature) const
Dynamic viscosity.
const std::string temperature
Definition: NS.h:27
virtual void checkInputVariables(Real &pressure, Real &temperature) const
Checks that the inputs are within the range of the tabulated data, and throws an error if they are no...
const std::string pressure
Definition: NS.h:26
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
Interpolated fluid property.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ mu_from_rho_T()

Real SinglePhaseFluidProperties::mu_from_rho_T ( Real  density,
Real  temperature 
) const
virtualinherited

Dynamic viscosity as a function of density and temperature.

Parameters
densityfluid density (kg/m^3)
temperaturefluid temperature (K)
Returns
viscosity (Pa.s)

Reimplemented in Water97FluidProperties, CO2FluidProperties, HydrogenFluidProperties, and NitrogenFluidProperties.

Definition at line 316 of file SinglePhaseFluidProperties.C.

317 {
318  mooseError(name(), ": mu_from_rho_T is not implemented.");
319 }
const std::string name
Definition: Setup.h:22

◆ mu_from_v_e()

Real SinglePhaseFluidProperties::mu_from_v_e ( Real  v,
Real  e 
) const
virtualinherited

Dynamic viscosity from specific volume and specific internal energy.

Parameters
[in]vspecific volume
[in]especific internal energy

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 71 of file SinglePhaseFluidProperties.C.

Referenced by FluidPropertiesMaterial::computeQpProperties(), GeneralVaporMixtureFluidProperties::mu_from_p_T(), IdealRealGasMixtureFluidProperties::mu_from_p_T(), and IdealRealGasMixtureFluidProperties::mu_from_T_v().

72 {
73  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
74 }
const std::string name
Definition: Setup.h:22

◆ p_from_h_s() [1/2]

Real SinglePhaseFluidProperties::p_from_h_s ( Real  h,
Real  s 
) const
virtualinherited

Pressure from specific enthalpy and specific entropy.

Parameters
[in]hspecific enthalpy
[in]sspecific entropy

Reimplemented in StiffenedGasFluidProperties, and IdealGasFluidProperties.

Definition at line 584 of file SinglePhaseFluidProperties.C.

Referenced by StagnationPressureAux::computeValue(), and StagnationTemperatureAux::computeValue().

585 {
586  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
587 }
const std::string name
Definition: Setup.h:22

◆ p_from_h_s() [2/2]

void SinglePhaseFluidProperties::p_from_h_s ( Real  h,
Real  s,
Real &  p,
Real &  dp_dh,
Real &  dp_ds 
) const
virtualinherited

Pressure and its derivatives from specific enthalpy and specific entropy.

Parameters
[in]hspecific enthalpy
[in]sspecific entropy

Reimplemented in StiffenedGasFluidProperties, and IdealGasFluidProperties.

Definition at line 590 of file SinglePhaseFluidProperties.C.

591 {
592  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
593 }
const std::string name
Definition: Setup.h:22

◆ p_from_T_v() [1/2]

Real SinglePhaseFluidProperties::p_from_T_v ( Real  T,
Real  v 
) const
virtualinherited

Pressure from temperature and specific volume.

Parameters
[in]Ttemperature
[in]vspecific volume

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 535 of file SinglePhaseFluidProperties.C.

Referenced by IdealRealGasMixtureFluidProperties::p_from_T_v().

536 {
537  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
538 }
const std::string name
Definition: Setup.h:22

◆ p_from_T_v() [2/2]

void SinglePhaseFluidProperties::p_from_T_v ( Real  T,
Real  v,
Real &  p,
Real &  dp_dT,
Real &  dp_dv 
) const
virtualinherited

Pressure and its derivatives from temperature and specific volume.

Parameters
[in]Ttemperature
[in]vspecific volume
[out]ppressure (Pa)
[out]dp_dTderivative of pressure w.r.t. temperature
[out]dp_dvderivative of pressure w.r.t. specific volume

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 541 of file SinglePhaseFluidProperties.C.

542 {
543  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
544 }
const std::string name
Definition: Setup.h:22

◆ p_from_v_e() [1/2]

Real SinglePhaseFluidProperties::p_from_v_e ( Real  v,
Real  e 
) const
virtualinherited

Pressure from specific volume and specific internal energy.

Parameters
[in]vspecific volume
[in]especific internal energy

Reimplemented in IdealGasFluidProperties, StiffenedGasFluidProperties, and NaNInterfaceTestFluidProperties.

Definition at line 28 of file SinglePhaseFluidProperties.C.

Referenced by FluidPropertiesMaterial::computeQpProperties(), PressureAux::computeValue(), StagnationPressureAux::computeValue(), and StagnationTemperatureAux::computeValue().

29 {
30  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
31 }
const std::string name
Definition: Setup.h:22

◆ p_from_v_e() [2/2]

void SinglePhaseFluidProperties::p_from_v_e ( Real  v,
Real  e,
Real &  p,
Real &  dp_dv,
Real &  dp_de 
) const
virtualinherited

Pressure and its derivatives from specific volume and specific internal energy.

Parameters
[in]vspecific volume
[in]especific internal energy
[out]ppressure
[out]dp_dvderivative of pressure w.r.t. specific volume
[out]dp_dederivative of pressure w.r.t. specific internal energy

Reimplemented in IdealGasFluidProperties, StiffenedGasFluidProperties, and NaNInterfaceTestFluidProperties.

Definition at line 34 of file SinglePhaseFluidProperties.C.

35 {
36  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
37 }
const std::string name
Definition: Setup.h:22

◆ pp_sat_from_p_T()

Real SinglePhaseFluidProperties::pp_sat_from_p_T ( Real  p,
Real  T 
) const
virtualinherited

Partial pressure at saturation in a gas mixture.

Parameters
[in]ppressure (Pa)
[in]Ttemperature (K)
Returns
pp_sat (Pa)

Reimplemented in StiffenedGasFluidProperties.

Definition at line 196 of file SinglePhaseFluidProperties.C.

Referenced by IdealRealGasMixtureFluidProperties::xs_prim_from_p_T().

197 {
198  mooseError(name(), ": pp_sat_from_p_T is not implemented");
199 }
const std::string name
Definition: Setup.h:22

◆ reshapeData2D()

void TabulatedFluidProperties::reshapeData2D ( unsigned int  nrow,
unsigned int  ncol,
const std::vector< Real > &  vec,
std::vector< std::vector< Real >> &  mat 
)
protected

Forms a 2D matrix from a single std::vector.

Parameters
nrownumber of rows in the matrix
ncolnumber of columns in the matrix
vec1D vector to reshape into a 2D matrix
[out]2Dmatrix formed by reshaping vec

Definition at line 639 of file TabulatedFluidProperties.C.

Referenced by initialSetup().

643 {
644  if (!vec.empty())
645  {
646  mat.resize(nrow);
647  for (unsigned int i = 0; i < nrow; ++i)
648  mat[i].resize(ncol);
649 
650  for (unsigned int i = 0; i < nrow; ++i)
651  for (unsigned int j = 0; j < ncol; ++j)
652  mat[i][j] = vec[i * ncol + j];
653  }
654 }

◆ rho()

Real SinglePhaseFluidProperties::rho ( Real  p,
Real  T 
) const
virtualinherited

Definition at line 491 of file SinglePhaseFluidProperties.C.

Referenced by SinglePhaseFluidProperties::beta_from_p_T(), StiffenedGasFluidProperties::c2_from_p_rho(), StiffenedGasFluidProperties::e_from_p_rho(), IdealGasFluidProperties::e_from_p_rho(), NaClFluidProperties::e_from_p_T(), SinglePhaseFluidProperties::e_from_p_T(), IdealGasFluidProperties::h_from_p_T(), Water97FluidProperties::k_from_p_T(), CO2FluidProperties::mu_from_p_T(), NitrogenFluidProperties::mu_from_p_T(), HydrogenFluidProperties::mu_from_p_T(), Water97FluidProperties::mu_from_p_T(), SinglePhaseFluidProperties::rho_dpT(), HelmholtzFluidProperties::rho_e_dpT(), IdealGasFluidPropertiesPT::rho_e_dpT(), Water97FluidProperties::rho_e_dpT(), NaClFluidProperties::rho_e_dpT(), SimpleFluidProperties::rho_e_dpT(), rho_e_dpT(), IdealGasFluidProperties::rho_from_p_s(), StiffenedGasFluidProperties::rho_from_p_s(), HelmholtzFluidProperties::rho_from_p_T(), IdealGasFluidPropertiesPT::rho_from_p_T(), StiffenedGasFluidProperties::rho_from_p_T(), CO2FluidProperties::rho_from_p_T(), IdealGasFluidProperties::rho_from_p_T(), Water97FluidProperties::rho_from_p_T(), NaClFluidProperties::rho_from_p_T(), SimpleFluidProperties::rho_from_p_T(), rho_from_p_T(), HelmholtzFluidProperties::rho_mu(), IdealGasFluidPropertiesPT::rho_mu(), SimpleFluidProperties::rho_mu(), Water97FluidProperties::rho_mu(), rho_mu(), HelmholtzFluidProperties::rho_mu_dpT(), IdealGasFluidPropertiesPT::rho_mu_dpT(), SimpleFluidProperties::rho_mu_dpT(), Water97FluidProperties::rho_mu_dpT(), rho_mu_dpT(), SinglePhaseFluidProperties::T_from_p_h(), and SinglePhaseFluidProperties::v_from_p_T().

492 {
493  return rho_from_p_T(p, T);
494 }
virtual Real rho_from_p_T(Real p, Real T) const
Density from pressure and temperature.

◆ rho_dpT()

void SinglePhaseFluidProperties::rho_dpT ( Real  pressure,
Real  temperature,
Real &  rho,
Real &  drho_dp,
Real &  drho_dT 
) const
virtualinherited

Definition at line 359 of file SinglePhaseFluidProperties.C.

361 {
362  rho_from_p_T(pressure, temperature, rho, drho_dp, drho_dT);
363 }
const std::string temperature
Definition: NS.h:27
virtual Real rho(Real p, Real T) const
virtual Real rho_from_p_T(Real p, Real T) const
Density from pressure and temperature.
const std::string pressure
Definition: NS.h:26

◆ rho_e_dpT()

void TabulatedFluidProperties::rho_e_dpT ( Real  pressure,
Real  temperature,
Real &  rho,
Real &  drho_dp,
Real &  drho_dT,
Real &  e,
Real &  de_dp,
Real &  de_dT 
) const
overridevirtual

Density and internal energy and their derivatives wrt pressure and temperature.

Parameters
pressurefluid pressure (Pa)
temperaturefluid temperature (K)
[out]rhodensity (kg/m^3)
[out]drho_dpderivative of density wrt pressure
[out]drho_dTderivative of density wrt temperature
[out]einternal energy (J/kg)
[out]de_dpderivative of internal energy wrt pressure
[out]de_dTderivative of internal energy wrt temperature

Reimplemented from SinglePhaseFluidProperties.

Definition at line 361 of file TabulatedFluidProperties.C.

369 {
370  rho_from_p_T(pressure, temperature, rho, drho_dp, drho_dT);
371  e_from_p_T(pressure, temperature, e, de_dp, de_dT);
372 }
const std::string temperature
Definition: NS.h:27
virtual Real rho(Real p, Real T) const
virtual Real e_from_p_T(Real pressure, Real temperature) const override
Internal energy from pressure and temperature.
virtual Real rho_from_p_T(Real pressure, Real temperature) const override
Density from pressure and temperature.
const std::string pressure
Definition: NS.h:26
virtual Real e(Real pressure, Real temperature) const

◆ rho_from_p_s() [1/2]

Real SinglePhaseFluidProperties::rho_from_p_s ( Real  p,
Real  s 
) const
virtualinherited

Density from pressure and specific entropy.

Parameters
[in]ppressure
[in]sspecific entropy

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 103 of file SinglePhaseFluidProperties.C.

Referenced by StagnationTemperatureAux::computeValue(), and SinglePhaseFluidProperties::T_from_p_h().

104 {
105  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
106 }
const std::string name
Definition: Setup.h:22

◆ rho_from_p_s() [2/2]

void SinglePhaseFluidProperties::rho_from_p_s ( Real  p,
Real  s,
Real &  rho,
Real &  drho_dp,
Real &  drho_ds 
) const
virtualinherited

Density and its derivatives from pressure and specific entropy.

Parameters
[in]ppressure
[in]sspecific entropy
[out]rhodensity
[out]drho_dpderivative of density w.r.t. pressure
[out]drho_dsderivative of density w.r.t. specific entropy

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 109 of file SinglePhaseFluidProperties.C.

110 {
111  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
112 }
const std::string name
Definition: Setup.h:22

◆ rho_from_p_T() [1/2]

Real TabulatedFluidProperties::rho_from_p_T ( Real  p,
Real  T 
) const
overridevirtual

Density from pressure and temperature.

Parameters
[in]ppressure (Pa)
[in]Ttemperature (K)
Returns
density (kg/m^3)

Reimplemented from SinglePhaseFluidProperties.

Definition at line 309 of file TabulatedFluidProperties.C.

Referenced by rho_e_dpT(), rho_mu(), and rho_mu_dpT().

310 {
312  {
315  }
316  else
318 }
const std::string temperature
Definition: NS.h:27
virtual Real rho_from_p_T(Real p, Real T) const
Density from pressure and temperature.
virtual void checkInputVariables(Real &pressure, Real &temperature) const
Checks that the inputs are within the range of the tabulated data, and throws an error if they are no...
const std::string pressure
Definition: NS.h:26
unsigned int _density_idx
Index of each property.
bool _interpolate_density
Set of flags to note whether a property is to be interpolated.
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
Interpolated fluid property.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ rho_from_p_T() [2/2]

void TabulatedFluidProperties::rho_from_p_T ( Real  p,
Real  T,
Real &  rho,
Real &  drho_dp,
Real &  drho_dT 
) const
overridevirtual

Density and its derivatives from pressure and temperature.

Parameters
[in]ppressure (Pa)
[in]Ttemperature (K)
[out]rhodensity (kg/m^3)
[out]drho_dpderivative of density w.r.t. pressure
[out]drho_dTderivative of density w.r.t. temperature

Reimplemented from SinglePhaseFluidProperties.

Definition at line 321 of file TabulatedFluidProperties.C.

323 {
325  {
327  _property_ipol[_density_idx]->sampleValueAndDerivatives(
328  pressure, temperature, rho, drho_dp, drho_dT);
329  }
330  else
331  _fp.rho_from_p_T(pressure, temperature, rho, drho_dp, drho_dT);
332 }
const std::string temperature
Definition: NS.h:27
virtual Real rho(Real p, Real T) const
virtual Real rho_from_p_T(Real p, Real T) const
Density from pressure and temperature.
virtual void checkInputVariables(Real &pressure, Real &temperature) const
Checks that the inputs are within the range of the tabulated data, and throws an error if they are no...
const std::string pressure
Definition: NS.h:26
unsigned int _density_idx
Index of each property.
bool _interpolate_density
Set of flags to note whether a property is to be interpolated.
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
Interpolated fluid property.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ rho_mu()

void TabulatedFluidProperties::rho_mu ( Real  pressure,
Real  temperature,
Real &  rho,
Real &  mu 
) const
overridevirtual

Density and viscosity.

Parameters
pressurefluid pressure (Pa)
temperaturefluid temperature (K)
[out]rhodensity (kg/m^3)
[out]muviscosity (Pa.s)

Reimplemented from SinglePhaseFluidProperties.

Definition at line 427 of file TabulatedFluidProperties.C.

428 {
431 }
virtual Real mu(Real pressure, Real temperature) const
Dynamic viscosity.
const std::string temperature
Definition: NS.h:27
virtual Real rho(Real p, Real T) const
virtual Real rho_from_p_T(Real pressure, Real temperature) const override
Density from pressure and temperature.
virtual Real mu_from_p_T(Real pressure, Real temperature) const override
const std::string pressure
Definition: NS.h:26

◆ rho_mu_dpT()

void TabulatedFluidProperties::rho_mu_dpT ( Real  pressure,
Real  temperature,
Real &  rho,
Real &  drho_dp,
Real &  drho_dT,
Real &  mu,
Real &  dmu_dp,
Real &  dmu_dT 
) const
overridevirtual

Density and viscosity and their derivatives wrt pressure and temperature.

Parameters
pressurefluid pressure (Pa)
temperaturefluid temperature (K)
[out]rhodensity (kg/m^3)
[out]drho_dpderivative of density wrt pressure
[out]drho_dTderivative of density wrt temperature
[out]muviscosity (Pa.s)
[out]dmu_dpderivative of viscosity wrt pressure
[out]dmu_dTderivative of viscosity wrt temperature

Reimplemented from SinglePhaseFluidProperties.

Definition at line 434 of file TabulatedFluidProperties.C.

442 {
443  rho_from_p_T(pressure, temperature, rho, drho_dp, drho_dT);
444  mu_from_p_T(pressure, temperature, mu, dmu_dp, dmu_dT);
445 }
virtual Real mu(Real pressure, Real temperature) const
Dynamic viscosity.
const std::string temperature
Definition: NS.h:27
virtual Real rho(Real p, Real T) const
virtual Real rho_from_p_T(Real pressure, Real temperature) const override
Density from pressure and temperature.
virtual Real mu_from_p_T(Real pressure, Real temperature) const override
const std::string pressure
Definition: NS.h:26

◆ s()

Real SinglePhaseFluidProperties::s ( Real  pressure,
Real  temperature 
) const
virtualinherited

◆ s_from_h_p() [1/2]

Real SinglePhaseFluidProperties::s_from_h_p ( Real  h,
Real  p 
) const
virtualinherited

Specific entropy from specific enthalpy and pressure.

Parameters
[in]hspecific enthalpy
[in]ppressure

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 92 of file SinglePhaseFluidProperties.C.

Referenced by SinglePhaseFluidProperties::T_from_p_h().

93 {
94  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
95 }
const std::string name
Definition: Setup.h:22

◆ s_from_h_p() [2/2]

void SinglePhaseFluidProperties::s_from_h_p ( Real  h,
Real  p,
Real &  s,
Real &  ds_dh,
Real &  ds_dp 
) const
virtualinherited

Specific entropy and its derivatives from specific enthalpy and pressure.

Parameters
[in]hspecific enthalpy
[in]ppressure
[out]sspecific entropy
[out]ds_dhderivative of specific entropy w.r.t. specific enthalpy
[out]ds_dpderivative of specific entropy w.r.t. pressure

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 98 of file SinglePhaseFluidProperties.C.

99 {
100  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
101 }
const std::string name
Definition: Setup.h:22

◆ s_from_p_T() [1/2]

Real TabulatedFluidProperties::s_from_p_T ( Real  p,
Real  T 
) const
overridevirtual

Specific entropy from pressure and temperature.

Parameters
[in]ppressure
[in]Ttemperature

Reimplemented from SinglePhaseFluidProperties.

Definition at line 504 of file TabulatedFluidProperties.C.

505 {
507  {
510  }
511  else
513 }
const std::string temperature
Definition: NS.h:27
virtual void checkInputVariables(Real &pressure, Real &temperature) const
Checks that the inputs are within the range of the tabulated data, and throws an error if they are no...
virtual Real s_from_p_T(Real p, Real T) const
Specific entropy from pressure and temperature.
const std::string pressure
Definition: NS.h:26
std::vector< std::unique_ptr< BicubicInterpolation > > _property_ipol
Interpolated fluid property.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

◆ s_from_p_T() [2/2]

void TabulatedFluidProperties::s_from_p_T ( Real  p,
Real  T,
Real &  s,
Real &  ds_dp,
Real &  ds_dT 
) const
overridevirtual

Specific entropy and its derivatives from pressure and temperature.

Parameters
[in]ppressure
[in]Ttemperature
[out]sspecific entropy
[out]ds_dpderivative of specific entropy w.r.t. pressure
[out]ds_dTderivative of specific entropy w.r.t. temperature

Reimplemented from SinglePhaseFluidProperties.

Definition at line 516 of file TabulatedFluidProperties.C.

517 {
518  SinglePhaseFluidProperties::s_from_p_T(p, T, s, ds_dp, ds_dT);
519 }
virtual Real s(Real pressure, Real temperature) const
virtual Real s_from_p_T(Real p, Real T) const
Specific entropy from pressure and temperature.

◆ s_from_T_v() [1/2]

Real SinglePhaseFluidProperties::s_from_T_v ( Real  T,
Real  v 
) const
virtualinherited

Specific entropy from temperature and specific volume.

Parameters
[in]Ttemperature
[in]vspecific volume

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 557 of file SinglePhaseFluidProperties.C.

Referenced by IdealRealGasMixtureFluidProperties::s_from_T_v().

558 {
559  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
560 }
const std::string name
Definition: Setup.h:22

◆ s_from_T_v() [2/2]

void SinglePhaseFluidProperties::s_from_T_v ( Real  T,
Real  v,
Real &  s,
Real &  ds_dT,
Real &  ds_dv 
) const
virtualinherited

Specific entropy and its derivatives from temperature and specific volume.

Parameters
[in]Ttemperature
[in]vspecific volume
[out]sspecific entropy (J/kg)
[out]ds_dTderivative of specific entropy w.r.t. temperature
[out]ds_dvderivative of specific entropy w.r.t. specific volume

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 563 of file SinglePhaseFluidProperties.C.

564 {
565  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
566 }
const std::string name
Definition: Setup.h:22

◆ s_from_v_e() [1/2]

Real SinglePhaseFluidProperties::s_from_v_e ( Real  v,
Real  e 
) const
virtualinherited

Specific entropy from specific volume and specific internal energy.

Parameters
[in]vspecific volume
[in]especific internal energy

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 81 of file SinglePhaseFluidProperties.C.

Referenced by StagnationPressureAux::computeValue(), and StagnationTemperatureAux::computeValue().

82 {
83  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
84 }
const std::string name
Definition: Setup.h:22

◆ s_from_v_e() [2/2]

void SinglePhaseFluidProperties::s_from_v_e ( Real  v,
Real  e,
Real &  s,
Real &  ds_dv,
Real &  ds_de 
) const
virtualinherited

Specific entropy and its derivatives from specific volume and specific internal energy.

Parameters
[in]vspecific volume
[in]especific internal energy
[out]sspecific entropy
[out]ds_dvderivative of specific entropy w.r.t. specific volume
[out]ds_dederivative of specific entropy w.r.t. specific internal energy

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 87 of file SinglePhaseFluidProperties.C.

88 {
89  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
90 }
const std::string name
Definition: Setup.h:22

◆ subdomainSetup()

virtual void FluidProperties::subdomainSetup ( )
inlinefinalvirtualinherited

Definition at line 32 of file FluidProperties.h.

32 {}

◆ T_from_p_h()

Real SinglePhaseFluidProperties::T_from_p_h ( Real  pressure,
Real  enthalpy 
) const
virtualinherited

Temperature from pressure and specific enthalpy.

Parameters
[in]pressurepressure (Pa)
[in]enthalpyenthalpy (J/kg)
Returns
Temperature (K)

Reimplemented in IdealGasFluidProperties.

Definition at line 601 of file SinglePhaseFluidProperties.C.

602 {
603  const Real s = s_from_h_p(h, p);
604  const Real rho = rho_from_p_s(p, s);
605  const Real v = 1. / rho;
606  const Real e = e_from_v_h(v, h);
607  return T_from_v_e(v, e);
608 }
virtual Real T_from_v_e(Real v, Real e) const
Temperature from specific volume and specific internal energy.
virtual Real s(Real pressure, Real temperature) const
virtual Real h(Real p, Real T) const
virtual Real s_from_h_p(Real h, Real p) const
Specific entropy from specific enthalpy and pressure.
virtual Real rho(Real p, Real T) const
virtual Real e_from_v_h(Real v, Real h) const
Specific internal energy as a function of specific volume and specific enthalpy.
virtual Real rho_from_p_s(Real p, Real s) const
Density from pressure and specific entropy.
virtual Real e(Real pressure, Real temperature) const

◆ T_from_v_e() [1/2]

Real SinglePhaseFluidProperties::T_from_v_e ( Real  v,
Real  e 
) const
virtualinherited

Temperature from specific volume and specific internal energy.

Parameters
[in]vspecific volume
[in]especific internal energy
Returns
sound speed

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 39 of file SinglePhaseFluidProperties.C.

Referenced by FluidPropertiesMaterial::computeQpProperties(), StagnationTemperatureAux::computeValue(), TemperatureAux::computeValue(), IdealRealGasMixtureFluidProperties::p_T_from_v_e(), and SinglePhaseFluidProperties::T_from_p_h().

40 {
41  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
42 }
const std::string name
Definition: Setup.h:22

◆ T_from_v_e() [2/2]

void SinglePhaseFluidProperties::T_from_v_e ( Real  v,
Real  e,
Real &  T,
Real &  dT_dv,
Real &  dT_de 
) const
virtualinherited

Temperature and its derivatives from specific volume and specific internal energy.

Parameters
[in]vspecific volume
[in]especific internal energy
[out]Ttemperature
[out]dT_dvderivative of temperature w.r.t. specific volume
[out]dT_dederivative of temperature w.r.t. specific internal energy

Reimplemented in IdealGasFluidProperties, and StiffenedGasFluidProperties.

Definition at line 45 of file SinglePhaseFluidProperties.C.

46 {
47  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
48 }
const std::string name
Definition: Setup.h:22

◆ threadJoin()

virtual void FluidProperties::threadJoin ( const UserObject &  )
inlinefinalvirtualinherited

Definition at line 31 of file FluidProperties.h.

31 {}

◆ triplePointPressure()

Real SinglePhaseFluidProperties::triplePointPressure ( ) const
virtualinherited

Triple point pressure.

Returns
triple point pressure (Pa)

Reimplemented in HydrogenFluidProperties, CO2FluidProperties, NitrogenFluidProperties, MethaneFluidProperties, NaClFluidProperties, and Water97FluidProperties.

Definition at line 238 of file SinglePhaseFluidProperties.C.

239 {
240  mooseError(name(), ": triplePointPressure() is not implemented");
241 }
const std::string name
Definition: Setup.h:22

◆ triplePointTemperature()

Real SinglePhaseFluidProperties::triplePointTemperature ( ) const
virtualinherited

Triple point temperature.

Returns
triple point temperature (K)

Reimplemented in HydrogenFluidProperties, CO2FluidProperties, NitrogenFluidProperties, MethaneFluidProperties, NaClFluidProperties, and Water97FluidProperties.

Definition at line 244 of file SinglePhaseFluidProperties.C.

245 {
246  mooseError(name(), ": triplePointTemperature() is not implemented");
247 }
const std::string name
Definition: Setup.h:22

◆ v_e_spndl_from_T()

void SinglePhaseFluidProperties::v_e_spndl_from_T ( Real  T,
Real &  v,
Real &  e 
) const
virtualinherited

Specific internal energy from temperature and specific volume.

Parameters
[in]Ttemperature
[in]vspecific volume

Reimplemented in StiffenedGasFluidProperties.

Definition at line 524 of file SinglePhaseFluidProperties.C.

Referenced by IdealRealGasMixtureFluidProperties::v_from_p_T().

525 {
526  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
527 }
const std::string name
Definition: Setup.h:22

◆ v_from_p_T() [1/2]

Real SinglePhaseFluidProperties::v_from_p_T ( Real  p,
Real  T 
) const
virtualinherited

Specific volume from pressure and temperature.

Parameters
[in]ppressure
[in]Ttemperature

Definition at line 151 of file SinglePhaseFluidProperties.C.

Referenced by GeneralVaporMixtureFluidProperties::c_from_p_T(), GeneralVaporMixtureFluidProperties::cp_from_p_T(), GeneralVaporMixtureFluidProperties::cv_from_p_T(), GeneralVaporMixtureFluidProperties::k_from_p_T(), GeneralVaporMixtureFluidProperties::mu_from_p_T(), GeneralVaporMixtureFluidProperties::v_from_p_T(), and IdealRealGasMixtureFluidProperties::xs_prim_from_p_T().

152 {
153  Real rho = rho_from_p_T(p, T);
154  return 1.0 / rho;
155 }
virtual Real rho(Real p, Real T) const
virtual Real rho_from_p_T(Real p, Real T) const
Density from pressure and temperature.

◆ v_from_p_T() [2/2]

void SinglePhaseFluidProperties::v_from_p_T ( Real  p,
Real  T,
Real &  v,
Real &  dv_dp,
Real &  dv_dT 
) const
virtualinherited

Specific volume and its derivatives from pressure and temperature.

Parameters
[in]ppressure
[in]Ttemperature
[out]vspecific volume
[out]dv_dpderivative of specific volume w.r.t. pressure
[out]dv_dTderivative of specific volume w.r.t. temperature

Definition at line 158 of file SinglePhaseFluidProperties.C.

159 {
160  Real rho, drho_dp, drho_dT;
161  rho_from_p_T(p, T, rho, drho_dp, drho_dT);
162 
163  v = 1.0 / rho;
164  const Real dv_drho = -1.0 / (rho * rho);
165 
166  dv_dp = dv_drho * drho_dp;
167  dv_dT = dv_drho * drho_dT;
168 }
virtual Real rho(Real p, Real T) const
virtual Real rho_from_p_T(Real p, Real T) const
Density from pressure and temperature.

◆ vaporPressure()

Real SinglePhaseFluidProperties::vaporPressure ( Real  temperature) const
virtualinherited

Vapor pressure.

Used to delineate liquid and gas phases. Valid for temperatures between the triple point temperature and the critical temperature

Parameters
temperaturewater temperature (K)
Returns
saturation pressure (Pa)

Reimplemented in Water97FluidProperties, CO2FluidProperties, HydrogenFluidProperties, NitrogenFluidProperties, and MethaneFluidProperties.

Definition at line 345 of file SinglePhaseFluidProperties.C.

Referenced by BrineFluidProperties::vaporPressure().

346 {
347  mooseError(name(), ": vaporPressure() is not implemented");
348 }
const std::string name
Definition: Setup.h:22

◆ vaporPressure_dT()

void SinglePhaseFluidProperties::vaporPressure_dT ( Real  temperature,
Real &  psat,
Real &  dpsat_dT 
) const
virtualinherited

Vapor pressure.

Used to delineate liquid and gas phases. Valid for temperatures between the triple point temperature and the critical temperature

Parameters
temperaturewater temperature (K)
[out]saturationpressure (Pa)
[out]derivativeof saturation pressure wrt temperature (Pa/K)

Reimplemented in Water97FluidProperties.

Definition at line 351 of file SinglePhaseFluidProperties.C.

Referenced by PorousFlowWaterNCG::equilibriumMassFractions(), and PorousFlowWaterNCG::gasProperties().

354 {
355  mooseError(name(), ": vaporPressure_dT() is not implemented");
356 }
const std::string name
Definition: Setup.h:22

◆ writeTabulatedData()

void TabulatedFluidProperties::writeTabulatedData ( std::string  file_name)
protected

Writes tabulated data to a file.

Parameters
file_namename of the file to be written

Definition at line 534 of file TabulatedFluidProperties.C.

Referenced by initialSetup().

535 {
536  if (processor_id() == 0)
537  {
538  MooseUtils::checkFileWriteable(file_name);
539 
540  std::ofstream file_out(file_name.c_str());
541 
542  // Write out date and fluid type
543  time_t now = time(&now);
544  file_out << "# " << _fp.fluidName() << " properties created by TabulatedFluidProperties on "
545  << ctime(&now) << "\n";
546 
547  // Write out column names
548  file_out << "pressure, temperature";
549  for (std::size_t i = 0; i < _interpolated_properties.size(); ++i)
550  file_out << ", " << _interpolated_properties[i];
551  file_out << "\n";
552 
553  // Write out the fluid property data
554  for (unsigned int p = 0; p < _num_p; ++p)
555  for (unsigned int t = 0; t < _num_T; ++t)
556  {
557  file_out << _pressure[p] << ", " << _temperature[t];
558  for (std::size_t i = 0; i < _properties.size(); ++i)
559  file_out << ", " << _properties[i][p * _num_T + t];
560  file_out << "\n";
561  }
562  }
563 }
std::vector< std::string > _interpolated_properties
List of properties to be interpolated.
std::vector< Real > _pressure
Pressure vector.
std::vector< Real > _temperature
Temperature vector.
unsigned int _num_T
Number of temperature points in the tabulated data.
std::vector< std::vector< Real > > _properties
Tabulated fluid properties.
unsigned int _num_p
Number of pressure points in the tabulated data.
virtual std::string fluidName() const
Fluid name.
const SinglePhaseFluidProperties & _fp
SinglePhaseFluidPropertiesPT UserObject.

Member Data Documentation

◆ _cp_idx

unsigned int TabulatedFluidProperties::_cp_idx
protected

Definition at line 246 of file TabulatedFluidProperties.h.

Referenced by cp_from_p_T(), and initialSetup().

◆ _csv_reader

MooseUtils::DelimitedFileReader TabulatedFluidProperties::_csv_reader
protected

The MOOSE delimited file reader.

Definition at line 251 of file TabulatedFluidProperties.h.

Referenced by initialSetup(), and TabulatedFluidProperties().

◆ _cv_idx

unsigned int TabulatedFluidProperties::_cv_idx
protected

Definition at line 247 of file TabulatedFluidProperties.h.

Referenced by cv_from_p_T(), and initialSetup().

◆ _density_idx

unsigned int TabulatedFluidProperties::_density_idx
protected

Index of each property.

Definition at line 241 of file TabulatedFluidProperties.h.

Referenced by initialSetup(), and rho_from_p_T().

◆ _enthalpy_idx

unsigned int TabulatedFluidProperties::_enthalpy_idx
protected

Definition at line 242 of file TabulatedFluidProperties.h.

Referenced by h_from_p_T(), and initialSetup().

◆ _entropy_idx

unsigned int TabulatedFluidProperties::_entropy_idx
protected

Definition at line 248 of file TabulatedFluidProperties.h.

Referenced by initialSetup(), and s_from_p_T().

◆ _file_name

FileName TabulatedFluidProperties::_file_name
protected

File name of tabulated data file.

Definition at line 194 of file TabulatedFluidProperties.h.

Referenced by initialSetup().

◆ _fp

const SinglePhaseFluidProperties& TabulatedFluidProperties::_fp
protected

◆ _internal_energy_idx

unsigned int TabulatedFluidProperties::_internal_energy_idx
protected

Definition at line 243 of file TabulatedFluidProperties.h.

Referenced by e_from_p_T(), and initialSetup().

◆ _interpolate_cp

bool TabulatedFluidProperties::_interpolate_cp
protected

Definition at line 236 of file TabulatedFluidProperties.h.

Referenced by cp_from_p_T(), and initialSetup().

◆ _interpolate_cv

bool TabulatedFluidProperties::_interpolate_cv
protected

Definition at line 237 of file TabulatedFluidProperties.h.

Referenced by cv_from_p_T(), and initialSetup().

◆ _interpolate_density

bool TabulatedFluidProperties::_interpolate_density
protected

Set of flags to note whether a property is to be interpolated.

Definition at line 231 of file TabulatedFluidProperties.h.

Referenced by initialSetup(), and rho_from_p_T().

◆ _interpolate_enthalpy

bool TabulatedFluidProperties::_interpolate_enthalpy
protected

Definition at line 232 of file TabulatedFluidProperties.h.

Referenced by h_from_p_T(), and initialSetup().

◆ _interpolate_entropy

bool TabulatedFluidProperties::_interpolate_entropy
protected

Definition at line 238 of file TabulatedFluidProperties.h.

Referenced by initialSetup(), and s_from_p_T().

◆ _interpolate_internal_energy

bool TabulatedFluidProperties::_interpolate_internal_energy
protected

Definition at line 233 of file TabulatedFluidProperties.h.

Referenced by e_from_p_T(), and initialSetup().

◆ _interpolate_k

bool TabulatedFluidProperties::_interpolate_k
protected

Definition at line 235 of file TabulatedFluidProperties.h.

Referenced by initialSetup(), and k_from_p_T().

◆ _interpolate_viscosity

bool TabulatedFluidProperties::_interpolate_viscosity
protected

Definition at line 234 of file TabulatedFluidProperties.h.

Referenced by initialSetup(), and mu_from_p_T().

◆ _interpolated_properties

std::vector<std::string> TabulatedFluidProperties::_interpolated_properties
protected

List of properties to be interpolated.

Definition at line 229 of file TabulatedFluidProperties.h.

Referenced by generateTabulatedData(), initialSetup(), and writeTabulatedData().

◆ _interpolated_properties_enum

MultiMooseEnum TabulatedFluidProperties::_interpolated_properties_enum
protected

Properties to be interpolated entered in the input file.

Definition at line 227 of file TabulatedFluidProperties.h.

Referenced by generateTabulatedData().

◆ _k_idx

unsigned int TabulatedFluidProperties::_k_idx
protected

Definition at line 245 of file TabulatedFluidProperties.h.

Referenced by initialSetup(), and k_from_p_T().

◆ _num_p

unsigned int TabulatedFluidProperties::_num_p
protected

Number of pressure points in the tabulated data.

Definition at line 216 of file TabulatedFluidProperties.h.

Referenced by generateTabulatedData(), initialSetup(), and writeTabulatedData().

◆ _num_T

unsigned int TabulatedFluidProperties::_num_T
protected

Number of temperature points in the tabulated data.

Definition at line 214 of file TabulatedFluidProperties.h.

Referenced by generateTabulatedData(), initialSetup(), and writeTabulatedData().

◆ _pressure

std::vector<Real> TabulatedFluidProperties::_pressure
protected

Pressure vector.

Definition at line 196 of file TabulatedFluidProperties.h.

Referenced by generateTabulatedData(), initialSetup(), and writeTabulatedData().

◆ _pressure_max

Real TabulatedFluidProperties::_pressure_max
protected

Maximum pressure in tabulated data.

Definition at line 212 of file TabulatedFluidProperties.h.

Referenced by checkInputVariables(), generateTabulatedData(), initialSetup(), and TabulatedFluidProperties().

◆ _pressure_min

Real TabulatedFluidProperties::_pressure_min
protected

Minimum pressure in tabulated data.

Definition at line 210 of file TabulatedFluidProperties.h.

Referenced by checkInputVariables(), generateTabulatedData(), initialSetup(), and TabulatedFluidProperties().

◆ _properties

std::vector<std::vector<Real> > TabulatedFluidProperties::_properties
protected

Tabulated fluid properties.

Definition at line 200 of file TabulatedFluidProperties.h.

Referenced by generateTabulatedData(), initialSetup(), and writeTabulatedData().

◆ _property_columns

const std::vector<std::string> TabulatedFluidProperties::_property_columns
protected
Initial value:
{
"density", "enthalpy", "internal_energy", "viscosity", "k", "cv", "cp", "entropy"}

List of possible property column names to be read.

Definition at line 224 of file TabulatedFluidProperties.h.

Referenced by initialSetup().

◆ _property_ipol

std::vector<std::unique_ptr<BicubicInterpolation> > TabulatedFluidProperties::_property_ipol
protected

Interpolated fluid property.

Definition at line 203 of file TabulatedFluidProperties.h.

Referenced by cp_from_p_T(), cv_from_p_T(), e_from_p_T(), h_from_p_T(), initialSetup(), k_from_p_T(), mu_from_p_T(), rho_from_p_T(), and s_from_p_T().

◆ _R

const Real SinglePhaseFluidProperties::_R
protectedinherited

◆ _required_columns

const std::vector<std::string> TabulatedFluidProperties::_required_columns {"pressure", "temperature"}
protected

List of required column names to be read.

Definition at line 222 of file TabulatedFluidProperties.h.

Referenced by initialSetup().

◆ _T_c2k

const Real SinglePhaseFluidProperties::_T_c2k
protectedinherited

◆ _temperature

std::vector<Real> TabulatedFluidProperties::_temperature
protected

Temperature vector.

Definition at line 198 of file TabulatedFluidProperties.h.

Referenced by generateTabulatedData(), initialSetup(), and writeTabulatedData().

◆ _temperature_max

Real TabulatedFluidProperties::_temperature_max
protected

Maximum temperature in tabulated data.

Definition at line 208 of file TabulatedFluidProperties.h.

Referenced by checkInputVariables(), generateTabulatedData(), initialSetup(), and TabulatedFluidProperties().

◆ _temperature_min

Real TabulatedFluidProperties::_temperature_min
protected

Minimum temperature in tabulated data.

Definition at line 206 of file TabulatedFluidProperties.h.

Referenced by checkInputVariables(), generateTabulatedData(), initialSetup(), and TabulatedFluidProperties().

◆ _viscosity_idx

unsigned int TabulatedFluidProperties::_viscosity_idx
protected

Definition at line 244 of file TabulatedFluidProperties.h.

Referenced by initialSetup(), and mu_from_p_T().


The documentation for this class was generated from the following files: