# TabulatedFluidProperties

Fluid properties using bicubic interpolation on tabulated values provided

The TabulatedFluidProperties UserObject calculates fluid properties using bicubic interpolation of data provided in a text 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 (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.

## 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. These are: density, enthalpy, internal_energy, viscosity, k (the thermal conductivity), cp (the isobaric specific heat capacity), cv (the 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.

## Using TabulatedFluidProperties

### Reading from an existing file

Consider the example where TabulatedFluidProperties 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 interpolation, while all remaining properties provided by the FluidProperties interface will be calculated using a CO2FluidProperties UserObject.

The input file syntax necessary to achieve this is

[Modules]
[./FluidProperties]
[./co2]
type = CO2FluidProperties
[../]
[./tabulated]
type = TabulatedFluidProperties
fp = co2
fluid_property_file = fluid_properties.csv
[../]
[]
[]

(modules/fluid_properties/test/tests/tabulated/tabulated.i)

### Writing data file

If no tabulated fluid property data file exists, then data for the properties specified in the input file parameter interpolated_properties will be generated using 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


[Modules]
[./FluidProperties]
[./co2]
type = CO2FluidProperties
[../]
[./tabulated]
type = TabulatedFluidProperties
fp = co2
fluid_property_file = fluid_properties.csv
interpolated_properties = 'density enthalpy viscosity'
temperature_min = 300
temperature_max = 400
pressure_min = 1e6
pressure_max = 10e6
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 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.

note

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 using bicubic interpolation, while all remaining fluid properties will be calculated using the provided FluidProperties UserObject.

## Input Parameters

• fpThe name of the FluidProperties UserObject

C++ Type:UserObjectName

Options:

Description:The name of the FluidProperties UserObject

### Required Parameters

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

Default:False

C++ Type:bool

Options:

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

• pressure_max5e+07Maximum pressure for tabulated data. Default is 50 MPa

Default:5e+07

C++ Type:double

Options:

Description:Maximum pressure for tabulated data. Default is 50 MPa

• num_T100Number of points to divide temperature range. Default is 100

Default:100

C++ Type:unsigned int

Options:

Description:Number of points to divide temperature range. Default is 100

• pressure_min100000Minimum pressure for tabulated data. Default is 0.1 MPa)

Default:100000

C++ Type:double

Options:

Description:Minimum pressure for tabulated data. Default is 0.1 MPa)

• temperature_max500Maximum temperature for tabulated data. Default is 500 K

Default:500

C++ Type:double

Options:

Description:Maximum temperature for tabulated data. Default is 500 K

• fluid_property_filefluid_properties.csvName of the csv file containing the tabulated fluid property data. If no file exists and save_file = true, then one will be written to fluid_properties.csv using the temperature and pressure range specified.

Default:fluid_properties.csv

C++ Type:FileName

Options:

Description:Name of the csv file containing the tabulated fluid property data. If no file exists and save_file = true, then one will be written to fluid_properties.csv using the temperature and pressure range specified.

• save_fileTrueWhether to save the csv fluid properties file

Default:True

C++ Type:bool

Options:

Description:Whether to save the csv fluid properties file

• num_p100Number of points to divide pressure range. Default is 100

Default:100

C++ Type:unsigned int

Options:

Description:Number of points to divide pressure range. Default is 100

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

Default:TIMESTEP_END

C++ Type:ExecFlagEnum

Options:NONE INITIAL LINEAR NONLINEAR TIMESTEP_END TIMESTEP_BEGIN FINAL CUSTOM

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

• 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 cv cp entropy

Description:Properties to interpolate if no data file is provided

• temperature_min300Minimum temperature for tabulated data. Default is 300 K)

Default:300

C++ Type:double

Options:

Description:Minimum temperature for tabulated data. Default is 300 K)

### Optional Parameters

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

C++ Type:std::vector

Options:

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

• enableTrueSet the enabled status of the MooseObject.

Default:True

C++ Type:bool

Options:

Description:Set the enabled status of the MooseObject.

• 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

Options:

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).

• force_preauxFalseForces the GeneralUserObject to be executed in PREAUX

Default:False

C++ Type:bool

Options:

Description:Forces the GeneralUserObject to be executed in PREAUX

• 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

Options:

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.