gaspype.fluid#
- class gaspype.fluid(composition, fs=None, shape=None)#
Bases:
object
A class to represent a fluid defined by a composition of one or more species.
- species#
List of species names in the associated fluid_system
- Type:
list[str]
- array_composition#
Array of the molar amounts of the species in the fluid
- Type:
FloatArray
- array_element_composition#
Array of the element composition in the fluid
- Type:
FloatArray
- array_fractions#
Array of the molar fractions of the species in the fluid
- Type:
FloatArray
- total#
Array of the sums of the molar amount of all species
- Type:
FloatArray | float
- fs#
Reference to the fluid_system used for this fluid
- Type:
- shape#
Shape of the fluid array
- Type:
_Shape
- elements#
List of elements in the fluid_system
- Type:
list[str]
Instantiates a fluid.
- Parameters:
composition (
dict
[str
,float
] |list
[float
] |ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – A dict of species names with their composition, e.g. {‘O2’:0.5,’H2O’:0.5} or a list/numpy-array of compositions. The array can be multidimensional, the size of the last dimension must match the number of species defined for the fluid_system. The indices of the last dimension correspond to the indices in the active_species list of the fluid_system.fs (
fluid_system
|None
) – Reference to a fluid_system. Is optional if composition is defined by a dict. If not specified a new fluid_system with the components from the dict is created.shape (
Optional
[Sequence
[int
]]) – Tuple or list for the dimensions the fluid array. Can only be used if composition argument is a dict. Otherwise the dimensions are specified by the composition argument.
- get_G(t, p)#
Get absolute gibbs free energy (H - TS)
- Parameters:
t (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Absolute temperature(s) in Kelvin. Fluid shape and shape of the temperature must be broadcastablep (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Pressures(s) in Pascal. Fluid shape and shape of the temperature must be broadcastable
- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]] |float
- Returns:
Gibbs free energy in J
- get_H(t)#
Get absolute enthalpy of the fluid at the given temperature
Enthalpy is referenced to 25 °C and includes enthalpy of formation. Therefore the enthalpy of H2 and O2 is 0 at 25 °C, but the enthalpy of water vapor at 25 °C is −241 kJ/mol (enthalpy of formation).
- Parameters:
t (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Absolute temperature(s) in Kelvin. Fluid shape and shape of the temperature must be broadcastable- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]] |float
- Returns:
Enthalpies in J
- get_S(t, p)#
Get absolute entropy of the fluid at the given temperature and pressure
- Parameters:
t (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Absolute temperature(s) in Kelvin. Fluid shape and shape of the temperature must be broadcastable- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]] |float
- Returns:
Entropy in J/K
- get_composition_dict()#
Get a dict of the molar amount of each fluid species
- Return type:
dict
[str
,float
]- Returns:
Returns a dict of floats with the molar amount of each fluid species in mol
- get_cp(t)#
Get molar heat capacity at constant pressure
- Parameters:
t (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Absolute temperature(s) in Kelvin. Fluid shape and shape of the temperature must be broadcastable- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]] |float
- Returns:
Heat capacity in J/mol/K
- get_density(t, p)#
Get mass based fluid density
- Parameters:
t (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Absolute temperature(s) in Kelvin. Fluid shape and shape of the temperature must be broadcastablep (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Pressure in Pa. Fluid shape and shape of the pressure must be broadcastable
- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]] |float
- Returns:
Density of the fluid in kg/m³
- get_fractions_dict()#
Get a dict of the molar fractions of each fluid species
- Return type:
dict
[str
,float
]- Returns:
Returns a dict of floats with the molar fractions of each fluid species
- get_g(t, p)#
Get molar gibbs free energy (h - Ts)
- Parameters:
t (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Absolute temperature(s) in Kelvin. Fluid shape and shape of the temperature must be broadcastablep (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Pressures(s) in Pascal. Fluid shape and shape of the temperature must be broadcastable
- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]] |float
- Returns:
Gibbs free energy in J/mol
- get_g_rt(t, p)#
Get specific gibbs free energy divided by RT: g/R/T == (h/T-s)/R
- Parameters:
t (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Absolute temperature(s) in Kelvin. Fluid shape and shape of the temperature must be broadcastablep (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Pressures(s) in Pascal. Fluid shape and shape of the temperature must be broadcastable
- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]] |float
- Returns:
Gibbs free energy divided by RT (dimensionless)
- get_h(t)#
Get specific enthalpy of the fluid at the given temperature
Enthalpy is referenced to 25 °C and includes enthalpy of formation. Therefore the enthalpy of H2 and O2 is 0 at 25 °C, but the enthalpy of water vapor at 25 °C is −241 kJ/mol (enthalpy of formation).
- Parameters:
t (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Absolute temperature(s) in Kelvin. Fluid shape and shape of the temperature must be broadcastable- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]] |float
- Returns:
Enthalpies in J/mol
- get_mass()#
Get Absolute fluid mass
- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]] |float
- Returns:
Mass of the fluid in kg
- get_molar_mass()#
Get molar fluid mass
- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]] |float
- Returns:
Mass of the fluid in kg/mol
- get_s(t, p)#
Get molar entropy of the fluid at the given temperature and pressure
- Parameters:
t (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Absolute temperature(s) in Kelvin. Fluid shape and shape of the temperature must be broadcastable- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]] |float
- Returns:
Entropy in J/mol/K
- get_v(t, p)#
Get Absolute fluid volume
- Parameters:
t (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Absolute temperature(s) in Kelvin. Fluid shape and shape of the temperature must be broadcastablep (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Pressure in Pa. Fluid shape and shape of the pressure must be broadcastable
- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]] |float
- Returns:
Volume of the fluid in m³
- get_vm(t, p)#
Get molar fluid volume
- Parameters:
t (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Absolute temperature(s) in Kelvin. Fluid shape and shape of the temperature must be broadcastablep (
float
|ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – Pressure in Pa. Fluid shape and shape of the pressure must be broadcastable
- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]] |float
- Returns:
Molar volume of the fluid in m³/mol
- get_x(species=None)#
Get molar fractions of fluid species
- Parameters:
species (
str
|list
[str
] |None
) – A single species name, a list of species names or None for returning the molar fractions of all species- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]]- Returns:
Returns an array of floats with the molar fractions of the species. If the a single species name is provided the return float array has the same dimensions as the fluid type. If a list or None is provided the return array has an additional dimension for the species.