twin_premixed_flame_axisymmetric.ipynb (Source)

Twin Premixed Counter-Flow Flame Example

This example documents how to simulate two identical, axisymmetric, premixed jets of reactants shooting into each other. An illustration of this configuration is shown in the figure below

Twin Premixed Flame

Import modules

In [1]:
from __future__ import print_function
from __future__ import division

import cantera as ct
import numpy as np

print("Running Cantera Version: " + str(ct.__version__))
Running Cantera Version: 2.3.0a3

Define the reactant conditions, gas mixture and kinetic mechanism associated with the gas

In [2]:
#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 CH4/Air premixed mixture with equivalence ratio=0.75
gas.set_equivalence_ratio(0.75, 'CH4', {'O2':1.0, 'N2':3.76})
gas.TP = To, Po

# Set the velocity of the reactants
# This is what determines the strain-rate
axial_velocity = 2.0 # in m/s

# Done with initial conditions
# Compute the mass flux, as this is what the Flame object requires
massFlux = gas.density * axial_velocity # units kg/m2/s

Define functions

In [3]:
# Differentiation function for data that has variable grid spacing Used here to
# compute normal strain-rate
def derivative(x, y):
    dydx = np.zeros(y.shape, y.dtype.type)

    dx = np.diff(x)
    dy = np.diff(y)
    dydx[0:-1] = dy/dx

    dydx[-1] = (y[-1] - y[-2])/(x[-1] - x[-2])

    return dydx

def computeStrainRates(oppFlame):
    # Compute the derivative of axial velocity to obtain normal strain rate
    strainRates = derivative(oppFlame.grid, oppFlame.u)

    # Obtain the location of the max. strain rate upstream of the pre-heat zone.
    # This is the characteristic strain rate
    maxStrLocation = abs(strainRates).argmax()
    minVelocityPoint = oppFlame.u[:maxStrLocation].argmin()

    # Characteristic Strain Rate = K
    strainRatePoint = abs(strainRates[:minVelocityPoint]).argmax()
    K = abs(strainRates[strainRatePoint])

    return strainRates, strainRatePoint, K

def computeConsumptionSpeed(oppFlame):

    Tb = max(oppFlame.T)
    Tu = min(oppFlame.T)
    rho_u = max(oppFlame.density)

    integrand = oppFlame.heat_release_rate/oppFlame.cp

    I = np.trapz(integrand, oppFlame.grid)
    Sc = I/(Tb - Tu)/rho_u

    return Sc

# This function is called to run the solver
def solveOpposedFlame(oppFlame, massFlux=0.12, loglevel=0,
                      ratio=2, slope=0.3, curve=0.3, prune=0.05):
    """
    Execute this function to run the Oppposed Flow Simulation This function
    takes a CounterFlowTwinPremixedFlame object as the first argument
    """

    oppFlame.reactants.mdot = massFlux
    oppFlame.set_refine_criteria(ratio=ratio, slope=slope, curve=curve, prune=prune)

    oppFlame.show_solution()
    oppFlame.solve(loglevel, auto=True)

    # Compute the strain rate, just before the flame. This is not necessarily
    # the maximum We use the max. strain rate just upstream of the pre-heat zone
    # as this is the strain rate that computations comprare against, like when
    # plotting Su vs. K
    strainRates, strainRatePoint, K = computeStrainRates(oppFlame)

    return np.max(oppFlame.T), K, strainRatePoint

Define a flame object, domain width and tranport model

In [4]:
# Define a domain half-width of 2.5 cm, meaning the whole domain is 5 cm wide
width = 0.025

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

# Uncomment the following line to use a Multi-component formulation. Default is
# mixture-averaged
#oppFlame.transport_model = 'Multi'

Run the Solver

In [5]:
# The solver returns the peak temperature, strain rate and
# the point which we ascribe to the characteristic strain rate.

(T, K, strainRatePoint) = solveOpposedFlame(oppFlame, massFlux, loglevel=1)

# You can plot/see all state space variables by calling oppFlame.foo where foo
# is T, Y[i], etc. The spatial variable (distance in meters) is in oppFlame.grid
# Thus to plot temperature vs distance, use oppFlame.grid and oppFlame.T

#This is to save output
oppFlame.write_csv("premixed_twin_flame.csv", quiet=False)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> reactants <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    Mass Flux:        2.268 kg/m^2/s 
    Temperature:        300 K 
    Mass Fractions: 
                      O2      0.2232 
                     CH4     0.04197 
                      N2      0.7348 



>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> flame <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    Pressure:   1.013e+05 Pa

-------------------------------------------------------------------------------
          z           u           V           T      lambda          H2 
-------------------------------------------------------------------------------
          0           2           0         300           0           0 
      0.005         1.6          32         300           0           0 
       0.01         1.2          64         300           0    2.06e-21 
     0.0125           1          80        1110           0   3.711e-06 
      0.015         0.8          96        1920           0   7.422e-06 
       0.02         0.4         128        1920           0   7.422e-06 
      0.025           0         160        1920           0   7.422e-06 

-------------------------------------------------------------------------------
          z           H           O          O2          OH         H2O 
-------------------------------------------------------------------------------
          0           0           0      0.2232           0           0 
      0.005           0           0      0.2232           0           0 
       0.01   9.354e-23   1.216e-20      0.2232   1.907e-19   2.604e-17 
     0.0125   1.685e-07   2.191e-05      0.1386   0.0003435     0.04691 
      0.015    3.37e-07   4.382e-05     0.05403   0.0006871     0.09382 
       0.02    3.37e-07   4.382e-05     0.05403   0.0006871     0.09382 
      0.025    3.37e-07   4.382e-05     0.05403   0.0006871     0.09382 

-------------------------------------------------------------------------------
          z         HO2        H2O2           C          CH         CH2 
-------------------------------------------------------------------------------
          0           0           0           0           0           0 
      0.005           0           0           0           0           0 
       0.01   2.619e-22   1.513e-23   1.528e-38   1.236e-39   4.048e-39 
     0.0125   4.718e-07   2.725e-08   2.753e-23   2.226e-24   7.292e-24 
      0.015   9.435e-07    5.45e-08   5.506e-23   4.452e-24   1.458e-23 
       0.02   9.435e-07    5.45e-08   5.506e-23   4.452e-24   1.458e-23 
      0.025   9.435e-07    5.45e-08   5.506e-23   4.452e-24   1.458e-23 

-------------------------------------------------------------------------------
          z      CH2(S)         CH3         CH4          CO         CO2 
-------------------------------------------------------------------------------
          0           0           0     0.04197           0           0 
      0.005           0           0     0.04197           0           0 
       0.01   1.788e-40   3.885e-38     0.04197   6.135e-20   3.186e-17 
     0.0125    3.22e-25   6.999e-23     0.02098   0.0001105     0.05739 
      0.015   6.441e-25     1.4e-22           0   0.0002211      0.1148 
       0.02   6.441e-25     1.4e-22   8.264e-23   0.0002211      0.1148 
      0.025   6.441e-25     1.4e-22   8.264e-23   0.0002211      0.1148 

-------------------------------------------------------------------------------
          z         HCO        CH2O       CH2OH        CH3O       CH3OH 
-------------------------------------------------------------------------------
          0           0           0           0           0           0 
      0.005           0           0           0           0           0 
       0.01   2.588e-28   2.804e-30    6.75e-37   8.315e-39   5.227e-38 
     0.0125   4.662e-13   5.052e-15   1.216e-21   1.498e-23   9.416e-23 
      0.015   9.324e-13    1.01e-14   2.432e-21   2.996e-23   1.883e-22 
       0.02   9.324e-13    1.01e-14   2.432e-21   2.996e-23   1.883e-22 
      0.025   9.324e-13    1.01e-14   2.432e-21   2.996e-23   1.883e-22 

-------------------------------------------------------------------------------
          z         C2H        C2H2        C2H3        C2H4        C2H5 
-------------------------------------------------------------------------------
          0           0           0           0           0           0 
      0.005           0           0           0           0           0 
       0.01   9.354e-48   7.624e-45   5.836e-51   9.138e-51   1.002e-56 
     0.0125   1.685e-32   1.373e-29   1.051e-35   1.646e-35   1.805e-41 
      0.015    3.37e-32   2.747e-29   2.103e-35   3.292e-35    3.61e-41 
       0.02    3.37e-32   2.747e-29   2.103e-35   3.292e-35    3.61e-41 
      0.025    3.37e-32   2.747e-29   2.103e-35   3.292e-35    3.61e-41 

-------------------------------------------------------------------------------
          z        C2H6        HCCO       CH2CO       HCCOH           N 
-------------------------------------------------------------------------------
          0           0           0           0           0           0 
      0.005           0           0           0           0           0 
       0.01   7.332e-58     2.1e-41   3.353e-41    1.05e-44   3.232e-26 
     0.0125   1.321e-42   3.783e-26    6.04e-26   1.892e-29   5.822e-11 
      0.015   2.641e-42   7.567e-26   1.208e-25   3.785e-29   1.164e-10 
       0.02   2.641e-42   7.567e-26   1.208e-25   3.785e-29   1.164e-10 
      0.025   2.641e-42   7.567e-26   1.208e-25   3.785e-29   1.164e-10 

-------------------------------------------------------------------------------
          z          NH         NH2         NH3         NNH          NO 
-------------------------------------------------------------------------------
          0           0           0           0           0           0 
      0.005           0           0           0           0           0 
       0.01   2.797e-27   8.651e-28   3.559e-27   4.476e-27   8.318e-19 
     0.0125   5.038e-12   1.559e-12   6.411e-12   8.062e-12    0.001498 
      0.015   1.008e-11   3.117e-12   1.282e-11   1.612e-11    0.002997 
       0.02   1.008e-11   3.117e-12   1.282e-11   1.612e-11    0.002997 
      0.025   1.008e-11   3.117e-12   1.282e-11   1.612e-11    0.002997 

-------------------------------------------------------------------------------
          z         NO2         N2O         HNO          CN         HCN 
-------------------------------------------------------------------------------
          0           0           0           0           0           0 
      0.005           0           0           0           0           0 
       0.01   1.205e-21   6.697e-23   2.279e-24   1.185e-33   8.215e-31 
     0.0125    2.17e-06   1.206e-07   4.106e-09   2.135e-18    1.48e-15 
      0.015   4.341e-06   2.413e-07   8.212e-09   4.269e-18    2.96e-15 
       0.02   4.341e-06   2.413e-07   8.212e-09   4.269e-18    2.96e-15 
      0.025   4.341e-06   2.413e-07   8.212e-09   4.269e-18    2.96e-15 

-------------------------------------------------------------------------------
          z        H2CN        HCNN        HCNO        HOCN        HNCO 
-------------------------------------------------------------------------------
          0           0           0           0           0           0 
      0.005           0           0           0           0           0 
       0.01   1.546e-38   4.735e-42   1.504e-35   8.599e-31    7.04e-28 
     0.0125   2.785e-23    8.53e-27    2.71e-20   1.549e-15   1.268e-12 
      0.015    5.57e-23   1.706e-26    5.42e-20   3.098e-15   2.536e-12 
       0.02    5.57e-23   1.706e-26    5.42e-20   3.098e-15   2.536e-12 
      0.025    5.57e-23   1.706e-26    5.42e-20   3.098e-15   2.536e-12 

-------------------------------------------------------------------------------
          z         NCO          N2          AR        C3H7        C3H8 
-------------------------------------------------------------------------------
          0           0      0.7348           0           0           0 
      0.005           0      0.7348           0           0           0 
       0.01   1.842e-29      0.7348           0   6.242e-76   4.325e-77 
     0.0125   3.319e-14      0.7341           0   1.125e-60   7.791e-62 
      0.015   6.638e-14      0.7334           0   2.249e-60   1.558e-61 
       0.02   6.638e-14      0.7334           0   2.249e-60   1.558e-61 
      0.025   6.638e-14      0.7334           0   2.249e-60   1.558e-61 

-------------------------------------------------------------------------------
          z      CH2CHO      CH3CHO 
-------------------------------------------------------------------------------
          0           0           0 
      0.005           0           0 
       0.01   1.343e-47   2.414e-48 
     0.0125    2.42e-32   4.349e-33 
      0.015    4.84e-32   8.698e-33 
       0.02    4.84e-32   8.698e-33 
      0.025    4.84e-32   8.698e-33 


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> products <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


-------------------------------------------------------------------------------
          z       dummy 
-------------------------------------------------------------------------------
          0           0 

************ Solving on 7 point grid with energy equation enabled ************

..............................................................................
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     2.848e-05      5.886
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     0.0004865      5.142
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps      0.008313       2.22
Attempt Newton solution of steady-state problem...    success.

Problem solved on [7] point grid(s).

..............................................................................
grid refinement disabled.

******************** Solving with grid refinement enabled ********************

..............................................................................
Attempt Newton solution of steady-state problem...    success.

Problem solved on [7] point grid(s).

..............................................................................
##############################################################################
Refining grid in flame.
    New points inserted after grid points 1 2 3 4 5 
    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 V point 1 point 4 u 
##############################################################################

..............................................................................
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     0.0001139      5.734
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps      0.002919      3.555
Attempt Newton solution of steady-state problem...    success.

Problem solved on [12] point grid(s).

..............................................................................
##############################################################################
Refining grid in flame.
    New points inserted after grid points 2 4 5 6 7 8 9 10 
    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 V point 2 point 7 u 
##############################################################################

..............................................................................
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     0.0001139      5.653
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     0.0001442       5.86
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps      0.002463      3.926
Attempt Newton solution of steady-state problem...    success.

Problem solved on [20] point grid(s).

..............................................................................
##############################################################################
Refining grid in flame.
    New points inserted after grid points 1 4 9 10 11 12 13 17 18 
    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 V point 1 point 4 u 
##############################################################################

..............................................................................
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     0.0001139      5.647
Attempt Newton solution of steady-state problem...    success.

Problem solved on [29] point grid(s).

..............................................................................
##############################################################################
Refining grid in flame.
    New points inserted after grid points 0 10 14 15 16 17 18 23 26 27 
    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 V point 0 point 10 point 23 u 
##############################################################################

..............................................................................
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     7.594e-05      6.151
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     0.0001442      6.013
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     4.561e-05      5.695
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     0.0001155      5.755
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps      0.001973       4.03
Attempt Newton solution of steady-state problem...    success.

Problem solved on [39] point grid(s).

..............................................................................
##############################################################################
Refining grid in flame.
    New points inserted after grid points 24 25 26 27 28 36 37 
    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 V u 
##############################################################################
refine: discarding point at 0.0148437

..............................................................................
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     5.695e-05      5.862
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     7.208e-05      6.072
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     0.0005474      4.974
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     7.306e-05      6.124
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps      0.001248      4.287
Attempt Newton solution of steady-state problem...    success.

Problem solved on [45] point grid(s).

..............................................................................
##############################################################################
Refining grid in flame.
    New points inserted after grid points 28 29 30 31 32 33 
    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 V u 
##############################################################################
refine: discarding point at 0.0170313
refine: discarding point at 0.0173438

..............................................................................
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     0.0001709       5.41
Attempt Newton solution of steady-state problem...    success.

Problem solved on [49] point grid(s).

..............................................................................
##############################################################################
Refining grid in flame.
    New points inserted after grid points 30 31 32 33 34 35 36 
    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 V u 
##############################################################################

..............................................................................
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     0.0001139      5.784
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     0.0005767      5.383
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     0.0003079      5.314
Attempt Newton solution of steady-state problem...    success.

Problem solved on [56] point grid(s).

..............................................................................
##############################################################################
Refining grid in flame.
    New points inserted after grid points 29 34 39 40 41 42 43 44 
    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 u 
##############################################################################
refine: discarding point at 0.0179688

..............................................................................
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     0.0001709       5.61
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps      0.001297      4.393
Attempt Newton solution of steady-state problem...    success.

Problem solved on [63] point grid(s).

..............................................................................
##############################################################################
Refining grid in flame.
    New points inserted after grid points 45 46 47 48 49 50 51 52 
    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 NO NO2 O O2 OH T point 46 u 
##############################################################################
refine: discarding point at 0.0184375
refine: discarding point at 0.01875

..............................................................................
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps     0.0002563      5.356
Attempt Newton solution of steady-state problem...    failure. 
Take 10 timesteps      0.001297      4.473
Attempt Newton solution of steady-state problem...    success.

Problem solved on [69] point grid(s).

..............................................................................
##############################################################################
Refining grid in flame.
    New points inserted after grid points 42 50 51 52 53 54 55 56 57 
    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 NO2 O O2 OH T point 42 point 53 u 
##############################################################################
refine: discarding point at 0.0182813
refine: discarding point at 0.0185938
refine: discarding point at 0.0189063
refine: discarding point at 0.0192188

..............................................................................
Attempt Newton solution of steady-state problem...    success.

Problem solved on [74] point grid(s).

..............................................................................
##############################################################################
Refining grid in flame.
    New points inserted after grid points 52 53 54 55 56 57 58 59 60 61 
    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 HO2 N2 NO2 O O2 OH T point 61 
##############################################################################
refine: discarding point at 0.0196875
refine: discarding point at 0.0199219

..............................................................................
Attempt Newton solution of steady-state problem...    success.

Problem solved on [82] point grid(s).

..............................................................................
##############################################################################
Refining grid in flame.
    New points inserted after grid points 51 52 55 56 57 58 59 60 61 62 
    to resolve C2H2 C2H3 C2H4 C2H5 C2H6 C3H8 CH CH2 CH2(S) CH2CO CH2OH CH3 CH3CHO CH3O HCCO HCO 
##############################################################################
refine: discarding point at 0.0195313

..............................................................................
Attempt Newton solution of steady-state problem...    success.

Problem solved on [91] point grid(s).

..............................................................................
##############################################################################
Refining grid in flame.
    New points inserted after grid points 46 47 48 52 54 55 72 
    to resolve C2H6 C3H8 CH3O point 52 point 72 
##############################################################################

..............................................................................
Attempt Newton solution of steady-state problem...    success.

Problem solved on [98] point grid(s).

..............................................................................
##############################################################################
Refining grid in flame.
    New points inserted after grid points 45 80 
    to resolve point 45 point 80 
##############################################################################

..............................................................................
Attempt Newton solution of steady-state problem...    success.

Problem solved on [100] point grid(s).

..............................................................................
no new points needed in flame
Solution saved to 'premixed_twin_flame.csv'.
In [6]:
Sc = computeConsumptionSpeed(oppFlame)

print("Peak temperature: {0:.1f} K".format(T))
print("Strain Rate: {0:.1f} 1/s".format(K))
print("Consumption Speed: {0:.2f} cm/s".format(Sc*100))
Peak temperature: 1920.5 K
Strain Rate: 163.6 1/s
Consumption Speed: 20.80 cm/s

Plot figures

Note that the graphs only represent one-half of the domain, because the solution is symmetric

In [7]:
# Import plotting modules and define plotting preference
import matplotlib.pyplot as plt
%matplotlib notebook

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

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

Axial velocity plot

In [8]:
plt.figure()

plt.plot(oppFlame.grid*100, oppFlame.u, 'r-o', lw=2)
plt.xlim(oppFlame.grid[0], oppFlame.grid[-1]*100)
plt.xlabel('Distance (cm)')
plt.ylabel('Axial Velocity (m/s)')

# Identify the point where the strain rate is calculated
plt.plot(oppFlame.grid[strainRatePoint]*100, oppFlame.u[strainRatePoint],'gs')
plt.annotate('Strain-Rate point',
             xy=(oppFlame.grid[strainRatePoint]*100, oppFlame.u[strainRatePoint]),
             xytext=(0.001, 0.1),
             arrowprops={'arrowstyle':'->'});

Temperature Plot

In [9]:
plt.figure()

plt.plot(oppFlame.grid*100, oppFlame.T, 'b-s', lw=2)
plt.xlim(oppFlame.grid[0], oppFlame.grid[-1]*100)
plt.xlabel('Distance (cm)')
plt.ylabel('Temperature (K)');

Major Species' Plot

In [10]:
"""
# To plot species, we first have to identify the index of the species in the array
# For 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))
"""

# Extract concentration data
X_CH4 = oppFlame.X[13]
X_CO2 = oppFlame.X[15]
X_H2O = oppFlame.X[5]

plt.figure()

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

plt.xlim(oppFlame.grid[0], oppFlame.grid[-1]*100)
plt.xlabel('Distance (cm)')
plt.ylabel('Mole Fractions')

plt.legend(loc=2);
In [ ]: