#!/usr/bin/env python # coding: utf-8 import cantera as ct import numpy as np from matplotlib.pylab import * gas = ct.Solution('gri30.xml', 'gri30_mix') p = 1e5 # pressure comp_f = 'C2H6:1' # fuel composition tin_f = 300.0 # fuel inlet temperature rho_f = p / (8.314 / 0.030 * tin_f) # fuel inlet density mdot_f = 0.24 # fuel inlet mass flow rate (kg/m^2/s) vel_f = mdot_f / rho_f # fuel inlet velocity print('Velocity of the fuel : ' + str(vel_f)) comp_o = 'O2:0.21, N2:0.78, AR:0.01' # oxidizer composition tin_o = 300.0 # oxidizer inlet temperature rho_o = p / (8.314 / 0.029 * tin_o) # oxidizer inlet density mdot_o = 0.72 # oxidizer inlet mass flow rate (kg/m^2/s) vel_o = mdot_o / rho_o # oxidizer inlet velocity print('Velocity of the oxidizer : ' + str(vel_o)) gas.TP = tin_o, p width = 0.02 a = (vel_o + vel_f) / width # calculation of the strain rate (s^-1) print('Strain rate of the diffusion flame : ' + str(a)) # This will instanciate the counterflow diffusion flame. As you might notice, and this is valid for all the other cases, you can instanciate the initial grid yourself. This allows you to refine the grid when you want. This can be a good trick when your simulation is crashing and you want to compute it again.

# As far as the inlets are concerned, the composition, temperature and mass flow rate needs to be specified. # In: initial_grid = np.linspace(0, width, 6) f = ct.CounterflowDiffusionFlame(gas, initial_grid) # Set the state of the two inlets f.fuel_inlet.mdot = mdot_f f.fuel_inlet.X = comp_f f.fuel_inlet.T = tin_f f.oxidizer_inlet.mdot = mdot_o f.oxidizer_inlet.X = comp_o f.oxidizer_inlet.T = tin_o # This starts the calculation of the counterflow diffusion flame. By experience, you will see that, out of this wonderful tutorial case, diffusion flames are hard to converge. You can either play with the size of the domain and every parameter said all along the tutorial (indeed, sometimes it converges better if the domain is smaller), or you can try a method that is developed here in CERFACS that resolves **the diffusion flame in the z-space**.