<jupyter_start><jupyter_text>Flame Speed with Sensitivity Analysis In this example we simulate a freely-propagating, adiabatic, 1-D flame and* Calculate its laminar burning velocity* Perform a sensitivity analysis of its kineticsThe figure below illustrates the setup, in a flame-fixed co-ordinate system. The reactants enter with density $\rho_{u}$, temperature $T_{u}$ and speed $S_{u}$. The products exit the flame at speed $S_{b}$, density $\rho_{b}$ and temperature $T_{b}$.   Import Modules<jupyter_code>from __future__ import print_function
from __future__ import division

import cantera as ct
import numpy as np

print("Running Cantera Version: " + str(ct.__version__))
# Import plotting modules and define plotting preference
%matplotlib notebook
import matplotlib.pylab as plt

plt.rcParams['axes.labelsize'] = 14
plt.rcParams['xtick.labelsize'] = 12
plt.rcParams['ytick.labelsize'] = 12
plt.rcParams['legend.fontsize'] = 10
plt.rcParams['figure.figsize'] = (8,6)

# Get the best of both ggplot and seaborn
plt.style.use('ggplot')
plt.style.use('seaborn-deep')

plt.rcParams['figure.autolayout'] = True

# Import Pandas for DataFrames
import pandas as pd<jupyter_output><empty_output><jupyter_text>Define the reactant conditions, gas mixture and kinetic mechanism associated with the gas<jupyter_code>#Inlet Temperature in Kelvin and Inlet Pressure in Pascals
#In this case we are setting the inlet T and P to room temperature conditions
To = 300
Po = 101325

#Define the gas-mixutre and kinetics
#In this case, we are choosing a GRI3.0 gas
gas = ct.Solution('gri30.cti')

# Create a stoichiometric CH4/Air premixed mixture 
gas.set_equivalence_ratio(1.0, 'CH4', {'O2':1.0, 'N2':3.76})
gas.TP = To, Po<jupyter_output><empty_output><jupyter_text>Define flame simulation conditions<jupyter_code># Domain width in metres
width = 0.014

# Create the flame object
flame = ct.FreeFlame(gas, width=width)

# Define tolerances for the solver
flame.set_refine_criteria(ratio=3, slope=0.1, curve=0.1)

# Define logging level
loglevel = 1<jupyter_output><empty_output><jupyter_text>Solve<jupyter_code>flame.solve(loglevel=loglevel, auto=True)
Su0 = flame.velocity[0]
print("Flame Speed is: {:.2f} cm/s".format(Su0*100))

# Note that the variable Su0 will also be used downsteam in the sensitivity analysis<jupyter_output><empty_output><jupyter_text>Plot figuresCheck and see if all has gone well. Plot temperature and species fractions to see Temperature Plot<jupyter_code>plt.figure()

plt.plot(flame.grid*100, flame.T, '-o')
plt.xlabel('Distance (cm)')
plt.ylabel('Temperature (K)');<jupyter_output><empty_output><jupyter_text>Major species' plot To plot species, we first have to identify the index of the species in the arrayFor this, cut & paste the following lines and run in a new cell to get the index    for i, specie in enumerate(gas.species()):        print(str(i) + '. ' + str(specie))<jupyter_code># Extract concentration data
X_CH4 = flame.X[13]
X_CO2 = flame.X[15]
X_H2O = flame.X[5]

plt.figure()

plt.plot(flame.grid*100, X_CH4, '-o', label=r'$CH_{4}$')
plt.plot(flame.grid*100, X_CO2, '-s', label=r'$CO_{2}$')
plt.plot(flame.grid*100, X_H2O, '-<', label=r'$H_{2}O$')

plt.legend(loc=2)
plt.xlabel('Distance (cm)')
plt.ylabel('MoleFractions');<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11884498480243161, 'fraction_numerical': 0.0243161094224924, 'mean_word_length': 5.987261146496815, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '403463', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1111, 'n_words': 335, 'path': 'Examen/.ipynb_checkpoints/Flamme-laminaire-checkpoint.ipynb', 'repo_name': 'vincentrobin/conda', 'size': '3290'}