jaxprop.two_component.mixture_calculations module#

class jaxprop.two_component.mixture_calculations.FluidTwoComponent(fluid_name_1: str, fluid_name_2: str, backend_1: str = 'HEOS', backend_2: str = 'HEOS', identifier: str = None)[source]#

Bases: Module

Fluid model for a two-component mixture (i.e., water and nitrogen)

Parameters:
fluid_name_1, fluid_name_2str

Fluid identifiers for CoolProp.

backend_1, backend_2str

CoolProp backend strings.

identifierstr, optional

Tag stored in the returned FluidState objects.

Methods

get_state(input_type, val1, val2, R)

Compute thermodynamic states from any supported input pair on a vectorized way.

backend_1: str#
backend_2: str#
fluid_1: FluidJAX#
fluid_2: FluidJAX#
fluid_name_1: str#
fluid_name_2: str#
get_state(input_type, val1, val2, R)[source]#

Compute thermodynamic states from any supported input pair on a vectorized way.

This is the main user-facing entry point. It accepts either scalar or array inputs for val1 and val2, automatically broadcasting them to a common shape and evaluating the corresponding fluid state at each point in a vectorized manner. Internally, the metho a Newton solver in normalized (p, T) space to recover the unique thermodynamic state that matches both input properties simultaneously.

All computations are compatible with JAX transformations such as jit, vmap, and automatic differentiation. Vectorization is handled internally using vmap over the scalar solver/interpolator. The output is a MixtureState object containing all thermodynamic and transport properties defined in the table, either for a single point (scalar inputs) or for each element of the broadcasted input arrays.

Parameters:
input_typeint

Identifier of the input pair (e.g. jxp.HmassP_INPUTS, jxp.PT_INPUTS).

val1float or array_like

First input variable (e.g. enthalpy, pressure, density).

val2float or array_like

Second input variable (e.g. pressure, temperature, entropy).

Rfloat or array_like

Mixture ratio (mass of fluid 1 / mass of fluid 2).

Returns
——-
MixtureState

Interpolated fluid state(s) corresponding to the specified input pair. If inputs are arrays, each property is returned as an array with the broadcasted shape of val1 and val2.

identifier: str#
jaxprop.two_component.mixture_calculations.get_mixture_state(fluid_1, fluid_2, p, T, R) MixtureState[source]#