Skip to content
This repository was archived by the owner on Jun 7, 2024. It is now read-only.

Commit 92cef7e

Browse files
committed
Checking against "pdep" reactions in ReactionLibrary reactions.txt file
This commit switches the general order of adding reactions to the ODE input file and CHEMKIN chem.inp file from: * Seed * Reaction Library pdepreactions * RMG (fame) pdepreactions * RMG nonpdep reactions to: * Seed * Reaction Library pdepreactions * RMG nonpdep reactions # RMG (fame) pdepreactions Example: Suppose user started with H and O2 in the input file, and Glarborg/C3 reaction library. RMG would find H+O2=O+OH in Glarborg/C3 library and would make HO2 (H+O2) included, thereby finding the O+OH well, making H+O2(+m)=O+OH(+m). In the previous order, RMG would add the RMG pdepreactions reaction to the list, and then add the Glarborg/C3 reaction to the list: this would be an incorrect duplicate. With the new order, RMG adds the Glarborg/C3 reaction, and then recognizes the RMG (fame) pdepreaction to be a duplicate and will not add it to the ODE or CHEMKIN list.
1 parent 226aeaf commit 92cef7e

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

source/RMG/jing/rxnSys/Chemkin.java

+13-10
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,17 @@ public static BufferedWriter writeChemkinPdepReactions(ReactionModel p_reactionM
603603
}
604604
}
605605

606+
// Then add all non-pdep, non-seed, reactions to the nonPDepList
607+
for (Iterator iter = p_reactionModel.getReactionSet().iterator(); iter.hasNext(); ) {
608+
Reaction r = (Reaction)iter.next();
609+
if (!r.isForward()) continue;
610+
// Check the seedList against r and its reverse
611+
if (seedList.contains(r) || seedList.contains(r.getReverseReaction())) continue;
612+
if (r instanceof ThirdBodyReaction || r instanceof TROEReaction || r instanceof LindemannReaction) continue;
613+
// Made it through all the tests.
614+
nonPDepList.add(r);
615+
}
616+
606617
// Then get reactions from pressure-dependent networks and add them to pDepList
607618
for (Iterator iter = PDepNetwork.getNetworks().iterator(); iter.hasNext(); ) {
608619
PDepNetwork pdn = (PDepNetwork)iter.next();
@@ -618,21 +629,13 @@ public static BufferedWriter writeChemkinPdepReactions(ReactionModel p_reactionM
618629
if (rxn.reactantEqualsProduct()) continue;
619630
if (pDepList.contains(rxn) || pDepList.contains(rxn.getReverseReaction())) continue;
620631
if (seedList.contains(rxn) || seedList.contains(rxn.getReverseReaction())) continue;
632+
if (nonPDepList.contains(rxn) || nonPDepList.contains(rxn.getReverseReaction())) continue;
621633

622634
// Made it through all the tests.
623635
pDepList.add(rxn);
624636
}
625637
}
626-
// Then add all non-pdep, non-seed, reactions to the nonPDepList
627-
for (Iterator iter = p_reactionModel.getReactionSet().iterator(); iter.hasNext(); ) {
628-
Reaction r = (Reaction)iter.next();
629-
if (!r.isForward()) continue;
630-
if (seedList.contains(r)) continue;
631-
if (r instanceof ThirdBodyReaction || r instanceof TROEReaction || r instanceof LindemannReaction) continue;
632-
// Made it through all the tests.
633-
nonPDepList.add(r);
634-
}
635-
638+
636639
// First report seed mechanism reactions
637640
for (Iterator iter = seedList.iterator(); iter.hasNext();){
638641
Reaction r = (Reaction)iter.next();

source/RMG/jing/rxnSys/JDAS.java

+19-6
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,13 @@ public void generatePDepReactionList(ReactionModel p_reactionModel,
267267
if (cerm.getSeedMechanism() != null)
268268
seedList = cerm.getSeedMechanism().getReactionSet();
269269

270+
for (Iterator iter = p_reactionModel.getReactionSet().iterator(); iter.hasNext();) {
271+
Reaction r = (Reaction) iter.next();
272+
if (r.isForward() && !(r instanceof ThirdBodyReaction) && !(r instanceof TROEReaction) && !(r instanceof LindemannReaction)) {
273+
nonPDepList.add(r);
274+
}
275+
}
276+
270277
for (Iterator iter = PDepNetwork.getCoreReactions(cerm).iterator(); iter.hasNext();) {
271278
PDepReaction rxn = (PDepReaction) iter.next();
272279
if (cerm.categorizeReaction(rxn) != 1) {
@@ -297,6 +304,17 @@ else if (seedList.contains(rxn) || seedList.contains(reverse)) {
297304
//Logger.debug(String.format("Excluding FAME-estimated PDep rate for %s from ODEs because it's in the seed mechanism",rxn));
298305
continue; // exclude rxns already in seed mechanism
299306
}
307+
/*
308+
* This elseif statement exists to catch pressure-dependent reactions
309+
* that were supplied to a Reaction Library in the reactions.txt file
310+
* (e.g. the pdep kinetics were fit to a particular pressure, OR
311+
* H+O2=O+OH). We want the Reaction Library's value to override
312+
* the FAME-estimated pdep kinetics.
313+
*/
314+
else if (nonPDepList.contains(rxn) || nonPDepList.contains(reverse)) {
315+
//Logger.debug(String.format("Excluding FAME-estimated PDep rate for %s from ODEs because it's in the reaction mechanism",rxn));
316+
continue; // exclude rxns already in mechanism
317+
}
300318
else {
301319
//Logger.debug(String.format("Including FAME-estimated PDep rate for %s in ODEs because it's not in the seed mechanism, nor does it have a P-dep rate from a reaction library.",rxn));
302320
}
@@ -313,12 +331,7 @@ else if (seedList.contains(rxn) || seedList.contains(reverse)) {
313331
}
314332
}
315333

316-
for (Iterator iter = p_reactionModel.getReactionSet().iterator(); iter.hasNext();) {
317-
Reaction r = (Reaction) iter.next();
318-
if (r.isForward() && !(r instanceof ThirdBodyReaction) && !(r instanceof TROEReaction) && !(r instanceof LindemannReaction)) {
319-
nonPDepList.add(r);
320-
}
321-
}
334+
322335

323336
duplicates.clear();
324337

0 commit comments

Comments
 (0)