{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Partial Equilibrium Assumption - Correction of 2-step schemes in the rich zone" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you want some more explanation about PEA, go and check the following [article](https://www.cerfacs.fr/~cfdbib/repository/TR_CFD_09_86.pdf).\n", "\n", "**Careful : The pea_coeff keyword in the mixture database should be unique and every coefficients should appear on one line.**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Useful importations" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import cantera as ct\n", "import matplotlib.pyplot as plt\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Exercise\n", "\n", "The objective of this exercice is to illustrate the impact of the PEA assumption on the laminar flame speed depending on the equivalence ratio.\n", "\n", "For that purpose, we will study a methane-air flame at atmospheric pressure, 300K and different equivalence ratios (`np.arange(0.6,1.7,0.2)`).\n", "\n", "The BFER mechanism for methane with and without PEA will be compared to a detailed mechanism for methane, the gri30. The BFER mechanism with or without PEA share the same yaml file, only the transport properties will differ (as PEA are only included for AVBP transport). Gas behaviors have already been defined in the yaml, you can switch from one another by calling their name:\n", "````\n", "gas = ct.solution('BFER_methane.yaml,name)\n", "````\n", "Then, we will use 2 names for BFER : \"CH4_BFER_mix\" and \"CH4_BFER_avbp7\". The mixture called \"CH4_BFER_avbp7\" will look for the mixture_database.dat file where the parameters for the pea assumption are given.\n", "\n", "The parameters for the flame solver can be set as the following:\n", "```\n", "tol_ss = [1.0e-5, 1.0e-8] # [rtol atol] for steady-state problem\n", "tol_ts = [1.0e-5, 1.0e-8] # [rtol atol] for time stepping\n", "loglevel = 1 # amount of diagnostic output (0 to 5)\n", "refine_grid = \"refine\"\n", "f = FreeFlame(gas, width=0.02)\n", "f.flame.set_steady_tolerances(default=tol_ss)\n", "f.flame.set_transient_tolerances(default=tol_ts)\n", "f.set_max_jac_age(50, 50)\n", "f.set_time_step(5.e-08, [10, 20, 80]) #s\n", "f.energy_enabled = True\n", "f.set_refine_criteria(ratio = 2.0, slope = 0.05, curve = 0.05)\n", "```\n", "\n", "Plot the laminar flame speed as a function of the equivalence ratio for the 3 mechanisms." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "p = 101325.0 # pressure\n", "tin = 300.0 # unburned gas temperature\n", "phis = np.arange(0.6,1.7,0.2) # range of equivalence ratio" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. Mechanisms tested" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "mechanisms = ['gri30.yaml','BFER_methane.yaml','BFER_methane.yaml']\n", "gazes = ['gri30_mix','CH4_BFER_mix', 'CH4_BFER_avbp7']\n", "fuel_species = 'CH4'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4. Parameters for the computation" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "tol_ss = [1.0e-5, 1.0e-8] # [rtol atol] for steady-state problem\n", "tol_ts = [1.0e-5, 1.0e-8] # [rtol atol] for time stepping\n", "loglevel = 1 # amount of diagnostic output (0 to 5)\n", "refine_grid = \"refine\" " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%capture\n", "Uall = [[] for mech in range(len(mechanisms))]\n", "for nb in range(len(mechanisms)):\n", " for phi in phis:\n", " print(phi, nb)\n", " gas = ct.Solution(mechanisms[nb], gazes[nb])\n", " m = gas.n_species\n", " ifuel = gas.species_index(fuel_species)\n", " io2 = gas.species_index('O2')\n", " in2 = gas.species_index('N2')\n", " gas.set_equivalence_ratio(phi, 'CH4:1', 'O2:1.0, N2:3.76')\n", " gas.TP = tin, p\n", "\n", " f = ct.FreeFlame(gas, width=0.02)\n", " f.flame.set_steady_tolerances(default=tol_ss)\n", " f.flame.set_transient_tolerances(default=tol_ts)\n", " f.inlet.X = gas.X\n", " f.inlet.T = tin\n", " f.set_max_jac_age(50, 50)\n", " f.set_time_step(5.e-08, [10, 20, 80]) #s\n", " f.energy_enabled = True\n", " f.set_refine_criteria(ratio = 2.0, slope = 0.05, curve = 0.05)\n", " f.solve(loglevel, refine_grid)\n", "\n", " Uall[nb].append(f.velocity[0])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fig=plt.figure(figsize=(18,16))\n", "a=fig.add_subplot(111)\n", "\n", "labellist = ['detailed', 'without PEA', 'with PEA']\n", "for label, sL in zip(labellist, Uall):\n", " a.plot(phis, sL, label=label)\n", " \n", "plt.title(r'Laminar flame speed vs. Equivalence ratio')\n", "plt.xlabel(r'Equivalence ratio [m]', fontsize=15)\n", "plt.ylabel(\"Laminar flame speed\")\n", "plt.legend()" ] } ], "metadata": { "kernelspec": { "display_name": "cantera-avbp3.0-py39", "language": "python", "name": "cantera-avbp3.0-py39" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.5" }, "vscode": { "interpreter": { "hash": "b0fa6594d8f4cbf19f97940f81e996739fb7646882a419484c72d19e05852a7e" } } }, "nbformat": 4, "nbformat_minor": 2 }