Conversions

Helper functions for unit conversion.

chemics.conversions.massfrac_to_molefrac(y, mw)[source]

Convert from mass fractions to mole fractions. Calculation assumes a total mass of 100 g.

\[ \begin{align}\begin{aligned}m_i = y_i \times 100\\x_i = \frac{\frac{m_i}{MW_i}}{\sum\frac{m_i}{MW_i}}\end{aligned}\end{align} \]

where \(m\) is mass [g], \(y\) is mass fraction [-], \(x\) is mole fraction [-], and \(MW\) is molecular weight [g/mol] of each component.

Parameters
  • y (list, tuple or array) – Mass fraction of each component [-]

  • mw (list, tuple or array) – Molecular weight of each component [g/mol]

Returns

x (array) – Mole fractions of each component [-]

Example

>>> y = [0.36, 0.16, 0.20, 0.28]
... mw = [12.011, 1.008, 15.999, 14.007]
... massfrac_to_molefrac(y, mw)
[0.136 0.718 0.057 0.09]
chemics.conversions.molefrac_to_massfrac(x, mw)[source]

Convert from mole fractions to mass fractions. Calculation assumes total moles is 100.

\[ \begin{align}\begin{aligned}n_i &= x_i \times 100\\y_i &= \frac{n_i\, MW_i}{\sum n_i\, MW_i}\end{aligned}\end{align} \]

where \(n\) is moles [mol], \(x\) is mole fraction [-], \(y\) is mass fraction [-], and \(MW\) is molecular weight [g/mol] of each component.

Parameters
  • x (list, tuple, or array) – Mole fraction of each component [-]

  • mw (list, tuple or array) – Molecular weight of each component [g/mol]

Returns

y (array) – Mass fraction of each component [-]

Example

>>> x = [0.36, 0.16, 0.20, 0.28]
>>> mw = [12.011, 1.008, 15.999, 14.007]
... molefrac_to_massfrac(x, mw)
[0.373 0.014 0.276 0.338]
chemics.conversions.slm_to_lpm(slm, pgas, tgas)[source]

Convert volumetric gas flow from standard liters per minute (SLM or SLPM) to liters per minute (LPM) where STP defined as 273.25 K and 101,325 Pa.

\[1 LPM = 1 SLPM \times \frac{T_{gas}}{273.15\,K} \times \frac{14.696\,psi}{P_{gas}}\]
Parameters
  • slm (float) – Volumetric gas flow in standard liters per minute [SLM]

  • pgas (float) – Absolute gas pressure [kPa]

  • tgas (float) – Gas temperature [K]

Returns

lpm (float) – Volumetric gas flow in liters per minute [LPM]

Example

>>> slm_to_lpm(580, 150, 773)
1108.74

References

Wikipedia contributors. (2018, February 8). Standard litre per minute. In Wikipedia online. Retrieved from https://en.wikipedia.org/wiki/Standard_litre_per_minute