Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surface Chemistry - Modified mechanism.H preprocessor directives & mechanism.cpp reaction maps #473

Merged
merged 22 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2e73ecf
Added mandatory -c/--chemistry CL argument
jAnirudh Jan 15, 2024
e639d0a
Using Kolla mechanism to track effects of CEPTR changes
jAnirudh Jan 15, 2024
024c25a
Modified the preprocessor directives
jAnirudh Jan 15, 2024
2494a38
Added surface species information
jAnirudh Jan 15, 2024
94bbd13
Modified formatter to replace '(' with '_'
jAnirudh Jan 15, 2024
a5fa996
Added indexing for additional heterogeneous reactions
jAnirudh Jan 16, 2024
41ea734
Modified the reaction_info rmap and get_rmap methods
jAnirudh Jan 16, 2024
a1ec8f3
Fixed NUM_SPECIES preprocessor directive for qssa mechanisms
jAnirudh Jan 17, 2024
4e11558
Included Modifications based on PR review
jAnirudh Jan 19, 2024
e62eb35
Removed not isinstance condition missed in earlier commit
jAnirudh Jan 19, 2024
92d584e
Modifications based on PR review round 2
jAnirudh Jan 20, 2024
f20d711
Followed formatting, updated qssa.py sort_reaction call
jAnirudh Jan 20, 2024
c567fb0
Used new Converter API for test_ceptr.py
jAnirudh Jan 20, 2024
c8ce2c4
Removed the Kolla mechanism from the ceptr subdirectory
jAnirudh Feb 1, 2024
93a1782
Merge branch 'development' into anirudh/surfchem
jAnirudh Feb 1, 2024
a170d9f
Modified ceptr.py to run in batch mode
jAnirudh Feb 2, 2024
8b52ede
Added missing parenthesis in preprocessor directives
jAnirudh Feb 5, 2024
cdf3451
Batch generated non-qss homogeneous reaction mechanions with new code
jAnirudh Feb 5, 2024
341ea7f
Merge branch 'development' into anirudh/surfchem
jAnirudh Feb 8, 2024
625d8f0
Doing qss files
marchdf Feb 8, 2024
e10e40f
Updated Ceptr.rst with details of modified usage
jAnirudh Feb 9, 2024
8d400a2
Used rst note in Ceptr.rst
jAnirudh Feb 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion Docs/sphinx/Ceptr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,28 @@ Generating for a single chemistry

There are three ways to use CEPTR to generate C++ mechanism files for a given chemistry

1. Using CEPTR directly::
1. Using CEPTR directly:

Executed from the ``${PELE_PHYSICS_HOME}/Support/ceptr`` directory, the most general usage of CEPTR is::

$ poetry run convert -f ${PELEPHYSICS_HOME}/Mechanisms/${chemistry}/mechanism.yaml \
--chemistry {chemistry-type} \
--gas_name {gas-name} \
--interface_name {interface-name}

The ``--chemistry``, or equivalently ``-c``, argument allows users to convey if the ``${chemistry}`` of interest is either one of two valid options, namely, ``homogeneous`` or ``heterogeneous``.
Similarly, the ``--gas_name`` and ``--interface_name`` allows users to specify the names of the homogeneous phase and gas-solid interface prescribed in the corresponding ``mechanism.yaml`` file.

The default ``chemistry-type``, ``gas-name`` are ``homogeneous`` and ``gas`` respectively while that for ``interface-name`` is ``None``.
Note that if a ``heterogeneous`` ``chemistry-type`` is specified, the user must necessarily specify a corresponding ``interface-name``.

An example of directly using CEPTR for homogeneous mechanisms is::

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

NOTE: CEPTR interpretations of heterogeneous mechanisms is currently a work in progress.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this an actual rst type note? there are some examples in here somewhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a new commit with the rst type note


2. Using a helper script in the directory containing the ``mechanism.yaml`` file::

$ ./convert.sh
Expand Down
53 changes: 32 additions & 21 deletions Mechanisms/Aromatic_KrNara/mechanism.H
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,21 @@
#define OC6H4O_ID 156
#define N2_ID 157

#define NUM_ELEMENTS 5
#define NUM_SPECIES 158
#define NUM_GAS_ELEMENTS 5 // Elements in the homogeneous phase
#define NUM_GAS_SPECIES 158 // Species in the homogeneous phase
#define NUM_GAS_REACTIONS 1049 // Reactions in the homogeneous phase

#define SITE_DENSITY 0.000000E+00 // mol/cm^2

#define NUM_SURFACE_ELEMENTS 0 // Additional elements in heterogeneous phase
#define NUM_SURFACE_SPECIES 0 // Species in the heterogeneous phase
#define NUM_SURFACE_REACTIONS 0 // Reactions in the heterogeneous phase

#define NUM_ELEMENTS (NUM_GAS_ELEMENTS + NUM_SURFACE_ELEMENTS)
#define NUM_SPECIES (NUM_GAS_SPECIES + NUM_SURFACE_SPECIES)
#define NUM_REACTIONS (NUM_GAS_REACTIONS + NUM_SURFACE_REACTIONS)

#define NUM_IONS 7
#define NUM_REACTIONS 1049

#define NUM_FIT 4

Expand Down Expand Up @@ -186439,7 +186450,7 @@ egtransetCOFD(amrex::Real* COFD)
COFD[33806] = -4.21537415E-01;
COFD[33807] = 1.63630500E-02;
COFD[33808] = -2.25933772E+01;
COFD[33809] = 5.42562555E+00;
COFD[33809] = 5.42562556E+00;
COFD[33810] = -4.48132861E-01;
COFD[33811] = 1.77847329E-02;
COFD[33812] = -2.24804061E+01;
Expand Down Expand Up @@ -202139,7 +202150,7 @@ egtransetCOFD(amrex::Real* COFD)
COFD[49506] = -4.91225485E-01;
COFD[49507] = 2.04057002E-02;
COFD[49508] = -2.25933772E+01;
COFD[49509] = 5.42562555E+00;
COFD[49509] = 5.42562556E+00;
COFD[49510] = -4.48132861E-01;
COFD[49511] = 1.77847329E-02;
COFD[49512] = -2.27399898E+01;
Expand Down Expand Up @@ -221355,19 +221366,19 @@ egtransetCOFD(amrex::Real* COFD)
COFD[68722] = 3.67306611E-01;
COFD[68723] = -2.15544181E-02;
COFD[68724] = -1.25531803E+01;
COFD[68725] = -2.57908185E-02;
COFD[68725] = -2.57908186E-02;
COFD[68726] = 3.65103624E-01;
COFD[68727] = -2.14528891E-02;
COFD[68728] = -1.25520156E+01;
COFD[68729] = -2.57908185E-02;
COFD[68729] = -2.57908186E-02;
COFD[68730] = 3.65103624E-01;
COFD[68731] = -2.14528891E-02;
COFD[68732] = -1.25785265E+01;
COFD[68733] = -2.57908185E-02;
COFD[68733] = -2.57908186E-02;
COFD[68734] = 3.65103624E-01;
COFD[68735] = -2.14528891E-02;
COFD[68736] = -1.25531803E+01;
COFD[68737] = -2.57908185E-02;
COFD[68737] = -2.57908186E-02;
COFD[68738] = 3.65103624E-01;
COFD[68739] = -2.14528891E-02;
COFD[68740] = -1.91904086E+01;
Expand Down Expand Up @@ -221987,19 +221998,19 @@ egtransetCOFD(amrex::Real* COFD)
COFD[69354] = 3.67306611E-01;
COFD[69355] = -2.15544181E-02;
COFD[69356] = -1.25516454E+01;
COFD[69357] = -2.57908185E-02;
COFD[69357] = -2.57908186E-02;
COFD[69358] = 3.65103624E-01;
COFD[69359] = -2.14528891E-02;
COFD[69360] = -1.25504843E+01;
COFD[69361] = -2.57908185E-02;
COFD[69361] = -2.57908186E-02;
COFD[69362] = 3.65103624E-01;
COFD[69363] = -2.14528891E-02;
COFD[69364] = -1.25769119E+01;
COFD[69365] = -2.57908185E-02;
COFD[69365] = -2.57908186E-02;
COFD[69366] = 3.65103624E-01;
COFD[69367] = -2.14528891E-02;
COFD[69368] = -1.25516454E+01;
COFD[69369] = -2.57908185E-02;
COFD[69369] = -2.57908186E-02;
COFD[69370] = 3.65103624E-01;
COFD[69371] = -2.14528891E-02;
COFD[69372] = -1.91896245E+01;
Expand Down Expand Up @@ -227007,11 +227018,11 @@ egtransetCOFD(amrex::Real* COFD)
COFD[74374] = 3.64334842E-01;
COFD[74375] = -2.14173756E-02;
COFD[74376] = -1.25531803E+01;
COFD[74377] = -2.57908185E-02;
COFD[74377] = -2.57908186E-02;
COFD[74378] = 3.65103624E-01;
COFD[74379] = -2.14528891E-02;
COFD[74380] = -1.25516454E+01;
COFD[74381] = -2.57908185E-02;
COFD[74381] = -2.57908186E-02;
COFD[74382] = 3.65103624E-01;
COFD[74383] = -2.14528891E-02;
COFD[74384] = -1.38292265E+01;
Expand Down Expand Up @@ -227639,11 +227650,11 @@ egtransetCOFD(amrex::Real* COFD)
COFD[75006] = 3.64334842E-01;
COFD[75007] = -2.14173756E-02;
COFD[75008] = -1.25520156E+01;
COFD[75009] = -2.57908185E-02;
COFD[75009] = -2.57908186E-02;
COFD[75010] = 3.65103624E-01;
COFD[75011] = -2.14528891E-02;
COFD[75012] = -1.25504843E+01;
COFD[75013] = -2.57908185E-02;
COFD[75013] = -2.57908186E-02;
COFD[75014] = 3.65103624E-01;
COFD[75015] = -2.14528891E-02;
COFD[75016] = -1.38281442E+01;
Expand Down Expand Up @@ -228271,11 +228282,11 @@ egtransetCOFD(amrex::Real* COFD)
COFD[75638] = 3.64334842E-01;
COFD[75639] = -2.14173756E-02;
COFD[75640] = -1.25785265E+01;
COFD[75641] = -2.57908185E-02;
COFD[75641] = -2.57908186E-02;
COFD[75642] = 3.65103624E-01;
COFD[75643] = -2.14528891E-02;
COFD[75644] = -1.25769119E+01;
COFD[75645] = -2.57908185E-02;
COFD[75645] = -2.57908186E-02;
COFD[75646] = 3.65103624E-01;
COFD[75647] = -2.14528891E-02;
COFD[75648] = -1.38527338E+01;
Expand Down Expand Up @@ -228903,11 +228914,11 @@ egtransetCOFD(amrex::Real* COFD)
COFD[76270] = 3.64334842E-01;
COFD[76271] = -2.14173756E-02;
COFD[76272] = -1.25531803E+01;
COFD[76273] = -2.57908185E-02;
COFD[76273] = -2.57908186E-02;
COFD[76274] = 3.65103624E-01;
COFD[76275] = -2.14528891E-02;
COFD[76276] = -1.25516454E+01;
COFD[76277] = -2.57908185E-02;
COFD[76277] = -2.57908186E-02;
COFD[76278] = 3.65103624E-01;
COFD[76279] = -2.14528891E-02;
COFD[76280] = -1.38292265E+01;
Expand Down
4 changes: 2 additions & 2 deletions Mechanisms/Aromatic_KrNara/mechanism.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "mechanism.H"
const int rmap[1049] = {
const int rmap[NUM_REACTIONS] = {
11, 13, 26, 44, 47, 49, 50, 51, 61, 74, 80, 81, 88,
91, 97, 112, 120, 141, 152, 166, 191, 192, 200, 201, 209, 210,
217, 220, 280, 391, 430, 823, 989, 4, 5, 6, 7, 8, 9,
Expand Down Expand Up @@ -86,7 +86,7 @@ const int rmap[1049] = {
void
GET_RMAP(int* _rmap)
{
for (int j = 0; j < 1049; ++j) {
for (int j = 0; j < NUM_REACTIONS; ++j) {
_rmap[j] = rmap[j];
}
}
Expand Down
17 changes: 14 additions & 3 deletions Mechanisms/BurkeDryer/mechanism.H
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,21 @@
#define CO_ID 11
#define CO2_ID 12

#define NUM_ELEMENTS 6
#define NUM_SPECIES 13
#define NUM_GAS_ELEMENTS 6 // Elements in the homogeneous phase
#define NUM_GAS_SPECIES 13 // Species in the homogeneous phase
#define NUM_GAS_REACTIONS 27 // Reactions in the homogeneous phase

#define SITE_DENSITY 0.000000E+00 // mol/cm^2

#define NUM_SURFACE_ELEMENTS 0 // Additional elements in heterogeneous phase
#define NUM_SURFACE_SPECIES 0 // Species in the heterogeneous phase
#define NUM_SURFACE_REACTIONS 0 // Reactions in the heterogeneous phase

#define NUM_ELEMENTS (NUM_GAS_ELEMENTS + NUM_SURFACE_ELEMENTS)
#define NUM_SPECIES (NUM_GAS_SPECIES + NUM_SURFACE_SPECIES)
#define NUM_REACTIONS (NUM_GAS_REACTIONS + NUM_SURFACE_REACTIONS)

#define NUM_IONS 0
#define NUM_REACTIONS 27

#define NUM_FIT 4

Expand Down
7 changes: 4 additions & 3 deletions Mechanisms/BurkeDryer/mechanism.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#include "mechanism.H"
const int rmap[27] = {14, 21, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 1, 2,
3, 4, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26};
const int rmap[NUM_REACTIONS] = {14, 21, 5, 6, 7, 8, 9, 10, 11,
12, 13, 0, 1, 2, 3, 4, 15, 16,
17, 18, 19, 20, 22, 23, 24, 25, 26};

// Returns 0-based map of reaction order
void
GET_RMAP(int* _rmap)
{
for (int j = 0; j < 27; ++j) {
for (int j = 0; j < NUM_REACTIONS; ++j) {
_rmap[j] = rmap[j];
}
}
Expand Down
17 changes: 14 additions & 3 deletions Mechanisms/C1-C2-NO/mechanism.H
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,21 @@
#define NCO_ID 42
#define CH3O2_ID 43

#define NUM_ELEMENTS 5
#define NUM_SPECIES 44
#define NUM_GAS_ELEMENTS 5 // Elements in the homogeneous phase
#define NUM_GAS_SPECIES 44 // Species in the homogeneous phase
#define NUM_GAS_REACTIONS 269 // Reactions in the homogeneous phase

#define SITE_DENSITY 0.000000E+00 // mol/cm^2

#define NUM_SURFACE_ELEMENTS 0 // Additional elements in heterogeneous phase
#define NUM_SURFACE_SPECIES 0 // Species in the heterogeneous phase
#define NUM_SURFACE_REACTIONS 0 // Reactions in the heterogeneous phase

#define NUM_ELEMENTS (NUM_GAS_ELEMENTS + NUM_SURFACE_ELEMENTS)
#define NUM_SPECIES (NUM_GAS_SPECIES + NUM_SURFACE_SPECIES)
#define NUM_REACTIONS (NUM_GAS_REACTIONS + NUM_SURFACE_REACTIONS)

#define NUM_IONS 0
#define NUM_REACTIONS 269

#define NUM_FIT 4

Expand Down
4 changes: 2 additions & 2 deletions Mechanisms/C1-C2-NO/mechanism.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "mechanism.H"
const int rmap[269] = {
const int rmap[NUM_REACTIONS] = {
11, 13, 41, 50, 52, 53, 61, 73, 78, 85, 87, 101, 104, 128, 139,
145, 158, 172, 173, 188, 196, 203, 213, 220, 222, 29, 127, 4, 5, 6,
7, 8, 9, 10, 38, 39, 245, 252, 0, 1, 2, 3, 12, 14, 15,
Expand All @@ -23,7 +23,7 @@ const int rmap[269] = {
void
GET_RMAP(int* _rmap)
{
for (int j = 0; j < 269; ++j) {
for (int j = 0; j < NUM_REACTIONS; ++j) {
_rmap[j] = rmap[j];
}
}
Expand Down
17 changes: 14 additions & 3 deletions Mechanisms/C1-C2-NO_qss/mechanism.H
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,21 @@
#define NCO_ID 37
#define CH3O2_ID 38

#define NUM_ELEMENTS 5
#define NUM_SPECIES 39
#define NUM_GAS_ELEMENTS 5 // Elements in the homogeneous phase
#define NUM_QSSA_GAS_SPECIES 39 // Species in the homogeneous phase
#define NUM_GAS_REACTIONS 269 // Reactions in the homogeneous phase

#define SITE_DENSITY 0.000000E+00 // mol/cm^2

#define NUM_SURFACE_ELEMENTS 0 // Additional elements in heterogeneous phase
#define NUM_SURFACE_SPECIES 0 // Species in the heterogeneous phase
#define NUM_SURFACE_REACTIONS 0 // Reactions in the heterogeneous phase

#define NUM_ELEMENTS (NUM_GAS_ELEMENTS + NUM_SURFACE_ELEMENTS)
#define NUM_SPECIES (NUM_QSSA_GAS_SPECIES + NUM_SURFACE_SPECIES)
#define NUM_REACTIONS (NUM_GAS_REACTIONS + NUM_SURFACE_REACTIONS)

#define NUM_IONS 0
#define NUM_REACTIONS 269

#define NUM_FIT 4

Expand Down
4 changes: 2 additions & 2 deletions Mechanisms/C1-C2-NO_qss/mechanism.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "mechanism.H"
const int rmap[269] = {
const int rmap[NUM_REACTIONS] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
Expand All @@ -23,7 +23,7 @@ const int rmap[269] = {
void
GET_RMAP(int* _rmap)
{
for (int j = 0; j < 269; ++j) {
for (int j = 0; j < NUM_REACTIONS; ++j) {
_rmap[j] = rmap[j];
}
}
Expand Down
23 changes: 17 additions & 6 deletions Mechanisms/CH4_lean/mechanism.H
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define H2O_ID 5
#define HO2_ID 6
#define CH2_ID 7
#define CH2S_ID 8
#define CH2_S_ID 8
#define CH3_ID 9
#define CH4_ID 10
#define CO_ID 11
Expand All @@ -31,10 +31,21 @@
#define CH2OH_ID 15
#define N2_ID 16

#define NUM_ELEMENTS 5
#define NUM_SPECIES 17
#define NUM_GAS_ELEMENTS 5 // Elements in the homogeneous phase
#define NUM_GAS_SPECIES 17 // Species in the homogeneous phase
#define NUM_GAS_REACTIONS 73 // Reactions in the homogeneous phase

#define SITE_DENSITY 0.000000E+00 // mol/cm^2

#define NUM_SURFACE_ELEMENTS 0 // Additional elements in heterogeneous phase
#define NUM_SURFACE_SPECIES 0 // Species in the heterogeneous phase
#define NUM_SURFACE_REACTIONS 0 // Reactions in the heterogeneous phase

#define NUM_ELEMENTS (NUM_GAS_ELEMENTS + NUM_SURFACE_ELEMENTS)
#define NUM_SPECIES (NUM_GAS_SPECIES + NUM_SURFACE_SPECIES)
#define NUM_REACTIONS (NUM_GAS_REACTIONS + NUM_SURFACE_REACTIONS)

#define NUM_IONS 0
#define NUM_REACTIONS 73

#define NUM_FIT 4

Expand Down Expand Up @@ -14184,7 +14195,7 @@ egtransetCOFD(amrex::Real* COFD)
COFD[805] = 5.11785645E+00;
COFD[806] = -4.37867828E-01;
COFD[807] = 1.85047543E-02;
COFD[808] = -1.99343635E+01;
COFD[808] = -1.99343636E+01;
COFD[809] = 4.99746595E+00;
COFD[810] = -4.23838963E-01;
COFD[811] = 1.79592094E-02;
Expand Down Expand Up @@ -14440,7 +14451,7 @@ egtransetCOFD(amrex::Real* COFD)
COFD[1061] = 5.35659323E+00;
COFD[1062] = -4.62684013E-01;
COFD[1063] = 1.93375283E-02;
COFD[1064] = -1.99343635E+01;
COFD[1064] = -1.99343636E+01;
COFD[1065] = 4.99746595E+00;
COFD[1066] = -4.23838963E-01;
COFD[1067] = 1.79592094E-02;
Expand Down
4 changes: 2 additions & 2 deletions Mechanisms/CH4_lean/mechanism.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "mechanism.H"
const int rmap[73] = {
const int rmap[NUM_REACTIONS] = {
28, 29, 31, 33, 38, 0, 1, 8, 15, 16, 17, 18, 20, 21, 22, 23, 24, 69, 70,
2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 19, 25, 26, 27, 30, 32, 34,
35, 36, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
Expand All @@ -9,7 +9,7 @@ const int rmap[73] = {
void
GET_RMAP(int* _rmap)
{
for (int j = 0; j < 73; ++j) {
for (int j = 0; j < NUM_REACTIONS; ++j) {
_rmap[j] = rmap[j];
}
}
Expand Down
Loading
Loading