TabulatedFluidProperties

Single phase fluid properties computed using bi-dimensional interpolation of tabulated values.

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 object is requested to provide a fluid property outside this phase space.

This class is intended to be used when complicated formulations for fluid properties (such as density or internal energy) are required, which can be computationally expensive. This is particularly the case when 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 example, density must be solved iteratively using pressure and temperature, which increases the computational burden.

Using an interpolation of tabulated fluid properties can significantly reduce the computational time for computing fluid properties defined using complex equations of state, which may reduce the overall computational cost dramatically, especially if fluid properties are calculated a large number of times.

commentnote

TabulatedFluidProperties is a base class and may not be used. A derived class, specifying an interpolation method to use to interpolate between the tabulated data, must be used instead. Currently only bicubic tabular interpolation is implemented. Bilinear interpolation is a work in progress.

File format

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 also any number of the fluid properties that TabulatedFluidProperties understands. The exact names used are:

  • density

  • enthalpy

  • v (specific_volume)

  • internal_energy

  • viscosity

  • k (the thermal conductivity)

  • g (gibbs free energy)

  • cp (the isobaric specific heat capacity)

  • cv (the isochoric specific heat capacity)

  • c (speed of sound in fluid)

  • entropy

commentnote

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, with two pressure points and three temperature points, 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

Using TabulatedFluidProperties

Reading from an existing file

Consider the example where a TabulatedFluidProperties object is used to reduce the cost of calculating CO fluid properties. In this example, a file containing the tabulated fluid properties, named fluid_properties.csv is provided. All properties listed in this file will be calculated using either Bilinear or Bicubic interpolation (the interpolation type is to be specified in the input file), while all remaining properties provided by the FluidProperties interface will be calculated using a CO2FluidProperties object.

The input file syntax necessary to achieve this with a (pressure, temperature) variable set is shown below. A TabulatedBicubicFluidProperties is used.

[FluidProperties]
  [co2]
    type = CO2FluidProperties
  []
  [tabulated]
    type = TabulatedBicubicFluidProperties
    fp = co2
    interpolated_properties = 'density enthalpy viscosity internal_energy k c cv cp entropy'
    # fluid_property_file = fluid_properties.csv
    construct_pT_from_ve = false
    construct_pT_from_vh = false

    # Tabulation range
    temperature_min = 280
    temperature_max = 600
    pressure_min = 1e5
    pressure_max = 3e6

    # Newton parameters
    tolerance = 1e-8
    T_initial_guess = 350
    p_initial_guess = 1.5e5
  []
[]
(moose/modules/fluid_properties/test/tests/tabulated/tabulated.i)

With a (specific volume, specific energy) variable set, the syntax shown in the example file below may be used:

[FluidProperties]
  [co2]
    type = IdealGasFluidProperties
  []
  [tabulated]
    type = TabulatedBicubicFluidProperties
    interpolated_properties = 'density enthalpy viscosity internal_energy k c cv cp entropy'

    # Uncomment this to read the tabulation
    # fluid_property_file = fluid_properties.csv
    # Uncomment this to use the CO2 fluid properties above
    # fp = 'co2'

    # Uncomment this to write out a tabulation
    # fluid_property_output_file = 'fluid_properties.csv'

    # Enable the use of the (v,e) variables
    construct_pT_from_ve = true
    construct_pT_from_vh = true
    out_of_bounds_behavior = 'set_to_closest_bound'

    # Tabulation range
    temperature_min = 280
    temperature_max = 600
    pressure_min = 1e5
    pressure_max = 7e5

    # Newton parameters
    tolerance = 1e-8
    T_initial_guess = 310
    p_initial_guess = 1.8e5
  []
[]
(moose/modules/fluid_properties/test/tests/tabulated/tabulated_v_e.i)

Writing data file

The TabulatedFluidProperties-derived classes can write a file containing the data for the properties specified in the input file parameter interpolated_properties. It will use the pressure and temperature ranges specified in the input file at the beginning of the simulation.

For example, if we wish to generate a file containing tabulated properties for CO density, enthalpy and viscosity for and , divided into 50 and 100 equal points, respectively, then the input file syntax necessary is


[FluidProperties]
  [co2]
    type = CO2FluidProperties
  []
  [tabulated]
    type = TabulatedBicubicFluidProperties
    fp = co2
    fluid_property_output_file = fluid_properties.csv
    interpolated_properties = 'density enthalpy viscosity'

    # Bounds of interpolation
    temperature_min = 300
    temperature_max = 400
    pressure_min = 1e6
    pressure_max = 10e6

    # Grid discretization
    num_T = 50
    num_p = 100
  []
[]

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 object are used, the initial time to generate the data and the subsequent interpolation time can be much less than using the original FluidProperties object.

Using the "construct_pT_from_ve" parameter and the "fluid_property_output_file" parameters, a tabulation using the (specific volume, specific internal energy) variables can be generated. The output file name for this additional tabulation will be suffixed with _ve.csv.

commentnote

All fluid properties read from a file or specified in the input file (and their derivatives with respect to pressure and temperature) will be calculated through interpolation, while all remaining (or missing) fluid properties will be calculated using the provided FluidProperties object.

Using alternative variable sets

The (pressure, temperature) variable set is not adequate for all fluid flow applications, and alternative variable sets may be used with TabulatedFluidProperties objects. (specific volume (v), specific internal energy (e)), and (specific volume, specific enthalpy (h)) are supported.

Option 1: Creation of interpolations between variable sets

The first option is to use (pressure, temperature) variable for all fluid properties, and rely on tabulated conversions from (specific volume, specific internal energy / enthalpy) to (pressure, temperature) to compute properties. This option is selected with the "construct_pT_from_ve" and "construct_pT_from_vh" parameters. The workflow is as follows:

  • The data is read from a data file tabulated with pressure and temperature, and interpolations based on pressure and temperature are created for each tabulated property.

  • The pressure and temperature data is converted to the alternative variable set (for example (v,e)) using Newton's method. The inversion uses the interpolations created from the tabulated data, or if available the FluidProperties object as this reduces the error.

  • A grid of values for pressure and temperature is computed for the alternative variable set. This is used to create a tabulated interpolation from the alternative variable set to the (pressure, temperature) variable set. This process is described in the next section, see Generating (v,e) to (p,T) conversion interpolations.

  • When querying a fluid property using the alternative variable set, the interpolations are first used to convert to the (pressure, temperature) variable set (for example, computing and ). Then the fluid property desired is queried using this variable set (for example, ) and returned. This can be summarized as

commentnote

The additional variable sets supported are and . A few properties may be computed using alternative variable sets: and for example.

commentnote

File data may only be read and written with the (pressure, temperature) variable set. The alternative variable set must be either contained in the tabulation read or be computable from pressure and temperature in the FluidProperties object.

Generating (v,e) to (p,T) conversion interpolations

As fluid properties are much more often tabulated using pressure and temperature than alternative variable sets, the alternative variables are systematically converted to pressure and temperature to perform the fluid property evaluations. This involves the creation of an interpolation of pressure and temperature using the alternative variable sets. This is done in several sets, described for the set:

  • A grid of data is generated. If a fluid property user object is provided, the bounds are based on the specified bounds on pressure and temperature : , else the bounds are chosen from the tabulated data. The number of points in the grid in both dimensions are user-selected parameters. The v grid may be created using base-10 log-spacing by setting "use_log_grid_v". The e grid may be created using base-10 log-spacing by setting "use_log_grid_e".

  • These bounds may not be physically realizable simultaneously. It could be that the fluid may not have both and . Part of the grid may not be physical.

  • The pressure and temperature are then calculated for every point in the grid by using the Newton method utilities. Note that sometimes pressure and temperature values can be outside the user-defined range during this variable set inversion. when this is the case, the values are replaced with their respective minimum and maximum values. This only means that the interpolations will be constant over part of the grid, which should be outside of the range of interest.

  • An interpolation object, very similar to the ones created for the other fluid properties based on data, is created for both variables of the alternative set. This object can then compute: and .

commentnote

Warnings will be output when a pressure or temperature value is limited to its bound, and when an inversion from the alternative variable set to pressure or temperature fails, often because the grid extends beyond physically reachable values.

Option 2: Using interpolations in (v,e) of the fluid properties

To avoid the difficulties in converting from (v,e) to (pressure, temperature) and then evaluating the properties with (pressure, temperature), the properties can also be interpolated in (v,e). These interpolations can be created from either another FluidProperties object, with the "fp", or from a (specific volume, specific internal energy) tabulation, using the "fluid_property_ve_file" parameter.

Similarly as for (pressure, temperature), the list of properties to interpolate should be provided using the "interpolated_properties" parameter.

The format of the tabulation is similar to the one mentioned in File format, except that specific volume and specific internal energy replace pressure and temperature for the tabulation variables. Pressure and temperature will likely instead appear as the tabulated properties, so that temperature(v,e) and pressure(v,e) can be computed directly from interpolations.

Input Parameters

  • allow_fp_and_tabulationFalseWhether to allow the two sources of data concurrently

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Whether to allow the two sources of data concurrently

  • create_pT_interpolationsTrueWhether to load (from file) or create (from a fluid property object) properties interpolations from pressure and temperature

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Whether to load (from file) or create (from a fluid property object) properties interpolations from pressure and temperature

  • create_ve_interpolationsFalseWhether to load (from file) or create (from a fluid property object) properties interpolations from pressure and temperature

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Whether to load (from file) or create (from a fluid property object) properties interpolations from pressure and temperature

  • execute_onTIMESTEP_ENDThe list of flag(s) indicating when this object should be executed, the available options include NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM.

    Default:TIMESTEP_END

    C++ Type:ExecFlagEnum

    Options:NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM

    Controllable:No

    Description:The list of flag(s) indicating when this object should be executed, the available options include NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM.

  • fluid_property_output_fileName of the CSV file which can be output with the tabulation. This file can then be read as a 'fluid_property_file'

    C++ Type:FileName

    Controllable:No

    Description:Name of the CSV file which can be output with the tabulation. This file can then be read as a 'fluid_property_file'

  • fluid_property_ve_fileName of the csv file containing the tabulated (v,e) fluid property data.

    C++ Type:FileName

    Controllable:No

    Description:Name of the csv file containing the tabulated (v,e) fluid property data.

  • fluid_property_ve_output_fileName of the CSV file which can be output with the (v,e) tabulation. This file can then be read as a 'fluid_property_ve_file'

    C++ Type:FileName

    Controllable:No

    Description:Name of the CSV file which can be output with the (v,e) tabulation. This file can then be read as a 'fluid_property_ve_file'

  • fpThe name of the FluidProperties UserObject

    C++ Type:UserObjectName

    Controllable:No

    Description:The name of the FluidProperties UserObject

  • interpolated_propertiesdensity enthalpy internal_energy viscosityProperties to interpolate if no data file is provided

    Default:density enthalpy internal_energy viscosity

    C++ Type:MultiMooseEnum

    Options:density, enthalpy, internal_energy, viscosity, k, c, cv, cp, entropy, pressure, temperature

    Controllable:No

    Description:Properties to interpolate if no data file is provided

  • prop_getter_suffixAn optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.

    C++ Type:MaterialPropertyName

    Controllable:No

    Description:An optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.

  • use_interpolated_stateFalseFor the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.

    Default:False

    C++ Type:bool

    Controllable:No

    Description:For the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.

  • use_log_grid_eFalseOption to use a base-10 logarithmically-spaced grid for specific internal energy instead of a linearly-spaced grid.

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Option to use a base-10 logarithmically-spaced grid for specific internal energy instead of a linearly-spaced grid.

Optional Parameters

  • T_initial_guess400Temperature initial guess for Newton Method variable set conversion

    Default:400

    C++ Type:double

    Controllable:No

    Description:Temperature initial guess for Newton Method variable set conversion

  • p_initial_guess200000Pressure initial guess for Newton Method variable set conversion

    Default:200000

    C++ Type:double

    Controllable:No

    Description:Pressure initial guess for Newton Method variable set conversion

  • tolerance1e-08Tolerance for 2D Newton variable set conversion

    Default:1e-08

    C++ Type:double

    Controllable:No

    Description:Tolerance for 2D Newton variable set conversion

Variable Set Conversions Newton Solve Parameters

  • allow_duplicate_execution_on_initialFalseIn the case where this UserObject is depended upon by an initial condition, allow it to be executed twice during the initial setup (once before the IC and again after mesh adaptivity (if applicable).

    Default:False

    C++ Type:bool

    Controllable:No

    Description:In the case where this UserObject is depended upon by an initial condition, allow it to be executed twice during the initial setup (once before the IC and again after mesh adaptivity (if applicable).

  • allow_imperfect_jacobiansFalsetrue to allow unimplemented property derivative terms to be set to zero for the AD API

    Default:False

    C++ Type:bool

    Controllable:No

    Description:true to allow unimplemented property derivative terms to be set to zero for the AD API

  • control_tagsAdds user-defined labels for accessing object parameters via control logic.

    C++ Type:std::vector<std::string>

    Controllable:No

    Description:Adds user-defined labels for accessing object parameters via control logic.

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Controllable:Yes

    Description:Set the enabled status of the MooseObject.

  • execution_order_group0Execution order groups are executed in increasing order (e.g., the lowest number is executed first). Note that negative group numbers may be used to execute groups before the default (0) group. Please refer to the user object documentation for ordering of user object execution within a group.

    Default:0

    C++ Type:int

    Controllable:No

    Description:Execution order groups are executed in increasing order (e.g., the lowest number is executed first). Note that negative group numbers may be used to execute groups before the default (0) group. Please refer to the user object documentation for ordering of user object execution within a group.

  • force_postauxFalseForces the UserObject to be executed in POSTAUX

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Forces the UserObject to be executed in POSTAUX

  • force_preauxFalseForces the UserObject to be executed in PREAUX

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Forces the UserObject to be executed in PREAUX

  • force_preicFalseForces the UserObject to be executed in PREIC during initial setup

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Forces the UserObject to be executed in PREIC during initial setup

  • fp_typesingle-phase-fpType of the fluid property object

    Default:single-phase-fp

    C++ Type:FPType

    Controllable:No

    Description:Type of the fluid property object

  • use_displaced_meshFalseWhether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Whether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.

Advanced Parameters

  • construct_pT_from_veFalseIf the lookup table (p, T) as functions of (v, e) should be constructed.

    Default:False

    C++ Type:bool

    Controllable:No

    Description:If the lookup table (p, T) as functions of (v, e) should be constructed.

  • construct_pT_from_vhFalseIf the lookup table (p, T) as functions of (v, h) should be constructed.

    Default:False

    C++ Type:bool

    Controllable:No

    Description:If the lookup table (p, T) as functions of (v, h) should be constructed.

Variable Set Conversion Parameters

  • e_maxMaximum specific internal energy for tabulated data.

    C++ Type:double

    Controllable:No

    Description:Maximum specific internal energy for tabulated data.

  • e_minMinimum specific internal energy for tabulated data.

    C++ Type:double

    Controllable:No

    Description:Minimum specific internal energy for tabulated data.

  • out_of_bounds_behaviorthrowProperty evaluation behavior when evaluated outside the user-specified or tabulation-specified bounds

    Default:throw

    C++ Type:MooseEnum

    Options:ignore, throw, declare_invalid, set_to_closest_bound

    Controllable:No

    Description:Property evaluation behavior when evaluated outside the user-specified or tabulation-specified bounds

  • pressure_max5e+07Maximum pressure for tabulated data.

    Default:5e+07

    C++ Type:double

    Controllable:No

    Description:Maximum pressure for tabulated data.

  • pressure_min100000Minimum pressure for tabulated data.

    Default:100000

    C++ Type:double

    Controllable:No

    Description:Minimum pressure for tabulated data.

  • temperature_max500Maximum temperature for tabulated data.

    Default:500

    C++ Type:double

    Controllable:No

    Description:Maximum temperature for tabulated data.

  • temperature_min300Minimum temperature for tabulated data.

    Default:300

    C++ Type:double

    Controllable:No

    Description:Minimum temperature for tabulated data.

  • v_maxMaximum specific volume for tabulated data.

    C++ Type:double

    Controllable:No

    Description:Maximum specific volume for tabulated data.

  • v_minMinimum specific volume for tabulated data.

    C++ Type:double

    Controllable:No

    Description:Minimum specific volume for tabulated data.

Tabulation And Interpolation Bounds Parameters

  • fluid_property_fileName of the csv file containing the tabulated fluid property data.

    C++ Type:FileName

    Controllable:No

    Description:Name of the csv file containing the tabulated fluid property data.

Tabulation File Read/Write Parameters

  • num_T100Number of points to divide temperature range.

    Default:100

    C++ Type:unsigned int

    Controllable:No

    Description:Number of points to divide temperature range.

  • num_e100Number of points to divide specific internal energy range for (v,e) lookups.

    Default:100

    C++ Type:unsigned int

    Controllable:No

    Description:Number of points to divide specific internal energy range for (v,e) lookups.

  • num_p100Number of points to divide pressure range.

    Default:100

    C++ Type:unsigned int

    Controllable:No

    Description:Number of points to divide pressure range.

  • num_v100Number of points to divide specific volume range for (v,e) lookups.

    Default:100

    C++ Type:unsigned int

    Controllable:No

    Description:Number of points to divide specific volume range for (v,e) lookups.

  • use_log_grid_vFalseOption to use a base-10 logarithmically-spaced grid for specific volume instead of a linearly-spaced grid.

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Option to use a base-10 logarithmically-spaced grid for specific volume instead of a linearly-spaced grid.

Tabulation And Interpolation Discretization Parameters