jaxprop.bicubic package#
Public bicubic evaluator and coefficient-construction utility.
- class jaxprop.bicubic.FluidBicubic(fluid_name: str = None, backend: str = 'HEOS', h_min: float = None, h_max: float = None, p_min: float = None, p_max: float = None, N_h: int = None, N_p: int = None, 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', *, name: str = None, inverse_max_steps: int = 64, inverse_tolerance: float = 1e-10, metastable_domain: str = 'physical', phase_support: bool = False)[source]#
Bases:
SourceReferencesMixin,ModuleFluid 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_state, performs bicubic interpolation at the requested state.
Generation uses the selected finite-difference scheme. Cache reuse requires an exact generation manifest, verified source identity and valid arrays.
- 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
- inverse_max_stepsint, optional
Nonnegative iteration limit for property-pair inverses (default: 64).
- inverse_tolerancefloat, optional
Positive tolerance for the nonlinear solver and its independent scaled residual check (default: 1e-10). These inverse controls do not change table generation or the persisted cache identity.
- metastable_domain{‘physical’, ‘formal’}, optional
Physical metastable tables require positive constant-volume heat capacity and isothermal bulk modulus at source samples. Formal mode explicitly permits calorically unstable homogeneous EOS states for research. Cells that may cross a heat-capacity pole do not expose the affected response properties. Both modes retain mechanical guards. Stability is prepared during construction, with no added EOS queries in interpolation. The default is ‘physical’.
- table_namestr, optional
File stem. The default includes a digest of the complete generation identity so different configurations can coexist in one cache directory.
- table_dirstr, optional
Directory for saving/loading table pickle (default: “fluid_tables”).
- identifierstr, optional
Tag stored in the returned FluidState objects.
- Attributes:
- capabilities
- configuration
- critical_point
- name
- references
tableExpose the complete payload for inspection without tracing metadata.
- triple_point_liquid
- triple_point_vapor
Methods
get_state(input_type, prop_1, prop_2, *[, ...])Evaluate a bounded table state with explicit numerical failure policy.
get_state_saturation(input_type, prop_1, ...)Evaluate the stored PQ saturation endpoint; other tables reject it.
- N_h: int#
- N_p: int#
- N_p_sat: int#
- PROPERTY_CALCULATORS = {9: <function FluidBicubic.<dictcomp>.<lambda>>, 10: <function FluidBicubic.<dictcomp>.<lambda>>, 18: <function FluidBicubic.<dictcomp>.<lambda>>, 20: <function FluidBicubic.<dictcomp>.<lambda>>, 22: <function FluidBicubic.<dictcomp>.<lambda>>, 26: <function FluidBicubic.<dictcomp>.<lambda>>, 30: <function FluidBicubic.<dictcomp>.<lambda>>, 32: <function FluidBicubic.<dictcomp>.<lambda>>}#
- backend: str#
- property capabilities#
- coarse_step: int#
- property configuration#
- delta_h: float#
- delta_logP: float#
- delta_logP_sat: float#
- fluid_name: str#
- get_state(input_type, prop_1, prop_2, *, generalize_quality=False, supersaturation=False, errors='raise')[source]#
Evaluate a bounded table state with explicit numerical failure policy.
The input-pair selector is static for JAX compilation; numerical inputs and table coefficients remain dynamic. Each pair has its own cached specialization, so the same fluid object supports different advertised pairs throughout a simulation without specializing on numerical values.
Eager calls default to indexed raising. Within JAX transformations, explicitly select
errors='mask'orerrors='clip'.
- get_state_saturation(input_type, prop_1, prop_2, *, generalize_quality=False, supersaturation=False, errors='raise')[source]#
Evaluate the stored PQ saturation endpoint; other tables reject it.
- grad_method: str#
- h_max: float#
- h_min: float#
- h_vals: Array#
- identifier: str#
- inverse_max_steps: int#
- inverse_tolerance: float#
- logP_sat_vals: Array#
- logP_vals: Array#
- metadata: dict#
- metastable_domain: str#
- metastable_phase: str#
- mixture_ratio: float#
- model: str#
- property name#
- p_max: float#
- p_min: float#
- phase_support: bool = False#
- provider: str#
- reference_id: tuple#
- property table#
Expose the complete payload for inspection without tracing metadata.
The outer dictionary is a snapshot; numerical entries share the stored arrays. Generation/reload validate the complete persisted manifest.
- table_dir: str#
- table_mode: str#
- table_name: str#
- jaxprop.bicubic.compute_bicubic_coefficients(value, grad_h, grad_logP, grad_hlogP, delta_h, delta_logP)[source]#
Submodules#
- jaxprop.bicubic.bicubic_interpolation module
FluidBicubicFluidBicubic.N_hFluidBicubic.N_pFluidBicubic.N_p_satFluidBicubic.PROPERTY_CALCULATORSFluidBicubic.backendFluidBicubic.capabilitiesFluidBicubic.coarse_stepFluidBicubic.configurationFluidBicubic.delta_hFluidBicubic.delta_logPFluidBicubic.delta_logP_satFluidBicubic.fluid_nameFluidBicubic.get_state()FluidBicubic.get_state_saturation()FluidBicubic.grad_methodFluidBicubic.h_maxFluidBicubic.h_minFluidBicubic.h_valsFluidBicubic.identifierFluidBicubic.inverse_max_stepsFluidBicubic.inverse_toleranceFluidBicubic.logP_sat_valsFluidBicubic.logP_valsFluidBicubic.metadataFluidBicubic.metastable_domainFluidBicubic.metastable_phaseFluidBicubic.mixture_ratioFluidBicubic.modelFluidBicubic.nameFluidBicubic.p_maxFluidBicubic.p_minFluidBicubic.phase_supportFluidBicubic.providerFluidBicubic.reference_idFluidBicubic.tableFluidBicubic.table_dirFluidBicubic.table_modeFluidBicubic.table_name
compute_bicubic_coefficients()