FluidProperties System
Overview
FluidProperties
objects define interfaces for computing thermodynamic properties of fluids (liquids and gases). The consistent interface allows different fluids to be used in an input file by simply swapping the name of the Fluid Properties UserObject in a plug-and-play manner.
There are multiple base classes suited to different phase and component combinations, as well as to different applications:
HEMFluidProperties
: single component, single phase, HEM formulationMultiComponentFluidProperties
: two components, single phase, formulationSinglePhaseFluidProperties: single component, single phase
TwoPhaseFluidProperties
: single component, two phasesVaporMixtureFluidProperties
: multiple components, single (vapor) phase
Usage
Fluid properties objects are GeneralUserObject
s that have empty initialize()
, execute()
and finalize()
methods, so they do nothing during a simulation. Their purpose is to provide convenient access to fluid properties through the existing UserObject interface.
All Fluid Properties UserObjects can be accessed in MOOSE objects through the usual UserObject interface. The following example provides a detailed explanation of the steps involved to use the Fluid Properties UserObjects in other MOOSE objects, and the syntax required in the input file.
This example is for a problem that has energy-volume as the primary variables. A material is provided to calculate fluid properties at the quadrature points.
Source
To access the fluid properties defined in the Fluid Properties module in a MOOSE object, the source code of the object must include the following lines of code.
In the header file of the material, a const
reference to the base SinglePhaseFluidProperties object is required:
const SinglePhaseFluidProperties & _fp;
(moose/modules/fluid_properties/include/materials/FluidPropertiesMaterialVE.h)A forward declaration to the SinglePhaseFluidProperties class is required at the beginning of the header file.
class SinglePhaseFluidProperties;
(moose/modules/fluid_properties/include/materials/FluidPropertiesMaterialVE.h)In the source file, the SinglePhaseFluidProperties
class must be included
#include "SinglePhaseFluidProperties.h"
(moose/modules/fluid_properties/src/materials/FluidPropertiesMaterialVE.C)The Fluid Properties UserObject is passed to this material in the input file by adding a UserObject name parameters in the input parameters:
params.addRequiredParam<UserObjectName>("fp", "The name of the user object for fluid properties");
(moose/modules/fluid_properties/src/materials/FluidPropertiesMaterialVE.C)The reference to the UserObject is then initialized in the constructor using
_fp(getUserObject<SinglePhaseFluidProperties>("fp"))
(moose/modules/fluid_properties/src/materials/FluidPropertiesMaterialVE.C)The properties defined in the Fluid Properties UserObject can now be accessed through the reference. In this material, the computeQpProperties
method calculates a number of properties at the quadrature points using the values of _v[_qp]
and _e[_qp]
.
FluidPropertiesMaterialVE::computeQpProperties()
{
_p[_qp] = _fp.p_from_v_e(_v[_qp], _e[_qp]);
_T[_qp] = _fp.T_from_v_e(_v[_qp], _e[_qp]);
_c[_qp] = _fp.c_from_v_e(_v[_qp], _e[_qp]);
_cp[_qp] = _fp.cp_from_v_e(_v[_qp], _e[_qp]);
_cv[_qp] = _fp.cv_from_v_e(_v[_qp], _e[_qp]);
_mu[_qp] = _fp.mu_from_v_e(_v[_qp], _e[_qp]);
_k[_qp] = _fp.k_from_v_e(_v[_qp], _e[_qp]);
_s[_qp] = _fp.s_from_v_e(_v[_qp], _e[_qp]);
_g[_qp] = _fp.g_from_v_e(_v[_qp], _e[_qp]);
}
(moose/modules/fluid_properties/src/materials/FluidPropertiesMaterialVE.C)In a similar fashion, fluid properties can be accessed using the Automatic Differentiation interface using the DualReal
version which provides both the value and derivatives
DualReal rho = _fp.p_from_T_v(T, v);
where and are DualReal
's. The result (density rho
in this example) then contains both the value of density and its derivatives with respect to the primary variables T
and v
.
Input file syntax
The Fluid Properties UserObjects are implemented in an input file in the FluidProperties
block. For example, to use the ideal gas formulation for specific volume and energy, the input file syntax would be:
[FluidProperties]
[./ideal_gas]
type = IdealGasFluidProperties
gamma = 1.4
molar_mass = 1.000536678700361
[../]
[]
(moose/modules/fluid_properties/test/tests/ideal_gas/test.i)In this example, the user has specified a value for gamma
(the ratio of isobaric to isochoric specific heat capacities), and R
, the universal gas constant.
The fluid properties can then be accessed by other MOOSE objects through the name given in the input file.
[Materials]
[./fp_mat]
type = FluidPropertiesMaterialVE
e = e
v = v
fp = ideal_gas
[../]
[]
(moose/modules/fluid_properties/test/tests/ideal_gas/test.i)Due to the consistent interface for fluid properties, a different fluid can be substituted in the input file be changing the type of the UserObject. For example, to use a stiffened gas instead of an ideal gas, the only modification required in the input file is
[FluidProperties]
[./sg]
type = StiffenedGasFluidProperties
gamma = 2.35
q = -1167e3
q_prime = 0
p_inf = 1.e9
cv = 1816
mu = 0.9
k = 0.6
[../]
[]
(moose/modules/fluid_properties/test/tests/stiffened_gas/test.i)Creating additional fluids
New fluids can be added to the Fluid Properties module by inheriting from the base class and overriding the methods that describe the fluid properties. These can then be used in an identical manner as all other Fluid Properties UserObjects.
Utilities
Fluid Properties Interrogator
The FluidPropertiesInterrogator is a user object which can be used to query eligible fluid properties objects.
Fluid properties materials
The FluidPropertiesMaterialVE and FluidPropertiesMaterialPT are materials which define many fluid properties as material properties, mainly for visualizing them over the solve domain.
Available Objects
- Fluid Properties App
- BrineFluidPropertiesFluid properties for brine
- CO2FluidPropertiesFluid properties for carbon dioxide (CO2) using the Span & Wagner EOS
- CaloricallyImperfectGasFluid properties for an ideal gas with imperfect caloric behavior.
- FlibeFluidPropertiesFluid properties for flibe
- FlinakFluidPropertiesFluid properties for flinak
- HeliumFluidPropertiesFluid properties for helium
- HydrogenFluidPropertiesFluid properties for Hydrogen (H2)
- IdealGasFluidPropertiesFluid properties for an ideal gas
- IdealRealGasMixtureFluidPropertiesClass for fluid properties of an arbitrary vapor mixture
- LeadBismuthFluidPropertiesFluid properties for Lead Bismuth eutectic 2LiF-BeF2
- LeadFluidPropertiesFluid properties for Lead
- MethaneFluidPropertiesFluid properties for methane (CH4)
- NaClFluidPropertiesFluid properties for NaCl
- NaKFluidPropertiesFluid properties for NaK
- NitrogenFluidPropertiesFluid properties for Nitrogen (N2)
- SimpleFluidPropertiesFluid properties for a simple fluid with a constant bulk density
- SodiumPropertiesFluid properties for sodium
- SodiumSaturationFluidPropertiesFluid properties for liquid sodium at saturation conditions
- StiffenedGasFluidPropertiesFluid properties for a stiffened gas
- StiffenedGasTwoPhaseFluidPropertiesTwo-phase stiffened gas fluid properties
- TabulatedBicubicFluidPropertiesFluid properties using bicubic interpolation on tabulated values provided
- TabulatedFluidPropertiesFluid properties using bicubic interpolation on tabulated values provided
- TemperaturePressureFunctionFluidPropertiesSingle-phase fluid properties that allows to provide thermal conductivity, density, and viscosity as functions of temperature and pressure.
- TwoPhaseFluidPropertiesIndependent2-phase fluid properties for 2 independent single-phase fluid properties
- Water97FluidPropertiesFluid properties for water and steam (H2O) using IAPWS-IF97
Available Actions
- Fluid Properties App
- AddFluidPropertiesActionAdd a UserObject object to the simulation.