Modify set_equivalence_ratio to support sulfur combustion

Modify set_equivalence_ratio to support sulfur combustion
This commit is contained in:
g3bk47 2017-09-12 11:37:38 +02:00 committed by Ray Speth
parent 89bca5fcd1
commit 48eaedbbb4

View file

@ -571,8 +571,8 @@ cdef class ThermoPhase(_SolutionBase):
"""
Set the composition to a mixture of *fuel* and *oxidizer* at the
specified equivalence ratio *phi*, holding temperature and pressure
constant. Considers the oxidation of C and H to CO2 and H2O. Other
elements are assumed not to participate in oxidation (i.e. N ends up as
constant. Considers the oxidation of C to CO2, H to H2O and S to SO2.
Other elements are assumed not to participate in oxidation (i.e. N ends up as
N2)::
>>> gas.set_equivalence_ratio(0.5, 'CH4', 'O2:1.0, N2:3.76')
@ -614,6 +614,11 @@ cdef class ThermoPhase(_SolutionBase):
nH = np.array([self.n_atoms(k, 'H') for k in range(self.n_species)])
else:
nH = np.zeros(self.n_species)
if 'S' in self.element_names:
nS = np.array([self.n_atoms(k, 'S') for k in range(self.n_species)])
else:
nS = np.zeros(self.n_species)
Cf = nC.dot(Xf)
Co = nC.dot(Xo)
@ -621,8 +626,10 @@ cdef class ThermoPhase(_SolutionBase):
Oo = nO.dot(Xo)
Hf = nH.dot(Xf)
Ho = nH.dot(Xo)
Sf = nS.dot(Xf)
So = nS.dot(Xo)
stoichAirFuelRatio = - (Of - 2*Cf - Hf/2.0) / (Oo - 2*Co - Ho/2.0)
stoichAirFuelRatio = - (Of - 2*Cf - 2*Sf - Hf/2.0) / (Oo - 2*Co - 2*So - Ho/2.0)
Xr = phi * Xf + stoichAirFuelRatio * Xo
self.TPX = None, None, Xr