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
The first time running PelePhysics, third-party libraries have to be downloaded compiled
makeTPL
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
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.
In the above case, the 7 species will be CH4, O2, H2O, N2, CO, CO2, H2. Note that the order will correspond to the species order in the prob.h file. For example, CH4 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.
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.
Beware thatceptr requires Python version between (>=3.8 and <3.11). Is best to work with environments: pyenv, conda or similar. This may require careful python install (see Tips)
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).
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
that require a linear solver, PelePhysics has different options, see PelePhsyics documentation. 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 = 1ode.analytical_jacobian = 1 enables the Analytical Jacobian.
If cvode.solve_type = 99ode.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 documentation