ReactionMechanismGenerator / RMG-Py

Python version of the amazing Reaction Mechanism Generator (RMG).
http://reactionmechanismgenerator.github.io/RMG-Py/
Other
397 stars 228 forks source link

Range of Temperature #2191

Closed ysadat7 closed 1 year ago

ysadat7 commented 3 years ago

Hello I was reading the paper recently published on RMG 3.0 and I noticed the model can be run for a temperature range instead of a single temperature. To give you a bit of context, I'm modelling n-Decane autoxidation for temperatures between 140-180 and I have been running single jobs for the intermediate temperatures to see how the model behaves. Would you please explain how the temperature range could be written in the input file and whether it would be an accurate representation of the model. Many thanks

mjohnson541 commented 3 years ago

See the documentation here: http://reactionmechanismgenerator.github.io/RMG-Py/users/rmg/input.html#advanced-setting-range-based-reactors.

In general ranged reactors are very robust if you're varying 2 or less dimensions (temperature, pressure, initial conditions...) and especially robust for small temperature ranges like that.

ysadat7 commented 3 years ago

Thanks Matt, I should have mentioned that my model occurs at the liquid reactor, is that still the case? I have been trying to run the model and it keeps failing, please kindly have a look at my input file:

database( thermoLibraries = ['primaryThermoLibrary'], reactionLibraries = [], seedMechanisms = [], kineticsDepositories = ['training'], kineticsFamilies = 'default', kineticsEstimator = 'rate rules', )

List of species fuel, ao, and smiles

species( label='decane', reactive=True, structure=SMILES("CCCCCCCCCC"), ) species( label='oxygen', reactive=True, structure=SMILES("[O][O]"), ) species( label='ROOH', reactive=True, structure=SMILES("CCCCCCCCCCOO"), ) species( label='RO', reactive=True, structure=SMILES("CCCCCCCCCC[O]"), ) species( label='OH', reactive=True, structure=SMILES("[OH]"), ) species( label='ROH', reactive=True, structure=SMILES("CCCCCCCCCCO"), ) species( label='R(=O)R', reactive=True, structure=SMILES("CCCCCCCC(=O)CC"), ) species( label='R=O', reactive=True, structure=SMILES("CCCCCCCCCC=O"), )

Reaction systems

liquidReactor( temperature=[(413,'K'),(453,'K')] #Temperature initialConcentrations={ "decane": (4.70000000E-03,'mol/cm^3'), #fuel conc "oxygen": (2.00000000E-06,'mol/cm^3') #O2 conc }, terminationTime=(1200,'s'), #time )

solvation( solvent='decane' #solvent )

simulator( atol=1e-16, rtol=1e-8, )

model( toleranceMoveToCore=0.001, toleranceInterruptSimulation=0.1, filterReactions=True, )

options( units='si', saveRestartPeriod=False, generateOutputHTML=True, generatePlots=True, saveSimulationProfiles=True, )

mjohnson541 commented 3 years ago

What error message are you getting?

ysadat7 commented 3 years ago

This is what I'm getting:

Loading thermodynamics library from primaryThermoLibrary.py in /home/fcq17ss/RMG-database/input/thermo/libraries... Loading thermodynamics group database from /home/fcq17ss/RMG-database/input/thermo/groups... Loading transport library from GRI-Mech.py in /home/fcq17ss/RMG-database/input/transport/libraries... Loading transport library from NOx2018.py in /home/fcq17ss/RMG-database/input/transport/libraries... Loading transport library from OneDMinN2.py in /home/fcq17ss/RMG-database/input/transport/libraries... Loading transport library from PrimaryTransportLibrary.py in /home/fcq17ss/RMG-database/input/transport/libraries... Loading transport group database from /home/fcq17ss/RMG-database/input/transport/groups... Loading frequencies group database from /home/fcq17ss/RMG-database/input/statmech/groups... Loading Platts additivity group database from /home/fcq17ss/RMG-database/input/solvation/groups... Adding rate rules from training set in kinetics families... Warning: Cphigh is above the theoretical CpInf value for ThermoData object ThermoData(Tdata=([300,400,500,600,800,1000,1500],'K'), Cpdata=([36.6869,38.2195,39.253,40.4473,45.0357,50.6323,54.2027],'J/(molK)'), H298=(310.047,'kJ/mol'), S298=(162.808,'J/(molK)'), Cp0=(29.1007,'J/(molK)'), CpInf=(37.4151,'J/(molK)'), comment="""Thermo group additivity estimation: group(O2s-CsCs) + group(CsJ2_singlet-CsH)"""). The thermo for this species is probably wrong! Setting CpInf = Cphigh for Entropy calculationat T = 2000.0 K... Warning: Cphigh is above the theoretical CpInf value for ThermoData object ThermoData(Tdata=([300,400,500,600,800,1000,1500],'K'), Cpdata=([36.6869,38.2195,39.253,40.4473,45.0357,50.6323,54.2027],'J/(molK)'), H298=(310.047,'kJ/mol'), S298=(162.808,'J/(molK)'), Cp0=(29.1007,'J/(molK)'), CpInf=(37.4151,'J/(molK)'), comment="""Thermo group additivity estimation: group(O2s-CsCs) + group(CsJ2_singlet-CsH)"""). The thermo for this species is probably wrong! Setting CpInf = Cphigh for Entropy calculationat T = 1666.6666666666665 K... Warning: Cphigh is above the theoretical CpInf value for ThermoData object ThermoData(Tdata=([300,400,500,600,800,1000,1500],'K'), Cpdata=([36.6869,38.2195,39.253,40.4473,45.0357,50.6323,54.2027],'J/(molK)'), H298=(310.047,'kJ/mol'), S298=(162.808,'J/(molK)'), Cp0=(29.1007,'J/(molK)'), CpInf=(37.4151,'J/(molK)'), comment="""Thermo group additivity estimation: group(O2s-CsCs) + group(CsJ2_singlet-CsH)"""). The thermo for this species is probably wrong! Setting CpInf = Cphigh for Entropy calculationat T = 2000.0 K... Warning: Cphigh is above the theoretical CpInf value for ThermoData object ThermoData(Tdata=([300,400,500,600,800,1000,1500],'K'), Cpdata=([36.6869,38.2195,39.253,40.4473,45.0357,50.6323,54.2027],'J/(molK)'), H298=(310.047,'kJ/mol'), S298=(162.808,'J/(molK)'), Cp0=(29.1007,'J/(molK)'), CpInf=(37.4151,'J/(molK)'), comment="""Thermo group additivity estimation: group(O2s-CsCs) + group(CsJ2_singlet-CsH)"""). The thermo for this species is probably wrong! Setting CpInf = Cphigh for Entropy calculationat T = 1666.6666666666665 K... Filling in rate rules in kinetics families by averaging... Enabling diffusion-limited kinetics... Setting solvent data for decane Traceback (most recent call last): File "/home/fcq17ss/RMG-Py/rmg.py", line 111, in main() File "/home/fcq17ss/RMG-Py/rmg.py", line 105, in main rmg.execute(kwargs) File "/home/fcq17ss/RMG-Py/rmgpy/rmg/main.py", line 651, in execute self.initialize(kwargs) File "/home/fcq17ss/RMG-Py/rmgpy/rmg/main.py", line 518, in initialize reaction_system.viscosity = solvent_data.get_solvent_viscosity(reaction_system.T.value_si) AttributeError: 'NoneType' object has no attribute 'value_si'

mjohnson541 commented 3 years ago

This looks like a bug using ranged reactors for liquid simulations. In your case with that short of a temperature range I think you're almost certainly fine using two reactors one at each end of your temperature range (you can put one in the middle too if you want to be extra safe) for now. I would actually be a bit surprised if you got a significantly different mechanism just using one reactor at any temperature in that range.

mjohnson541 commented 3 years ago

Ranged reactors was more built for large ranges where the chemistry can change a lot ex: 500-1600 K. Although it wouldn't hurt.

ysadat7 commented 3 years ago

Thanks Matt, I think the problem was using [ ] somehow, and the entry in the input file wasn't recognised as such: [(413,'K'),(453,'K')], I had just followed the same footsteps of simplereactors, but apparently that wouldn't work for liquidphase. I used the following instead which worked luckily. About the temperature range, in fact there is a lot of difference in Oxygen consumption when running individual runs from 140-180, in fact there is no initiation in 140, whereas in the 180 runs the oxygen is consumed instantly, hence I wanted to include the range to make sure we get the most accurate detailed mechanism prior to the reduction.

Reaction systems

liquidReactor( temperature=(413,'K'), #Temperature initialConcentrations={ "decane": (4.70000000E-03,'mol/cm^3'), #fuel conc "oxygen": (2.00000000E-06,'mol/cm^3') #O2 conc }, terminationTime=(1200,'s'), #time )

liquidReactor( temperature=(433,'K'), #Temperature initialConcentrations={ "decane": (4.70000000E-03,'mol/cm^3'), #fuel conc "oxygen": (2.00000000E-06,'mol/cm^3') #O2 conc }, terminationTime=(1200,'s'), #time )

liquidReactor( temperature=(453,'K'), #Temperature initialConcentrations={ "decane": (4.70000000E-03,'mol/cm^3'), #fuel conc "oxygen": (2.00000000E-06,'mol/cm^3') #O2 conc }, terminationTime=(1200,'s'), #time )

hwpang commented 3 years ago

I thought I have fixed this bug in #1918 but I guess this bug is still there. I will take a look at this.

hwpang commented 3 years ago

@ysadat7 Hello! I was able to run your script with the temperature range on the current master without encountering any errors. Are you running on the newest commit on the master branch?

ysadat7 commented 3 years ago

Hello, yes I was able to run my session with no problem with the second script I put here, it was a matter of having separate liquid reactors instead of just one... Thanks for your help

github-actions[bot] commented 1 year ago

This issue is being automatically marked as stale because it has not received any interaction in the last 90 days. Please leave a comment if this is still a relevant issue, otherwise it will automatically be closed in 30 days.