# Using the Fluid Properties module

## Implementation

PorousFlow can use any of the UserObjects in the Fluid Properties module that use the pressure-temperature formulation. A fluid is included in the input file by adding the following block

[./FluidProperties]
[./water]
type = Water97FluidProperties
[../]
[../]

(modules/porous_flow/test/tests/fluids/h2o.i)

To calculate fluid properties, a PorousFlowSingleComponentFluid Material can be used by adding

[Materials]
[./temperature]
type = PorousFlowTemperature
at_nodes = false
temperature = temp
[../]
[./ppss]
type = PorousFlow1PhaseFullySaturated
at_nodes = false
porepressure = pp
[../]
[./water]
type = PorousFlowSingleComponentFluid
at_nodes = false
temperature_unit = Kelvin
fp = water
phase = 0
[../]
[]

(modules/porous_flow/test/tests/fluids/h2o.i)

Fluid density, viscosity, internal energy and enthalpy are calculated by this material (depending on the options chosen, see PorousFlowSingleComponentFluid for details).

Multiple fluids can be included by simply adding additional fluids to the Modules block and corresponding PorousFlowSingleComponentFluid entries in the Materials block.

Due to this design, it is trivial to change the fluid used by simply swapping out the Fluid Properties UserObjects.

note

The fluid properties UserObjects expect temperature in Kelvin.

If the input file uses temperature in Celcius, the temperature_unit option in PorousFlowSingleComponentFluid must be set to Celcius.

## Performance

Computing fluid properties such as density and viscosity can be expensive when using detailed fluid equations of state (such as Water97FluidProperties or CO2FluidProperties). In some cases, these computations can be a significant proportion of the overall time taken.

In order to reduce the computational expense of using high-precision fluid formulations, the Fluid Properties module provides a general UserObject that uses bicubic interpolation to calculate fluid properties, see TabulatedFluidProperties for details. Using interpolation to calculate fluid properties can significantly reduce the computational expense (particularly for CO2FluidProperties, where the density is calculated iteratively from pressure and temperature).

In the PorousFlow module, fluid density and viscosity are typically calculated at the same time. To achieve the maximum benefit from TabulatedFluidProperties, users should ensure that both density and viscosity are calculated by interpolation, by either providing them in the supplied properties file, or making sure that both are specified in the interpolated_properties input parameter if no data file exists.