flask-vialChemistry

Complex chemistry in the code is handled through the PelePhysicsarrow-up-right 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 Canteraarrow-up-right. 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.

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.

Similarly the reactions label describes the chemical reactions used.

See details of yaml format in YAMLarrow-up-right

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 Tutorialarrow-up-right

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 poetryarrow-up-right package manager.

circle-exclamation

The script command is then

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).

More details in Cantera CK2YAMLarrow-up-right 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-Kwongarrow-up-right 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 SUNDIALSarrow-up-right. 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 documentationarrow-up-right. To activate CVODE, in the GNUMakefile

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

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)

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

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 documentationarrow-up-right

Last updated