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

Commit

Permalink
Checking against "pdep" reactions in ReactionLibrary reactions.txt file
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mrharper committed Mar 12, 2011
1 parent 226aeaf commit 92cef7e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
23 changes: 13 additions & 10 deletions source/RMG/jing/rxnSys/Chemkin.java
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,17 @@ public static BufferedWriter writeChemkinPdepReactions(ReactionModel p_reactionM
}
}

// Then add all non-pdep, non-seed, reactions to the nonPDepList
for (Iterator iter = p_reactionModel.getReactionSet().iterator(); iter.hasNext(); ) {
Reaction r = (Reaction)iter.next();
if (!r.isForward()) continue;
// Check the seedList against r and its reverse
if (seedList.contains(r) || seedList.contains(r.getReverseReaction())) continue;
if (r instanceof ThirdBodyReaction || r instanceof TROEReaction || r instanceof LindemannReaction) continue;
// Made it through all the tests.
nonPDepList.add(r);
}

// Then get reactions from pressure-dependent networks and add them to pDepList
for (Iterator iter = PDepNetwork.getNetworks().iterator(); iter.hasNext(); ) {
PDepNetwork pdn = (PDepNetwork)iter.next();
Expand All @@ -618,21 +629,13 @@ public static BufferedWriter writeChemkinPdepReactions(ReactionModel p_reactionM
if (rxn.reactantEqualsProduct()) continue;
if (pDepList.contains(rxn) || pDepList.contains(rxn.getReverseReaction())) continue;
if (seedList.contains(rxn) || seedList.contains(rxn.getReverseReaction())) continue;
if (nonPDepList.contains(rxn) || nonPDepList.contains(rxn.getReverseReaction())) continue;

// Made it through all the tests.
pDepList.add(rxn);
}
}
// Then add all non-pdep, non-seed, reactions to the nonPDepList
for (Iterator iter = p_reactionModel.getReactionSet().iterator(); iter.hasNext(); ) {
Reaction r = (Reaction)iter.next();
if (!r.isForward()) continue;
if (seedList.contains(r)) continue;
if (r instanceof ThirdBodyReaction || r instanceof TROEReaction || r instanceof LindemannReaction) continue;
// Made it through all the tests.
nonPDepList.add(r);
}


// First report seed mechanism reactions
for (Iterator iter = seedList.iterator(); iter.hasNext();){
Reaction r = (Reaction)iter.next();
Expand Down
25 changes: 19 additions & 6 deletions source/RMG/jing/rxnSys/JDAS.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,13 @@ public void generatePDepReactionList(ReactionModel p_reactionModel,
if (cerm.getSeedMechanism() != null)
seedList = cerm.getSeedMechanism().getReactionSet();

for (Iterator iter = p_reactionModel.getReactionSet().iterator(); iter.hasNext();) {
Reaction r = (Reaction) iter.next();
if (r.isForward() && !(r instanceof ThirdBodyReaction) && !(r instanceof TROEReaction) && !(r instanceof LindemannReaction)) {
nonPDepList.add(r);
}
}

for (Iterator iter = PDepNetwork.getCoreReactions(cerm).iterator(); iter.hasNext();) {
PDepReaction rxn = (PDepReaction) iter.next();
if (cerm.categorizeReaction(rxn) != 1) {
Expand Down Expand Up @@ -297,6 +304,17 @@ else if (seedList.contains(rxn) || seedList.contains(reverse)) {
//Logger.debug(String.format("Excluding FAME-estimated PDep rate for %s from ODEs because it's in the seed mechanism",rxn));
continue; // exclude rxns already in seed mechanism
}
/*
* This elseif statement exists to catch pressure-dependent reactions
* that were supplied to a Reaction Library in the reactions.txt file
* (e.g. the pdep kinetics were fit to a particular pressure, OR
* H+O2=O+OH). We want the Reaction Library's value to override
* the FAME-estimated pdep kinetics.
*/
else if (nonPDepList.contains(rxn) || nonPDepList.contains(reverse)) {
//Logger.debug(String.format("Excluding FAME-estimated PDep rate for %s from ODEs because it's in the reaction mechanism",rxn));
continue; // exclude rxns already in mechanism
}
else {
//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));
}
Expand All @@ -313,12 +331,7 @@ else if (seedList.contains(rxn) || seedList.contains(reverse)) {
}
}

for (Iterator iter = p_reactionModel.getReactionSet().iterator(); iter.hasNext();) {
Reaction r = (Reaction) iter.next();
if (r.isForward() && !(r instanceof ThirdBodyReaction) && !(r instanceof TROEReaction) && !(r instanceof LindemannReaction)) {
nonPDepList.add(r);
}
}


duplicates.clear();

Expand Down

3 comments on commit 92cef7e

@rwest
Copy link
Member

@rwest rwest commented on 92cef7e Mar 12, 2011

Choose a reason for hiding this comment

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

Is it possible that there's a non-pdep bimolecular reaction A+B<=>C+D, and a well-skipping pdep rate from a network like A+B<=>X<=>C+B in which case wouldn't we want both?

@mrharper
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you're absolutely right.

@mrharper
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The difference between the two cases is that one "non-pdep" bimolecular reaction comes from RMG (H_Abstraction, Disproportionation) while the other comes from a Reaction Library. We can add a check for the reactions' kinetics' source/comments ... but is there a cleaner way?

Please sign in to comment.