gaspype/examples/sulfur_oxygen_equalibrium.md

1.2 KiB

Sulfur Oxygen Equilibrium

This example shows equilibrium calculations for sulfur/oxygen mixtures.

import gaspype as gp
import numpy as np
import matplotlib.pyplot as plt

List possible sulfur/oxygen species:

gp.species(element_names = 'S, O')

Or more specific by using regular expressions:

gp.species('S?[2-3]?O?[2-5]?', use_regex=True)

Calculation of the molar equilibrium fractions for sulfur and oxygen depending on the oxygen to sulfur ratio:

fs = gp.fluid_system(['S2', 'S2O', 'SO2', 'SO3', 'O2'])

oxygen_ratio = np.linspace(0.5, 3, num=128)
el = gp.elements({'S': 1}, fs) + oxygen_ratio * gp.elements({'O': 1}, fs)

composition = gp.equilibrium(el, 800+273.15, 1e4)

plt.plot(oxygen_ratio, composition.get_x())
plt.legend(composition.species)

Calculation of the molar equilibrium fractions for sulfur and oxygen depending on temperature in °C:

fs = gp.fluid_system(['S2', 'S2O', 'SO2', 'SO3', 'O2'])

el = gp.elements({'S': 1, 'O':2.5}, fs)

t_range = np.linspace(500, 1300, num=32)
composition = gp.equilibrium(el, t_range+273.15, 1e4)

plt.plot(t_range, composition.get_x())
plt.legend(composition.species)