Page cover

Chemistry

Complex chemistry in the code is handled through the PelePhysics library. To install PelePhysics, type$ ./install.sh pelephys in the lib directory. It may be already installed if the code was installed using safe (check QuickStart)

set-up

In the GNUmakefile the user needs to set-up the following options

# PelePhysics
EOS_MODEL := FUEGO
TRANSPORT_MODEL := SIMPLE
CHEMISTRY_MODEL := BurkeDryer

and also the following lines exists, pointing to PelePhysics library.

USE_PELEPHYSICS = TRUE
PELE_PHYSICS_HOME = $(abspath ../../lib/PelePhysics)

The first time running PelePhysics, third-party libraries have to be downloaded compiled

make TPL

Chemical Mechanisms

The chemical mechanism are located in PelePhysics/Support/Mechanism/Models (PelePhysics v23) or PelePhysics/Mechanisms (PelePhysics v25). The mechanisms are organised in directories, that must have the same name as CHEMISTRY_MODEL option in the GNUMakefile

$ ls lib/PelePhysics/Support/Mechanism/Models
Aromatic_KrNara LuDME               decane_3sp          heptane_lu_88sk
BurkeDryer      LuEthylene          dodecane_lu         heptane_lu_qss
C1-C2-NO        LuEthylene_qss      dodecane_lu_qss     isooctane_lu
C1-C2-NO_qss    Make.package        dodecane_wang       list_mech
CH4_lean        NUIGalway           dodmethair_4sp      list_qss_mech
CH4_lean_qss    Null                drm19               methaneIons_diRenzo
Davis           PPHYS_CONSTANTS.H.  ethylene_af         ndodecane_35
FFCM1_Red       SootReaction        grimech12           nitrogens
HP_DME          air                 grimech30           propane_fc
IonizedAir      alzeta              grimech30-noArN     sCO2
JL4             chem-CH4-2step      header
Kolla           chem-H              heptane_3sp
LiDryer         converter.sh        heptane_fc

A local mechanism can be used by setting USE_LOCALCHEM = TRUE and specify a LOCALCHEM_PATH (absolute path) in GNUMakefile. To build the code, the mechanism folder needs several files: mechanism.H,mechanims.cpp and Make.package that hard-coded the chemistry, see an example of local chemistry set-up in exm/ibm/srp.

All mechanisms are derived using yaml format from Cantera. The list of chemical mechanisms directlly available can be obtained directly by $cat PelePhysics/Support/Mechanism/Models/list_mech with a few more that use QSSA (see list_qss_mech file). Opening the mechanism.yaml file within a directory, will give an indication of the species involved and chemical reactions.

For example, in the Jones and Lindstedt mechanism (a 4-step process for hydrocarbon combustion), seven species are used. In the mechanism.yaml file, the label phases indicates which chemical components will be included.

phases:
- name: gas
  thermo: ideal-gas
  elements: [C, O, H, N]
  species: [CH4, O2, H2O, N2, CO, CO2, H2]
  kinetics: gas
  transport: mixture-averaged
  state: {T: 300.0, P: 1 atm}

In the above case, the 7 species will be CH4\text{CH}_4, O2\text{O}_2, H2O\text{H}_2\text{O}, N2\text{N}_2, CO\text{CO}, CO2\text{CO}_2, H2\text{H}_2. Note that the order will correspond to the species order in the prob.h file. For example, CH4\text{CH}_4 will be solved first in the species. The label species, indicate thermodynamic and transport properties of the chemical species.

species:
- name: CH4
  composition: {C: 1, H: 4}
  thermo:
    model: NASA7
    temperature-ranges: [200.0, 1000.0, 3500.0]
    data:
    - [5.14987613, -0.0136709788, 4.91800599e-05, -4.84743026e-08, 1.66693956e-11,
      -1.02466476e+04, -4.64130376]
    - [0.074851495, 0.0133909467, -5.73285809e-06, 1.22292535e-09, -1.0181523e-13,
      -9468.34459, 18.437318]
    note: L 8/88
  transport:
    model: gas
    geometry: nonlinear
    well-depth: 141.4
    diameter: 3.746
    polarizability: 2.6
    rotational-relaxation: 13.0
- name: O2
  ...

Similarly the reactions label describes the chemical reactions used.

reactions:
- equation: 2 CH4 + O2 => 2 CO + 4 H2  # Reaction 1
  rate-constant: {A: 3.91e+13, b: 0.0, Ea: 3.0e+04} 
  orders: {CH4: 0.5, O2: 1.25}
- equation: CH4 + H2O <=> CO + 3 H2  # Reaction 2
  rate-constant: {A: 3.0e+11, b: 0.0, Ea: 3.0e+04}
  ...

See details of yaml format in YAML

Generate a new mechanism

For all the available mechanisms in PelePhysics, a Cantera yaml format is provided. If CHEMKIN files are present, Pelephysics rely on Cantera’s ck2yaml utility to convert CHEMKIN files to the Cantera yaml format. They are converter scripts to facilitate this process. Check PelePhysics Tutorial

Once the mechanism.yaml is generated, is good idea to check that is readable by Cantera, there are scripts in tools/combustion can be helpful). The yaml format needs to generate two chemistry-specific files: mechanism.cpp and mechanism.H. These are the files that Cerisse/Pele codes require to run (Cantera is not needed to run cerisse). To convert use the CLI utility ceptr (located in Pelephysics/Support/ceptr), which requires the poetry package manager.

The script command is then

$ cd ${PELE_PHYSICS_HOME}/Support/ceptr
$ poetry run convert -f ${PATH_TO_CHEMISTRY}/mechanism.yaml

This will create the required files in ${PATH_TO_CHEMISTRY}A similar script can be used to convert CHEMKIN files to yaml (and then use the above script to generate the C++ files).

$ cd ${PELE_PHYSICS_HOME}/Support/ceptr
$ poetry run ck2yaml --input ${PATH_TO_CHEMISTRY}/mechanism.inp 
--thermo ${PATH_TO_CHEMISTRY}/therm.dat --transport ${PATH_TO_CHEMISTRY}/tran.dat --permissive 

More details in Cantera CK2YAML documentation

Equations of State

Using PelePhysics there are three Equations of State (EOS) models:

  • A simple GammaLaw model for a single component perfect gas. This can also be used directly without PelePhysics (see PROB)

  • A multi-component ideal gas labelled Fuego Used for multi-component (reacting or not) calculations.

  • The Soave-Redlich-Kwong cubic equation of state for a general mixture of non-ideal gases

Chemistry Integration

PelePhysics has different options to integrate the chemistrym using implicit ODE solvers: CVODE an DVODE. CVODE is part of a software family called sundials for SUite of Nonlinear and DIfferential / ALgebraic equation Solver SUNDIALS. which should be installed (see install SUNDIALS). The methods implemented in CVODE are variable-order, variable-step multistep methods, based on formulas broadly following

αnyk+βnhny˙k=0\alpha_n y_k + \beta_n h_n \dot{y}_k = 0

that require a linear solver, PelePhysics has different options, see PelePhsyics documentation. To activate CVODE, in the GNUMakefile

USE_SUNDIALS_PP = TRUE

input options

The input file consists of specific blocks containing keywords that apply to different aspects of the problem's integration. Each block is associated with a suffix that helps determine which keywords are required, depending on the options set in the GNUmakefile. For example, if CVODE is enabled via the GNUmakefile, keywords starting with cvode.* are relevant. The general ode.* keywords are shared across all ODE integrators and are also applicable to CVODE.

Key Parameters and Options

Keyword
Description

ode.reactor_type

Switches between a CV reactor and a CVH reactor.

cvode.solve_type

Controls the CVODE linear integration method: 1 = Dense direct linear solver 5 = Sparse direct linear solver (requires KLU library) 99 = Krylov iterative solver

ode.analytical_jacobian

Determines the Jacobian solver method, with different behaviors based on cvode.solve_type:

  • If cvode.solve_type = 1 ode.analytical_jacobian = 1 enables the Analytical Jacobian.

  • If cvode.solve_type = 99 ode.analytical_jacobian = 1 activates the preconditioned GMRES solver, while setting ode.analytical_jacobian = 0 enables the non-preconditioned GMRES solver.

  • If cvode.solve_type = 99 and the KLU library is linked, then the preconditioned solver operates in a sparse format.

  • If cvode.solve_type = 5, the only valid option is ode.analytical_jacobian = 1.

This structure allows users to configure the solver behavior efficiently based on their requirements.

Premixed Flame Initialisation

Pre-computed profiles from 1D freely propagating premixed flames can be used to initialise a solutions. To create a 1D profile, a python script is used tools/combustion/1d-flame-run.py that uses Cantera and requires a chemistry files in yaml format. The script can be modified to create different profiles based on different conditions. The flame profiles can be seen by

$ python 1d-flame-plot.py

A pmf-Y.txt file (or pmf-X.txt depending on the options) will be created. PelePhysics requires a specific *.dat format that is used in Cerisse as well. To convert the files, you can use the Python script pmf_f2dat.py in lib/PelePhysics/Utility (PelePhysics v23)

$ python pmf_f2dat.py inputfile.txt pmf.dat

The pmf.dat file will look like (for a 9-species hydrogen mechanism)

VARIABLES  =  "X"  "temp"  "u"  "rho"  "Y_H2" "Y_O2" "Y_H2O" "Y_H" "Y_O" "Y_OH" "Y_HO2" "Y_H2O2" "Y_N2"
 ZONE  I=454  FORMAT=POINT  SPECFORMAT=MASS 
0.0 298.0 0.534292484155303 0.9893277276003428 0.014467517837899192 0.22962878760502656 1.1722583290927352e-19 -5.887036225686357e-21 6.511836937427712e-19 -3.6814739215435833e-19 -3.4206663655715174e-18 -1.7741231617078512e-18 0.7559036945570743

And is the file that the code needs, the place can be selected in the input file (see example in exm/planar flame). This set-up does not reuire to set-up poetry, but additional options can be done followingPelephysics documentation

Last updated