API reference

Autogenerated reference for the documented public encomp modules. The core modules (encomp.units, encomp.utypes, encomp.fluids, encomp.coolprop) are listed first. encomp.sympy is included for existing users, but is legacy and planned for removal in a future major release.

encomp.units

Imports and extends the pint library for physical units. Always import this module when working with encomp (most other modules will import this one).

Implements a type-aware system on top of pint that verifies that the dimensionality of the unit is correct.

CUSTOM_DIMENSIONS: list[str] = ['currency', 'normal']

Names of the registered custom base dimensions. The entries defined out of the box match the custom-dimension section of defs/units.txt; define_dimensionality() appends every dimensionality it defines.

exception DimensionalityComparisonError(msg='')[source]

Bases: _DimensionalityError

Raised when an ordering comparison has incompatible dimensionality.

Parameters:

msg (str)

Return type:

None

exception DimensionalityError(units1, units2, dim1='', dim2='', extra_msg='')[source]

Bases: PintTypeError

Raised when trying to convert between incompatible units.

Parameters:
  • units1 (Any)

  • units2 (Any)

  • dim1 (str)

  • dim2 (str)

  • extra_msg (str)

Return type:

None

dim1: str = ''
dim2: str = ''
extra_msg: str = ''
units1: Any
units2: Any
exception DimensionalityRedefinitionError[source]

Bases: ValueError

Raised when defining a dimensionality that already exists.

exception DimensionalityTypeError(msg='')[source]

Bases: _DimensionalityError

Raised when two semantic dimensionality classes are not compatible.

Parameters:

msg (str)

Return type:

None

exception ExpectedDimensionalityError(msg='')[source]

Bases: _DimensionalityError

Raised when a quantity cannot be reinterpreted as a requested dimensionality.

Parameters:

msg (str)

Return type:

None

class Quantity(val, unit=None, _depth=0)[source]

Bases: NumpyQuantity[Any], NonMultiplicativeQuantity[Any], MeasurementQuantity[Any], Generic[DT, MT]

Physical quantity with a magnitude, unit, dimensionality, and magnitude type.

Quantity extends Pint’s quantity type with runtime dimensionality subclasses (for example Quantity[Pressure, float]) and magnitude containers such as float, numpy arrays, Polars Series and Polars Expr. Construction validates that the unit’s physical dimensions match the requested dimensionality subclass.

Absolute temperature and temperature-difference quantities deliberately remain separate dimensionality types even though both have Pint dimension [temperature]. Use to() for unit conversion and asdim() only for explicit semantic reinterpretation between compatible dimensionality classes.

Parameters:
  • val (Any)

  • unit (Any)

  • _depth (int)

Return type:

Quantity[Any, Any]

FORMATTING_SPECS = ('~P', '~L', '~H', '~Lx')
NORMAL_M3_VARIANTS = ('nm³', 'Nm³', 'nm3', 'Nm3', 'nm**3', 'Nm**3', 'nm^3', 'Nm^3')
PINT_PRESENTATION_SPECS: ClassVar[tuple[str, ...]] = ('raw', 'Lx', 'D', 'H', 'P', 'L', 'C')
TEMPERATURE_DIFFERENCE_UCS = (<UnitsContainer({'delta_kelvin': 1})>, <UnitsContainer({'delta_degree_Celsius': 1})>, <UnitsContainer({'delta_degree_Fahrenheit': 1})>, <UnitsContainer({'delta_degree_Reaumur': 1})>)
asdim(other)[source]

Return this quantity reinterpreted as another dimensionality class.

other can be a dimensionality class or another quantity whose dimensionality should be used. This is not a unit conversion: it succeeds only when the source and target have the same physical dimensions. For TemperatureDifference, offset temperature units such as degC are rewritten to their delta units (delta_degC) so the result cannot be confused with an absolute temperature.

Return type:

Quantity[UnknownDimensionality]

Parameters:

other (type[DT_] | Quantity[UnknownDimensionality])

astype(magnitude_type)[source]
Overloads:
  • self, magnitude_type (Literal[‘float’]) → Quantity[DT, float]

  • self, magnitude_type (Literal[‘ndarray’]) → Quantity[DT, Numpy1DArray]

  • self, magnitude_type (Literal[‘pl.Expr’]) → Quantity[DT, pl.Expr]

  • self, magnitude_type (Literal[‘pl.Series’]) → Quantity[DT, pl.Series]

  • self, magnitude_type (type[MT_] | MagnitudeTypeName) → Quantity[DT, MT_]

Parameters:

magnitude_type (type[Any] | Literal['float', 'ndarray', 'pl.Series', 'pl.Expr'])

Return type:

Quantity[UnknownDimensionality]

Return this quantity with its magnitude converted to another container type.

magnitude_type accepts float, numpy array, Polars Series, Polars Expr, or the corresponding string names. Units and dimensionality are unchanged. Converting to pl.Expr is only defined for scalar quantities, which become a literal expression.

atol: float = 1e-12
check(dimension)[source]

Return whether this quantity has the same physical dimensions as dimension.

This intentionally compares dimensions, not semantic dimensionality classes: Temperature and TemperatureDifference both have [temperature], and sibling energy-per-mass classes share [energy] / [mass]. Use isinstance/isinstance_types or check_compatibility when that semantic distinction matters.

Return type:

bool

Parameters:

dimension (Quantity[UnknownDimensionality] | UnitsContainer | Unit[DT_] | Unit | str | Dimensionality | type[Dimensionality])

check_compatibility(other)[source]

Raise DimensionalityTypeError unless other can be combined with this quantity.

Compatibility is semantic, not just dimensional: Temperature and TemperatureDifference share [temperature] but are not compatible. A plain number is compatible only with a dimensionless quantity.

Return type:

None

Parameters:

other (Quantity[UnknownDimensionality] | float)

static correct_unit(unit)[source]

Normalize supported unit spelling variants before Pint parses them.

Notably, Nm3/nm3 forms are interpreted as normal cubic meters (normal_cubic_meter), not nanometers cubed. Use nanometer**3 when a nanoscale volume is intended.

Return type:

str

Parameters:

unit (str)

property dt: type[DT]

Dimensionality class associated with this quantity.

classmethod from_expr(expr)[source]

Create a scalar quantity from a SymPy expression containing SI unit symbols.

The expression is expected to use the symbols produced by Quantity._sympy_(). Residual symbols that are not known unit symbols raise KeyError.

Return type:

Quantity[UnknownDimensionality, float]

Parameters:

expr (Basic)

get_subclass(dt, mt)[source]

Return the Quantity subclass for dimensionality dt and magnitude type mt.

Return type:

type[Quantity[UnknownDimensionality]]

Parameters:
  • dt (type[DT_])

  • mt (type[MT_])

classmethod get_unit(unit_name)[source]

Parse unit_name with the encomp unit registry and return a Unit.

Return type:

Unit

Parameters:

unit_name (Literal['', '%', 'percent', 'pct', 'mol%', 'mol-%', 'mole%', 'mole-%', 'kg%', 'kg-%', 'm3%', 'm3-%', 'm³%', 'm³-%', 'vol%', 'vol-%', 'volume%', 'volume-%', 'wt%', 'wt-%', 'weight%', 'weight-%', 'ppm', '-', 'dimensionless'] | ~typing.Literal['SEK', 'EUR', 'USD', 'kSEK', 'kEUR', 'kUSD', 'MSEK', 'MEUR', 'MUSD'] | ~typing.Literal['SEK/MWh', 'EUR/MWh', 'SEK/kWh', 'EUR/kWh', 'SEK/GWh', 'EUR/GWh', 'SEK/TWh', 'EUR/TWh'] | ~typing.Literal['SEK/kg', 'EUR/kg', 'SEK/t', 'EUR/t', 'SEK/ton', 'EUR/ton', 'SEK/g', 'EUR/g', 'SEK/mg', 'EUR/mg', 'SEK/ug', 'EUR/ug'] | ~typing.Literal['SEK/L', 'EUR/L', 'SEK/l', 'EUR/l', 'SEK/liter', 'EUR/liter', 'SEK/m3', 'EUR/m3', 'SEK/m^3', 'EUR/m^3', 'SEK/m**3', 'EUR/m**3', 'SEK/m³', 'EUR/m³'] | ~typing.Literal['SEK/h', 'EUR/h', 'SEK/hr', 'EUR/hr', 'SEK/hour', 'EUR/hour', 'SEK/d', 'EUR/d', 'SEK/day', 'EUR/day', 'SEK/week', 'EUR/week', 'SEK/yr', 'EUR/yr', 'SEK/year', 'EUR/year', 'SEK/a', 'EUR/a'] | ~typing.Literal['m', 'meter', 'km', 'cm', 'mm', 'um'] | ~typing.Literal['kg', 'g', 'ton', 'tonne', 't', 'mg', 'ug'] | ~typing.Literal['s', 'second', 'min', 'minute', 'h', 'hr', 'hour', 'd', 'day', 'week', 'yr', 'a', 'year', 'ms', 'us'] | ~typing.Literal['Hz', 'kHz', 'MHz', 'GHz', 'rpm', '1/s'] | ~typing.Literal['degC', '°C', 'K', 'degF', '°F', '℃', '℉'] | ~typing.Literal['delta_K', 'ΔK', 'delta_°C', 'delta_degC', 'Δ°C', 'Δ℃', 'delta_°F', 'delta_degF', 'Δ°F', 'Δ℉'] | ~typing.Literal['mol', 'kmol'] | ~typing.Literal['g/mol', 'kg/mol', 'kg/kmol'] | ~typing.Literal['mol/g', 'kmol/kg'] | ~typing.Literal['A', 'mA'] | ~typing.Literal['cd', 'lm'] | ~typing.Literal['m2', 'm^2', 'm**2', 'm²', 'cm2', 'cm^2', 'cm**2', 'cm²'] | ~typing.Literal['L', 'l', 'liter', 'm3', 'm^3', 'm³', 'm**3', 'dm3', 'dm^3', 'dm³', 'dm**3', 'cm3', 'cm^3', 'cm³', 'cm**3'] | ~typing.Literal['normal liter', 'Nm3', 'nm3', 'Nm^3', 'nm^3', 'Nm³', 'nm³', 'Nm**3', 'nm**3'] | ~typing.Literal['bar', 'kPa', 'Pa', 'MPa', 'mbar', 'mmHg', 'torr', 'psi', 'atm', 'N/m2', 'N/m^2', 'N/m**2', 'N/m²'] | ~typing.Literal['kg/s', 'kg/h', 'kg/hr', 'g/s', 'g/h', 'g/hr', 'ton/h', 't/h', 'ton/hr', 't/hr', 't/d', 'ton/day', 'ton/week', 't/a', 't/year', 'ton/a', 'ton/year'] | ~typing.Literal['m3/s', 'm3/h', 'm3/hr', 'm**3/s', 'm**3/h', 'm**3/hr', 'm^3/s', 'm^3/h', 'm^3/hr', 'm³/s', 'm³/h', 'm³/hr', 'liter/second', 'l/s', 'L/s', 'liter/s', 'liter/hour', 'l/h', 'L/h', 'L/hr', 'l/hr'] | ~typing.Literal['Nm3/s', 'Nm3/h', 'Nm3/hr', 'nm3/s', 'nm3/h', 'nm3/hr', 'Nm^3/s', 'Nm^3/h', 'Nm^3/hr', 'nm^3/s', 'nm^3/h', 'nm^3/hr', 'Nm³/s', 'Nm³/h', 'Nm³/hr', 'nm³/s', 'nm³/h', 'nm³/hr', 'Nm**3/s', 'Nm**3/h', 'Nm**3/hr', 'nm**3/s', 'nm**3/h', 'nm**3/hr'] | ~typing.Literal['kg/m3', 'kg/m**3', 'kg/m^3', 'kg/m³', 'kg/liter', 'g/l', 'g/L', 'gram/liter', 'g/cm3', 'g/cm**3', 'g/cm^3', 'g/cm³'] | ~typing.Literal['mol/m3', 'mol/m**3', 'mol/m^3', 'mol/m³', 'kmol/m3', 'kmol/m**3', 'kmol/m^3', 'kmol/m³', 'mol/l', 'mol/L'] | ~typing.Literal['m3/kg', 'm^3/kg', 'm³/kg', 'l/g', 'L/g'] | ~typing.Literal['Nm3/kg', 'Nm^3/kg', 'Nm³/kg', 'nm3/kg', 'nm^3/kg', 'nm³/kg'] | ~typing.Literal['kg/Nm3', 'kg/Nm^3', 'kg/Nm³', 'kg/nm3', 'kg/nm^3', 'kg/nm³', 'g/Nm3', 'g/Nm^3', 'g/Nm³'] | ~typing.Literal['J', 'kJ', 'MJ', 'GJ', 'TJ', 'PJ', 'kWh', 'MWh', 'Wh', 'GWh', 'TWh'] | ~typing.Literal['W', 'kW', 'MW', 'GW', 'TW', 'mW', 'kWh/d', 'kWh/yr', 'kWh/year', 'MWh/d', 'MWh/yr', 'MWh/year', 'GWh/d', 'GWh/yr', 'GWh/year', 'TWh/d', 'TWh/yr', 'TWh/year'] | ~typing.Literal['W/m2', 'W/m^2', 'W/m**2', 'W/m²', 'kW/m2', 'kW/m^2', 'kW/m**2', 'kW/m²'] | ~typing.Literal['m/s', 'km/s', 'm/min', 'cm/s', 'cm/min', 'km/h', 'kmh', 'kph'] | ~typing.Literal['N', 'kN', 'mN'] | ~typing.Literal['Pa*s', 'Pa s', 'cP'] | ~typing.Literal['m2/s', 'm**2/s', 'm^2/s', 'm²/s', 'cSt', 'cm2/s', 'cm**2/s', 'cm^2/s', 'cm²/s'] | ~typing.Literal['MJ/kg', 'MWh/kg', 'kJ/kg', 'kWh/kg', 'J/kg', 'J/g', 'MJ/t', 'MWh/t', 'kJ/t', 'kWh/t', 'MJ/ton', 'MWh/ton', 'kJ/ton', 'kWh/ton'] | ~typing.Literal['J/mol', 'kJ/mol', 'J/kmol', 'kJ/kmol', 'MJ/kmol'] | ~typing.Literal['kJ/kg/K', 'kJ/kg/delta_degC', 'kJ/kg/Δ°C', 'kJ/kg/Δ℃', 'kJ/kg/°C', 'kJ/kg/℃', 'kJ/kg/degC', 'J/kg/K', 'J/kg/delta_degC', 'J/kg/Δ°C', 'J/kg/Δ℃', 'J/kg/°C', 'J/kg/℃', 'J/kg/degC', 'J/g/K', 'J/g/delta_degC', 'J/g/Δ°C', 'J/g/Δ℃', 'J/g/°C', 'J/g/℃', 'J/g/degC'] | ~typing.Literal['W/m/K', 'W/m/delta_degC', 'W/m/Δ°C', 'W/m/Δ℃', 'kW/m/K', 'mW/m/K'] | ~typing.Literal['W/m2/K', 'W/m^2/K', 'W/m**2/K', 'W/m²/K', 'W/m2/delta_degC', 'W/m^2/delta_degC', 'W/m**2/delta_degC', 'W/m²/delta_degC', 'W/m2/Δ°C', 'W/m^2/Δ°C', 'W/m**2/Δ°C', 'W/m²/Δ°C', 'kW/m2/K', 'kW/m^2/K', 'kW/m**2/K', 'kW/m²/K'] | str)

static get_unit_symbol(s)[source]
Return type:

Symbol

Parameters:

s (str)

static get_unknown_dimensionality_subclass()[source]

Return the magnitude-agnostic quantity subclass with unknown dimensionality.

Return type:

type[Quantity[UnknownDimensionality]]

is_compatible_with(other, *contexts, **ctx_kwargs)[source]

Whether other is convertible to this quantity’s unit and check_compatibility() passes.

Return type:

bool

Parameters:
  • other (Quantity[UnknownDimensionality] | float)

  • contexts (Any)

  • ctx_kwargs (Any)

property is_scalar: bool

Whether the magnitude is a scalar (float) rather than a container.

ito(unit)[source]

Convert this quantity in place to unit.

Like to(), this preserves the dimensionality type and applies the same temperature-vs-temperature-difference checks. Integer numpy magnitudes may be copied to floating point before conversion so unit scaling cannot fail due to integer casting rules.

Return type:

None

Parameters:

unit (Literal['', '%', 'percent', 'pct', 'mol%', 'mol-%', 'mole%', 'mole-%', 'kg%', 'kg-%', 'm3%', 'm3-%', 'm³%', 'm³-%', 'vol%', 'vol-%', 'volume%', 'volume-%', 'wt%', 'wt-%', 'weight%', 'weight-%', 'ppm', '-', 'dimensionless'] | ~typing.Literal['SEK', 'EUR', 'USD', 'kSEK', 'kEUR', 'kUSD', 'MSEK', 'MEUR', 'MUSD'] | ~typing.Literal['SEK/MWh', 'EUR/MWh', 'SEK/kWh', 'EUR/kWh', 'SEK/GWh', 'EUR/GWh', 'SEK/TWh', 'EUR/TWh'] | ~typing.Literal['SEK/kg', 'EUR/kg', 'SEK/t', 'EUR/t', 'SEK/ton', 'EUR/ton', 'SEK/g', 'EUR/g', 'SEK/mg', 'EUR/mg', 'SEK/ug', 'EUR/ug'] | ~typing.Literal['SEK/L', 'EUR/L', 'SEK/l', 'EUR/l', 'SEK/liter', 'EUR/liter', 'SEK/m3', 'EUR/m3', 'SEK/m^3', 'EUR/m^3', 'SEK/m**3', 'EUR/m**3', 'SEK/m³', 'EUR/m³'] | ~typing.Literal['SEK/h', 'EUR/h', 'SEK/hr', 'EUR/hr', 'SEK/hour', 'EUR/hour', 'SEK/d', 'EUR/d', 'SEK/day', 'EUR/day', 'SEK/week', 'EUR/week', 'SEK/yr', 'EUR/yr', 'SEK/year', 'EUR/year', 'SEK/a', 'EUR/a'] | ~typing.Literal['m', 'meter', 'km', 'cm', 'mm', 'um'] | ~typing.Literal['kg', 'g', 'ton', 'tonne', 't', 'mg', 'ug'] | ~typing.Literal['s', 'second', 'min', 'minute', 'h', 'hr', 'hour', 'd', 'day', 'week', 'yr', 'a', 'year', 'ms', 'us'] | ~typing.Literal['Hz', 'kHz', 'MHz', 'GHz', 'rpm', '1/s'] | ~typing.Literal['degC', '°C', 'K', 'degF', '°F', '℃', '℉'] | ~typing.Literal['delta_K', 'ΔK', 'delta_°C', 'delta_degC', 'Δ°C', 'Δ℃', 'delta_°F', 'delta_degF', 'Δ°F', 'Δ℉'] | ~typing.Literal['mol', 'kmol'] | ~typing.Literal['g/mol', 'kg/mol', 'kg/kmol'] | ~typing.Literal['mol/g', 'kmol/kg'] | ~typing.Literal['A', 'mA'] | ~typing.Literal['cd', 'lm'] | ~typing.Literal['m2', 'm^2', 'm**2', 'm²', 'cm2', 'cm^2', 'cm**2', 'cm²'] | ~typing.Literal['L', 'l', 'liter', 'm3', 'm^3', 'm³', 'm**3', 'dm3', 'dm^3', 'dm³', 'dm**3', 'cm3', 'cm^3', 'cm³', 'cm**3'] | ~typing.Literal['normal liter', 'Nm3', 'nm3', 'Nm^3', 'nm^3', 'Nm³', 'nm³', 'Nm**3', 'nm**3'] | ~typing.Literal['bar', 'kPa', 'Pa', 'MPa', 'mbar', 'mmHg', 'torr', 'psi', 'atm', 'N/m2', 'N/m^2', 'N/m**2', 'N/m²'] | ~typing.Literal['kg/s', 'kg/h', 'kg/hr', 'g/s', 'g/h', 'g/hr', 'ton/h', 't/h', 'ton/hr', 't/hr', 't/d', 'ton/day', 'ton/week', 't/a', 't/year', 'ton/a', 'ton/year'] | ~typing.Literal['m3/s', 'm3/h', 'm3/hr', 'm**3/s', 'm**3/h', 'm**3/hr', 'm^3/s', 'm^3/h', 'm^3/hr', 'm³/s', 'm³/h', 'm³/hr', 'liter/second', 'l/s', 'L/s', 'liter/s', 'liter/hour', 'l/h', 'L/h', 'L/hr', 'l/hr'] | ~typing.Literal['Nm3/s', 'Nm3/h', 'Nm3/hr', 'nm3/s', 'nm3/h', 'nm3/hr', 'Nm^3/s', 'Nm^3/h', 'Nm^3/hr', 'nm^3/s', 'nm^3/h', 'nm^3/hr', 'Nm³/s', 'Nm³/h', 'Nm³/hr', 'nm³/s', 'nm³/h', 'nm³/hr', 'Nm**3/s', 'Nm**3/h', 'Nm**3/hr', 'nm**3/s', 'nm**3/h', 'nm**3/hr'] | ~typing.Literal['kg/m3', 'kg/m**3', 'kg/m^3', 'kg/m³', 'kg/liter', 'g/l', 'g/L', 'gram/liter', 'g/cm3', 'g/cm**3', 'g/cm^3', 'g/cm³'] | ~typing.Literal['mol/m3', 'mol/m**3', 'mol/m^3', 'mol/m³', 'kmol/m3', 'kmol/m**3', 'kmol/m^3', 'kmol/m³', 'mol/l', 'mol/L'] | ~typing.Literal['m3/kg', 'm^3/kg', 'm³/kg', 'l/g', 'L/g'] | ~typing.Literal['Nm3/kg', 'Nm^3/kg', 'Nm³/kg', 'nm3/kg', 'nm^3/kg', 'nm³/kg'] | ~typing.Literal['kg/Nm3', 'kg/Nm^3', 'kg/Nm³', 'kg/nm3', 'kg/nm^3', 'kg/nm³', 'g/Nm3', 'g/Nm^3', 'g/Nm³'] | ~typing.Literal['J', 'kJ', 'MJ', 'GJ', 'TJ', 'PJ', 'kWh', 'MWh', 'Wh', 'GWh', 'TWh'] | ~typing.Literal['W', 'kW', 'MW', 'GW', 'TW', 'mW', 'kWh/d', 'kWh/yr', 'kWh/year', 'MWh/d', 'MWh/yr', 'MWh/year', 'GWh/d', 'GWh/yr', 'GWh/year', 'TWh/d', 'TWh/yr', 'TWh/year'] | ~typing.Literal['W/m2', 'W/m^2', 'W/m**2', 'W/m²', 'kW/m2', 'kW/m^2', 'kW/m**2', 'kW/m²'] | ~typing.Literal['m/s', 'km/s', 'm/min', 'cm/s', 'cm/min', 'km/h', 'kmh', 'kph'] | ~typing.Literal['N', 'kN', 'mN'] | ~typing.Literal['Pa*s', 'Pa s', 'cP'] | ~typing.Literal['m2/s', 'm**2/s', 'm^2/s', 'm²/s', 'cSt', 'cm2/s', 'cm**2/s', 'cm^2/s', 'cm²/s'] | ~typing.Literal['MJ/kg', 'MWh/kg', 'kJ/kg', 'kWh/kg', 'J/kg', 'J/g', 'MJ/t', 'MWh/t', 'kJ/t', 'kWh/t', 'MJ/ton', 'MWh/ton', 'kJ/ton', 'kWh/ton'] | ~typing.Literal['J/mol', 'kJ/mol', 'J/kmol', 'kJ/kmol', 'MJ/kmol'] | ~typing.Literal['kJ/kg/K', 'kJ/kg/delta_degC', 'kJ/kg/Δ°C', 'kJ/kg/Δ℃', 'kJ/kg/°C', 'kJ/kg/℃', 'kJ/kg/degC', 'J/kg/K', 'J/kg/delta_degC', 'J/kg/Δ°C', 'J/kg/Δ℃', 'J/kg/°C', 'J/kg/℃', 'J/kg/degC', 'J/g/K', 'J/g/delta_degC', 'J/g/Δ°C', 'J/g/Δ℃', 'J/g/°C', 'J/g/℃', 'J/g/degC'] | ~typing.Literal['W/m/K', 'W/m/delta_degC', 'W/m/Δ°C', 'W/m/Δ℃', 'kW/m/K', 'mW/m/K'] | ~typing.Literal['W/m2/K', 'W/m^2/K', 'W/m**2/K', 'W/m²/K', 'W/m2/delta_degC', 'W/m^2/delta_degC', 'W/m**2/delta_degC', 'W/m²/delta_degC', 'W/m2/Δ°C', 'W/m^2/Δ°C', 'W/m**2/Δ°C', 'W/m²/Δ°C', 'kW/m2/K', 'kW/m^2/K', 'kW/m**2/K', 'kW/m²/K'] | ~encomp.units.Unit[~encomp.utypes.DT] | ~pint.util.UnitsContainer | str | dict[str, ~numbers.Number])

property m: MT

Magnitude value stored in this quantity.

m_as(units)[source]

Return the magnitude converted to unit.

This is the typed shorthand for self.to(unit).m and applies exactly the same dimensionality and temperature-safety checks as to().

Return type:

TypeVar(MT, float, ndarray[tuple[int], dtype[float64]], Series, Expr)

Parameters:

units (Literal['', '%', 'percent', 'pct', 'mol%', 'mol-%', 'mole%', 'mole-%', 'kg%', 'kg-%', 'm3%', 'm3-%', 'm³%', 'm³-%', 'vol%', 'vol-%', 'volume%', 'volume-%', 'wt%', 'wt-%', 'weight%', 'weight-%', 'ppm', '-', 'dimensionless'] | ~typing.Literal['SEK', 'EUR', 'USD', 'kSEK', 'kEUR', 'kUSD', 'MSEK', 'MEUR', 'MUSD'] | ~typing.Literal['SEK/MWh', 'EUR/MWh', 'SEK/kWh', 'EUR/kWh', 'SEK/GWh', 'EUR/GWh', 'SEK/TWh', 'EUR/TWh'] | ~typing.Literal['SEK/kg', 'EUR/kg', 'SEK/t', 'EUR/t', 'SEK/ton', 'EUR/ton', 'SEK/g', 'EUR/g', 'SEK/mg', 'EUR/mg', 'SEK/ug', 'EUR/ug'] | ~typing.Literal['SEK/L', 'EUR/L', 'SEK/l', 'EUR/l', 'SEK/liter', 'EUR/liter', 'SEK/m3', 'EUR/m3', 'SEK/m^3', 'EUR/m^3', 'SEK/m**3', 'EUR/m**3', 'SEK/m³', 'EUR/m³'] | ~typing.Literal['SEK/h', 'EUR/h', 'SEK/hr', 'EUR/hr', 'SEK/hour', 'EUR/hour', 'SEK/d', 'EUR/d', 'SEK/day', 'EUR/day', 'SEK/week', 'EUR/week', 'SEK/yr', 'EUR/yr', 'SEK/year', 'EUR/year', 'SEK/a', 'EUR/a'] | ~typing.Literal['m', 'meter', 'km', 'cm', 'mm', 'um'] | ~typing.Literal['kg', 'g', 'ton', 'tonne', 't', 'mg', 'ug'] | ~typing.Literal['s', 'second', 'min', 'minute', 'h', 'hr', 'hour', 'd', 'day', 'week', 'yr', 'a', 'year', 'ms', 'us'] | ~typing.Literal['Hz', 'kHz', 'MHz', 'GHz', 'rpm', '1/s'] | ~typing.Literal['degC', '°C', 'K', 'degF', '°F', '℃', '℉'] | ~typing.Literal['delta_K', 'ΔK', 'delta_°C', 'delta_degC', 'Δ°C', 'Δ℃', 'delta_°F', 'delta_degF', 'Δ°F', 'Δ℉'] | ~typing.Literal['mol', 'kmol'] | ~typing.Literal['g/mol', 'kg/mol', 'kg/kmol'] | ~typing.Literal['mol/g', 'kmol/kg'] | ~typing.Literal['A', 'mA'] | ~typing.Literal['cd', 'lm'] | ~typing.Literal['m2', 'm^2', 'm**2', 'm²', 'cm2', 'cm^2', 'cm**2', 'cm²'] | ~typing.Literal['L', 'l', 'liter', 'm3', 'm^3', 'm³', 'm**3', 'dm3', 'dm^3', 'dm³', 'dm**3', 'cm3', 'cm^3', 'cm³', 'cm**3'] | ~typing.Literal['normal liter', 'Nm3', 'nm3', 'Nm^3', 'nm^3', 'Nm³', 'nm³', 'Nm**3', 'nm**3'] | ~typing.Literal['bar', 'kPa', 'Pa', 'MPa', 'mbar', 'mmHg', 'torr', 'psi', 'atm', 'N/m2', 'N/m^2', 'N/m**2', 'N/m²'] | ~typing.Literal['kg/s', 'kg/h', 'kg/hr', 'g/s', 'g/h', 'g/hr', 'ton/h', 't/h', 'ton/hr', 't/hr', 't/d', 'ton/day', 'ton/week', 't/a', 't/year', 'ton/a', 'ton/year'] | ~typing.Literal['m3/s', 'm3/h', 'm3/hr', 'm**3/s', 'm**3/h', 'm**3/hr', 'm^3/s', 'm^3/h', 'm^3/hr', 'm³/s', 'm³/h', 'm³/hr', 'liter/second', 'l/s', 'L/s', 'liter/s', 'liter/hour', 'l/h', 'L/h', 'L/hr', 'l/hr'] | ~typing.Literal['Nm3/s', 'Nm3/h', 'Nm3/hr', 'nm3/s', 'nm3/h', 'nm3/hr', 'Nm^3/s', 'Nm^3/h', 'Nm^3/hr', 'nm^3/s', 'nm^3/h', 'nm^3/hr', 'Nm³/s', 'Nm³/h', 'Nm³/hr', 'nm³/s', 'nm³/h', 'nm³/hr', 'Nm**3/s', 'Nm**3/h', 'Nm**3/hr', 'nm**3/s', 'nm**3/h', 'nm**3/hr'] | ~typing.Literal['kg/m3', 'kg/m**3', 'kg/m^3', 'kg/m³', 'kg/liter', 'g/l', 'g/L', 'gram/liter', 'g/cm3', 'g/cm**3', 'g/cm^3', 'g/cm³'] | ~typing.Literal['mol/m3', 'mol/m**3', 'mol/m^3', 'mol/m³', 'kmol/m3', 'kmol/m**3', 'kmol/m^3', 'kmol/m³', 'mol/l', 'mol/L'] | ~typing.Literal['m3/kg', 'm^3/kg', 'm³/kg', 'l/g', 'L/g'] | ~typing.Literal['Nm3/kg', 'Nm^3/kg', 'Nm³/kg', 'nm3/kg', 'nm^3/kg', 'nm³/kg'] | ~typing.Literal['kg/Nm3', 'kg/Nm^3', 'kg/Nm³', 'kg/nm3', 'kg/nm^3', 'kg/nm³', 'g/Nm3', 'g/Nm^3', 'g/Nm³'] | ~typing.Literal['J', 'kJ', 'MJ', 'GJ', 'TJ', 'PJ', 'kWh', 'MWh', 'Wh', 'GWh', 'TWh'] | ~typing.Literal['W', 'kW', 'MW', 'GW', 'TW', 'mW', 'kWh/d', 'kWh/yr', 'kWh/year', 'MWh/d', 'MWh/yr', 'MWh/year', 'GWh/d', 'GWh/yr', 'GWh/year', 'TWh/d', 'TWh/yr', 'TWh/year'] | ~typing.Literal['W/m2', 'W/m^2', 'W/m**2', 'W/m²', 'kW/m2', 'kW/m^2', 'kW/m**2', 'kW/m²'] | ~typing.Literal['m/s', 'km/s', 'm/min', 'cm/s', 'cm/min', 'km/h', 'kmh', 'kph'] | ~typing.Literal['N', 'kN', 'mN'] | ~typing.Literal['Pa*s', 'Pa s', 'cP'] | ~typing.Literal['m2/s', 'm**2/s', 'm^2/s', 'm²/s', 'cSt', 'cm2/s', 'cm**2/s', 'cm^2/s', 'cm²/s'] | ~typing.Literal['MJ/kg', 'MWh/kg', 'kJ/kg', 'kWh/kg', 'J/kg', 'J/g', 'MJ/t', 'MWh/t', 'kJ/t', 'kWh/t', 'MJ/ton', 'MWh/ton', 'kJ/ton', 'kWh/ton'] | ~typing.Literal['J/mol', 'kJ/mol', 'J/kmol', 'kJ/kmol', 'MJ/kmol'] | ~typing.Literal['kJ/kg/K', 'kJ/kg/delta_degC', 'kJ/kg/Δ°C', 'kJ/kg/Δ℃', 'kJ/kg/°C', 'kJ/kg/℃', 'kJ/kg/degC', 'J/kg/K', 'J/kg/delta_degC', 'J/kg/Δ°C', 'J/kg/Δ℃', 'J/kg/°C', 'J/kg/℃', 'J/kg/degC', 'J/g/K', 'J/g/delta_degC', 'J/g/Δ°C', 'J/g/Δ℃', 'J/g/°C', 'J/g/℃', 'J/g/degC'] | ~typing.Literal['W/m/K', 'W/m/delta_degC', 'W/m/Δ°C', 'W/m/Δ℃', 'kW/m/K', 'mW/m/K'] | ~typing.Literal['W/m2/K', 'W/m^2/K', 'W/m**2/K', 'W/m²/K', 'W/m2/delta_degC', 'W/m^2/delta_degC', 'W/m**2/delta_degC', 'W/m²/delta_degC', 'W/m2/Δ°C', 'W/m^2/Δ°C', 'W/m**2/Δ°C', 'W/m²/Δ°C', 'kW/m2/K', 'kW/m^2/K', 'kW/m**2/K', 'kW/m²/K'] | ~encomp.units.Unit[~encomp.utypes.DT] | ~pint.util.UnitsContainer | str | dict[str, ~numbers.Number] | ~encomp.units.Quantity[UnknownDimensionality])

property mt: type[MT]

Concrete magnitude container type for this quantity.

property mt_name: Literal['float', 'ndarray', 'pl.Series', 'pl.Expr']

String name for this quantity’s magnitude container type.

property ndim: int

0 for a scalar, 1 for a vector magnitude.

Type:

Number of magnitude dimensions

rtol: float = 1e-09
to(unit)[source]

Return a new quantity converted to unit.

The returned quantity keeps this quantity’s dimensionality type. The target may be a unit string, Unit, UnitsContainer, dict accepted by Pint, or another quantity whose unit should be used. Absolute temperatures cannot be converted to delta temperature units, and temperature differences cannot be converted to offset temperature units; use asdim() when that reinterpretation is intentional.

Return type:

Quantity[UnknownDimensionality]

Parameters:

unit (Literal['', '%', 'percent', 'pct', 'mol%', 'mol-%', 'mole%', 'mole-%', 'kg%', 'kg-%', 'm3%', 'm3-%', 'm³%', 'm³-%', 'vol%', 'vol-%', 'volume%', 'volume-%', 'wt%', 'wt-%', 'weight%', 'weight-%', 'ppm', '-', 'dimensionless'] | ~typing.Literal['SEK', 'EUR', 'USD', 'kSEK', 'kEUR', 'kUSD', 'MSEK', 'MEUR', 'MUSD'] | ~typing.Literal['SEK/MWh', 'EUR/MWh', 'SEK/kWh', 'EUR/kWh', 'SEK/GWh', 'EUR/GWh', 'SEK/TWh', 'EUR/TWh'] | ~typing.Literal['SEK/kg', 'EUR/kg', 'SEK/t', 'EUR/t', 'SEK/ton', 'EUR/ton', 'SEK/g', 'EUR/g', 'SEK/mg', 'EUR/mg', 'SEK/ug', 'EUR/ug'] | ~typing.Literal['SEK/L', 'EUR/L', 'SEK/l', 'EUR/l', 'SEK/liter', 'EUR/liter', 'SEK/m3', 'EUR/m3', 'SEK/m^3', 'EUR/m^3', 'SEK/m**3', 'EUR/m**3', 'SEK/m³', 'EUR/m³'] | ~typing.Literal['SEK/h', 'EUR/h', 'SEK/hr', 'EUR/hr', 'SEK/hour', 'EUR/hour', 'SEK/d', 'EUR/d', 'SEK/day', 'EUR/day', 'SEK/week', 'EUR/week', 'SEK/yr', 'EUR/yr', 'SEK/year', 'EUR/year', 'SEK/a', 'EUR/a'] | ~typing.Literal['m', 'meter', 'km', 'cm', 'mm', 'um'] | ~typing.Literal['kg', 'g', 'ton', 'tonne', 't', 'mg', 'ug'] | ~typing.Literal['s', 'second', 'min', 'minute', 'h', 'hr', 'hour', 'd', 'day', 'week', 'yr', 'a', 'year', 'ms', 'us'] | ~typing.Literal['Hz', 'kHz', 'MHz', 'GHz', 'rpm', '1/s'] | ~typing.Literal['degC', '°C', 'K', 'degF', '°F', '℃', '℉'] | ~typing.Literal['delta_K', 'ΔK', 'delta_°C', 'delta_degC', 'Δ°C', 'Δ℃', 'delta_°F', 'delta_degF', 'Δ°F', 'Δ℉'] | ~typing.Literal['mol', 'kmol'] | ~typing.Literal['g/mol', 'kg/mol', 'kg/kmol'] | ~typing.Literal['mol/g', 'kmol/kg'] | ~typing.Literal['A', 'mA'] | ~typing.Literal['cd', 'lm'] | ~typing.Literal['m2', 'm^2', 'm**2', 'm²', 'cm2', 'cm^2', 'cm**2', 'cm²'] | ~typing.Literal['L', 'l', 'liter', 'm3', 'm^3', 'm³', 'm**3', 'dm3', 'dm^3', 'dm³', 'dm**3', 'cm3', 'cm^3', 'cm³', 'cm**3'] | ~typing.Literal['normal liter', 'Nm3', 'nm3', 'Nm^3', 'nm^3', 'Nm³', 'nm³', 'Nm**3', 'nm**3'] | ~typing.Literal['bar', 'kPa', 'Pa', 'MPa', 'mbar', 'mmHg', 'torr', 'psi', 'atm', 'N/m2', 'N/m^2', 'N/m**2', 'N/m²'] | ~typing.Literal['kg/s', 'kg/h', 'kg/hr', 'g/s', 'g/h', 'g/hr', 'ton/h', 't/h', 'ton/hr', 't/hr', 't/d', 'ton/day', 'ton/week', 't/a', 't/year', 'ton/a', 'ton/year'] | ~typing.Literal['m3/s', 'm3/h', 'm3/hr', 'm**3/s', 'm**3/h', 'm**3/hr', 'm^3/s', 'm^3/h', 'm^3/hr', 'm³/s', 'm³/h', 'm³/hr', 'liter/second', 'l/s', 'L/s', 'liter/s', 'liter/hour', 'l/h', 'L/h', 'L/hr', 'l/hr'] | ~typing.Literal['Nm3/s', 'Nm3/h', 'Nm3/hr', 'nm3/s', 'nm3/h', 'nm3/hr', 'Nm^3/s', 'Nm^3/h', 'Nm^3/hr', 'nm^3/s', 'nm^3/h', 'nm^3/hr', 'Nm³/s', 'Nm³/h', 'Nm³/hr', 'nm³/s', 'nm³/h', 'nm³/hr', 'Nm**3/s', 'Nm**3/h', 'Nm**3/hr', 'nm**3/s', 'nm**3/h', 'nm**3/hr'] | ~typing.Literal['kg/m3', 'kg/m**3', 'kg/m^3', 'kg/m³', 'kg/liter', 'g/l', 'g/L', 'gram/liter', 'g/cm3', 'g/cm**3', 'g/cm^3', 'g/cm³'] | ~typing.Literal['mol/m3', 'mol/m**3', 'mol/m^3', 'mol/m³', 'kmol/m3', 'kmol/m**3', 'kmol/m^3', 'kmol/m³', 'mol/l', 'mol/L'] | ~typing.Literal['m3/kg', 'm^3/kg', 'm³/kg', 'l/g', 'L/g'] | ~typing.Literal['Nm3/kg', 'Nm^3/kg', 'Nm³/kg', 'nm3/kg', 'nm^3/kg', 'nm³/kg'] | ~typing.Literal['kg/Nm3', 'kg/Nm^3', 'kg/Nm³', 'kg/nm3', 'kg/nm^3', 'kg/nm³', 'g/Nm3', 'g/Nm^3', 'g/Nm³'] | ~typing.Literal['J', 'kJ', 'MJ', 'GJ', 'TJ', 'PJ', 'kWh', 'MWh', 'Wh', 'GWh', 'TWh'] | ~typing.Literal['W', 'kW', 'MW', 'GW', 'TW', 'mW', 'kWh/d', 'kWh/yr', 'kWh/year', 'MWh/d', 'MWh/yr', 'MWh/year', 'GWh/d', 'GWh/yr', 'GWh/year', 'TWh/d', 'TWh/yr', 'TWh/year'] | ~typing.Literal['W/m2', 'W/m^2', 'W/m**2', 'W/m²', 'kW/m2', 'kW/m^2', 'kW/m**2', 'kW/m²'] | ~typing.Literal['m/s', 'km/s', 'm/min', 'cm/s', 'cm/min', 'km/h', 'kmh', 'kph'] | ~typing.Literal['N', 'kN', 'mN'] | ~typing.Literal['Pa*s', 'Pa s', 'cP'] | ~typing.Literal['m2/s', 'm**2/s', 'm^2/s', 'm²/s', 'cSt', 'cm2/s', 'cm**2/s', 'cm^2/s', 'cm²/s'] | ~typing.Literal['MJ/kg', 'MWh/kg', 'kJ/kg', 'kWh/kg', 'J/kg', 'J/g', 'MJ/t', 'MWh/t', 'kJ/t', 'kWh/t', 'MJ/ton', 'MWh/ton', 'kJ/ton', 'kWh/ton'] | ~typing.Literal['J/mol', 'kJ/mol', 'J/kmol', 'kJ/kmol', 'MJ/kmol'] | ~typing.Literal['kJ/kg/K', 'kJ/kg/delta_degC', 'kJ/kg/Δ°C', 'kJ/kg/Δ℃', 'kJ/kg/°C', 'kJ/kg/℃', 'kJ/kg/degC', 'J/kg/K', 'J/kg/delta_degC', 'J/kg/Δ°C', 'J/kg/Δ℃', 'J/kg/°C', 'J/kg/℃', 'J/kg/degC', 'J/g/K', 'J/g/delta_degC', 'J/g/Δ°C', 'J/g/Δ℃', 'J/g/°C', 'J/g/℃', 'J/g/degC'] | ~typing.Literal['W/m/K', 'W/m/delta_degC', 'W/m/Δ°C', 'W/m/Δ℃', 'kW/m/K', 'mW/m/K'] | ~typing.Literal['W/m2/K', 'W/m^2/K', 'W/m**2/K', 'W/m²/K', 'W/m2/delta_degC', 'W/m^2/delta_degC', 'W/m**2/delta_degC', 'W/m²/delta_degC', 'W/m2/Δ°C', 'W/m^2/Δ°C', 'W/m**2/Δ°C', 'W/m²/Δ°C', 'kW/m2/K', 'kW/m^2/K', 'kW/m**2/K', 'kW/m²/K'] | ~encomp.units.Unit[~encomp.utypes.DT] | ~pint.util.UnitsContainer | str | dict[str, ~numbers.Number] | ~encomp.units.Quantity[UnknownDimensionality])

to_base_units()[source]

Return a copy converted to base SI units.

Return type:

Quantity[UnknownDimensionality]

to_reduced_units()[source]

Return a copy with units reduced by canceling common factors.

Return type:

Quantity[UnknownDimensionality]

to_root_units()[source]

Return a copy converted to Pint root units.

Return type:

Quantity[UnknownDimensionality]

property u: Unit[DT]

Short alias for units.

property units: Unit[DT]

Quantity unit as an encomp Unit instance.

unknown()[source]

Return this quantity with its dimensionality erased, i.e. asdim(UnknownDimensionality).

Return type:

Quantity[UnknownDimensionality]

classmethod validate(qty, info)[source]

Pydantic validator: coerce qty to this subclass, checking dimensionality and magnitude type.

Every failure is re-raised as a pydantic_core.PydanticCustomError with type quantity_dimensionality, quantity_magnitude_type or quantity_validation.

Return type:

Quantity[UnknownDimensionality]

Parameters:
  • qty (Any)

  • info (Any)

static validate_magnitude_type(mt)[source]

Raise TypeError unless mt is a supported magnitude container type.

Return type:

None

Parameters:

mt (type)

class Unit(units)[source]

Bases: PlainUnit, Generic[DT]

Parameters:

units (UnitLike)

exception UnitStrippedWarning(msg)[source]

Bases: UserWarning, PintError

Parameters:

msg (str)

msg: str
define_dimensionality(name, symbol=None, if_exists='raise')[source]

Defines a new dimensionality that can be combined with existing dimensionalities. In case the dimensionality is already defined, DimensionalityRedefinitionError will be raised.

This can be used to define a new dimensionality for an amount of some specific substance. For instance, if the dimensionalities “air” and “fuel” are defined, the unit (kg air) / (kg fuel) has the simplified dimensionality of [air] / [fuel].

Note

Make sure to only define new custom dimensions using this function, since the unit needs to be appended to the CUSTOM_DIMENSIONS list as well.

Parameters:
  • name (str) – Name of the dimensionality

  • symbol (str | None) – Optional (short) symbol, by default None

  • if_exists (Literal['raise', 'warn']) – What to do when a dimensionality with this name is already defined: "raise" (default) raises DimensionalityRedefinitionError, "warn" logs a warning and keeps the existing definition

Return type:

None

set_quantity_format(fmt='compact')[source]

Set the process-wide default format used when rendering quantities and units.

"compact"/"normal" select Pint’s compact pretty format ("~P"); "siunitx" selects the LaTeX siunitx format ("~Lx"). Any value in Quantity.FORMATTING_SPECS can also be passed directly.

Return type:

None

Parameters:

fmt (str)

encomp.utypes

Contains type definitions for encomp.units.Quantity objects.

The dimensionalities defined in this module can be combined with * and /. Some commonly used derived dimensionalities (like density) are defined for convenience.

Most dimensionalities are backed by unit literals (see get_registered_units()) and by * / / overloads on encomp.units.Quantity, so they are inferred statically. A few – NormalTemperature, MassPerEnergy, PowerPerLength, PowerPerVolume, PowerPerTemperature and the HeatingValue family – are deliberately vocabulary only: they have no unit literals and no overloads, and exist so user code can annotate quantities with them and reinterpret via encomp.units.Quantity.asdim().

class Area[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2})>
class Currency[source]

Bases: Dimensionality

Arbitrary currency ([currency] dimension).

Warning

The scaling between the built-in currencies (SEK, EUR, USD) is a fixed placeholder (10 SEK = 1 EUR = 1 USD), not an exchange rate: converting a Quantity across currencies silently applies these fabricated factors. Do not use this system for currency conversion – keep all quantities in a single currency, or implement a pint context with real exchange rates.

dimensions: UnitsContainer = <UnitsContainer({'[currency]': 1})>
class CurrencyPerEnergy[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[currency]': 1, '[length]': -2, '[mass]': -1, '[time]': 2})>
class CurrencyPerMass[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[currency]': 1, '[mass]': -1})>
class CurrencyPerTime[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[currency]': 1, '[time]': -1})>
class CurrencyPerVolume[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[currency]': 1, '[length]': -3})>
class Current[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[current]': 1})>
class Density[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': -3, '[mass]': 1})>
class Dimensionality[source]

Bases: object

Represents the dimensionality of a unit, i.e. a combination (product) of the base dimensions (with optional rational exponents).

A dimension can be expressed as

\[\Pi \, d^n_d, d \in \{T, L, M ,I, \Theta, N, J, \ldots\}, n_d \in \mathbb{Q}\]

where ${T, L, M, …}$ are the base dimensions (time, length, mass, …) and $n_d$ is a rational number.

Subclasses of this abstract base class are used as type parameters when creating instances of encomp.units.Quantity.

The dimensions class attribute defines the dimensions of the dimensionality using an instance of pint.unit.UnitsContainer.

Distinctness is registry-relative: if another dimensionality with the same dimensions is registered later, is_distinct() for those dimensions may change. Define custom dimensionalities at import time and use globally unique class names in library code.

dimensions: UnitsContainer = <UnitsContainer({})>
classmethod get_dimensionality(dimensions)[source]

Return the registered dimensionality for dimensions.

Unregistered dimensions get a new subclass named after them, for example Dimensionality[[mass] ** 2 / [length] ** 3].

Return type:

type[Dimensionality]

Parameters:

dimensions (UnitsContainer)

classmethod is_distinct()[source]

Whether this class is the one get_dimensionality() returns for its dimensions.

Unless _distinct is set explicitly, only the first registered subclass with a given dimensions is distinct. The answer is registry-relative and can change when a later subclass registers the same dimensions.

Return type:

bool

class Dimensionless[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({})>
class DynamicViscosity[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': -1, '[mass]': 1, '[time]': -1})>
class Energy[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[mass]': 1, '[time]': -2})>
class EnergyPerMass[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[time]': -2})>
class Force[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 1, '[mass]': 1, '[time]': -2})>
class Frequency[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[time]': -1})>
class HeatTransferCoefficient[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[mass]': 1, '[temperature]': -1, '[time]': -3})>
class HeatingValue[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[time]': -2})>
class HigherHeatingValue[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[time]': -2})>
class IndistinctDimensionality[source]

Bases: Dimensionality

class KinematicViscosity[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[time]': -1})>
class Length[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 1})>
class LowerHeatingValue[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[time]': -2})>
class Luminosity[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[luminosity]': 1})>
class Mass[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[mass]': 1})>
class MassFlow[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[mass]': 1, '[time]': -1})>
class MassPerEnergy[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': -2, '[time]': 2})>
class MassPerNormalVolume[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': -3, '[mass]': 1, '[normal]': -1})>
class MixtureEnthalpyPerDryAir[source]

Bases: IndistinctDimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[time]': -2})>
class MixtureEnthalpyPerHumidAir[source]

Bases: IndistinctDimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[time]': -2})>
class MixtureEntropyPerDryAir[source]

Bases: IndistinctDimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[temperature]': -1, '[time]': -2})>
class MixtureEntropyPerHumidAir[source]

Bases: IndistinctDimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[temperature]': -1, '[time]': -2})>
class MixtureVolumePerDryAir[source]

Bases: IndistinctDimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 3, '[mass]': -1})>
class MixtureVolumePerHumidAir[source]

Bases: IndistinctDimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 3, '[mass]': -1})>
class MolarDensity[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': -3, '[substance]': 1})>
class MolarMass[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[mass]': 1, '[substance]': -1})>
class MolarSpecificEnthalpy[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[mass]': 1, '[substance]': -1, '[time]': -2})>
class MolarSpecificEntropy[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[mass]': 1, '[substance]': -1, '[temperature]': -1, '[time]': -2})>
class MolarSpecificHeatCapacity[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[mass]': 1, '[substance]': -1, '[temperature]': -1, '[time]': -2})>
class MolarSpecificInternalEnergy[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[mass]': 1, '[substance]': -1, '[time]': -2})>
class Normal[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[normal]': 1})>
class NormalTemperature[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[normal]': 1, '[temperature]': 1})>
class NormalVolume[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 3, '[normal]': 1})>
class NormalVolumeFlow[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 3, '[normal]': 1, '[time]': -1})>
class NormalVolumePerMass[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 3, '[mass]': -1, '[normal]': 1})>
class Power[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[mass]': 1, '[time]': -3})>
class PowerPerArea[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[mass]': 1, '[time]': -3})>
class PowerPerLength[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 1, '[mass]': 1, '[time]': -3})>
class PowerPerTemperature[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[mass]': 1, '[temperature]': -1, '[time]': -3})>
class PowerPerVolume[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': -1, '[mass]': 1, '[time]': -3})>
class Pressure[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': -1, '[mass]': 1, '[time]': -2})>
SpecificEnthalpy

alias of EnergyPerMass

class SpecificEntropy[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[temperature]': -1, '[time]': -2})>
class SpecificHeatCapacity[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[temperature]': -1, '[time]': -2})>
class SpecificHeatPerDryAir[source]

Bases: IndistinctDimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[temperature]': -1, '[time]': -2})>
class SpecificHeatPerHumidAir[source]

Bases: IndistinctDimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[temperature]': -1, '[time]': -2})>
class SpecificInternalEnergy[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 2, '[time]': -2})>
class SpecificVolume[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 3, '[mass]': -1})>
class Substance[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[substance]': 1})>
class SubstancePerMass[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[mass]': -1, '[substance]': 1})>
class SurfaceTension[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[mass]': 1, '[time]': -2})>
class Temperature[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[temperature]': 1})>
class TemperatureDifference[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[temperature]': 1})>
class ThermalConductivity[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 1, '[mass]': 1, '[temperature]': -1, '[time]': -3})>
class Time[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[time]': 1})>
class UnitsContainer(*args, non_int_type=None, **kwargs)[source]

Bases: Mapping[str, complex | float | int | Decimal | Fraction]

The UnitsContainer stores the product of units and their respective exponent and implements the corresponding operations.

UnitsContainer is a read-only mapping. All operations (even in place ones) return new instances.

Parameters:
  • non_int_type (type | None) – Numerical type used for non integer values.

  • args (Any)

  • kwargs (Any)

add(key, value)[source]

Create a new UnitsContainer adding value to the value existing for a given key.

Parameters:
  • key (str) – unit to which the value will be added.

  • value (Number) – value to be added.

  • self (Self)

Returns:

A copy of this container.

Return type:

Self

copy()[source]

Create a copy of this UnitsContainer.

Return type:

Self

Parameters:

self (Self)

format_babel(spec, registry=None, **kwspec)[source]
Return type:

str

Parameters:

spec (str)

remove(keys)[source]

Create a new UnitsContainer purged from given entries.

Parameters:
  • keys (Iterable[str]) – Iterable of keys (units) to remove.

  • self (Self)

Returns:

A copy of this container.

Return type:

Self

rename(oldkey, newkey)[source]

Create a new UnitsContainer in which an entry has been renamed.

Parameters:
  • oldkey (str) – Existing key (unit).

  • newkey (str) – New key (unit).

  • self (Self)

Returns:

A copy of this container.

Return type:

Self

unit_items()[source]
Return type:

Iterable[tuple[str, Union[complex, float, int, Decimal, Fraction]]]

class UnknownDimensionality[source]

Bases: Dimensionality

class Velocity[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 1, '[time]': -1})>
class Volume[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 3})>
class VolumeFlow[source]

Bases: Dimensionality

dimensions: UnitsContainer = <UnitsContainer({'[length]': 3, '[time]': -1})>
get_registered_units()[source]

Return the literal unit spellings registered for each known dimensionality.

Return type:

dict[str, tuple[str, ...]]

encomp.fluids

Classes and functions relating to fluid properties. Uses CoolProp as backend.

class CoolPropFluid(name, **kwargs)[source]

Bases: ABC, Generic[MT]

Base class that represents a fluid (pure or mixture, gas or liquid). Uses CoolProp as backend to determine fluid properties.

This class should not be used directly, since it does not contain a fixed point to determine fluid properties (temperature, pressure, enthalpy, entropy, …). Define a subclass of encomp.fluids.CoolPropFluid that implements the __init__ method (this method must set instance attributes name and points).

Fluid names for pure fluids are not case-sensitive, but the mixture names are. A name may fold in the backend ("IF97::Water", "HEOS::CO2&O2"); a bare name defaults to the HEOS backend. Incompressible fluids and their mixtures use the INCOMP:: prefix, optionally with a concentration ("INCOMP::MEG[0.5]"). An unknown name raises ValueError at construction.

The names recognized by the installed CoolProp build are listed by

import CoolProp.CoolProp as CP

CP.get_global_param_string("FluidsList")            # pure and pseudo-pure
CP.get_global_param_string("incompressible_list_pure")
CP.get_global_param_string("incompressible_list_solution")
CP.get_global_param_string("predefined_mixtures")

Examples: Water, Air, Nitrogen, CarbonDioxide, Ammonia, R134a, Toluene, INCOMP::T66, INCOMP::MPG[0.5], R410A.mix.

Refer to the CoolProp documentation for more information:

The names Water and HEOS::Water use the formulation defined by IAPWS-95. Use the name IF97::Water to instead use the slightly faster (but less accurate) IAPWS-97 formulation. In most cases, the difference between IAPWS-95 and IAPWS-97 is negligible. Read CoolProp’s introduction about water properties for more information.

Parameters:
  • name (Union[Literal['Water', 'IF97::Water', 'HEOS::Water', 'HEOS', 'Air', 'Nitrogen', 'Oxygen', 'CarbonDioxide', 'Hydrogen', 'Methane', 'Ammonia', 'Argon', 'R134a'], str]) –

    The name of the fluid, same name as is used by CoolProp. Include the INCOMP:: prefix and potential mixing ratio for incompressible mixtures.

    Examples:

  • kwargs (Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float])

ALL_PROPERTIES: set[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w']] = {'A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GAS_CONSTANT', 'GMASS', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity'}
BACKEND: ClassVar[dict[Literal['backend'], Callable[[...], float | ndarray[tuple[int], dtype[float64]]]]] = {'backend': <nanobind.nb_func object>}
COOLPROP_ERROR_MESSAGES = ('is not valid for keyed_output', 'is not valid for trivial_keyed_output', "For now, we don't support", 'is not implemented for this backend', 'is only defined within the two-phase region', 'failed ungracefully', 'value to T_phase_determination_pure_or_pseudopure is invalid', "Brent's method f(b) is NAN", 'do not bracket the root', 'was unable to find a solution for')
PHASES: dict[float, Literal['Liquid', 'Gas', 'Two-phase', 'Supercritical liquid', 'Supercritical gas', 'Supercritical fluid', 'Critical point', 'Unknown', 'Not imposed', 'Variable', 'N/A']] = {0.0: 'Liquid', 1.0: 'Supercritical fluid', 2.0: 'Supercritical gas', 3.0: 'Supercritical liquid', 4.0: 'Critical point', 5.0: 'Gas', 6.0: 'Two-phase', 7.0: 'Unknown', 8.0: 'Not imposed'}
PROPERTY_MAP: dict[tuple[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], ...], tuple[Annotated[str, 'Unit string'], str]] = {('A', 'SPEED_OF_SOUND', 'speed_of_sound'): ('m/s', 'Speed of sound'), ('C', 'CPMASS', 'Cpmass'): ('J/kg/K', 'Mass specific constant pressure specific heat'), ('CONDUCTIVITY', 'L', 'conductivity'): ('W/m/K', 'Thermal conductivity'), ('CP0MASS', 'Cp0mass'): ('J/kg/K', 'Ideal gas mass specific constant pressure specific heat'), ('CP0MOLAR', 'Cp0molar'): ('J/mol/K', 'Ideal gas molar specific constant pressure specific heat'), ('CPMOLAR', 'Cpmolar'): ('J/mol/K', 'Molar specific constant pressure specific heat'), ('CVMASS', 'Cvmass', 'O'): ('J/kg/K', 'Mass specific constant volume specific heat'), ('CVMOLAR', 'Cvmolar'): ('J/mol/K', 'Molar specific constant volume specific heat'), ('D', 'DMASS', 'Dmass'): ('kg/m³', 'Mass density'), ('DELTA', 'Delta'): ('dimensionless', 'Reduced density (rho/rhoc)'), ('DIPOLE_MOMENT', 'dipole_moment'): ('C*m', 'Dipole moment'), ('DMOLAR', 'Dmolar'): ('mol/m³', 'Molar density'), ('G', 'GMASS', 'Gmass'): ('J/kg', 'Mass specific Gibbs energy'), ('GAS_CONSTANT', 'gas_constant'): ('J/mol/K', 'Molar gas constant'), ('GMOLAR', 'Gmolar'): ('J/mol', 'Molar specific Gibbs energy'), ('GMOLAR_RESIDUAL', 'Gmolar_residual'): ('J/mol', 'Residual molar Gibbs energy'), ('H', 'HMASS', 'Hmass'): ('J/kg', 'Mass specific enthalpy'), ('HELMHOLTZMASS', 'Helmholtzmass'): ('J/kg', 'Mass specific Helmholtz energy'), ('HELMHOLTZMOLAR', 'Helmholtzmolar'): ('J/mol', 'Molar specific Helmholtz energy'), ('HMOLAR', 'Hmolar'): ('J/mol', 'Molar specific enthalpy'), ('HMOLAR_RESIDUAL', 'Hmolar_residual'): ('J/mol', 'Residual molar enthalpy'), ('I', 'SURFACE_TENSION', 'surface_tension'): ('N/m', 'Surface tension'), ('ISENTROPIC_EXPANSION_COEFFICIENT', 'isentropic_expansion_coefficient'): ('dimensionless', 'Isentropic expansion coefficient'), ('ISOBARIC_EXPANSION_COEFFICIENT', 'isobaric_expansion_coefficient'): ('1/K', 'Isobaric expansion coefficient'), ('ISOTHERMAL_COMPRESSIBILITY', 'isothermal_compressibility'): ('1/Pa', 'Isothermal compressibility'), ('M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'molar_mass', 'molarmass', 'molemass'): ('kg/mol', 'Molar mass'), ('P',): ('Pa', 'Pressure'), ('PCRIT', 'P_CRITICAL', 'Pcrit', 'p_critical', 'pcrit'): ('Pa', 'Pressure at the critical point'), ('PHASE', 'Phase'): ('dimensionless', 'Phase index as a float'), ('PMAX', 'P_MAX', 'P_max', 'pmax'): ('Pa', 'Maximum pressure limit'), ('PMIN', 'P_MIN', 'P_min', 'pmin'): ('Pa', 'Minimum pressure limit'), ('PRANDTL', 'Prandtl'): ('dimensionless', 'Prandtl number'), ('PTRIPLE', 'P_TRIPLE', 'p_triple', 'ptriple'): ('Pa', 'Pressure at the triple point (pure only)'), ('P_REDUCING', 'p_reducing'): ('Pa', 'Pressure at the reducing point'), ('Q',): ('dimensionless', 'Mass vapor quality'), ('RHOCRIT', 'RHOMASS_CRITICAL', 'rhocrit', 'rhomass_critical'): ('kg/m³', 'Mass density at critical point'), ('RHOMASS_REDUCING', 'rhomass_reducing'): ('kg/m³', 'Mass density at reducing point'), ('RHOMOLAR_CRITICAL', 'rhomolar_critical'): ('mol/m³', 'Molar density at critical point'), ('RHOMOLAR_REDUCING', 'rhomolar_reducing'): ('mol/m³', 'Molar density at reducing point'), ('S', 'SMASS', 'Smass'): ('J/kg/K', 'Mass specific entropy'), ('SMOLAR', 'Smolar'): ('J/mol/K', 'Molar specific entropy'), ('SMOLAR_RESIDUAL', 'Smolar_residual'): ('J/mol/K', 'Residual molar entropy'), ('T',): ('K', 'Temperature'), ('TAU', 'Tau'): ('dimensionless', 'Reciprocal reduced temperature (Tc/T)'), ('TCRIT', 'T_CRITICAL', 'T_critical', 'Tcrit'): ('K', 'Temperature at the critical point'), ('TMAX', 'T_MAX', 'T_max', 'Tmax'): ('K', 'Maximum temperature limit'), ('TMIN', 'T_MIN', 'T_min', 'Tmin'): ('K', 'Minimum temperature limit'), ('TTRIPLE', 'T_TRIPLE', 'T_triple', 'Ttriple'): ('K', 'Temperature at the triple point'), ('T_FREEZE', 'T_freeze'): ('K', 'Freezing temperature for incompressible solutions'), ('T_REDUCING', 'T_reducing'): ('K', 'Temperature at the reducing point'), ('U', 'UMASS', 'Umass'): ('J/kg', 'Mass specific internal energy'), ('UMOLAR', 'Umolar'): ('J/mol', 'Molar specific internal energy'), ('V', 'VISCOSITY', 'viscosity'): ('Pa*s', 'Viscosity'), ('Z',): ('dimensionless', 'Compressibility factor')}
REPR_PROPERTIES: tuple[tuple[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], str], ...] = (('P', '.0f'), ('T', '.1f'), ('D', '.1f'), ('V', '.2g'))
RETURN_UNITS: dict[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], Annotated[str, 'Unit string']] = {'C': 'kJ/kg/K', 'H': 'kJ/kg', 'P': 'kPa', 'PCRIT': 'kPa', 'PMAX': 'kPa', 'PMIN': 'kPa', 'PTRIPLE': 'kPa', 'P_REDUCING': 'kPa', 'S': 'kJ/kg/K', 'T': '°C', 'TCRIT': '°C', 'TMAX': '°C', 'TMIN': '°C', 'TTRIPLE': '°C', 'T_FREEZE': '°C', 'T_REDUCING': '°C', 'U': 'kJ/kg', 'V': 'cP'}
STATE_INPUTS: ClassVar[frozenset[str]] = frozenset({'D', 'DMASS', 'DMOLAR', 'Dmass', 'Dmolar', 'H', 'HMASS', 'HMOLAR', 'Hmass', 'Hmolar', 'P', 'Q', 'S', 'SMASS', 'SMOLAR', 'Smass', 'Smolar', 'T', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar'})
check_exception(prop, e)[source]

Re-raise e, or return so the caller can yield NaN for prop.

CoolProp signals both “out of range” and “not implemented” with ValueError; those cases warn (or stay silent) and produce NaN. Anything else re-raises.

Return type:

None

Parameters:
  • prop (Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'])

  • e (ValueError)

classmethod check_inputs(kwargs)[source]

Raise ValueError unless every key names a distinct CoolProp state input.

Return type:

None

Parameters:

kwargs (Mapping[str, object])

construct_quantity(val, output, convert_magnitude=True)[source]

Wrap a raw CoolProp result as a Quantity, converted to the preferred RETURN_UNITS.

Return type:

Quantity[UnknownDimensionality]

Parameters:
  • val (float | ndarray[tuple[int], dtype[float64]] | Expr)

  • output (Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'])

  • convert_magnitude (bool)

classmethod describe(prop)[source]

Return a one-line description of prop: its synonyms, meaning, and unit.

Return type:

str

Parameters:

prop (Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'])

evaluate(output, *points)[source]

Evaluate output in CoolProp’s own unit, dispatching on the magnitude type of points.

Return type:

float | ndarray[tuple[int], dtype[float64]] | Expr

Parameters:
  • output (Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'])

  • points (tuple[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], float | ~numpy.ndarray[tuple[int], ~numpy.dtype[~numpy.float64]] | ~polars.expr.expr.Expr])

evaluate_expression(output, *points)[source]

Build (or reuse) the cached pl.Expr plugin node that evaluates output.

Return type:

Expr

Parameters:
  • output (Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'])

  • points (tuple[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], ~polars.expr.expr.Expr])

evaluate_multiple(output, *points)[source]

Evaluate output for array inputs in one vectorized backend call; non-finite rows are NaN.

Return type:

ndarray[tuple[int], dtype[float64]]

Parameters:
  • output (Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'])

  • points (tuple[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], ~numpy.ndarray[tuple[int], ~numpy.dtype[~numpy.float64]]])

evaluate_multiple_separately(output, props, arrs_flat_masked, N)[source]

Evaluate output row by row, so a single invalid row yields NaN rather than failing the batch.

Return type:

ndarray[tuple[int], dtype[float64]]

Parameters:
  • output (Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'])

  • props (list[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w']])

  • arrs_flat_masked (list[ndarray[tuple[int], dtype[float64]]])

  • N (int)

evaluate_single(output, *points)[source]

Evaluate output for scalar inputs through the CoolProp backend, returning NaN on an invalid state.

Return type:

float

Parameters:
  • output (Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'])

  • points (tuple[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], float])

get(output, points=None, convert_magnitude=True)[source]

Wraps the CoolProp backend function (PropsSI, or HAPropsSI for encomp.fluids.HumidAir), handles input and output with encomp.units.Quantity objects.

Parameters:
  • output (Union[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity'], Literal['B', 'C', 'CV', 'CVha', 'Cha', 'Conductivity', 'D', 'DewPoint', 'Enthalpy', 'Entropy', 'H', 'Hda', 'Hha', 'HumRat', 'K', 'M', 'Omega', 'P', 'P_w', 'R', 'RH', 'RelHum', 'S', 'Sda', 'Sha', 'T', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'V', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'Z', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w']]) – Name of the output property

  • points (list[tuple[Union[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity'], Literal['B', 'C', 'CV', 'CVha', 'Cha', 'Conductivity', 'D', 'DewPoint', 'Enthalpy', 'Entropy', 'H', 'Hda', 'Hha', 'HumRat', 'K', 'M', 'Omega', 'P', 'P_w', 'R', 'RH', 'RelHum', 'S', 'Sda', 'Sha', 'T', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'V', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'Z', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w']], Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]]] | None) – Fixed state variables: name and value of the property. The number of points must match the number expected by the CoolProp backend function. If None, the points from the __init__ method are used

  • convert_magnitude (bool) – Whether to convert the output to the same magnitude type as the input, by default True

Returns:

Quantity representing the output property

Return type:

Quantity[UnknownDimensionality]

classmethod get_coolprop_unit(prop)[source]

Return the unit CoolProp reports prop in, before conversion to RETURN_UNITS.

Return type:

Unit

Parameters:

prop (Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'])

classmethod get_prop_key(prop)[source]

Return the tuple of synonyms in PROPERTY_MAP that prop belongs to.

Return type:

tuple[Union[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity'], Literal['B', 'C', 'CV', 'CVha', 'Cha', 'Conductivity', 'D', 'DewPoint', 'Enthalpy', 'Entropy', 'H', 'Hda', 'Hha', 'HumRat', 'K', 'M', 'Omega', 'P', 'P_w', 'R', 'RH', 'RelHum', 'S', 'Sda', 'Sha', 'T', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'V', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'Z', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w']], ...]

Parameters:

prop (str)

classmethod is_valid_prop(prop)[source]

Whether prop is a CoolProp property name known to this class.

Return type:

bool

Parameters:

prop (str)

name: Literal['Water', 'IF97::Water', 'HEOS::Water', 'HEOS', 'Air', 'Nitrogen', 'Oxygen', 'CarbonDioxide', 'Hydrogen', 'Methane', 'Ammonia', 'Argon', 'R134a'] | str
points: list[tuple[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]]]
classmethod search(inp)[source]

Return the describe() lines of every property whose description contains inp.

Return type:

list[str]

Parameters:

inp (str)

to_numeric_correct_unit(prop, qty)[source]

Convert a state-input quantity to CoolProp’s unit for prop and return its bare magnitude.

This is where the dimensionality of a state input is validated: a mismatch raises encomp.units.ExpectedDimensionalityError.

Return type:

float | ndarray[tuple[int], dtype[float64]] | Expr

Parameters:
  • prop (Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'])

  • qty (Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float])

EAGER_PLUGIN_MIN_SIZE = 1000

Eager numpy / pl.Series inputs with at least this many elements are evaluated through the GIL-free rust plugin (faster and lower peak memory than CoolProp’s vectorized PropsSI, and much faster than the low-level per-row Python loop for an assumed phase / composition). Scalars and smaller arrays stay on the Python CoolProp path, where the plugin’s fixed dispatch overhead would dominate. The two paths are verified to agree on dtype, value, and NaN/inf handling (test_fluids).

class Fluid(name, *, composition=None, **kwargs)[source]

Bases: CoolPropFluid[MT]

Represents a fluid at a fixed state, for example at a specific temperature and pressure.

The fluid name is resolved eagerly: an unknown name raises ValueError here, not at the first property access. The dimensionality of each state input is still validated lazily, when a property is evaluated.

Parameters:
  • name (Union[Literal['Water', 'IF97::Water', 'HEOS::Water', 'HEOS', 'Air', 'Nitrogen', 'Oxygen', 'CarbonDioxide', 'Hydrogen', 'Methane', 'Ammonia', 'Argon', 'R134a'], str]) – Name of the fluid. With composition this is the backend only (e.g. "HEOS"); otherwise the full CoolProp name, optionally with fixed fractions (e.g. "HEOS::CO2[0.5]&O2[0.5]").

  • composition (dict[Union[Literal['Water', 'IF97::Water', 'HEOS::Water', 'HEOS', 'Air', 'Nitrogen', 'Oxygen', 'CarbonDioxide', 'Hydrogen', 'Methane', 'Ammonia', 'Argon', 'R134a'], str], float | int] | None) – Fixed mixture composition as {species: mole fraction} (like CoolProp’s "HEOS::CO2[0.5]&O2[0.5]" name syntax). Mole fractions must sum to 1. Cannot be combined with fractions baked into name, and requires a mixture backend (e.g. HEOS). Pair with assume_phase() for speed. Per-row varying composition is not supported – loop and build one Fluid per composition. (For an incompressible mixture instead use the name concentration, e.g. "INCOMP::MEG[0.5]" – 50 % glycol, on the fluid’s own mass/volume basis.)

  • kwargs (Unpack[FluidState[TypeVar(MT, float, ndarray[tuple[int], dtype[float64]], Series, Expr)]]) – Values for the two fixed points. The name of the keyword argument is the CoolProp property name.

property A: Quantity[Velocity]
property C: Quantity[SpecificHeatCapacity]
property CPMOLAR: Quantity[MolarSpecificHeatCapacity]
property CVMASS: Quantity[SpecificHeatCapacity]
property CVMOLAR: Quantity[MolarSpecificHeatCapacity]
property D: Quantity[Density]
property DELTA: Quantity[Dimensionless]
property DMOLAR: Quantity[MolarDensity]
property GAS_CONSTANT: Quantity[MolarSpecificHeatCapacity]

Molar gas constant, which shares its dimensions with a molar heat capacity.

property H: Quantity[EnergyPerMass]
property HMOLAR: Quantity[MolarSpecificEnthalpy]
property I: Quantity[SurfaceTension]
property L: Quantity[ThermalConductivity]
property M: Quantity[MolarMass]
property P: Quantity[Pressure]
property PCRIT: Quantity[Pressure]
property PHASE: Quantity[Dimensionless]
property PMAX: Quantity[Pressure]
property PMIN: Quantity[Pressure]
property PRANDTL: Quantity[Dimensionless]
property PTRIPLE: Quantity[Pressure]
property P_REDUCING: Quantity[Pressure]
property Q: Quantity[Dimensionless]
property RHOCRIT: Quantity[Density]
property RHOMASS_REDUCING: Quantity[Density]
property RHOMOLAR_CRITICAL: Quantity[MolarDensity]
property RHOMOLAR_REDUCING: Quantity[MolarDensity]
property S: Quantity[SpecificEntropy]
property SMOLAR: Quantity[MolarSpecificEntropy]
property T: Quantity[Temperature]
property TAU: Quantity[Dimensionless]
property TCRIT: Quantity[Temperature]
property TMAX: Quantity[Temperature]
property TMIN: Quantity[Temperature]
property TTRIPLE: Quantity[Temperature]
property T_FREEZE: Quantity[Temperature]
property T_REDUCING: Quantity[Temperature]
property U: Quantity[SpecificInternalEnergy]
property UMOLAR: Quantity[MolarSpecificInternalEnergy]
property V: Quantity[DynamicViscosity]
property Z: Quantity[Dimensionless]
assume_phase(phase)[source]

Force the equation of state to assume phase, skipping CoolProp’s own phase determination. This is a speed tool, not a validation tool.

With P, T inputs CoolProp normally runs a phase-stability search to decide whether the state is single- or two-phase. For HEOS/GERG mixtures that search dominates the cost (~5 ms/point); assuming a phase you already know skips it and switches evaluation to the low-level AbstractState API – on the order of 100-1000x faster.

Important caveats:

  • Only the HEOS/GERG backends honour it. IF97 (the default for Water) is region-explicit and ignores an assumed phase, so this call is a no-op there: it emits a warning and keeps the fast vectorized path (rather than switching to the slower per-point loop). Use Fluid("HEOS::Water", ...) if you need an assumed phase for water.

  • The assumed phase must be correct for the operating domain. Forcing a phase the fluid is not actually in does NOT raise – on HEOS you get either NaN (deep in the wrong phase) or a finite but non-physical metastable root (near the saturation line). So it cannot be used to detect a wrong phase; for that, evaluate with auto-phase and check phase (or quality Q) instead.

Pass None to clear it and restore automatic determination. Mutates self and returns it, so it can be chained:

Fluid("HEOS::CO2[0.5]&O2[0.5]", P=P, T=T).assume_phase("gas").D
Parameters:

phase (Optional[Literal['gas', 'liquid', 'supercritical', 'supercritical_gas', 'supercritical_liquid', 'twophase']]) – One of "gas", "liquid", "supercritical", "supercritical_gas", "supercritical_liquid", "twophase", or None to clear.

Return type:

Self

property phase: Literal['Liquid', 'Gas', 'Two-phase', 'Supercritical liquid', 'Supercritical gas', 'Supercritical fluid', 'Critical point', 'Unknown', 'Not imposed', 'Variable', 'N/A']
point_1: tuple[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]]
point_2: tuple[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]]
class FluidState[source]

Bases: TypedDict, Generic[MT]

Valid CoolProp fluid state-input property names for Fluid/Water.

Used with Unpack to statically check the **kwargs keys at the call site. The Quantity[Any, float] arm of each value type lets one fixed point be a plain scalar while another is vectorised, so a mixed float + MT call still infers the magnitude type correctly.

D: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
DMASS: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
DMOLAR: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Dmass: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Dmolar: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
H: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
HMASS: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
HMOLAR: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Hmass: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Hmolar: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
P: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Q: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
S: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
SMASS: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
SMOLAR: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Smass: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Smolar: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
T: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
U: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
UMASS: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
UMOLAR: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Umass: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Umolar: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
class HumidAir(**kwargs)[source]

Bases: CoolPropFluid[MT]

Humid-air wrapper around CoolProp’s HAPropsSI function.

HumidAir.M follows CoolProp’s humid-air naming and returns dynamic viscosity. This differs from Fluid.M, which returns molar mass.

Interface to the CoolProp function for humid air, CoolProp.CoolProp.HAPropsSI. Needs three fixed points instead of two.

Parameters:

kwargs (Unpack[HumidAirState[TypeVar(MT, float, ndarray[tuple[int], dtype[float64]], Series, Expr)]]) – Values for the three fixed points. The name of the keyword argument is the CoolProp property name.

ALL_PROPERTIES: set[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w']] = {'B', 'C', 'CV', 'CVha', 'Cha', 'Conductivity', 'D', 'DewPoint', 'Enthalpy', 'Entropy', 'H', 'Hda', 'Hha', 'HumRat', 'K', 'M', 'Omega', 'P', 'P_w', 'R', 'RH', 'RelHum', 'S', 'Sda', 'Sha', 'T', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'V', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'Z', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'}
property B: Quantity[Temperature]
BACKEND: ClassVar[dict[Literal['backend'], Callable[[...], float | ndarray[tuple[int], dtype[float64]]]]] = {'backend': <nanobind.nb_func object>}
property C: Quantity[SpecificHeatPerDryAir]
property CV: Quantity[SpecificHeatPerDryAir]
property CVha: Quantity[SpecificHeatPerHumidAir]
property Cha: Quantity[SpecificHeatPerHumidAir]
property D: Quantity[Temperature]
property H: Quantity[MixtureEnthalpyPerDryAir]
property Hha: Quantity[MixtureEnthalpyPerHumidAir]
property K: Quantity[ThermalConductivity]
property M: Quantity[DynamicViscosity]
property P: Quantity[Pressure]
PROPERTY_MAP: dict[tuple[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], ...], tuple[str, str]] = {('B', 'Twb', 'T_wb', 'WetBulb'): ('K', 'Wet-Bulb Temperature'), ('C', 'cp'): ('J/kg/K', 'Mixture specific heat per unit dry air'), ('CV',): ('J/kg/K', 'Mixture specific heat at constant volume per unit dry air'), ('CVha', 'cv_ha'): ('J/kg/K', 'Mixture specific heat at constant volume per unit humid air'), ('Cha', 'cp_ha'): ('J/kg/K', 'Mixture specific heat per unit humid air'), ('D', 'Tdp', 'DewPoint', 'T_dp'): ('K', 'Dew-Point Temperature'), ('H', 'Hda', 'Enthalpy'): ('J/kg', 'Mixture enthalpy per dry air'), ('Hha',): ('J/kg', 'Mixture enthalpy per humid air'), ('K', 'k', 'Conductivity'): ('W/m/K', 'Mixture thermal conductivity'), ('M', 'Visc', 'mu'): ('Pa*s', 'Mixture viscosity'), ('P',): ('Pa', 'Pressure'), ('P_w',): ('Pa', 'Partial pressure of water vapor'), ('R', 'RH', 'RelHum'): ('dimensionless', 'Relative humidity in [0, 1]'), ('S', 'Sda', 'Entropy'): ('J/kg/K', 'Mixture entropy per unit dry air'), ('Sha',): ('J/kg/K', 'Mixture entropy per unit humid air'), ('T', 'Tdb', 'T_db'): ('K', 'Dry-Bulb Temperature'), ('V', 'Vda'): ('m³/kg', 'Mixture volume per unit dry air'), ('Vha',): ('m³/kg', 'Mixture volume per unit humid air'), ('W', 'Omega', 'HumRat'): ('dimensionless', 'Humidity Ratio mass water per mass dry air'), ('Z',): ('dimensionless', 'Compressibility factor'), ('psi_w', 'Y'): ('dimensionless', 'Water mole fraction')}
property P_w: Quantity[Pressure]
property R: Quantity[Dimensionless]
REPR_PROPERTIES: tuple[tuple[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], str], ...] = (('P', '.0f'), ('T', '.1f'), ('R', '.2f'), ('Vda', '.1f'), ('Vha', '.1f'), ('M', '.2g'))
RETURN_UNITS: dict[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], str] = {'B': '°C', 'D': '°C', 'M': 'cP', 'P': 'kPa', 'P_w': 'kPa', 'T': '°C'}
property S: Quantity[MixtureEntropyPerDryAir]
STATE_INPUTS: ClassVar[frozenset[str]] = frozenset({'B', 'D', 'DewPoint', 'Enthalpy', 'Entropy', 'H', 'Hda', 'Hha', 'HumRat', 'Omega', 'P', 'P_w', 'R', 'RH', 'RelHum', 'S', 'Sda', 'Sha', 'T', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'V', 'Vda', 'Vha', 'W', 'WetBulb', 'Y', 'psi_w'})
property Sha: Quantity[MixtureEntropyPerHumidAir]
property T: Quantity[Temperature]
property V: Quantity[MixtureVolumePerDryAir]
property Vha: Quantity[MixtureVolumePerHumidAir]
property W: Quantity[Dimensionless]
property Z: Quantity[Dimensionless]
point_1: tuple[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]]
point_2: tuple[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]]
point_3: tuple[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity', 'B', 'CV', 'CVha', 'Cha', 'Conductivity', 'DewPoint', 'Enthalpy', 'Entropy', 'Hda', 'Hha', 'HumRat', 'K', 'Omega', 'P_w', 'R', 'RH', 'RelHum', 'Sda', 'Sha', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'], Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]]
property psi_w: Quantity[Dimensionless]
class HumidAirState[source]

Bases: TypedDict, Generic[MT]

Valid CoolProp humid-air (HAPropsSI) STATE-INPUT parameter names for HumidAir – the subset that can fix a state (matches encomp.coolprop.HUMID_AIR_INPUTS; output-only properties like Visc / Conductivity / heat capacities are excluded). Used with Unpack to statically check the **kwargs keys at the call site.

B: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
D: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
DewPoint: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Enthalpy: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Entropy: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
H: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Hda: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Hha: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
HumRat: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Omega: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
P: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
P_w: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
R: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
RH: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
RelHum: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
S: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Sda: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Sha: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
T: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
T_db: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
T_dp: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
T_wb: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Tdb: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Tdp: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Twb: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
V: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Vda: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Vha: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
W: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
WetBulb: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
Y: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
psi_w: Quantity[UnknownDimensionality] | Quantity[UnknownDimensionality, float]
class Water(**kwargs)[source]

Bases: Fluid[MT]

Convenience class to access water and steam properties via CoolProp.

Parameters:

kwargs (Unpack[FluidState[TypeVar(MT, float, ndarray[tuple[int], dtype[float64]], Series, Expr)]]) – Values for the two fixed points. The name of the keyword argument is the CoolProp property name.

clear_expr_evaluation_cache()[source]

Drop the cache of constructed CoolProp pl.Expr nodes.

Repeated evaluations of the same property, on the same fluid and inputs, return the identical expression object, so callers that deduplicate expressions by id() see one node instead of many. Clearing the cache never changes a result; it only releases the cached nodes. Useful when benchmarking expression construction, or to free the (bounded) cache in a long-lived process that builds many distinct fluids.

Return type:

None

encomp.polars

Polars integration: a unit-carrying extension data type.

Importing this module registers the "encomp.unit" extension type with polars. After that, plain polars I/O (pl.read_parquet, pl.scan_parquet, pl.sink_parquet, …) round-trips unit-typed columns with no encomp-specific read/write functions: the unit is column-level Arrow field metadata (ARROW:extension:name / ARROW:extension:metadata) in the file. Metadata-aware Arrow consumers can inspect those standard field keys with their ordinary schema APIs. Unregistered Polars 1.x readers warn and load storage values by default; readers using POLARS_UNKNOWN_EXTENSION_TYPE_BEHAVIOR=load_as_extension preserve a generic extension (the planned Polars 2.0 default).

Polars refuses arithmetic on extension-typed columns (there is no third-party kernel or supertype resolution), so the dtype is deliberately only a persistence and guardrail layer: unit algebra lives in encomp.units.Quantity, which is exposed by validated QuantityFrame descriptors and written back through QuantityFrame.derive(). The with_units() and units_of() helpers remain available for explicit low-level ingestion and metadata inspection.

Warning

The underlying polars extension-type API is marked unstable by polars. encomp pins the observed behavior in its test suite so a breaking polars bump fails loudly rather than silently.

class Assignment(column, value)[source]

Bases: Generic

A dimension-checked output binding created by Column.assign().

Parameters:
  • column (Column[DT])

  • value (Quantity[DT, pl.Expr])

class Column(value, dimensionality, *, name=None)[source]

Bases: Generic

A unit-bearing column declaration on a QuantityFrame.

Access through the schema class returns the declaration. Access through a validated schema instance returns a Quantity[DT, pl.Expr].

Parameters:
  • value (str | Unit[Any])

  • dimensionality (type[DT])

  • name (str | None)

assign(value)[source]

Bind a typed expression quantity to this declared output column.

Return type:

Assignment[TypeVar(DT, bound= Dimensionality)]

Parameters:

value (Quantity[DT, pl.Expr])

property name: str

Physical Polars column name, defaulting to the schema attribute name.

class QuantityFrame(frame)[source]

Bases: object

Validated, lazy Polars frame with typed quantity-column descriptors.

Parameters:

frame (pl.DataFrame | pl.LazyFrame)

classmethod derive(frame, *assignments)[source]

Derive declared quantity columns from typed expression assignments.

Return type:

Self

Parameters:
classmethod from_untyped(frame)[source]

Assign the declared units to bare numeric columns, then validate.

Return type:

Self

Parameters:

frame (DataFrame | LazyFrame)

lf: LazyFrame
classmethod scan_parquet(source)[source]

Lazily scan a Parquet file and validate its persisted unit schema.

Return type:

Self

Parameters:

source (str | Path)

class UnitDType(unit, storage=None)[source]

Bases: BaseExtension

Polars extension dtype carrying a physical unit as column metadata.

A dtype instance consists of the stable extension name "encomp.unit", a numeric storage dtype, and a canonical unit string. Polars refuses value-producing arithmetic on extension columns; validated encomp.polars.QuantityFrame descriptors enter Quantity unit algebra and QuantityFrame.derive returns results to a frame.

Parameters:
  • unit (str | Unit[Any])

  • storage (pl.DataType | None)

property unit: Unit[Any]

The column unit parsed from the extension metadata.

unit(value, *, name=None, asdim=None)[source]
Overloads:
  • value (_ut.DimensionlessUnits), name (str | None) → Column[_ut.Dimensionless]

  • value (_ut.CurrencyUnits), name (str | None) → Column[_ut.Currency]

  • value (_ut.CurrencyPerEnergyUnits), name (str | None) → Column[_ut.CurrencyPerEnergy]

  • value (_ut.CurrencyPerMassUnits), name (str | None) → Column[_ut.CurrencyPerMass]

  • value (_ut.CurrencyPerVolumeUnits), name (str | None) → Column[_ut.CurrencyPerVolume]

  • value (_ut.CurrencyPerTimeUnits), name (str | None) → Column[_ut.CurrencyPerTime]

  • value (_ut.LengthUnits), name (str | None) → Column[_ut.Length]

  • value (_ut.MassUnits), name (str | None) → Column[_ut.Mass]

  • value (_ut.TimeUnits), name (str | None) → Column[_ut.Time]

  • value (_ut.FrequencyUnits), name (str | None) → Column[_ut.Frequency]

  • value (_ut.TemperatureUnits), name (str | None) → Column[_ut.Temperature]

  • value (_ut.TemperatureDifferenceUnits), name (str | None) → Column[_ut.TemperatureDifference]

  • value (_ut.SubstanceUnits), name (str | None) → Column[_ut.Substance]

  • value (_ut.MolarMassUnits), name (str | None) → Column[_ut.MolarMass]

  • value (_ut.SubstancePerMassUnits), name (str | None) → Column[_ut.SubstancePerMass]

  • value (_ut.CurrentUnits), name (str | None) → Column[_ut.Current]

  • value (_ut.LuminosityUnits), name (str | None) → Column[_ut.Luminosity]

  • value (_ut.AreaUnits), name (str | None) → Column[_ut.Area]

  • value (_ut.VolumeUnits), name (str | None) → Column[_ut.Volume]

  • value (_ut.NormalVolumeUnits), name (str | None) → Column[_ut.NormalVolume]

  • value (_ut.PressureUnits), name (str | None) → Column[_ut.Pressure]

  • value (_ut.MassFlowUnits), name (str | None) → Column[_ut.MassFlow]

  • value (_ut.VolumeFlowUnits), name (str | None) → Column[_ut.VolumeFlow]

  • value (_ut.NormalVolumeFlowUnits), name (str | None) → Column[_ut.NormalVolumeFlow]

  • value (_ut.DensityUnits), name (str | None) → Column[_ut.Density]

  • value (_ut.MolarDensityUnits), name (str | None) → Column[_ut.MolarDensity]

  • value (_ut.SpecificVolumeUnits), name (str | None) → Column[_ut.SpecificVolume]

  • value (_ut.NormalVolumePerMassUnits), name (str | None) → Column[_ut.NormalVolumePerMass]

  • value (_ut.MassPerNormalVolumeUnits), name (str | None) → Column[_ut.MassPerNormalVolume]

  • value (_ut.EnergyUnits), name (str | None) → Column[_ut.Energy]

  • value (_ut.PowerUnits), name (str | None) → Column[_ut.Power]

  • value (_ut.VelocityUnits), name (str | None) → Column[_ut.Velocity]

  • value (_ut.ForceUnits), name (str | None) → Column[_ut.Force]

  • value (_ut.DynamicViscosityUnits), name (str | None) → Column[_ut.DynamicViscosity]

  • value (_ut.KinematicViscosityUnits), name (str | None) → Column[_ut.KinematicViscosity]

  • value (_ut.EnergyPerMassUnits), name (str | None) → Column[_ut.EnergyPerMass]

  • value (_ut.MolarSpecificEnthalpyUnits), name (str | None) → Column[_ut.MolarSpecificEnthalpy]

  • value (_ut.SpecificHeatCapacityUnits), name (str | None) → Column[_ut.SpecificHeatCapacity]

  • value (_ut.ThermalConductivityUnits), name (str | None) → Column[_ut.ThermalConductivity]

  • value (_ut.PowerPerAreaUnits), name (str | None) → Column[_ut.PowerPerArea]

  • value (_ut.HeatTransferCoefficientUnits), name (str | None) → Column[_ut.HeatTransferCoefficient]

  • value (Unit[DT]), name (str | None) → Column[DT]

  • value (str | Unit[Any]), name (str | None), asdim (type[DT]) → Column[DT]

  • value (str | Unit[Any]), name (str | None), asdim (None) → Column[UnknownDimensionality]

Parameters:
Return type:

Column[Any]

Declare a quantity column, inferring dimensionality from its unit.

Registered literal spellings are also inferred by static type checkers. Any other valid Pint unit is inferred at runtime and is statically UnknownDimensionality unless asdim= is supplied. The override is validated; it never performs an unchecked cast.

units_of(frame)[source]

Units of every unit-typed column in the frame, read from the schema.

Reads only schema metadata: no data pass, and a LazyFrame (e.g. a pl.scan_parquet) is not collected. Columns without a unit dtype are omitted.

Return type:

dict[str, Unit[Any]]

Parameters:

frame (DataFrame | LazyFrame)

with_units(frame, units)[source]
Overloads:
  • frame (pl.DataFrame), units (Mapping[str, str | Unit[Any]]) → pl.DataFrame

  • frame (pl.LazyFrame), units (Mapping[str, str | Unit[Any]]) → pl.LazyFrame

Parameters:
  • frame (DataFrame | LazyFrame)

  • units (Mapping[str, str | Unit[Any]])

Return type:

DataFrame | LazyFrame

Attach unit dtypes to existing numeric columns.

The magnitudes are not touched and the storage dtype is preserved (Float32 stays Float32). The unit schema is always spelled explicitly by the caller — it is never inferred from data. A key that is not a column, a non-numeric column, or an unknown unit string raises.

encomp.coolprop

Parallel CoolProp property evaluation as Polars expression plugins.

The fluid / water / humid_air API mirrors encomp.fluids: fluid requires the fluid name (with the backend folded in, e.g. "HEOS::CarbonDioxide") exactly as encomp.fluids.Fluid does, water fixes it to IF97 water/steam like encomp.fluids.Water, a mixture is given by a composition dict, and a fixed phase by assume_phase.

import polars as pl
from encomp import coolprop as cp

df.select(
    cp.water("DMASS", "P", "T").alias("rho"),   # IF97 water/steam
    cp.water("HMASS", "P", "T").alias("h"),
)                       # independent properties run in PARALLEL (no GIL)

df.select(cp.fluid("DMASS", "P", "H", name="HEOS::Water"))   # any input pair (named by inputs)
df.select(cp.fluid("DMASS", "P", "T", name="HEOS::CO2&O2",   # mixture, mole fractions
                   composition={"CO2": 0.7, "O2": 0.3}))
df.select(cp.humid_air("W", "P", "T", "R"))                  # humid air
# for differently-named columns, alias them: cp.water("DMASS", pl.col("p").alias("P"), "T")
ASSUMED_PHASES: frozenset[Literal['gas', 'liquid', 'supercritical', 'supercritical_gas', 'supercritical_liquid', 'twophase']] = frozenset({'gas', 'liquid', 'supercritical', 'supercritical_gas', 'supercritical_liquid', 'twophase'})

Runtime set of the user-facing assumed-phase names in AssumedPhase.

BACKENDS: frozenset[Literal['HEOS', 'IF97', 'REFPROP', 'SRK', 'PR', 'PCSAFT', 'VTPR', 'INCOMP', 'BICUBIC&HEOS', 'TTSE&HEOS']] = frozenset({'BICUBIC&HEOS', 'HEOS', 'IF97', 'INCOMP', 'PCSAFT', 'PR', 'REFPROP', 'SRK', 'TTSE&HEOS', 'VTPR'})

Runtime set of the CoolProp AbstractState backend names in Backend.

FLUID_INPUTS: frozenset[Literal['P', 'T', 'Q', 'D', 'DMASS', 'DMOLAR', 'Dmass', 'Dmolar', 'H', 'HMASS', 'HMOLAR', 'Hmass', 'Hmolar', 'S', 'SMASS', 'SMOLAR', 'Smass', 'Smolar', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar']] = frozenset({'D', 'DMASS', 'DMOLAR', 'Dmass', 'Dmolar', 'H', 'HMASS', 'HMOLAR', 'Hmass', 'Hmolar', 'P', 'Q', 'S', 'SMASS', 'SMOLAR', 'Smass', 'Smolar', 'T', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar'})

Runtime set of the fluid state-input names in FluidInput – the subset of FluidParam that can fix a state.

FLUID_PARAMS: frozenset[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity']] = frozenset({'A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GAS_CONSTANT', 'GMASS', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity'})

Runtime set of the CoolProp fluid parameter names in FluidParam.

HUMID_AIR_INPUTS: frozenset[Literal['T', 'Tdb', 'T_db', 'B', 'Twb', 'T_wb', 'WetBulb', 'D', 'Tdp', 'T_dp', 'DewPoint', 'W', 'Omega', 'HumRat', 'psi_w', 'R', 'RH', 'RelHum', 'H', 'Hda', 'Hha', 'Enthalpy', 'S', 'Sda', 'Sha', 'Entropy', 'V', 'Vda', 'Vha', 'P', 'P_w', 'Y']] = frozenset({'B', 'D', 'DewPoint', 'Enthalpy', 'Entropy', 'H', 'Hda', 'Hha', 'HumRat', 'Omega', 'P', 'P_w', 'R', 'RH', 'RelHum', 'S', 'Sda', 'Sha', 'T', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'V', 'Vda', 'Vha', 'W', 'WetBulb', 'Y', 'psi_w'})

Runtime set of the HAPropsSI state-input names in HumidAirInput – the subset of HumidAirParam that can fix a state.

HUMID_AIR_PARAMS: frozenset[Literal['B', 'C', 'CV', 'CVha', 'Cha', 'Conductivity', 'D', 'DewPoint', 'Enthalpy', 'Entropy', 'H', 'Hda', 'Hha', 'HumRat', 'K', 'M', 'Omega', 'P', 'P_w', 'R', 'RH', 'RelHum', 'S', 'Sda', 'Sha', 'T', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'V', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'Z', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w']] = frozenset({'B', 'C', 'CV', 'CVha', 'Cha', 'Conductivity', 'D', 'DewPoint', 'Enthalpy', 'Entropy', 'H', 'Hda', 'Hha', 'HumRat', 'K', 'M', 'Omega', 'P', 'P_w', 'R', 'RH', 'RelHum', 'S', 'Sda', 'Sha', 'T', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'V', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'Z', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'})

Runtime set of the HAPropsSI parameter names in HumidAirParam.

PHASES: frozenset[Literal['phase_liquid', 'phase_gas', 'phase_twophase', 'phase_supercritical', 'phase_supercritical_gas', 'phase_supercritical_liquid', 'phase_critical_point']] = frozenset({'phase_critical_point', 'phase_gas', 'phase_liquid', 'phase_supercritical', 'phase_supercritical_gas', 'phase_supercritical_liquid', 'phase_twophase'})

Runtime set of the low-level CoolProp phase_* strings in Phase.

PHASE_IGNORING_BACKENDS: frozenset[str] = frozenset({'IF97'})

assuming a phase has no effect there, so fluid() logs a warning when assume_phase names one of these. Mirrors the set encomp.fluids.Fluid uses.

Type:

Region-explicit backends that ignore AbstractState.specify_phase

WATER_NAME: Literal['Water', 'IF97::Water', 'HEOS::Water', 'HEOS', 'Air', 'Nitrogen', 'Oxygen', 'CarbonDioxide', 'Hydrogen', 'Methane', 'Ammonia', 'Argon', 'R134a'] = 'IF97::Water'

The fluid name behind encomp.fluids.Water, and the one water() evaluates.

fluid(output, input1, input2, *, name, assume_phase=None, composition=None)[source]

A CoolProp fluid property (output) as a parallel Polars expression.

Mirrors encomp.fluids.Fluid, including that name is required. Use water() for the IF97 water/steam shorthand, as encomp.fluids.Water mirrors encomp.fluids.Fluid.

The fluid is identified by name with the backend folded in ("HEOS::CarbonDioxide", "IF97::Water"; a bare "Water" defaults to HEOS/IAPWS-95). A mixture is given either by fractions in the name ("HEOS::CO2[0.5]&O2[0.5]") or a composition={species: mole fraction} dict; mole fractions must sum to 1 (an off-by-more-than-rounding sum is an error). An incompressible mixture instead carries a single concentration in the name ("INCOMP::MEG[0.5]"), on the fluid’s own basis (see resolve_fluid_spec()). assume_phase pins the phase, skipping CoolProp’s phase-stability search (a speed tool; honoured by HEOS/GERG, ignored by region-explicit backends like IF97, which log a warning).

Each input identifies its property by NAME – a string is the property and the column read from it; an expression by its output name (pl.col("P") or pl.col("p").alias("P")). Both must be CoolProp state inputs (P/T/Q/D/H/S/U, any pair: PT, PH, PQ, …).

Inputs are numeric columns holding SI magnitudes. A unit-carrying extension dtype (encomp.polars) is accepted when its unit is already the SI unit CoolProp expects for that input (verified against CoolProp’s own parameter metadata); any other unit is refused at schema-resolution time with the expected unit named – convert first (e.g. encomp.polars.quantities + .to(...)), or pass raw SI values via .ext.storage().

Return type:

Expr

Parameters:
  • output (Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity'])

  • input1 (Literal['P', 'T', 'Q', 'D', 'DMASS', 'DMOLAR', 'Dmass', 'Dmolar', 'H', 'HMASS', 'HMOLAR', 'Hmass', 'Hmolar', 'S', 'SMASS', 'SMOLAR', 'Smass', 'Smolar', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar'] | ~polars.expr.expr.Expr)

  • input2 (Literal['P', 'T', 'Q', 'D', 'DMASS', 'DMOLAR', 'Dmass', 'Dmolar', 'H', 'HMASS', 'HMOLAR', 'Hmass', 'Hmolar', 'S', 'SMASS', 'SMOLAR', 'Smass', 'Smolar', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar'] | ~polars.expr.expr.Expr)

  • name (Literal['Water', 'IF97::Water', 'HEOS::Water', 'HEOS', 'Air', 'Nitrogen', 'Oxygen', 'CarbonDioxide', 'Hydrogen', 'Methane', 'Ammonia', 'Argon', 'R134a'] | str)

  • assume_phase (Literal['gas', 'liquid', 'supercritical', 'supercritical_gas', 'supercritical_liquid', 'twophase'] | None)

  • composition (dict[Literal['Water', 'IF97::Water', 'HEOS::Water', 'HEOS', 'Air', 'Nitrogen', 'Oxygen', 'CarbonDioxide', 'Hydrogen', 'Methane', 'Ammonia', 'Argon', 'R134a'] | str, float | int] | None)

humid_air(output, input1, input2, input3)[source]

A humid-air (HAPropsSI) property as a Polars expression.

Each input identifies its property by name (the string, or the expression’s output name); all three must be HAPropsSI state inputs (T, P, R, W, B, …). Like fluid(), inputs hold SI magnitudes: a unit-carrying extension dtype is accepted only when its unit is already the expected SI unit, and refused with the expected unit named otherwise.

Return type:

Expr

Parameters:
  • output (Literal['B', 'C', 'CV', 'CVha', 'Cha', 'Conductivity', 'D', 'DewPoint', 'Enthalpy', 'Entropy', 'H', 'Hda', 'Hha', 'HumRat', 'K', 'M', 'Omega', 'P', 'P_w', 'R', 'RH', 'RelHum', 'S', 'Sda', 'Sha', 'T', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'V', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'Z', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w'])

  • input1 (Literal['T', 'Tdb', 'T_db', 'B', 'Twb', 'T_wb', 'WetBulb', 'D', 'Tdp', 'T_dp', 'DewPoint', 'W', 'Omega', 'HumRat', 'psi_w', 'R', 'RH', 'RelHum', 'H', 'Hda', 'Hha', 'Enthalpy', 'S', 'Sda', 'Sha', 'Entropy', 'V', 'Vda', 'Vha', 'P', 'P_w', 'Y'] | ~polars.expr.expr.Expr)

  • input2 (Literal['T', 'Tdb', 'T_db', 'B', 'Twb', 'T_wb', 'WetBulb', 'D', 'Tdp', 'T_dp', 'DewPoint', 'W', 'Omega', 'HumRat', 'psi_w', 'R', 'RH', 'RelHum', 'H', 'Hda', 'Hha', 'Enthalpy', 'S', 'Sda', 'Sha', 'Entropy', 'V', 'Vda', 'Vha', 'P', 'P_w', 'Y'] | ~polars.expr.expr.Expr)

  • input3 (Literal['T', 'Tdb', 'T_db', 'B', 'Twb', 'T_wb', 'WetBulb', 'D', 'Tdp', 'T_dp', 'DewPoint', 'W', 'Omega', 'HumRat', 'psi_w', 'R', 'RH', 'RelHum', 'H', 'Hda', 'Hha', 'Enthalpy', 'S', 'Sda', 'Sha', 'Entropy', 'V', 'Vda', 'Vha', 'P', 'P_w', 'Y'] | ~polars.expr.expr.Expr)

is_assumed_phase(name)[source]
Return type:

TypeIs[Literal['gas', 'liquid', 'supercritical', 'supercritical_gas', 'supercritical_liquid', 'twophase']]

Parameters:

name (str)

is_backend(name)[source]
Return type:

TypeIs[Literal['HEOS', 'IF97', 'REFPROP', 'SRK', 'PR', 'PCSAFT', 'VTPR', 'INCOMP', 'BICUBIC&HEOS', 'TTSE&HEOS']]

Parameters:

name (str)

is_fluid_input(name)[source]
Return type:

TypeIs[Literal['P', 'T', 'Q', 'D', 'DMASS', 'DMOLAR', 'Dmass', 'Dmolar', 'H', 'HMASS', 'HMOLAR', 'Hmass', 'Hmolar', 'S', 'SMASS', 'SMOLAR', 'Smass', 'Smolar', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar']]

Parameters:

name (str)

is_fluid_param(name)[source]
Return type:

TypeIs[Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity']]

Parameters:

name (str)

is_humid_air_input(name)[source]
Return type:

TypeIs[Literal['T', 'Tdb', 'T_db', 'B', 'Twb', 'T_wb', 'WetBulb', 'D', 'Tdp', 'T_dp', 'DewPoint', 'W', 'Omega', 'HumRat', 'psi_w', 'R', 'RH', 'RelHum', 'H', 'Hda', 'Hha', 'Enthalpy', 'S', 'Sda', 'Sha', 'Entropy', 'V', 'Vda', 'Vha', 'P', 'P_w', 'Y']]

Parameters:

name (str)

is_humid_air_param(name)[source]
Return type:

TypeIs[Literal['B', 'C', 'CV', 'CVha', 'Cha', 'Conductivity', 'D', 'DewPoint', 'Enthalpy', 'Entropy', 'H', 'Hda', 'Hha', 'HumRat', 'K', 'M', 'Omega', 'P', 'P_w', 'R', 'RH', 'RelHum', 'S', 'Sda', 'Sha', 'T', 'T_db', 'T_dp', 'T_wb', 'Tdb', 'Tdp', 'Twb', 'V', 'Vda', 'Vha', 'Visc', 'W', 'WetBulb', 'Y', 'Z', 'cp', 'cp_ha', 'cv_ha', 'k', 'mu', 'psi_w']]

Parameters:

name (str)

is_phase(name)[source]
Return type:

TypeIs[Literal['phase_liquid', 'phase_gas', 'phase_twophase', 'phase_supercritical', 'phase_supercritical_gas', 'phase_supercritical_liquid', 'phase_critical_point']]

Parameters:

name (str)

lib_path()[source]

Absolute path to the bundled CoolProp dynamic library for this platform.

Return type:

str

lib_version()[source]

CoolProp version of the bundled library (cached; the bundled lib never changes).

Return type:

str

resolve_fluid_spec(name, composition=None)[source]

Resolve a CoolProp name (+ optional composition dict) into the (backend, fluids, fractions) an AbstractState needs. The single place that parses and validates a fluid name + composition; encomp.fluids.Fluid delegates here.

The backend may be folded into name ("IF97::Water", "HEOS::CO2&O2") or, with a composition dict, passed as the bare backend ("HEOS"); no backend defaults to HEOS.

fractions is None for a pure fluid. Otherwise its basis is FLUID-SPECIFIC (CoolProp’s set_fractions selects it, the caller never does):

  • a multi-species mixture (HEOS/PR/…) is mole fractions that must sum to 1 (a small tolerance absorbs float rounding); a sum further off is an error, not a silent renormalise.

  • a single-species incompressible concentration ("INCOMP::MEG[0.5]") is an absolute fraction on the fluid’s own basis – mass for aqueous solutions (glycols, brines, seawater), volume for the volume-specified antifreezes – and is NOT normalised.

Return type:

tuple[str, str, list[float] | None]

Parameters:
  • name (Literal['Water', 'IF97::Water', 'HEOS::Water', 'HEOS', 'Air', 'Nitrogen', 'Oxygen', 'CarbonDioxide', 'Hydrogen', 'Methane', 'Ammonia', 'Argon', 'R134a'] | str)

  • composition (dict[Literal['Water', 'IF97::Water', 'HEOS::Water', 'HEOS', 'Air', 'Nitrogen', 'Oxygen', 'CarbonDioxide', 'Hydrogen', 'Methane', 'Ammonia', 'Argon', 'R134a'] | str, float | int] | None)

self_check()[source]

True if the plugin loads and evaluates one known value correctly (cached).

Return type:

bool

water(output, input1, input2)[source]

A water/steam property as a parallel Polars expression, using IAPWS-IF97.

Mirrors encomp.fluids.Water: the fluid is fixed to "IF97::Water", so there is no name. Equivalent to fluid(output, input1, input2, name="IF97::Water").

composition and assume_phase are not accepted: water is a pure fluid, and IF97 is region-explicit so an assumed phase would be ignored. Use fluid(..., name="HEOS::Water") for the IAPWS-95 reference formulation, which does honour an assumed phase.

Return type:

Expr

Parameters:
  • output (Literal['A', 'C', 'CONDUCTIVITY', 'CP0MASS', 'CP0MOLAR', 'CPMASS', 'CPMOLAR', 'CVMASS', 'CVMOLAR', 'Cp0mass', 'Cp0molar', 'Cpmass', 'Cpmolar', 'Cvmass', 'Cvmolar', 'D', 'DELTA', 'DIPOLE_MOMENT', 'DMASS', 'DMOLAR', 'Delta', 'Dmass', 'Dmolar', 'G', 'GMASS', 'GAS_CONSTANT', 'GMOLAR', 'GMOLAR_RESIDUAL', 'Gmass', 'Gmolar', 'Gmolar_residual', 'H', 'HELMHOLTZMASS', 'HELMHOLTZMOLAR', 'HMASS', 'HMOLAR', 'HMOLAR_RESIDUAL', 'Helmholtzmass', 'Helmholtzmolar', 'Hmass', 'Hmolar', 'Hmolar_residual', 'I', 'ISENTROPIC_EXPANSION_COEFFICIENT', 'ISOBARIC_EXPANSION_COEFFICIENT', 'ISOTHERMAL_COMPRESSIBILITY', 'L', 'M', 'MOLARMASS', 'MOLAR_MASS', 'MOLEMASS', 'O', 'P', 'PCRIT', 'PHASE', 'PMAX', 'PMIN', 'PRANDTL', 'PTRIPLE', 'P_CRITICAL', 'P_MAX', 'P_MIN', 'P_REDUCING', 'P_TRIPLE', 'P_max', 'P_min', 'Pcrit', 'Phase', 'Prandtl', 'Q', 'RHOCRIT', 'RHOMASS_CRITICAL', 'RHOMASS_REDUCING', 'RHOMOLAR_CRITICAL', 'RHOMOLAR_REDUCING', 'S', 'SMASS', 'SMOLAR', 'SMOLAR_RESIDUAL', 'SPEED_OF_SOUND', 'SURFACE_TENSION', 'Smass', 'Smolar', 'Smolar_residual', 'T', 'TAU', 'TCRIT', 'TMAX', 'TMIN', 'TTRIPLE', 'T_CRITICAL', 'T_FREEZE', 'T_MAX', 'T_MIN', 'T_REDUCING', 'T_TRIPLE', 'T_critical', 'T_freeze', 'T_max', 'T_min', 'T_reducing', 'T_triple', 'Tau', 'Tcrit', 'Tmax', 'Tmin', 'Ttriple', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar', 'V', 'VISCOSITY', 'Z', 'conductivity', 'dipole_moment', 'gas_constant', 'isentropic_expansion_coefficient', 'isobaric_expansion_coefficient', 'isothermal_compressibility', 'molar_mass', 'molarmass', 'molemass', 'p_critical', 'p_reducing', 'p_triple', 'pcrit', 'pmax', 'pmin', 'ptriple', 'rhocrit', 'rhomass_critical', 'rhomass_reducing', 'rhomolar_critical', 'rhomolar_reducing', 'speed_of_sound', 'surface_tension', 'viscosity'])

  • input1 (Literal['P', 'T', 'Q', 'D', 'DMASS', 'DMOLAR', 'Dmass', 'Dmolar', 'H', 'HMASS', 'HMOLAR', 'Hmass', 'Hmolar', 'S', 'SMASS', 'SMOLAR', 'Smass', 'Smolar', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar'] | ~polars.expr.expr.Expr)

  • input2 (Literal['P', 'T', 'Q', 'D', 'DMASS', 'DMOLAR', 'Dmass', 'Dmolar', 'H', 'HMASS', 'HMOLAR', 'Hmass', 'Hmolar', 'S', 'SMASS', 'SMOLAR', 'Smass', 'Smolar', 'U', 'UMASS', 'UMOLAR', 'Umass', 'Umolar'] | ~polars.expr.expr.Expr)

encomp.sympy

Imports and extends the sympy library for symbolic mathematics. Contains tools for converting SymPy expressions to Python modules and functions.

class Symbol(name, **assumptions)[source]

Bases: Symbol

A sympy.Symbol extended with convenience methods for typeset sub- and superscripts (_(), __(), decorate()). Each method returns a new symbol with the same assumptions as the original.

Symbols are identified by name and assumptions:

>>> from sympy import Symbol
>>> Symbol("x") == Symbol("x")

True >>> Symbol(“x”, real=True) == Symbol(“x”, real=False) False

append(s, where='sub')[source]

Adds the input s to an existing sub- or superscript. Does not append to prefixes. Creates the sub- or superscript if it does not exist.

Parameters:
  • s (str | int) – Text or index to be added

  • where (Literal['sub', 'sup']) – Whether to append to the subscript or superscript, by default ‘sub’

Returns:

A new symbol with the same assumptions as the input, with updated sub- or superscript

Return type:

Self

decorate(prefix=None, suffix=None, prefix_sub=None, prefix_sup=None, suffix_sub=None, suffix_sup=None)[source]

Method that decorates a symbol with subscripts and/or superscripts before or after the symbol. Returns a new symbol object with the same assumptions (i.e. real, positive, complex, etc…) as the input.

Using LaTeX syntax supported by sympy:

{prefix}^{prefix_sup}_{prefix_sub}{symbol}_{suffix_sub}^{suffix_sup}{suffix}

symbol is the input symbol. The prefix and suffix parts are added without _ or ^. Each of the parts (except symbol) can be empty.

The decorations can be string or integer, floats are not allowed. In case the input symbol already contains sub- or superscripts, the decorations are not appended to those. Instead, a new level is introduced. To keep things simple, make sure that the input symbol is a simple symbol.

Use the append method to append to an existing sub- or superscript in the suffix.

Parameters:
  • prefix (str | int | None) – Prefix added before the symbol, by default None

  • suffix (str | int | None) – Suffix added after the symbol, by default None

  • prefix_sub (str | int | None) – Subscript prefix before the symbol and after prefix, by default None

  • prefix_sup (str | int | None) – Superscript prefix before the symbol and after prefix, by default None

  • suffix_sub (str | int | None) – Subscript suffix after the symbol and before suffix, by default None

  • suffix_sup (str | int | None) – Superscript suffix after the symbol and before suffix, by default None

Returns:

A new symbol with the same assumptions as the input, with added decorations

Return type:

Self

default_assumptions = {}
delta()[source]

Add \Delta prefix.

Return type:

Self

name
evaluate(e, value_map, *, units=False)[source]

Evaluates the input expression, given the mapping of symbol to value in value_map.

Parameters:
  • e (Basic) – Input expression to evaluate

  • value_map (dict[Symbol, Quantity | ndarray]) – Mapping from symbol to value for all required symbols in e, additional symbols may be present

  • units (bool) – Whether to keep the units, if False Quantity is converted to float (after calling to_base_units()), by default False

Returns:

Value of the expression. Returns a Quantity if units=True; otherwise returns the numeric magnitude as float or np.ndarray.

Return type:

Quantity | ndarray | float

get_args(e)[source]

Returns a sorted list of identifiers for each free symbol in the input expression. The sort order is according to the string outputs from encomp.sympy.to_identifier().

Parameters:

e (Basic) – Input expression

Returns:

Sorted list of identifiers for each free symbol

Return type:

list[str]

get_function(e, *, units=False)[source]

Wrapper around encomp.sympy.get_lambda() that handles inputs and potential units.

Parameters:
  • e (Basic) – Input expression

  • units (bool) – Whether to keep the units, if False Quantity is converted to float (after calling to_base_units()), by default False

Returns:

Function that evaluates the input expression from a mapping of symbols to values.

Return type:

Callable[[dict[Any, Any]], Any]

get_lambda(e, *, to_str=False)[source]
Overloads:
  • e (sp.Basic), to_str (Literal[True]) → tuple[str, list[str]]

  • e (sp.Basic), to_str (Literal[False]) → tuple[Callable[…, Any], list[str]]

  • e (sp.Basic) → tuple[Callable[…, Any], list[str]]

Parameters:
  • e (Basic)

  • to_str (bool)

Return type:

tuple[Callable[[…], Any] | str, list[str]]

Converts the input expression to a lambda function with valid identifiers as parameter names.

Parameters:
  • e (Basic) – Input expression

  • to_str (bool) – Whether to return the string representation of the lambda function, by default False

Returns:

The lambda function (or string representation) and the list of parameters to the function

Return type:

tuple[Callable[…, Any] | str, list[str]]

get_lambda_kwargs(value_map, include=None, *, units=False)[source]

Returns a mapping from identifier to value (Quantity or float) based on the input value map (Symbol to value). If include is a list, only these symbols will be included.

Parameters:
  • value_map (dict[Symbol | str, Quantity | ndarray]) – Mapping from symbol or symbol identifier to value

  • include (Sequence[Symbol | str] | None) – Optional sequence of symbols or symbol identifiers to include, by default None

  • units (bool) – Whether to keep the units, if False Quantity is converted to float (after calling to_base_units()), by default False

Returns:

Mapping from identifier to value

Return type:

dict[str, Quantity | ndarray | float]

get_lambda_matrix(M)[source]

Converts the input matrix into a lambda function that returns an array. Converts the matrix to Python source, it is not possible to use in-memory lambda functions for this. Use eval(src) on the output from this function to create a function object.

Parameters:

M (MutableDenseMatrix) – Input matrix

Returns:

Python source code for the function and a list of parameters

Return type:

tuple[str, list[str]]

get_sol_expr(equations, symbol, avoid=None)[source]

Wrapper around sp.solve that returns the solution expression for a single symbol, or None in case SymPy could not solve for the specified symbol. Only considers equations in the input list that actually contains the symbol. Prefers to use equations that contain symbol on the LHS.

Parameters:
  • equations (Equality | list[Equality]) – List of equations or a single equation

  • symbol (Symbol) – Symbol to solve for (isolate)

  • avoid (set[Symbol] | None) – Set of symbols to avoid in the substitution expressions, by default None

Returns:

Expression that equals symbol, or None in case the equation(s) could not be solved

Return type:

Basic | None

recursive_subs(e, replacements)[source]

Substitute the expressions in replacements recursively. This might not be necessary in all cases, SymPy’s builtin subs() method should also do this recursively.

Note

The order of the tuples in replacements might matter, make sure to order these sensibly in case the expression contains a lot of nested substitutions.

Parameters:
  • e (Basic) – Input expression

  • replacements (list[tuple[Symbol, Basic]]) – List of replacements: symbol, replace

Returns:

Substituted expression

Return type:

Basic

simplify_exponents(e)[source]

Simplifies an expression by combining float and int exponents. This is not done automatically by SymPy.

Adapted from https://stackoverflow.com/questions/54243832/sympy-wont-simplify-or-expand-exponential-with-decimals

Parameters:

e (Basic) – A SymPy expression, potentially containing mixed float and int exponents

Returns:

Simplified expression with float and int exponents combined

Return type:

Basic

substitute_unknowns(e, knowns, eqns, avoid=None)[source]

Uses the equations eqns to substitute the unknown symbols in the input expression. Uses recursion to deal with nested substitutions.

Parameters:
  • e (Basic) – Input expression that potentially contains unknown symbols

  • knowns (set[Symbol]) – Set of known symbols

  • eqns (list[Equality]) – List of equations that define the unknown symbols in terms of known ones

  • avoid (set[Symbol] | None) – Set of symbols to avoid in the substitution expressions, by default None

Returns:

The substituted expression without any unknown symbols

Return type:

Basic

symbols(inp, **kwargs)[source]

Like sympy.symbols, but typed as a list and always returning more than one symbol.

kwargs are SymPy assumptions (positive=True, integer=True, …).

Return type:

list[Symbol]

Parameters:
  • inp (str)

  • kwargs (Any)

to_identifier(s)[source]

Converts a SymPy symbol to a valid Python identifier. This function will only remove special characters.

The Latex command \text{} is replaced with T. This is done to differentiate between symbols \text{kg} (returns Tkg) and kg (returns kg).

Parameters:

s (object) – Input symbol or string representation

Returns:

Valid Python identifier created from the input symbol

Return type:

str

typeset(x)[source]

Does some additional typesetting for the input Latex string, for example \text{} around strings and upper-case characters.

Use comma , to separate parts of the input, for example

input,i

will be typeset as \text{input},i: the i is a separate part and is typeset with a math font. Spaces around commas will be removed to make sub- and superscripts more compact. Use ~ before a single upper-case letter to typeset it with a math font.

Uses flags from encomp.settings to determine how to typeset the input.

Parameters:

x (str | int) – Input string or int (will be converted to str)

Returns:

Output Latex string

Return type:

str

typeset_chemical(s)[source]

Typesets chemical formulas using Latex.

Parameters:

s (str) – Input string

Returns:

Output string with chemical formulas typeset correctly

Return type:

str

encomp.gases

Functions related to gases: normal volume to mass conversion, compressibility, etc…

A normal volume (Nm³, at 0 °C and 1 atm) is a distinct dimensionality (NormalVolume, dimensions [normal] * [length]³), so it can never be confused with an actual volume at process conditions. The functions here convert between mass, actual volume and normal volume; the normal-volume side is typed (and returned) as NormalVolume / NormalVolumeFlow with Nm³-based units.

Gas-condition literals use the values in encomp.constants.CONSTANTS: "N" means normal conditions (0 °C, 1 atm) and "S" means standard conditions (15 °C, 1 atm).

The functions here name their fluid parameter fluid_name, whereas encomp.fluids.Fluid names it name. That is intentional, not an inconsistency: name is unambiguous on a fluid object, while a free function that also takes volumes, masses and conditions has to say whose name it is.

Note

Humid-air-specific conversions are not implemented here; use encomp.fluids.HumidAir for humid-air properties.

type GasCondition = tuple[Quantity[Pressure], Quantity[Temperature]]
type GasConditionInput = GasCondition | Literal['N', 'S']
actual_volume_to_normal_volume(volume, condition, fluid_name='Air')[source]
Overloads:
  • volume (Quantity[Volume, Any]), condition (GasConditionInput), fluid_name (str) → Quantity[NormalVolume, Any]

  • volume (Quantity[VolumeFlow, Any]), condition (GasConditionInput), fluid_name (str) → Quantity[NormalVolumeFlow, Any]

Parameters:
Return type:

Quantity[NormalVolume] | Quantity[NormalVolumeFlow]

Convert actual volume to normal volume.

Parameters:
  • volume (Quantity[Volume] | Quantity[VolumeFlow]) – Input actual volume or actual volume flow

  • condition (Union[tuple[Quantity[Pressure], Quantity[Temperature]], Literal['N', 'S']]) – Condition at which the input volume is evaluated

  • fluid_name (str) – Name of the fluid, by default ‘Air’

Returns:

Corresponding normal volume (Nm³) or normal volume flow (Nm³/h)

Return type:

Quantity[NormalVolume, Any] | Quantity[NormalVolumeFlow, Any]

convert_gas_volume(V1, condition_1='N', condition_2='N', fluid_name='Air')[source]
Overloads:
  • V1 (Quantity[Volume, MT]), condition_1 (GasConditionInput), condition_2 (GasConditionInput), fluid_name (str) → Quantity[Volume, MT]

  • V1 (Quantity[VolumeFlow, MT]), condition_1 (GasConditionInput), condition_2 (GasConditionInput), fluid_name (str) → Quantity[VolumeFlow, MT]

Parameters:
Return type:

Quantity[Volume] | Quantity[VolumeFlow]

Converts the volume \(V_1\) (at \(T_1, P_1\)) to \(V_2\) (at \(T_2, P_2\)); the dimensionality (volume or volume flow) and the units of the input are preserved. Uses compressibility factors from CoolProp.

The values for \(P_i, T_i\) are passed as a tuple (P, T) (pressure first) using the parameters condition_1 and condition_2. Optionally, the literals "N" and "S" can be passed to indicate normal and standard conditions. "N" is 0 °C and 1 atm (CONSTANTS.normal_conditions_*); "S" is 15 °C and 1 atm (CONSTANTS.standard_conditions_*).

Both conditions default to "N", so calling this with only V1 converts nothing (it still evaluates \(Z\) twice, at the same state). Pass at least one of condition_1 / condition_2 for a conversion to take place.

Parameters:
  • V1 (Quantity[Volume] | Quantity[VolumeFlow]) – Volume or volume flow \(V_1\) at condition 1

  • condition_1 (Union[tuple[Quantity[Pressure], Quantity[Temperature]], Literal['N', 'S']]) – Literal[‘N’, ‘S’], optional Pressure and temperature at condition 1, by default ‘N’

  • condition_2 (Union[tuple[Quantity[Pressure], Quantity[Temperature]], Literal['N', 'S']]) – Literal[‘N’, ‘S’], optional Pressure and temperature at condition 2, by default ‘N’

  • fluid_name (str) – CoolProp name of the fluid, by default ‘Air’

Returns:

Volume or volume flow \(V_2\) at condition 2, in the units of V1

Return type:

Quantity[Volume, MT] | Quantity[VolumeFlow, MT]

ideal_gas_density(P, T, M)[source]

Returns the density \(\rho\) of an ideal gas.

For an ideal gas, density is calculated from the ideal gas law:

\[\rho = \frac{p M}{R T}\]

The gas constant \(R\) is \(8.31446261815324 \; \frac{\text{kg} \, \text{m}^2}{\text{s}^2 \, \text{K} \, \text{mol}}\) (exact by the 2019 SI definition).

The magnitude type of the result follows P; T and M may be scalars alongside a vector P (a scalar molar mass is the common case).

Parameters:
  • P (Quantity[Pressure]) – Absolute pressure of the gas

  • T (Quantity[Temperature] | Quantity[Temperature, float]) – Temperature of the gas

  • M (Quantity[MolarMass] | Quantity[MolarMass, float]) – Molar mass of the gas

Returns:

Density of the ideal gas at the specified temperature and pressure

Return type:

Quantity[Density]

mass_from_actual_volume(volume, condition, fluid_name='Air')[source]
Overloads:
  • volume (Quantity[Volume, MT]), condition (GasConditionInput), fluid_name (str) → Quantity[Mass, MT]

  • volume (Quantity[VolumeFlow, MT]), condition (GasConditionInput), fluid_name (str) → Quantity[MassFlow, MT]

Parameters:
Return type:

Quantity[Mass] | Quantity[MassFlow]

Convert actual volume to mass.

Parameters:
  • volume (Quantity[Volume] | Quantity[VolumeFlow]) – Input actual volume or actual volume flow

  • condition (Union[tuple[Quantity[Pressure], Quantity[Temperature]], Literal['N', 'S']]) – Condition at which to calculate the mass

  • fluid_name (str) – Name of the fluid, by default ‘Air’

Returns:

Corresponding mass or mass flow

Return type:

Quantity[Mass, MT] | Quantity[MassFlow, MT]

mass_from_normal_volume(volume, fluid_name='Air')[source]
Overloads:
  • volume (Quantity[NormalVolume, MT]), fluid_name (str) → Quantity[Mass, MT]

  • volume (Quantity[NormalVolumeFlow, MT]), fluid_name (str) → Quantity[MassFlow, MT]

Parameters:
Return type:

Quantity[Mass] | Quantity[MassFlow]

Convert normal volume to mass.

A plain Volume/VolumeFlow input is also accepted at runtime (the legacy calling convention) and is interpreted as a volume at normal conditions; new code should pass a NormalVolume/NormalVolumeFlow (Nm³-based units).

Parameters:
  • volume (Quantity[NormalVolume] | Quantity[NormalVolumeFlow] | Quantity[Volume] | Quantity[VolumeFlow]) – Input normal volume or normal volume flow

  • fluid_name (str) – Name of the fluid, by default ‘Air’

Returns:

Corresponding mass or mass flow

Return type:

Quantity[Mass, MT] | Quantity[MassFlow, MT]

mass_to_actual_volume(mass, condition, fluid_name='Air')[source]
Overloads:
  • mass (Quantity[Mass, MT]), condition (GasConditionInput), fluid_name (str) → Quantity[Volume, MT]

  • mass (Quantity[MassFlow, MT]), condition (GasConditionInput), fluid_name (str) → Quantity[VolumeFlow, MT]

Parameters:
Return type:

Quantity[Volume] | Quantity[VolumeFlow]

Convert mass to actual volume.

Parameters:
  • mass (Quantity[Mass] | Quantity[MassFlow]) – Input mass or mass flow

  • condition (Union[tuple[Quantity[Pressure], Quantity[Temperature]], Literal['N', 'S']]) – Condition at which to calculate the actual volume

  • fluid_name (str) – Name of the fluid, by default ‘Air’

Returns:

Corresponding actual volume or actual volume flow

Return type:

Quantity[Volume, MT] | Quantity[VolumeFlow, MT]

mass_to_normal_volume(mass, fluid_name='Air')[source]
Overloads:
  • mass (Quantity[Mass, MT]), fluid_name (str) → Quantity[NormalVolume, MT]

  • mass (Quantity[MassFlow, MT]), fluid_name (str) → Quantity[NormalVolumeFlow, MT]

Parameters:
Return type:

Quantity[NormalVolume] | Quantity[NormalVolumeFlow]

Convert mass to normal volume.

Parameters:
  • mass (Quantity[Mass] | Quantity[MassFlow]) – Input mass or mass flow

  • fluid_name (str) – Name of the fluid, by default ‘Air’

Returns:

Corresponding normal volume (Nm³) or normal volume flow (Nm³/h)

Return type:

Quantity[NormalVolume, MT] | Quantity[NormalVolumeFlow, MT]

normal_volume_to_actual_volume(volume, condition, fluid_name='Air')[source]
Overloads:
  • volume (Quantity[NormalVolume, Any]), condition (GasConditionInput), fluid_name (str) → Quantity[Volume, Any]

  • volume (Quantity[NormalVolumeFlow, Any]), condition (GasConditionInput), fluid_name (str) → Quantity[VolumeFlow, Any]

Parameters:
Return type:

Quantity[Volume] | Quantity[VolumeFlow]

Convert normal volume to actual volume.

A plain Volume/VolumeFlow input is also accepted at runtime (the legacy calling convention) and is interpreted as a volume at normal conditions; new code should pass a NormalVolume/NormalVolumeFlow (Nm³-based units).

Parameters:
  • volume (Quantity[NormalVolume] | Quantity[NormalVolumeFlow] | Quantity[Volume] | Quantity[VolumeFlow]) – Input normal volume or normal volume flow

  • condition (Union[tuple[Quantity[Pressure], Quantity[Temperature]], Literal['N', 'S']]) – Condition at which to calculate the actual volume

  • fluid_name (str) – Name of the fluid, by default ‘Air’

Returns:

Corresponding actual volume or actual volume flow

Return type:

Quantity[Volume, Any] | Quantity[VolumeFlow, Any]

encomp.conversion

Conversions between related engineering quantity dimensionalities.

convert_volume_mass(inp, rho)[source]
Overloads:
  • inp (Quantity[Mass, MT]), rho (Quantity[Density, Any]) → Quantity[Volume, MT]

  • inp (Quantity[MassFlow, MT]), rho (Quantity[Density, Any]) → Quantity[VolumeFlow, MT]

  • inp (Quantity[Volume, MT]), rho (Quantity[Density, Any]) → Quantity[Mass, MT]

  • inp (Quantity[VolumeFlow, MT]), rho (Quantity[Density, Any]) → Quantity[MassFlow, MT]

  • inp (Quantity[Mass, MT] | Quantity[MassFlow, MT] | Quantity[Volume, MT] | Quantity[VolumeFlow, MT]), rho (Quantity[Density, Any]) → Quantity[Mass, MT] | Quantity[MassFlow, MT] | Quantity[Volume, MT] | Quantity[VolumeFlow, MT]

Parameters:
Return type:

Quantity[Mass] | Quantity[MassFlow] | Quantity[Volume] | Quantity[VolumeFlow]

Converts mass to volume or vice versa.

Parameters:
  • inp (Quantity[Mass] | Quantity[MassFlow] | Quantity[Volume] | Quantity[VolumeFlow]) – Input mass or volume (or flow)

  • rho (Quantity[Density]) – Density of the substance. A missing density is allowed and yields a missing result at that position, exactly as a missing inp does: NaN for float and numpy magnitudes, null for a Polars Series. A Polars result carries null (never NaN), so with a Polars inp a NaN density is rejected – spell the missing density as a null in a pl.Series. Every present value must be finite and strictly positive. Polars Expr inputs are deferred and cannot be data-validated here.

Returns:

Calculated volume or mass (or flow)

Return type:

M | V

encomp.context

Context managers for process-local filesystem and formatting changes.

Two unrelated groups share this module:

  • process utilitiesworking_dir(), temp_dir() and silence_stdout() temporarily change the working directory or redirect stdout; they have nothing to do with units.

  • quantity formattingquantity_format() scopes the process-wide default format used when rendering quantities and units.

quantity_format(fmt='compact')[source]

Context manager version of encomp.units.set_quantity_format() that resets to the previous value afterwards.

Parameters:

fmt (str) – Unit format string: one of '~P', '~L', '~H', '~Lx'. Also accepts the aliases 'compact': '~P', 'normal': '~P' and 'siunitx': '~Lx'.

Return type:

Generator[None]

silence_stdout()[source]

Context manager that redirects stdout to os.devnull. This is used to suppress functions that print to stdout.

Return type:

Generator[None]

temp_dir()[source]

Context manager that changes the current working directory to a temporary directory. The temporary directory is deleted after the context manager exits.

Return type:

Generator[Path]

working_dir(path)[source]

Context manager that changes the working directory. The working directory is changed back after the context manager exits.

Parameters:

path (Path | str) – The new working directory

Return type:

Generator[None]

encomp.constants

Physical constants and reference conditions used by encomp helpers.

CONSTANTS = <encomp.constants.Constants object>

Singleton Constants instance; every attribute access returns a fresh Quantity.

class Constants[source]

Bases: object

Namespace of constants exposed through the CONSTANTS singleton.

Every attribute returns a fresh Quantity. A Quantity is mutable – ito() converts in place and the m setter replaces the magnitude – so handing out one shared instance would let a caller alter the constant for the whole process.

property R: Quantity[UnknownDimensionality, float]

Molar gas constant, exact by the 2019 SI definition.

property SIGMA: Quantity[UnknownDimensionality, float]

Stefan-Boltzmann constant.

property normal_conditions_pressure: Quantity[Pressure, float]

Normal-condition pressure, 1 atm.

property normal_conditions_temperature: Quantity[Temperature, float]

Normal-condition temperature, 0 degC.

property standard_conditions_pressure: Quantity[Pressure, float]

Standard-condition pressure, 1 atm.

property standard_conditions_temperature: Quantity[Temperature, float]

Standard-condition temperature, 15 degC.

encomp.misc

Small runtime typing and source-inspection helpers used by encomp.

isinstance_types(obj, expected)[source]

Return whether obj conforms to a runtime type form.

This is the project-wide replacement for isinstance when the expected type may be parameterized, such as list[Quantity[Pressure]] or Quantity[Mass, float]. It delegates general type forms to typeguard.check_type() and handles Quantity subclasses directly so dimensionality and magnitude parameters are both respected.

Every element of a collection is checked, not just the first: a list[Quantity[Pressure]] holding a Quantity[Length] at any position is rejected. (typeguard.typechecked keeps typeguard’s own default of checking only the first element.)

Return type:

TypeIs[TypeVar(T)]

Parameters:
  • obj (Any)

  • expected (TypeForm)

name_assignments(src)[source]

Return simple name = ... assignments found in Python source text.

Return type:

list[tuple[str, str]]

Parameters:

src (str)

encomp.settings

Contains settings used elsewhere in the library.

SETTINGS = Settings(units=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/encomp/checkouts/latest/encomp/defs/units.txt'), typeset_symbol_scripts=True, ignore_ndarray_unit_stripped_warning=True, ignore_coolprop_warnings=True, autoconvert_offset_to_baseunit=False, default_unit_format='~P')

Singleton Settings instance, initialized the first time the library loads. Some consumers read values during their own import/initialization, so attribute assignment on this instance is not a general runtime-configuration API.

class Settings(_case_sensitive=None, _nested_model_default_partial_update=None, _env_prefix=None, _env_prefix_target=None, _env_file=PosixPath('.'), _env_file_encoding=None, _env_ignore_empty=None, _env_nested_delimiter=None, _env_nested_max_split=None, _env_parse_none_str=None, _env_parse_enums=None, _cli_prog_name=None, _cli_parse_args=None, _cli_settings_source=None, _cli_parse_none_str=None, _cli_hide_none_type=None, _cli_avoid_json=None, _cli_enforce_required=None, _cli_use_class_docs_for_groups=None, _cli_exit_on_error=None, _cli_prefix=None, _cli_flag_prefix_char=None, _cli_implicit_flags=None, _cli_ignore_unknown_args=None, _cli_kebab_case=None, _cli_shortcuts=None, _secrets_dir=None, _build_sources=None, **values)[source]

Bases: BaseSettings

Settings class.

Use an .env-file in the current working directory to override the defaults; pydantic-settings loads it automatically when this module is first imported (no manual loading needed).

The variables in the .env-file have the same names (not case-sensitive) as the attributes of this class, with the additional prefix ENCOMP_. In case of invalid values in the .env-file or environment variables, a ValidationError is raised.

Note

Names that are defined as global environment variables (either on the system or user level) take precedence over names in the .env-file. The global environment variables are loaded even if no .env-file was found.

Warning

Because the .env-file is resolved relative to the current working directory, a stray .env containing an invalid ENCOMP_* value (e.g. ENCOMP_UNITS pointing to a missing file) makes import encomp fail with a ValidationError – even in an unrelated project.

  • UNITS: path to a file with unit definitions for pint

  • TYPESET_SYMBOL_SCRIPTS: whether to typeset SymPy symbol sub- and superscripts

  • IGNORE_NDARRAY_UNIT_STRIPPED_WARNING: whether to suppress the pint warning when converting Quantity to NumPy array.

  • IGNORE_COOLPROP_WARNINGS: whether to suppress warnings from the CoolProp backend

  • AUTOCONVERT_OFFSET_TO_BASEUNIT: whether to automatically convert offset units in computations. If this is False, °C must be converted to K before multiplication (for example)

  • DEFAULT_UNIT_FORMAT: default unit format for Quantity objects: one of ~P (compact), ~L (Latex), ~H (HTML), ~Lx (Latex with SIUNITX package)

Note

All names are case-insensitive.

Environment-backed settings are loaded once when this module is imported. Some values are consumed during registry initialization, so assigning new values to SETTINGS is not a general runtime configuration API. Use encomp.units.set_quantity_format() to change quantity/unit rendering for the current process.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • _case_sensitive (bool | None)

  • _nested_model_default_partial_update (bool | None)

  • _env_prefix (str | None)

  • _env_prefix_target (EnvPrefixTarget | None)

  • _env_file (DotenvType | None)

  • _env_file_encoding (str | None)

  • _env_ignore_empty (bool | None)

  • _env_nested_delimiter (str | None)

  • _env_nested_max_split (int | None)

  • _env_parse_none_str (str | None)

  • _env_parse_enums (bool | None)

  • _cli_prog_name (str | None)

  • _cli_parse_args (bool | list[str] | tuple[str, ...] | None)

  • _cli_settings_source (CliSettingsSource[Any] | None)

  • _cli_parse_none_str (str | None)

  • _cli_hide_none_type (bool | None)

  • _cli_avoid_json (bool | None)

  • _cli_enforce_required (bool | None)

  • _cli_use_class_docs_for_groups (bool | None)

  • _cli_exit_on_error (bool | None)

  • _cli_prefix (str | None)

  • _cli_flag_prefix_char (str | None)

  • _cli_implicit_flags (bool | Literal['dual', 'toggle'] | None)

  • _cli_ignore_unknown_args (bool | None)

  • _cli_kebab_case (bool | Literal['all', 'no_enums'] | None)

  • _cli_shortcuts (Mapping[str, str | list[str]] | None)

  • _secrets_dir (PathType | None)

  • _build_sources (tuple[tuple[PydanticBaseSettingsSource, ...], dict[str, Any]] | None)

  • units (Annotated[Path, PathType(path_type=file)])

  • typeset_symbol_scripts (bool)

  • ignore_ndarray_unit_stripped_warning (bool)

  • ignore_coolprop_warnings (bool)

  • autoconvert_offset_to_baseunit (bool)

  • default_unit_format (Literal['~P', '~L', '~H', '~Lx'])

autoconvert_offset_to_baseunit: bool
default_unit_format: Literal['~P', '~L', '~H', '~Lx']
ignore_coolprop_warnings: bool
ignore_ndarray_unit_stripped_warning: bool
model_config = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_flag_prefix_char': '-', 'cli_hide_none_type': False, 'cli_ignore_unknown_args': False, 'cli_implicit_flags': False, 'cli_kebab_case': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_shortcuts': None, 'cli_use_class_docs_for_groups': False, 'enable_decoding': True, 'env_file': '.env', 'env_file_encoding': 'utf-8', 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_nested_max_split': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': 'ENCOMP_', 'env_prefix_target': 'variable', 'extra': 'ignore', 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_customise_sources'), 'secrets_dir': None, 'toml_file': None, 'validate_default': True, 'yaml_config_section': None, 'yaml_file': None, 'yaml_file_encoding': None}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

typeset_symbol_scripts: bool
units: Annotated[Path, PathType(path_type=file)]

encomp.structures

Helpers for chunking and flattening common Python containers.

divide_chunks(container, N)[source]
Overloads:
  • container (list[T]), N (int) → Iterator[list[T]]

  • container (tuple[T, …]), N (int) → Iterator[tuple[T, …]]

  • container (Sequence[T]), N (int) → Iterator[Sequence[T]]

  • container (np.ndarray), N (int) → Iterator[np.ndarray]

Parameters:
  • container (Any)

  • N (int)

Return type:

Any

Yield slices of container with at most N elements each.

Empty containers yield no chunks. N must be positive. The returned chunks preserve the container’s slicing behavior, so lists produce lists, tuples produce tuples, and numpy arrays produce arrays.

flatten(container, max_depth=None)[source]

Yield nested iterable contents as a flat stream.

Strings, bytes, dictionaries, Quantity instances, numpy arrays and Polars objects are treated as atomic values rather than recursively iterated.

Return type:

Iterator[Any]

Parameters:
  • container (Iterable[Any])

  • max_depth (int | None)