{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Twin Premixed Counter-Flow Flame\n",
"This example documents how to simulate two identical, axisymmetric, premixed jets of reactants shooting into each other. \n",
"\n",
"An illustration of this configuration is shown in the figure below."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Twin Premixed Flame](images/twinPremixedFlame.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Import modules"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Running Cantera Version: 3.0.0\n"
]
}
],
"source": [
"import cantera as ct\n",
"import numpy as np\n",
"\n",
"print(f\"Running Cantera Version: {ct.__version__}\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"%config InlineBackend.figure_formats = [\"svg\"]\n",
"import matplotlib.pyplot as plt\n",
"\n",
"plt.rcParams[\"figure.autolayout\"] = True\n",
"\n",
"plt.rcParams[\"axes.labelsize\"] = 14\n",
"plt.rcParams[\"xtick.labelsize\"] = 12\n",
"plt.rcParams[\"ytick.labelsize\"] = 12\n",
"plt.rcParams[\"legend.fontsize\"] = 10\n",
"plt.rcParams[\"figure.facecolor\"] = \"white\"\n",
"plt.rcParams[\"figure.figsize\"] = (8, 6)\n",
"plt.rcParams[\"figure.dpi\"] = 120"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Define the reactant conditions, gas mixture and kinetic mechanism associated with the gas"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# Inlet Temperature in Kelvin and Inlet Pressure in Pascals\n",
"# In this case we are setting the inlet T and P to room temperature conditions\n",
"To = 300\n",
"Po = 101325\n",
"\n",
"# Define the gas-mixutre and kinetics\n",
"# In this case, we are choosing a GRI3.0 gas\n",
"gas = ct.Solution(\"gri30.yaml\")\n",
"\n",
"# Create a CH4/Air premixed mixture with equivalence ratio=0.75\n",
"gas.set_equivalence_ratio(0.75, \"CH4\", {\"O2\": 1.0, \"N2\": 3.76})\n",
"gas.TP = To, Po\n",
"\n",
"# Set the velocity of the reactants\n",
"# This is what determines the strain-rate\n",
"axial_velocity = 2.0 # in m/s\n",
"\n",
"# Done with initial conditions\n",
"# Compute the mass flux, as this is what the Flame object requires\n",
"mass_flux = gas.density * axial_velocity # units kg/m2/s"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Define functions"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"def derivative(x, y):\n",
" \"\"\"Differentiation function for data that has variable grid spacing.\n",
" Used here to compute normal strain-rate.\n",
" \"\"\"\n",
" dydx = np.zeros_like(y)\n",
"\n",
" dx = np.diff(x)\n",
" dy = np.diff(y)\n",
" dydx[0:-1] = dy / dx\n",
"\n",
" dydx[-1] = (y[-1] - y[-2]) / (x[-1] - x[-2])\n",
"\n",
" return dydx\n",
"\n",
"\n",
"def compute_strain_rates(opposed_flame):\n",
" # Compute the derivative of axial velocity to obtain normal strain rate\n",
" strain_rates = derivative(opposed_flame.grid, opposed_flame.velocity)\n",
"\n",
" # Obtain the location of the max. strain rate upstream of the pre-heat zone.\n",
" # This is the characteristic strain rate\n",
" max_strain_location = abs(strain_rates).argmax()\n",
" min_velocity_point = opposed_flame.velocity[:max_strain_location].argmin()\n",
"\n",
" # Characteristic Strain Rate = K\n",
" strain_rate_point = abs(strain_rates[:min_velocity_point]).argmax()\n",
" K = abs(strain_rates[strain_rate_point])\n",
"\n",
" return strain_rates, strain_rate_point, K\n",
"\n",
"\n",
"def compute_consumption_speed(opposed_flame):\n",
"\n",
" Tb = max(opposed_flame.T)\n",
" Tu = min(opposed_flame.T)\n",
" rho_u = max(opposed_flame.density)\n",
"\n",
" integrand = opposed_flame.heat_release_rate / opposed_flame.cp\n",
"\n",
" I = np.trapz(integrand, opposed_flame.grid)\n",
" Sc = I / (Tb - Tu) / rho_u\n",
"\n",
" return Sc\n",
"\n",
"\n",
"# This function is called to run the solver\n",
"def solve_opposed_flame(\n",
" opposed_flame, mass_flux=0.12, loglevel=0, ratio=2, slope=0.3, curve=0.3, prune=0.05\n",
"):\n",
" \"\"\"\n",
" Execute this function to run the Oppposed Flow Simulation This function\n",
" takes a CounterFlowTwinPremixedFlame object as the first argument\n",
" \"\"\"\n",
"\n",
" opposed_flame.reactants.mdot = mass_flux\n",
" opposed_flame.set_refine_criteria(\n",
" ratio=ratio, slope=slope, curve=curve, prune=prune\n",
" )\n",
"\n",
" opposed_flame.show_solution()\n",
" opposed_flame.solve(loglevel, auto=True)\n",
"\n",
" # Compute the strain rate, just before the flame. This is not necessarily\n",
" # the maximum We use the max. strain rate just upstream of the pre-heat zone\n",
" # as this is the strain rate that computations comprare against, like when\n",
" # plotting Su vs. K\n",
" _, strain_rate_point, K = compute_strain_rates(opposed_flame)\n",
"\n",
" return np.max(opposed_flame.T), K, strain_rate_point"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Define a flame object, domain width and tranport model"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# Define a domain half-width of 2.5 cm, meaning the whole domain is 5 cm wide\n",
"width = 0.025\n",
"\n",
"# Create the flame object\n",
"opposed_flame = ct.CounterflowTwinPremixedFlame(gas, width=width)\n",
"\n",
"# Uncomment the following line to use a Multi-component formulation. Default is\n",
"# mixture-averaged\n",
"# opposed_flame.transport_model = 'Multi'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Run the Solver"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"scrolled": true,
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\n",
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> reactants <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
"\n",
" Mass Flux: 2.268 kg/m^2/s \n",
" Temperature: 300 K \n",
" Mass Fractions: \n",
" O2 0.2232 \n",
" CH4 0.04197 \n",
" N2 0.7348 \n",
"\n",
"\n",
"\n",
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> flame <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
"\n",
" Pressure: 1.013e+05 Pa\n",
"\n",
"-------------------------------------------------------------------------------\n",
" z velocity spread_rate T lambda eField \n",
"-------------------------------------------------------------------------------\n",
" 0 2 0 300 -2.903e+04 0 \n",
" 0.005 1.6 32 300 -2.903e+04 0 \n",
" 0.01 1.2 64 300 -2.903e+04 0 \n",
" 0.0125 1 80 1110 -2.903e+04 0 \n",
" 0.015 0.8 96 1920 -2.903e+04 0 \n",
" 0.02 0.4 128 1920 -2.903e+04 0 \n",
" 0.025 0 160 1920 -2.903e+04 0 \n",
"\n",
"-------------------------------------------------------------------------------\n",
" z H2 H O O2 OH \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0.2232 0 \n",
" 0.005 0 0 0 0.2232 0 \n",
" 0.01 2.06e-21 9.355e-23 1.216e-20 0.2232 1.907e-19 \n",
" 0.0125 3.711e-06 1.685e-07 2.191e-05 0.1386 0.0003435 \n",
" 0.015 7.423e-06 3.37e-07 4.382e-05 0.05402 0.0006871 \n",
" 0.02 7.423e-06 3.37e-07 4.382e-05 0.05402 0.0006871 \n",
" 0.025 7.423e-06 3.37e-07 4.382e-05 0.05402 0.0006871 \n",
"\n",
"-------------------------------------------------------------------------------\n",
" z H2O HO2 H2O2 C CH \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0 0 \n",
" 0.005 0 0 0 0 0 \n",
" 0.01 2.604e-17 2.619e-22 1.513e-23 1.528e-38 1.236e-39 \n",
" 0.0125 0.04691 4.717e-07 2.725e-08 2.753e-23 2.226e-24 \n",
" 0.015 0.09382 9.435e-07 5.45e-08 5.506e-23 4.452e-24 \n",
" 0.02 0.09382 9.435e-07 5.45e-08 5.506e-23 4.452e-24 \n",
" 0.025 0.09382 9.435e-07 5.45e-08 5.506e-23 4.452e-24 \n",
"\n",
"-------------------------------------------------------------------------------\n",
" z CH2 CH2(S) CH3 CH4 CO \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0.04197 0 \n",
" 0.005 0 0 0 0.04197 0 \n",
" 0.01 4.048e-39 1.788e-40 3.885e-38 0.04197 6.135e-20 \n",
" 0.0125 7.292e-24 3.22e-25 6.999e-23 0.02098 0.0001105 \n",
" 0.015 1.458e-23 6.441e-25 1.4e-22 0 0.000221 \n",
" 0.02 1.458e-23 6.441e-25 1.4e-22 8.264e-23 0.000221 \n",
" 0.025 1.458e-23 6.441e-25 1.4e-22 8.264e-23 0.000221 \n",
"\n",
"-------------------------------------------------------------------------------\n",
" z CO2 HCO CH2O CH2OH CH3O \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0 0 \n",
" 0.005 0 0 0 0 0 \n",
" 0.01 3.186e-17 2.588e-28 2.804e-30 6.75e-37 8.315e-39 \n",
" 0.0125 0.05739 4.662e-13 5.052e-15 1.216e-21 1.498e-23 \n",
" 0.015 0.1148 9.324e-13 1.01e-14 2.432e-21 2.996e-23 \n",
" 0.02 0.1148 9.324e-13 1.01e-14 2.432e-21 2.996e-23 \n",
" 0.025 0.1148 9.324e-13 1.01e-14 2.432e-21 2.996e-23 \n",
"\n",
"-------------------------------------------------------------------------------\n",
" z CH3OH C2H C2H2 C2H3 C2H4 \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0 0 \n",
" 0.005 0 0 0 0 0 \n",
" 0.01 5.227e-38 9.354e-48 7.624e-45 5.836e-51 9.138e-51 \n",
" 0.0125 9.416e-23 1.685e-32 1.373e-29 1.051e-35 1.646e-35 \n",
" 0.015 1.883e-22 3.37e-32 2.747e-29 2.103e-35 3.292e-35 \n",
" 0.02 1.883e-22 3.37e-32 2.747e-29 2.103e-35 3.292e-35 \n",
" 0.025 1.883e-22 3.37e-32 2.747e-29 2.103e-35 3.292e-35 \n",
"\n",
"-------------------------------------------------------------------------------\n",
" z C2H5 C2H6 HCCO CH2CO HCCOH \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0 0 \n",
" 0.005 0 0 0 0 0 \n",
" 0.01 1.002e-56 7.332e-58 2.1e-41 3.353e-41 1.05e-44 \n",
" 0.0125 1.805e-41 1.321e-42 3.783e-26 6.04e-26 1.892e-29 \n",
" 0.015 3.61e-41 2.641e-42 7.566e-26 1.208e-25 3.784e-29 \n",
" 0.02 3.61e-41 2.641e-42 7.566e-26 1.208e-25 3.784e-29 \n",
" 0.025 3.61e-41 2.641e-42 7.566e-26 1.208e-25 3.784e-29 \n",
"\n",
"-------------------------------------------------------------------------------\n",
" z N NH NH2 NH3 NNH \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0 0 \n",
" 0.005 0 0 0 0 0 \n",
" 0.01 3.232e-26 2.797e-27 8.652e-28 3.559e-27 4.476e-27 \n",
" 0.0125 5.822e-11 5.038e-12 1.559e-12 6.411e-12 8.063e-12 \n",
" 0.015 1.164e-10 1.008e-11 3.117e-12 1.282e-11 1.613e-11 \n",
" 0.02 1.164e-10 1.008e-11 3.117e-12 1.282e-11 1.613e-11 \n",
" 0.025 1.164e-10 1.008e-11 3.117e-12 1.282e-11 1.613e-11 \n",
"\n",
"-------------------------------------------------------------------------------\n",
" z NO NO2 N2O HNO CN \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0 0 \n",
" 0.005 0 0 0 0 0 \n",
" 0.01 8.318e-19 1.205e-21 6.697e-23 2.279e-24 1.185e-33 \n",
" 0.0125 0.001498 2.17e-06 1.206e-07 4.106e-09 2.135e-18 \n",
" 0.015 0.002997 4.341e-06 2.413e-07 8.212e-09 4.27e-18 \n",
" 0.02 0.002997 4.341e-06 2.413e-07 8.212e-09 4.27e-18 \n",
" 0.025 0.002997 4.341e-06 2.413e-07 8.212e-09 4.27e-18 \n",
"\n",
"-------------------------------------------------------------------------------\n",
" z HCN H2CN HCNN HCNO HOCN \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0 0 \n",
" 0.005 0 0 0 0 0 \n",
" 0.01 8.215e-31 1.546e-38 4.735e-42 1.504e-35 8.599e-31 \n",
" 0.0125 1.48e-15 2.785e-23 8.53e-27 2.71e-20 1.549e-15 \n",
" 0.015 2.96e-15 5.57e-23 1.706e-26 5.42e-20 3.098e-15 \n",
" 0.02 2.96e-15 5.57e-23 1.706e-26 5.42e-20 3.098e-15 \n",
" 0.025 2.96e-15 5.57e-23 1.706e-26 5.42e-20 3.098e-15 \n",
"\n",
"-------------------------------------------------------------------------------\n",
" z HNCO NCO N2 AR C3H7 \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0.7348 0 0 \n",
" 0.005 0 0 0.7348 0 0 \n",
" 0.01 7.04e-28 1.842e-29 0.7348 0 6.242e-76 \n",
" 0.0125 1.268e-12 3.319e-14 0.7341 0 1.125e-60 \n",
" 0.015 2.536e-12 6.638e-14 0.7334 0 2.249e-60 \n",
" 0.02 2.536e-12 6.638e-14 0.7334 0 2.249e-60 \n",
" 0.025 2.536e-12 6.638e-14 0.7334 0 2.249e-60 \n",
"\n",
"-------------------------------------------------------------------------------\n",
" z C3H8 CH2CHO CH3CHO \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 \n",
" 0.005 0 0 0 \n",
" 0.01 4.325e-77 1.343e-47 2.414e-48 \n",
" 0.0125 7.791e-62 2.42e-32 4.349e-33 \n",
" 0.015 1.558e-61 4.84e-32 8.697e-33 \n",
" 0.02 1.558e-61 4.84e-32 8.697e-33 \n",
" 0.025 1.558e-61 4.84e-32 8.697e-33 \n",
"\n",
"\n",
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> products <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
"\n",
"\n",
"-------------------------------------------------------------------------------\n",
" z \n",
"-------------------------------------------------------------------------------\n",
" 0 \n",
"\n",
"************ Solving on 7 point grid with energy equation enabled ************\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 2.848e-05 5.886\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0004865 5.141\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.008313 2.215\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [7] point grid(s).\n",
"\n",
"..............................................................................\n",
"grid refinement disabled.\n",
"\n",
"******************** Solving with grid refinement enabled ********************\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [7] point grid(s).\n",
"\n",
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 1 2 3 4 5 \n",
" to resolve C2H2 C2H4 C2H6 CH CH2 CH2(S) CH2CO CH2O CH2OH CH3 CH3CHO CH3O CH3OH CH4 CO CO2 H H2 H2O H2O2 HCCO HCN HCO HNCO HO2 N2 N2O NO NO2 O O2 OH T point 1 point 4 spread_rate velocity \n",
"##############################################################################\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0001139 5.733\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.002919 3.554\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [12] point grid(s).\n",
"\n",
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 2 4 5 6 7 8 9 10 \n",
" to resolve C C2H2 C2H3 C2H4 C2H5 C2H6 C3H8 CH CH2 CH2(S) CH2CO CH2O CH2OH CH3 CH3CHO CH3O CH3OH CH4 CO CO2 H H2 H2O H2O2 HCCO HCN HCO HNCO HO2 N2 N2O NO NO2 O O2 OH T point 2 point 7 spread_rate velocity \n",
"##############################################################################\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0001139 5.651\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0001442 5.861\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.002463 3.925\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [20] point grid(s).\n",
"\n",
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 1 4 9 10 11 12 13 17 18 \n",
" to resolve C C2H2 C2H3 C2H4 C2H6 CH CH2 CH2(S) CH2CO CH2O CH2OH CH3 CH3CHO CH3O CH3OH CH4 CO CO2 H H2 H2O H2O2 HCCO HCN HCO HNCO HO2 N2 N2O NO NO2 O O2 OH T point 1 point 4 spread_rate velocity \n",
"##############################################################################\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0001139 5.646\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [29] point grid(s).\n",
"\n",
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 0 10 14 15 16 17 18 23 26 27 \n",
" to resolve C C2H2 C2H3 C2H4 C2H5 C2H6 C3H8 CH CH2 CH2(S) CH2CHO CH2CO CH2O CH2OH CH3 CH3CHO CH3O CH3OH CH4 CO CO2 H H2 H2O H2O2 HCCO HCN HCO HNCO HO2 N2 N2O NO NO2 O O2 OH T point 0 point 10 point 23 spread_rate velocity \n",
"##############################################################################\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 7.594e-05 6.153\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 6.407e-05 6.19\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0001825 5.78\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0001732 5.637\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.004439 3.542\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [39] point grid(s).\n",
"\n",
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 24 25 26 27 28 36 37 \n",
" to resolve C C2H2 C2H3 C2H4 C2H5 C2H6 C3H8 CH CH2 CH2(S) CH2CO CH2O CH2OH CH3 CH3CHO CH3O CH3OH CH4 CO CO2 H H2 H2O H2O2 HCCO HCN HCO HNCO HO2 N2 N2O NO NO2 O O2 OH T spread_rate velocity \n",
"##############################################################################\n",
"refine: discarding point at 0.01484375\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 5.695e-05 5.741\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 7.208e-05 6.096\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0002053 4.868\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0001299 5.816\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.003329 3.518\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [45] point grid(s).\n",
"\n",
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 28 29 30 31 32 33 \n",
" to resolve C C2H2 C2H3 C2H4 C2H5 C2H6 C3H8 CH CH2 CH2(S) CH2CHO CH2CO CH2O CH2OH CH3 CH3CHO CH3O CH3OH CH4 CO CO2 H H2 H2O H2O2 HCCO HCN HCO HNCO HO2 N2 N2O NO NO2 O O2 OH T spread_rate velocity \n",
"##############################################################################\n",
"refine: discarding point at 0.01703125\n",
"refine: discarding point at 0.01734375\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0001709 5.404\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [49] point grid(s).\n",
"\n",
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 30 31 32 33 34 35 36 \n",
" to resolve C C2H2 C2H3 C2H4 C2H5 C2H6 C3H7 C3H8 CH CH2 CH2(S) CH2CHO CH2CO CH2O CH2OH CH3 CH3CHO CH3O CH3OH CH4 CO CO2 H H2 H2O H2O2 HCCO HCCOH HCN HCO HNCO HO2 N2 N2O NO NO2 O O2 OH T spread_rate velocity \n",
"##############################################################################\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0001709 5.746\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 7.208e-05 5.914\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0008211 4.68\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [56] point grid(s).\n",
"\n",
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 29 34 39 40 41 42 43 44 \n",
" to resolve C C2H2 C2H3 C2H4 C2H5 C2H6 C3H7 C3H8 CH CH2 CH2(S) CH2CHO CH2CO CH2O CH2OH CH3 CH3CHO CH3O CH3OH CH4 CO CO2 H H2 H2O H2O2 HCCO HCCOH HCN HCNO HCO HNCO HO2 N2 N2O NO NO2 O O2 OH T point 29 point 34 velocity \n",
"##############################################################################\n",
"refine: discarding point at 0.017968750000000002\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0001709 5.591\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [63] point grid(s).\n",
"\n",
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 44 45 46 47 48 49 50 52 \n",
" to resolve C2H2 C2H3 C2H4 C2H5 C2H6 C3H7 C3H8 CH CH2 CH2(S) CH2CHO CH2CO CH2O CH2OH CH3 CH3CHO CH3O CH3OH CH4 CO CO2 H H2 H2O H2O2 HCCO HCCOH HCN HCNO HCO HNCO HO2 N2 N2O NO NO2 O O2 OH T point 46 velocity \n",
"##############################################################################\n",
"refine: discarding point at 0.018437500000000002\n",
"refine: discarding point at 0.018750000000000003\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0002563 5.224\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.001946 4.407\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [69] point grid(s).\n",
"\n",
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 50 51 52 53 54 55 56 \n",
" to resolve C2H2 C2H3 C2H4 C2H5 C2H6 C3H7 C3H8 CH CH2 CH2(S) CH2CHO CH2CO CH2O CH2OH CH3 CH3CHO CH3O CH3OH CH4 CO CO2 H H2 H2O H2O2 HCCO HCCOH HCN HCNO HCO HNCO HO2 N2 N2O NO NO2 O O2 OH T point 54 velocity \n",
"##############################################################################\n",
"refine: discarding point at 0.018281250000000002\n",
"refine: discarding point at 0.018593750000000003\n",
"refine: discarding point at 0.018906250000000003\n",
"refine: discarding point at 0.019218750000000003\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [72] point grid(s).\n",
"\n",
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 50 51 52 53 54 55 56 57 58 59 60 \n",
" to resolve C2H2 C2H3 C2H4 C2H5 C2H6 C3H7 C3H8 CH CH2 CH2(S) CH2CHO CH2CO CH2O CH2OH CH3 CH3CHO CH3O CH3OH CH4 CO CO2 H H2 H2O H2O2 HCCO HCCOH HCN HCO HNCO HO2 N2 O O2 OH T point 58 velocity \n",
"##############################################################################\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.0002563 4.55\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.004379 3.726\n",
"Attempt Newton solution of steady-state problem... failure. \n",
"Take 10 timesteps 0.02217 1.783\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [83] point grid(s).\n",
"\n",
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 49 58 59 60 63 64 65 66 67 68 69 70 \n",
" to resolve C2H2 C2H3 C2H4 C2H5 C2H6 C3H7 C3H8 CH CH2 CH2(S) CH2CHO CH2CO CH2O CH2OH CH3 CH3CHO CH3O CH3OH CH4 CO H H2 H2O H2O2 HCCO HCCOH HCN HCO HNCO HO2 N2 O OH T point 49 point 70 velocity \n",
"##############################################################################\n",
"refine: discarding point at 0.019687500000000004\n",
"refine: discarding point at 0.019921875000000006\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [93] point grid(s).\n",
"\n",
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 63 64 65 71 \n",
" to resolve C2H2 C2H3 C2H5 C3H8 CH2 point 63 point 64 \n",
"##############################################################################\n",
"refine: discarding point at 0.019531250000000003\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [96] point grid(s).\n",
"\n",
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 65 \n",
" to resolve point 65 \n",
"##############################################################################\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [97] point grid(s).\n",
"\n",
"..............................................................................\n",
"no new points needed in flame\n"
]
}
],
"source": [
"# The solver returns the peak temperature, strain rate and\n",
"# the point which we ascribe to the characteristic strain rate.\n",
"\n",
"T, K, strain_rate_point = solve_opposed_flame(opposed_flame, mass_flux, loglevel=1)\n",
"\n",
"# You can plot/see all state space variables by calling opposed_flame.foo where foo\n",
"# is T, Y[i], etc. The spatial variable (distance in meters) is in opposed_flame.grid\n",
"# Thus to plot temperature vs distance, use opposed_flame.grid and opposed_flame.T\n",
"\n",
"# Uncomment this to save output\n",
"# opposed_flame.write_csv(\"premixed_twin_flame.csv\", quiet=False)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Peak temperature: 1921.1 K\n",
"Strain Rate: 163.7 1/s\n",
"Consumption Speed: 21.03 cm/s\n"
]
}
],
"source": [
"Sc = compute_consumption_speed(opposed_flame)\n",
"\n",
"print(f\"Peak temperature: {T:.1f} K\")\n",
"print(f\"Strain Rate: {K:.1f} 1/s\")\n",
"print(f\"Consumption Speed: {Sc * 100:.2f} cm/s\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Plot figures\n",
"\n",
"Note that the graphs only represent one-half of the domain, because the solution is symmetric"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Axial velocity plot"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n"
],
"text/plain": [
"