Closed alongd closed 1 year ago
I think I met the same problem when I try to use the simulate module in RMG-Py/scripts (Simulation and Sensitivity/Uncertainty Analysis):
Conducting simulation and sensitivity analysis of reaction system 1...
Traceback (most recent call last):
File "simulate.py", line 74, in <module>
main()
File "simulate.py", line 69, in main
run_simulation(inputFile, chemkinFile, dictFile, diffusionLimited=dflag, checkDuplicates=checkDuplicates)
File "/home/shenghuiqin/Code/RMG-Py/rmgpy/tools/simulate.py", line 128, in run_simulation
simulate(rmg,diffusionLimited)
File "/home/shenghuiqin/Code/RMG-Py/rmgpy/tools/simulate.py", line 105, in simulate
simulatorSettings=simulatorSettings,
File "rmgpy/solver/base.pyx", line 570, in rmgpy.solver.base.ReactionSystem.simulate
File "rmgpy/solver/base.pyx", line 669, in rmgpy.solver.base.ReactionSystem.simulate
File "rmgpy/solver/simple.pyx", line 202, in rmgpy.solver.simple.SimpleReactor.initializeModel
File "rmgpy/solver/base.pyx", line 475, in rmgpy.solver.base.ReactionSystem.set_initial_derivative
File "rmgpy/solver/simple.pyx", line 524, in rmgpy.solver.simple.SimpleReactor.residual
File "rmgpy/solver/base.pyx", line 1325, in rmgpy.solver.base.ReactionSystem.computeRateDerivative
ZeroDivisionError: float division
@alongd Hello, Alon. I meet the same issue as below:
Traceback (most recent call last):
File "rmg.py", line 173, in
Did you find a way to solve this problem? Thanks!
Hi @AH9316, it's been a while since I reported this, I think that the status is still of an open issue, I don't recall we resolved this. Could you prepare a minimal input file that reproduces this error?
Hi @alongd, below is the input file I used. Because I used imported mechanism as seed mechanism and thermolibrary, I attach the imported kinetic files(dictionary.txt and reaction.py) and thermo file(test3.py) too. Thanks.
Hi, @alongd. We find the reason cause this error in my case. In order to make you understand, let me recall what we have done.
Purpose: To import a gasoline mechanism into RMG database and use it as a ‘seedmechanism’ to run RMG simulation with addition of other fuel components. The objective is to obtain a final mechanism with cross reactions between gasoline and other fuel components.
Problem: The gasoline mechanism has the keyword ‘REV’ which expresses reversible reactions. Upon importing this into the database, RMG doesn’t recognize the ‘REV’ keyword, which means, the imported mechanism only has forward reactions.
Solution to this problem: In order to solve this problem, we change the original gasoline mechanism by manually separating reversible reactions into forward and backward reactions, thus avoiding the ‘REV’ keyword. Subsequently, we import this modified gasoline mechanism into the RMG database with both forward and backward reactions in the imported mechanism.
New problem: When we run RMG simulation with this modified imported gasoline mechanism, we meet this error: ZeroDivisionError: float division.
By checking each reaction, we narrowed down this problem to the following set of reactions shown below: !5, 5 in original mech H2+M<=>H+H+M 4.577E+19 -1.400 1.044E+05 REV/ 1.145E+20 -1.676 8.200E+02 / H2/2.5/ H2O/12/ CO/1.9/ CO2/3.8/ !6, 6 in original mech O2+M<=>O+O+M 4.420E+17 -0.634 1.189E+05 REV/ 6.165E+15 -0.500 0.000E+00 / H2/2.5/ H2O/12/ CO/1.9/ CO2/3.8/ CH4/2/ C2H6/3/ !7, 7 in original mech OH+M<=>O+H+M 9.780E+17 -0.743 1.021E+05 REV/ 4.714E+18 -1.000 0.000E+00 / H2/2.5/ H2O/12/ CO/1.5/ CO2/2/ CH4/2/ C2H6/3/ !8, 8 in original mech H2O+M<=>H+OH+M 1.907E+23 -1.830 1.185E+05 REV/ 4.500E+22 -2.000 0.000E+00 / H2/.73/ H2O/12/ CH4/2/ C2H6/3/ !26, 26 in original mech HCO+M<=>H+CO+M 4.750E+11 0.660 1.487E+04 REV/ 3.582E+10 1.041 -4.573E+02 / H2/2/ H2O/12/ CO/1.5/ CO2/2/ CH4/2/ C2H6/3/
To illustrate how we separate a reaction into forward and backward reactions: For reaction #5: H2+M=>H+H+M 4.577E+19 -1.400 1.044E+05 H2/2.5/ H2O/12/ CO/1.9/ CO2/3.8/ H+H+M=> H2+M 1.145E+20 -1.676 8.200E+02 H2/2.5/ H2O/12/ CO/1.9/ CO2/3.8/
Solution for new Problem: Due to the ‘ZeroDivision’ error we obtained when we separate the above set of reactions, we decided to maintain it as the same in the original gasoline mechanism and rather separate other reversible reactions into forward and backward reactions before importing this new modified mechanism into the database. With this new modified imported mechanism, we can run RMG simulation successfully without any ‘ZeroDivison’ error. Upon obtaining the final ‘chem.inp’ from RMG, we append the reversible Arrhenius parameters for the above reactions.
Other problem: 1) RMG still cannot handle reactions with more than 3 products, so when we run RMG simulation with the new modified imported mechanism, we comment out any such reaction in the reaction.py file located in the kinetic/library directory; for example “C14H14+O<=>C6H5CH2J+C6H6+CO+H”. 2) Since RMG produced an error when Tmin> 298K, we also change all Tmin which aren’t 298K to 298K of the corresponding imported thermodynamic file in thermo/library directory.
I attach the original gasoline mechanism below: Original_gasoline_mechanism.zip
I hope this is helpful to improve RMG software. Thanks!
This is in Python 2.7 and we stand no chance of reproducing it. Closing as stale.
Running the long nitrogen test (unmerged) crashes with:
Adding debug prints gave zero values in some kr, kf, C entries: