pyskyfire.common.fluids.Fluid¶
- class pyskyfire.common.fluids.Fluid(type, propellants, fractions, basis='mass', precision=3)¶
Mixture helper for fluids.
Stores a set of component names and composition.
- Parameters:
- type
str Role of the mixture (e.g.,
"fuel","oxidizer","coolant").- propellants
list[str] Component names (CoolProp canonical names, e.g.,
"Ethanol","Water").- fractions
list[float] Composition fractions corresponding to
propellants. Interpreted as mass or mole fractions depending onbasis.- basis
str,optional "mass"or"mole". Default is"mass".- precision
int,optional Number of decimal digits when exporting mole fractions (e.g., in
coolprop_string()). Default is3.
- type
- Attributes:
See also
CoolPropExternal property library used for molar masses and HEOS string format.
Notes
Fractions are re-normalized internally when converting to mole basis to guard against small rounding errors.
- as_mole_fractions()¶
Convert the stored composition to mole fractions.
- Returns:
- Raises:
ValueErrorIf
basisis not"mass"or"mole".
Notes
For a mass-basis input, the conversion uses \(x_i = \frac{w_i/M_i}{\sum_j w_j/M_j}\) with molar masses \(M_i\) from
molar_masses().
- coolprop_string()¶
Format a CoolProp HEOS mixture string.
- Returns:
strA string such as
'HEOS::Ethanol[0.800]&Water[0.200]', where the bracketed values are mole fractions withprecisiondigits.
Notes
The composition is always exported on a mole basis, using
as_mole_fractions()for conversion when needed.