jaxprop.helpers_props module

Contents

jaxprop.helpers_props module#

class jaxprop.helpers_props.BaseState(_meta_fields: tuple = ('fluid_name', 'identifier', '_meta_fields'))[source]#

Bases: Module

Base class for state-like objects.

Intentionally mirrors FluidState behavior with minimal generalization: - metadata fields are configurable via _meta_fields - alias lookup uses _alias_to_canonical (defaults to global ALIAS_TO_CANONICAL)

Methods

at_index(idx)

Extract a single state at the given index from a batched state.

flipped()

Return a new state where all array-valued fields are reversed in order.

items()

Dict-style iteration

keys()

Dict-style iteration

stack(states)

Combine a list of states into a batched state (values stacked into arrays).

to_dict([include_aliases])

Return dict of numeric properties, with optional aliases.

values()

Dict-style iteration

at_index(idx: int)[source]#

Extract a single state at the given index from a batched state.

This returns a new state with the same metadata, and each property reduced to the element at position idx along the first axis.

flipped()[source]#

Return a new state where all array-valued fields are reversed in order.

Scalars and 0-D arrays are left unchanged, while 1-D or N-D arrays are flipped along their first axis. Metadata fields are copied unchanged.

items()[source]#

Dict-style iteration

keys()[source]#

Dict-style iteration

classmethod stack(states: list)[source]#

Combine a list of states into a batched state (values stacked into arrays).

to_dict(include_aliases: bool = False)[source]#

Return dict of numeric properties, with optional aliases.

values()[source]#

Dict-style iteration

class jaxprop.helpers_props.FluidState(_meta_fields: tuple = ('fluid_name', 'identifier', '_meta_fields'), fluid_name: str = None, identifier: str = None, pressure: jax.Array = nan, temperature: jax.Array = nan, density: jax.Array = nan, enthalpy: jax.Array = nan, entropy: jax.Array = nan, internal_energy: jax.Array = nan, compressibility_factor: jax.Array = nan, isobaric_heat_capacity: jax.Array = nan, isochoric_heat_capacity: jax.Array = nan, heat_capacity_ratio: jax.Array = nan, speed_of_sound: jax.Array = nan, isothermal_compressibility: jax.Array = nan, isentropic_compressibility: jax.Array = nan, isothermal_bulk_modulus: jax.Array = nan, isentropic_bulk_modulus: jax.Array = nan, isobaric_expansion_coefficient: jax.Array = nan, isothermal_joule_thomson: jax.Array = nan, joule_thomson: jax.Array = nan, gruneisen: jax.Array = nan, viscosity: jax.Array = nan, conductivity: jax.Array = nan, is_two_phase: jax.Array = nan, vapor_quality: jax.Array = nan, void_fraction: jax.Array = nan, surface_tension: jax.Array = nan, subcooling: jax.Array = nan, superheating: jax.Array = nan, pressure_saturation: jax.Array = nan, temperature_saturation: jax.Array = nan, supersaturation_degree: jax.Array = nan, supersaturation_ratio: jax.Array = nan)[source]#

Bases: BaseState

Attributes:
fluid_name
identifier

Methods

at_index(idx)

Extract a single state at the given index from a batched state.

flipped()

Return a new state where all array-valued fields are reversed in order.

items()

Dict-style iteration

keys()

Dict-style iteration

stack(states)

Combine a list of states into a batched state (values stacked into arrays).

to_dict([include_aliases])

Return dict of numeric properties, with optional aliases.

values()

Dict-style iteration

compressibility_factor: Array = nan#
conductivity: Array = nan#
density: Array = nan#
enthalpy: Array = nan#
entropy: Array = nan#
fluid_name: str = None#
gruneisen: Array = nan#
heat_capacity_ratio: Array = nan#
identifier: str = None#
internal_energy: Array = nan#
is_two_phase: Array = nan#
isentropic_bulk_modulus: Array = nan#
isentropic_compressibility: Array = nan#
isobaric_expansion_coefficient: Array = nan#
isobaric_heat_capacity: Array = nan#
isochoric_heat_capacity: Array = nan#
isothermal_bulk_modulus: Array = nan#
isothermal_compressibility: Array = nan#
isothermal_joule_thomson: Array = nan#
joule_thomson: Array = nan#
pressure: Array = nan#
pressure_saturation: Array = nan#
speed_of_sound: Array = nan#
subcooling: Array = nan#
superheating: Array = nan#
supersaturation_degree: Array = nan#
supersaturation_ratio: Array = nan#
surface_tension: Array = nan#
temperature: Array = nan#
temperature_saturation: Array = nan#
vapor_quality: Array = nan#
viscosity: Array = nan#
void_fraction: Array = nan#
class jaxprop.helpers_props.MixtureState(_meta_fields: tuple = ('fluid_name', 'identifier', '_meta_fields'), identifier: str = None, fluid_name: str = None, component_1: FluidState = None, component_2: FluidState = None, mass_fraction_1: Array = nan, mass_fraction_2: Array = nan, volume_fraction_1: Array = nan, volume_fraction_2: Array = nan, pressure: Array = nan, temperature: Array = nan, density: Array = nan, enthalpy: Array = nan, internal_energy: Array = nan, entropy: Array = nan, isochoric_heat_capacity: Array = nan, isobaric_heat_capacity: Array = nan, compressibility_factor: Array = nan, speed_of_sound: Array = nan, speed_of_sound_p: Array = nan, speed_of_sound_pT: Array = nan, isothermal_compressibility: Array = nan, isentropic_compressibility: Array = nan, isothermal_bulk_modulus: Array = nan, isentropic_bulk_modulus: Array = nan, viscosity: Array = nan, conductivity: Array = nan, vapor_quality: Array = nan, void_fraction: Array = nan, joule_thomson: Array = nan, isothermal_joule_thomson: Array = nan)[source]#

Bases: BaseState

Two-component mixture state.

This class follows the same structure and behavior style as FluidState, but holds two nested FluidState objects for the components. Only stack requires an override because BaseState.stack assumes that each field is numeric, whereas component_1 and component_2 are FluidState objects.

Attributes:
component_1
component_2
fluid_name
identifier

Methods

at_index(idx)

Extract a single state at the given index from a batched state.

flipped()

Return a new state where all array-valued fields are reversed in order.

items()

Dict-style iteration

keys()

Dict-style iteration

stack(states)

Combine a list of states into a batched state (values stacked into arrays).

to_dict([include_aliases])

Return dict of numeric properties, with optional aliases.

values()

Dict-style iteration

component_1: FluidState = None#
component_2: FluidState = None#
compressibility_factor: Array = nan#
conductivity: Array = nan#
density: Array = nan#
enthalpy: Array = nan#
entropy: Array = nan#
fluid_name: str = None#
identifier: str = None#
internal_energy: Array = nan#
isentropic_bulk_modulus: Array = nan#
isentropic_compressibility: Array = nan#
isobaric_heat_capacity: Array = nan#
isochoric_heat_capacity: Array = nan#
isothermal_bulk_modulus: Array = nan#
isothermal_compressibility: Array = nan#
isothermal_joule_thomson: Array = nan#
joule_thomson: Array = nan#
mass_fraction_1: Array = nan#
mass_fraction_2: Array = nan#
pressure: Array = nan#
speed_of_sound: Array = nan#
speed_of_sound_p: Array = nan#
speed_of_sound_pT: Array = nan#
temperature: Array = nan#
vapor_quality: Array = nan#
viscosity: Array = nan#
void_fraction: Array = nan#
volume_fraction_1: Array = nan#
volume_fraction_2: Array = nan#
jaxprop.helpers_props.extract_vars(name)[source]#