{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Flame Temperature\n", "This example demonstrates calculation of the adiabatic flame temperature for a methane/air mixture, comparing calculations which assume either complete or incomplete combustion." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Using Cantera version: 2.6.0a4\n" ] } ], "source": [ "%matplotlib inline\n", "%config InlineBackend.figure_formats = [\"svg\"]\n", "import cantera as ct\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", "plt.rcParams[\"figure.dpi\"] = 120\n", "\n", "print(f\"Using Cantera version: {ct.__version__}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Complete Combustion\n", "\n", "The stoichiometric equation for complete combustion of a lean methane/air mixture ($\\phi < 1$) is:\n", "\n", "$$\\mathrm{\\phi CH_4 + 2(O_2 + 3.76 N_2) \\rightarrow \\phi CO_2 + 2\\phi H_2O + 2 (1-\\phi) O_2 + 7.52 N_2}$$\n", "\n", "For a rich mixture ($\\phi > 1$), this becomes:\n", "\n", "$$\\mathrm{\\phi CH_4 + 2(O_2 + 3.76 N_2) \\rightarrow CO_2 + 2 H_2O + (\\phi - 1) CH_4 + 7.52 N_2}$$\n", "\n", "To find the flame temperature resulting from these reactions using Cantera, we create a gas object containing only the species in the above stoichiometric equations, and then use the equilibrate() function to find the resulting mixture composition and temperature, taking advantage of the fact that equilibrium will strongly favor conversion of the fuel molecule." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Get all of the Species objects defined in the GRI 3.0 mechanism\n", "species = {S.name: S for S in ct.Species.listFromFile(\"gri30.yaml\")}\n", "\n", "# Create an IdealGas object with species representing complete combustion\n", "complete_species = [species[S] for S in (\"CH4\", \"O2\", \"N2\", \"CO2\", \"H2O\")]\n", "gas1 = ct.Solution(thermo=\"IdealGas\", species=complete_species)\n", "\n", "phi = np.linspace(0.5, 2.0, 100)\n", "T_complete = np.zeros(phi.shape)\n", "for i in range(len(phi)):\n", " gas1.TP = 300, ct.one_atm\n", " gas1.set_equivalence_ratio(phi[i], \"CH4\", \"O2:1, N2:3.76\")\n", " gas1.equilibrate(\"HP\")\n", " T_complete[i] = gas1.T" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Incomplete Combustion\n", "\n", "In the case of incomplete combustion, the resulting mixture composition is not known in advance, but must be found by calculating the equilibrium composition at constant enthalpy and temperature:\n", "\n", "$$\\mathrm{\\phi CH_4 + 2(O_2 + 3.76 N_2) \\rightarrow ? CO_2 + ? CO + ? H_2 + ? H_2O + ? O_2 + 7.52 N_2 + minor\\ species}$$\n", "\n", "Now, we use a gas phase object containing all 53 species defined in the GRI 3.0 mechanism, and compute the equilibrium composition as a function of equivalence ratio." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Create an IdealGas object including incomplete combustion species\n", "gas2 = ct.Solution(thermo=\"IdealGas\", species=species.values())\n", "T_incomplete = np.zeros(phi.shape)\n", "for i in range(len(phi)):\n", " gas2.TP = 300, ct.one_atm\n", " gas2.set_equivalence_ratio(phi[i], \"CH4\", \"O2:1, N2:3.76\")\n", " gas2.equilibrate(\"HP\")\n", " T_incomplete[i] = gas2.T" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n" ], "text/plain": [ "