gaspype.elements#
- class gaspype.elements(composition, fs=None, shape=None)#
Bases:
objectRepresent a fluid by composition of elements.
- array_element_composition#
Array of the element composition
- Type:
FloatArray
Instantiates an elements object.
- Parameters:
composition (
fluid|dict[str,float] |list[str] |list[float] |ndarray[tuple[Any,...],dtype[float64]]) – A fluid object, a dict of element names with their composition, e.g.: {‘O’:1,’H’:2} or a list/numpy-array of compositions. The array can be multidimensional, the size of the last dimension must match the number of elements used in 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.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_elemental_composition()#
Get a dict of the molar amount of each element
- Return type:
dict[str,float]- Returns:
Returns a dict of floats with the molar amount of each element in mol
- get_mass()#
Get absolute mass of elements
- Return type:
ndarray[tuple[Any,...],dtype[float64]] |float- Returns:
Mass of the fluid in kg
- get_n(elemental_species=None)#
Get molar amount of elements
- Parameters:
elemental_species (
str|list[str] |None) – A single element name, a list of element names or None for returning the amount of all element- Return type:
ndarray[tuple[Any,...],dtype[float64]]- Returns:
Returns an array of floats with the molar amount of the elements. If the a single element 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 elements.