import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import cantera as ct
gas = ct.Solution("gri30.yaml")
P = 101325
Tr = 298.15
gas.TPX = Tr, P, "CH4:1, O2:2, N2:7.52"
hR = gas.enthalpy_mass
gas.HPX = hR, P, "CO2:1, H2O:2, N2:7.52" # note, enthalpy is reactant enthalpy
yst = gas.Y
print("Tad =", gas.T, "K")
Tad = 2325.5981297600447 K
Species mass fractions are peicewise linear.
Lean:
Rich:
Enthalpy is a conserved scalar, so
gas.TPX = 298.15, P, "O2:1, N2:3.76"
y0 = gas.Y
h0 = gas.enthalpy_mass
gas.TPX = 298.15, P, "CH4:1"
y1 = gas.Y
h1 = gas.enthalpy_mass
ξ_st = gas.molecular_weights[gas.species_index("CH4")] / (
gas.molecular_weights[gas.species_index("CH4")] +
gas.molecular_weights[gas.species_index("O2")] * 2 +
gas.molecular_weights[gas.species_index("N2")] * 2*3.76 )
n = 1000
ξ = np.linspace(0.0,1,n)
T = np.zeros(n)
for i in range(n):
if ξ[i] <= ξ_st:
y = y0 + (yst-y0)*ξ[i]/ξ_st
else:
y = yst + (y1-yst)*(ξ[i]-ξ_st)/(1-ξ_st)
h = h0*(1-ξ[i]) + h1*ξ[i]
gas.HPY = h, P, y
T[i] = gas.T
#--------------------
plt.rc('font', size=14)
plt.plot(ξ,T)
plt.xlabel('ξ')
plt.ylabel('T (K)')
plt.xlim([0,1])
plt.ylim([298.15,2500]);