jaxprop.perfect_gas.perfect_gas module#
- class jaxprop.perfect_gas.perfect_gas.FluidPerfectGas(name, T_ref=300.0, p_ref=101325.0, identifier=None, *, backend=None)[source]#
Bases:
SourceReferencesMixin,Module- Attributes:
- capabilities
- configuration
- critical_point
- fluid_name
- identifier
- name
- reference_id
- references
- triple_point_liquid
- triple_point_vapor
Methods
get_state(input_type, prop_1, prop_2, *[, ...])Evaluate with dynamic numerical inputs and a static pair selector.
Validate a dynamic model view and refresh its persistent identity.
with_constants(**changes)Return a validated model with updated constants and fresh identity.
get_state_saturation
- backend: str = 'HEOS'#
- property capabilities#
- property configuration#
- constants: PerfectGasConstants#
- fluid_name: str = None#
- get_state(input_type, prop_1, prop_2, *, generalize_quality=False, supersaturation=False, errors='raise')[source]#
Evaluate with dynamic numerical inputs and a static pair selector.
The model is already a numerical PyTree with static identity metadata, so native JIT avoids filtered-method binding and per-value compilation.
- identifier: str = None#
- materialize()[source]#
Validate a dynamic model view and refresh its persistent identity.
Low-level
eqx.tree_atparameter edits remain efficient ephemeral differentiation views. Call this eager setup operation before storing or combining the resulting physical model’s states. No source is initialized and the numerical parameter dtypes are retained.
- model: str = 'perfect_gas'#
- property name#
- provider: str = 'native'#
- reference_id: tuple = None#
- with_constants(**changes)[source]#
Return a validated model with updated constants and fresh identity.
Constants are named as in
PerfectGasConstants; cp/cv remain derived from R/gamma, so they cannot become mutually inconsistent. Changes are materialized outside JAX transformations. Source reference records describe the calibration source, independently of this model.
- class jaxprop.perfect_gas.perfect_gas.PerfectGasConstants(R: jax.Array, gamma: jax.Array, T_ref: jax.Array, P_ref: jax.Array, h_ref: jax.Array, s_ref: jax.Array, k_ref: jax.Array, mu_ref: jax.Array, S_k: jax.Array, S_mu: jax.Array)[source]#
Bases:
Module- P_ref: Array#
- R: Array#
- S_k: Array#
- S_mu: Array#
- T_ref: Array#
- gamma: Array#
- h_ref: Array#
- k_ref: Array#
- mu_ref: Array#
- s_ref: Array#
- jaxprop.perfect_gas.perfect_gas.assemble_properties(T, p, rho, h, s, constants, *, cp=None)[source]#
- jaxprop.perfect_gas.perfect_gas.calculate_properties_PT(p, T, constants, *, cp=None)[source]#
Assemble a complete state, optionally sharing a resolved heat capacity.
Native request policies can supply the same dynamic scalar used to resolve and validate coordinates. Ordinary raw callers retain the original model calculation; no derived parameter is stored or frozen on the fluid.
- jaxprop.perfect_gas.perfect_gas.estimate_sutherland_constant(T1, mu1, T2, mu2)[source]#
Estimate the Sutherland constant [K] from two values of a transport property (viscosity or thermal conductivity) at two temperatures, assuming a Sutherland-like law:
mu(T) = mu_ref * (T / T_ref)^{3/2} * (T_ref + S) / (T + S)
- Parameters:
- T1, T2float
Temperatures in kelvin [K].
- mu1, mu2float
Transport property values at T1 and T2 (e.g. viscosity in Pa·s or conductivity in W/m·K).
- Returns:
- float
Estimated Sutherland constant in kelvin [K].
- jaxprop.perfect_gas.perfect_gas.get_constants(fluid_name, T_ref, p_ref, dT=100.0, *, backend='HEOS')[source]#
Compute perfect-gas constants from a real-fluid model at a reference state, and estimate Sutherland constants using offset temperatures.
- Parameters:
- fluid_namestr
Name of the fluid (passed to CoolProp).
- T_reffloat
Reference temperature in kelvin [K].
- P_reffloat
Reference pressure in pascal [Pa].
- dTfloat, optional
Temperature offset used to evaluate mu and k at T_ref ± dT for Sutherland constant estimation [K]. Default is 100.0.
- backendstr, optional
CoolProp source backend used for calibration. Default is “HEOS”.
- Returns:
- GasConstants
An Equinox module containing the perfect-gas constants: - R : specific gas constant [J/(kg·K)] - gamma : specific heat ratio [-] - T_ref : reference temperature [K] - P_ref : reference pressure [Pa] - s_ref : reference entropy [J/(kg·K)] - mu_ref : dynamic viscosity at T_ref [Pa·s] - S_mu : Sutherland constant for viscosity [K] - k_ref : thermal conductivity at T_ref [W/(m·K)] - S_k : Sutherland constant for thermal conductivity [K]
- Raises:
- ValueError
If required properties are missing or invalid.
- ZeroDivisionError
If the Sutherland estimation becomes numerically unstable.