jaxprop.bicubic.bicubic_interpolation module#

class jaxprop.bicubic.bicubic_interpolation.FluidBicubic(fluid_name: str, backend: str, h_min: float, h_max: float, p_min: float, p_max: float, N_h: int, N_p: int, N_p_sat: int = 60, mixture_ratio: float = None, metastable_phase: str = None, coarse_step: int = 10, gradient_method: str = 'central', identifier: str = None, table_name: str = None, table_dir: str = 'fluid_tables')[source]#

Bases: Module

Fluid model using bicubic property interpolation on an enthalpy-pressure grid.

Workflow:
  • On construction, attempts to load a precomputed table from disk.

  • If not found, generates the table with finite-difference derivatives, saves it to disk, and stores it in memory.

  • On get_props, performs bicubic interpolation at the requested state.

Table generation uses forward finite differences for first and mixed derivatives

Parameters:
fluid_namestr

Fluid identifier for CoolProp.

backendstr

CoolProp backend string.

h_min, h_maxfloat

Min/max enthalpy [J/kg].

p_min, p_maxfloat

Min/max pressure [Pa].

N_h, N_pint

Number of grid points in h and p.

coarse_stepint

Number of points to skip when determining the initial guess during 2D inverse interpolations

table_namestr, optional

Name of the table pickle file (default: “{fluid_name}_{N_h}x{N_p}”).

table_dirstr, optional

Directory for saving/loading table pickle (default: “fluid_tables”).

identifierstr, optional

Tag stored in the returned FluidState objects.

Methods

get_state

get_state_saturation

N_h: int#
N_p: int#
N_p_sat: int#
PROPERTY_CALCULATORS = {9: <function FluidBicubic.<lambda>>, 10: <function FluidBicubic.<lambda>>, 18: <function FluidBicubic.<lambda>>, 20: <function FluidBicubic.<lambda>>, 22: <function FluidBicubic.<lambda>>, 26: <function FluidBicubic.<lambda>>, 30: <function FluidBicubic.<lambda>>, 32: <function FluidBicubic.<lambda>>}#
backend: str#
coarse_step: int#
critical_point: dict#
delta_h: float#
delta_logP: float#
delta_logP_sat: float#
fluid_name: str#
get_state(input_type, val1, val2)[source]#
get_state_saturation(pressure)[source]#
grad_method: str#
h_max: float#
h_min: float#
h_vals: Array#
identifier: str#
logP_sat_vals: Array#
logP_vals: Array#
metadata: dict#
metastable_phase: str#
mixture_ratio: float#
p_max: float#
p_min: float#
table: dict#
table_dir: str#
table_name: str#
jaxprop.bicubic.bicubic_interpolation.compute_bicubic_coefficients(value, grad_h, grad_logP, grad_hlogP, delta_h, delta_logP)[source]#