Skip to content

Add handling for dissociative desorption reactions to flux pair generation #2783

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sevyharris
Copy link
Contributor

Motivation or Problem

RMG misses a flux pair when generating the flux pairs for surface dissocative adsorption reactions. See #2782 describing the issue.

Description of Changes

This code adds a case for handling dissocative adsorption reactions in the reactions.generate_pairs() function so that the gas-phase reactant gets paired with both surface products instead of just the bigger one.

Testing

I need to add some formal unit tests for these.

Reviewer Tips

Are there any other places in the code besides the flux diagrams that use the flux pairs? I'll need to make sure this still works for those applications.

@sevyharris sevyharris linked an issue Apr 10, 2025 that may be closed by this pull request
@sevyharris sevyharris force-pushed the dissociative_adsorption_flux_pairs branch from 8256212 to ba96873 Compare April 10, 2025 15:36
@sevyharris sevyharris force-pushed the dissociative_adsorption_flux_pairs branch from ba96873 to ec82f40 Compare April 10, 2025 16:32
@sevyharris
Copy link
Contributor Author

It now draws the missing arrow in my flux diagram for NH3 -> HX:

image

Copy link

Regression Testing Results

WARNING:root:Initial mole fractions do not sum to one; normalizing.
WARNING:root:Initial mole fractions do not sum to one; normalizing.
WARNING:root:Initial mole fractions do not sum to one; normalizing.
⚠️ One or more regression tests failed.
Please download the failed results and run the tests locally or check the log to see why.

Detailed regression test results.

Regression test aromatics:

Reference: Execution time (DD:HH:MM:SS): 00:00:01:08
Current: Execution time (DD:HH:MM:SS): 00:00:01:07
Reference: Memory used: 2805.76 MB
Current: Memory used: 2787.57 MB

aromatics Passed Core Comparison ✅

Original model has 15 species.
Test model has 15 species. ✅
Original model has 11 reactions.
Test model has 11 reactions. ✅

aromatics Passed Edge Comparison ✅

Original model has 106 species.
Test model has 106 species. ✅
Original model has 358 reactions.
Test model has 358 reactions. ✅

Observables Test Case: Aromatics Comparison

✅ All Observables varied by less than 0.500 on average between old model and new model in all conditions!

aromatics Passed Observable Testing ✅

Regression test liquid_oxidation:

Reference: Execution time (DD:HH:MM:SS): 00:00:02:22
Current: Execution time (DD:HH:MM:SS): 00:00:02:21
Reference: Memory used: 2910.93 MB
Current: Memory used: 2914.41 MB

liquid_oxidation Passed Core Comparison ✅

Original model has 37 species.
Test model has 37 species. ✅
Original model has 241 reactions.
Test model has 241 reactions. ✅

liquid_oxidation Failed Edge Comparison ❌

Original model has 214 species.
Test model has 214 species. ✅
Original model has 1593 reactions.
Test model has 1593 reactions. ✅
The original model has 4 reactions that the tested model does not have. ❌
rxn: C[CH]CC(C)OO(33) <=> CCC[C](C)OO(78) origin: intra_H_migration
rxn: CCCC[CH]OO(96) <=> C[CH]CCCOO(51) origin: intra_H_migration
rxn: CC(C[CH]COO)OO(115) <=> [OH](22) + CC(CCC=O)OO(116) origin: intra_H_migration
rxn: CC(C[CH]COO)OO(115) <=> [OH](22) + CC(=O)CCCOO(112) origin: intra_H_migration
The tested model has 4 reactions that the original model does not have. ❌
rxn: C[CH]CC(C)OO(31) <=> [OH](22) + CCCC(C)=O(28) origin: intra_H_migration
rxn: C[CH]CCCOO(48) <=> [OH](22) + CCCCC=O(45) origin: intra_H_migration
rxn: CC(C[CH]COO)OO(118) <=> CC(CC[CH]OO)OO(133) origin: intra_H_migration
rxn: CC(C[CH]COO)OO(118) <=> C[C](CCCOO)OO(132) origin: intra_H_migration

Non-identical kinetics! ❌
original:
rxn: CCC(CC)O[O](36) + CCCCCO[O](35) <=> oxygen(1) + CCC([O])CC(67) + CCCCC[O](69) origin: Peroxyl_Disproportionation
tested:
rxn: CCC(CC)O[O](37) + CCCCCO[O](36) <=> oxygen(1) + CCC([O])CC(69) + CCCCC[O](67) origin: Peroxyl_Disproportionation

k(1bar) 300K 400K 500K 600K 800K 1000K 1500K 2000K
k(T): 3.54 4.28 4.73 5.02 5.39 5.62 5.91 6.06
k(T): 7.83 7.49 7.23 7.02 6.68 6.42 5.95 5.61

kinetics: Arrhenius(A=(3.2e+12,'cm^3/(mol*s)'), n=0, Ea=(4.064,'kcal/mol'), T0=(1,'K'), comment="""Estimated from node Root_Ext-5R-R_7R!H->C_N-7C-inRing_Ext-5R-R""")
kinetics: Arrhenius(A=(3.18266e+20,'cm^3/(mol*s)'), n=-2.694, Ea=(0,'kcal/mol'), T0=(1,'K'), comment="""Estimated from node Root_Ext-5R-R_7R!H->C_N-7C-inRing""")
kinetics: Estimated from node Root_Ext-5R-R_7R!H->C_N-7C-inRing_Ext-5R-R
kinetics: Estimated from node Root_Ext-5R-R_7R!H->C_N-7C-inRing

Observables Test Case: liquid_oxidation Comparison

✅ All Observables varied by less than 0.100 on average between old model and new model in all conditions!

liquid_oxidation Passed Observable Testing ✅

Regression test nitrogen:

Reference: Execution time (DD:HH:MM:SS): 00:00:01:27
Current: Execution time (DD:HH:MM:SS): 00:00:01:26
Reference: Memory used: 2907.28 MB
Current: Memory used: 2899.26 MB

nitrogen Passed Core Comparison ✅

Original model has 41 species.
Test model has 41 species. ✅
Original model has 360 reactions.
Test model has 360 reactions. ✅

nitrogen Passed Edge Comparison ✅

Original model has 133 species.
Test model has 133 species. ✅
Original model has 983 reactions.
Test model has 983 reactions. ✅

Observables Test Case: NC Comparison

✅ All Observables varied by less than 0.200 on average between old model and new model in all conditions!

nitrogen Passed Observable Testing ✅

Regression test oxidation:

Reference: Execution time (DD:HH:MM:SS): 00:00:02:33
Current: Execution time (DD:HH:MM:SS): 00:00:02:27
Reference: Memory used: 2785.30 MB
Current: Memory used: 2771.01 MB

oxidation Passed Core Comparison ✅

Original model has 59 species.
Test model has 59 species. ✅
Original model has 694 reactions.
Test model has 694 reactions. ✅

oxidation Passed Edge Comparison ✅

Original model has 230 species.
Test model has 230 species. ✅
Original model has 1526 reactions.
Test model has 1526 reactions. ✅

Observables Test Case: Oxidation Comparison

✅ All Observables varied by less than 0.500 on average between old model and new model in all conditions!

oxidation Passed Observable Testing ✅

Regression test sulfur:

Reference: Execution time (DD:HH:MM:SS): 00:00:00:55
Current: Execution time (DD:HH:MM:SS): 00:00:00:55
Reference: Memory used: 2879.27 MB
Current: Memory used: 2866.51 MB

sulfur Passed Core Comparison ✅

Original model has 27 species.
Test model has 27 species. ✅
Original model has 74 reactions.
Test model has 74 reactions. ✅

sulfur Failed Edge Comparison ❌

Original model has 89 species.
Test model has 89 species. ✅
Original model has 227 reactions.
Test model has 227 reactions. ✅
The original model has 1 reactions that the tested model does not have. ❌
rxn: O(4) + SO2(15) (+N2) <=> SO3(16) (+N2) origin: primarySulfurLibrary
The tested model has 1 reactions that the original model does not have. ❌
rxn: O(4) + SO2(15) (+N2) <=> SO3(16) (+N2) origin: primarySulfurLibrary

Observables Test Case: SO2 Comparison

✅ All Observables varied by less than 0.100 on average between old model and new model in all conditions!

sulfur Passed Observable Testing ✅

Regression test superminimal:

Reference: Execution time (DD:HH:MM:SS): 00:00:00:39
Current: Execution time (DD:HH:MM:SS): 00:00:00:39
Reference: Memory used: 2980.01 MB
Current: Memory used: 2943.20 MB

superminimal Passed Core Comparison ✅

Original model has 13 species.
Test model has 13 species. ✅
Original model has 21 reactions.
Test model has 21 reactions. ✅

superminimal Passed Edge Comparison ✅

Original model has 18 species.
Test model has 18 species. ✅
Original model has 28 reactions.
Test model has 28 reactions. ✅

Regression test RMS_constantVIdealGasReactor_superminimal:

Reference: Execution time (DD:HH:MM:SS): 00:00:02:25
Current: Execution time (DD:HH:MM:SS): 00:00:02:24
Reference: Memory used: 3499.60 MB
Current: Memory used: 3502.90 MB

RMS_constantVIdealGasReactor_superminimal Passed Core Comparison ✅

Original model has 13 species.
Test model has 13 species. ✅
Original model has 19 reactions.
Test model has 19 reactions. ✅

RMS_constantVIdealGasReactor_superminimal Passed Edge Comparison ✅

Original model has 13 species.
Test model has 13 species. ✅
Original model has 19 reactions.
Test model has 19 reactions. ✅

Observables Test Case: RMS_constantVIdealGasReactor_superminimal Comparison

✅ All Observables varied by less than 0.100 on average between old model and new model in all conditions!

RMS_constantVIdealGasReactor_superminimal Passed Observable Testing ✅

Regression test RMS_CSTR_liquid_oxidation:

Reference: Execution time (DD:HH:MM:SS): 00:00:06:16
Current: Execution time (DD:HH:MM:SS): 00:00:06:16
Reference: Memory used: 3495.66 MB
Current: Memory used: 3501.17 MB

RMS_CSTR_liquid_oxidation Passed Core Comparison ✅

Original model has 37 species.
Test model has 37 species. ✅
Original model has 202 reactions.
Test model has 202 reactions. ✅

RMS_CSTR_liquid_oxidation Passed Edge Comparison ✅

Original model has 248 species.
Test model has 248 species. ✅
Original model has 2057 reactions.
Test model has 2057 reactions. ✅

Observables Test Case: RMS_CSTR_liquid_oxidation Comparison

✅ All Observables varied by less than 0.100 on average between old model and new model in all conditions!

RMS_CSTR_liquid_oxidation Passed Observable Testing ✅

Regression test fragment:

Reference: Execution time (DD:HH:MM:SS): 00:00:00:42
Current: Execution time (DD:HH:MM:SS): 00:00:00:42
Reference: Memory used: 2709.54 MB
Current: Memory used: 2699.99 MB

fragment Passed Core Comparison ✅

Original model has 10 species.
Test model has 10 species. ✅
Original model has 2 reactions.
Test model has 2 reactions. ✅

fragment Passed Edge Comparison ✅

Original model has 33 species.
Test model has 33 species. ✅
Original model has 47 reactions.
Test model has 47 reactions. ✅

Observables Test Case: fragment Comparison

✅ All Observables varied by less than 0.100 on average between old model and new model in all conditions!

fragment Passed Observable Testing ✅

Regression test RMS_constantVIdealGasReactor_fragment:

Reference: Execution time (DD:HH:MM:SS): 00:00:03:04
Current: Execution time (DD:HH:MM:SS): 00:00:03:04
Reference: Memory used: 3642.89 MB
Current: Memory used: 3640.20 MB

RMS_constantVIdealGasReactor_fragment Passed Core Comparison ✅

Original model has 10 species.
Test model has 10 species. ✅
Original model has 2 reactions.
Test model has 2 reactions. ✅

RMS_constantVIdealGasReactor_fragment Passed Edge Comparison ✅

Original model has 27 species.
Test model has 27 species. ✅
Original model has 24 reactions.
Test model has 24 reactions. ✅

Observables Test Case: RMS_constantVIdealGasReactor_fragment Comparison

✅ All Observables varied by less than 0.100 on average between old model and new model in all conditions!

RMS_constantVIdealGasReactor_fragment Passed Observable Testing ✅

Regression test minimal_surface:

Reference: Execution time (DD:HH:MM:SS): 00:00:00:45
Current: Execution time (DD:HH:MM:SS): 00:00:00:44
Reference: Memory used: 2892.39 MB
Current: Memory used: 2880.00 MB

minimal_surface Passed Core Comparison ✅

Original model has 11 species.
Test model has 11 species. ✅
Original model has 3 reactions.
Test model has 3 reactions. ✅

minimal_surface Passed Edge Comparison ✅

Original model has 38 species.
Test model has 38 species. ✅
Original model has 38 reactions.
Test model has 38 reactions. ✅

Observables Test Case: minimal_surface Comparison

✅ All Observables varied by less than 0.500 on average between old model and new model in all conditions!

minimal_surface Passed Observable Testing ✅

beep boop this comment was written by a bot 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dissociative adsorption generates wrong flux pairs?
1 participant