Gaspype provides two main classes: fluid and elements .
A fluid object can have multiple compositions. A multidimensional fluid object can be created for example by multiplication with a numpy array:
In some cases not the molecular but the atomic composition is of interest. The elements class can be used for atom based balances and works similar:
el = gp . elements ({ 'N' : 1 , 'Cl' : 2 }) el . get_mass ()
np . float64 ( 0.08490700000000001 )
A elements object can be as well instantiated from a fluid object. Arithmetic operations between elements and fluid result in an elements object:
el2 = gp . elements ( fl ) + el - 0.3 * fl el2
Cl 2.000e+00 mol H 4.200e+00 mol N 1.000e+00 mol O 7.000e-01 mol
Going from an atomic composition to an molecular composition is possible as well. One way is to calculate the thermodynamic equilibrium for a mixture:
fs = gp . fluid_system ( 'CH4, H2, CO, CO2, O2' ) el3 = gp . elements ({ 'C' : 1 , 'H' : 2 , 'O' : 1 }, fs ) fl3 = gp . equilibrium ( el3 , t = 800 ) fl3
... continue reading