fvars: FEHM thermodynamic calculations

It is occasionally useful to be able to calculate thermodynamic properties of the fluids that FEHM simulates. For convenience, the functions that calculate these properties, for two-phase water and CO2, are supplied here. Density (dens()), enthalpy (enth()) and viscosity (visc()), and their corresponding derivatives with respect to pressure and temperature, can be calculated for given pressure and temperature conditions. Furthermore, the position and derivatives of the saturation line for water can be calculated for a given temperature or pressure (sat() and tsat()).

Note, these functions are vectorised; that is, the user can supply vectors of temperature and pressure to output a vector of the corresponding variable.

Functions

fvars.dens(P, T, derivative='')[source]

Return liquid water, vapor water and CO2 density, or derivatives with respect to temperature or pressure, for specified temperature and pressure.

Parameters:
  • P (fl64) – Pressure (MPa).
  • T (str) – Temperature (degC)
  • derivative – Supply ‘T’ or ‘temperature’ for derivatives with respect to temperature, or ‘P’ or ‘pressure’ for derivatives with respect to pressure.
Returns:

Three element tuple containing (liquid, vapor, CO2) density or derivatives if requested.

fvars.enth(P, T, derivative='')[source]

Return liquid water, vapor water and CO2 enthalpy, or derivatives with respect to temperature or pressure, for specified temperature and pressure.

Parameters:
  • P (fl64) – Pressure (MPa).
  • T (str) – Temperature (degC)
  • derivative – Supply ‘T’ or ‘temperature’ for derivatives with respect to temperature, or ‘P’ or ‘pressure’ for derivatives with respect to pressure.
Returns:

Three element tuple containing (liquid, vapor, CO2) enthalpy or derivatives if requested.

fvars.visc(P, T, derivative='')[source]

Return liquid water, vapor water and CO2 viscosity, or derivatives with respect to temperature or pressure, for specified temperature and pressure.

Parameters:
  • P (fl64) – Pressure (MPa).
  • T (str) – Temperature (degC)
  • derivative – Supply ‘T’ or ‘temperature’ for derivatives with respect to temperature, or ‘P’ or ‘pressure’ for derivatives with respect to pressure.
Returns:

Three element tuple containing (liquid, vapor, CO2) viscosity or derivatives if requested.

fvars.sat(T)[source]

Return saturation pressure and first derivative for given temperature.

Parameters:T (fl64) – Temperature (degC)
Returns:Two element tuple containing (saturation pressure, derivative).
fvars.tsat(P)[source]

Return saturation temperature and first derivative for given pressure.

Parameters:P (fl64) – Pressure (degC)
Returns:Two element tuple containing (saturation temperature, derivative).
fvars.fluid_column(z, Tgrad, Tsurf, Psurf, iterations=3)[source]

Calculate thermodynamic properties of a column of fluid.

Parameters:
  • z (ndarray) – Vector of depths at which to return properties. If z does not begin at 0, this will be prepended.
  • Tgrad (fl64) – Temperature gradient in the column (degC / m).
  • Tsurf (fl64) – Surface temperature (degC).
  • Psurf – Surface pressure (MPa).
  • iterations (int) – Number of times to recalculate column pressure based on updated density.
Returns:

Three element tuple containing (liquid, vapor, CO2) properties. Each contains a three column array corresponding to pressure, temperature, density, enthalpy and viscosity of the fluid.

Examples

  1. Calculate the density of liquid water at 10 MPa and 150degC
rho=dens(10,150)[0]
  1. Calculate the derivative of water vapor enthalpy with respect to temperature, at 2 MPa and 200 - 250 degC.
dhdt=enth(2,np.linspace(200,250,10),'T')[1]
  1. Calculate the pressure at which water turns two-phase, for a temperature of 200degC.
Psat=sat(200)[0]
  1. Calculate the viscosity of CO2 at 40degC and 9 MPa.
mu=visc(9,40)[2]
  1. Calculate the pressure of a column of CO2, with a surface pressure of 8 MPa, and a geothermal gradient of 25degC / km.

z=np.linspace(0,4e3,200)

Pco2=fluid_column(z,0.025,20,8)[2][:,0]