ReactionMechanismGenerator / RMG-Py

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

RMG running get "xxx conversion: nan" #1678

Closed shenghuiqin closed 5 years ago

shenghuiqin commented 5 years ago

Topic

General area which your question is related to.

input file

#Data sources
database(
    thermoLibraries =['BurkeH2O2','FFCM1(-)','thermo_DFT_CCSDTF12_BAC','CBS_QB3_1dHR','DFT_QCI_thermo','primaryThermoLibrary'], # 'FFCM1(-)','primaryThermoLibrary', 'BurkeH2O2','DFT_QCI_thermo','CBS_QB3_1dHR'
    reactionLibraries = [('2005_Senosiain_OH_C2H2',False),('Glarborg/C3', False)], # 
    seedMechanisms = ['BurkeH2O2inN2','FFCM1(-)',], #
    kineticsDepositories = ['training'], 
    kineticsFamilies = ['default'],
    kineticsEstimator = 'rate rules',
)

#Constraints on generated species
generatedSpeciesConstraints(
    maximumRadicalElectrons = 2,
    allowed=['input species','seed mechanisms','reaction libraries'],
    maximumCarbonAtoms=9,
    maximumOxygenAtoms=4,
)

#List of species
species(
    label='C7H16',
    reactive=True,
    structure=SMILES("CCCCCCC"),
)
species(
    label='O2',
    reactive=True,
        structure=adjacencyList(
        """
        1 O u1 p2 {2,S}
        2 O u1 p2 {1,S}
        """),
)
species(
    label='N2',
    reactive=False,
    structure=SMILES("N#N")
)

#Reaction systems
simpleReactor(
    temperature=[(600,'K'),(1500,'K')],
    pressure=[(10.0,'bar'),(40.0,'bar')],
    nSims=8,
    initialMoleFractions={
        #"C7H10": 1,
        "O2":   0.10885, # phi=1 means 9.5 O2 per C7H10
        "N2":   0.881684808, # 8.1 times as much N2 as O2
        "C7H16":0.00946, #  

    },
    terminationTime = (1.0, 's'),
    terminationRateRatio = 0.01,
    terminationConversion={
                'C7H16': 0.99,
        },
)

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

model(
    toleranceKeepInEdge=0, # No pruning to start
    toleranceMoveToCore=0.4,
    toleranceInterruptSimulation=1,
    maxNumObjsPerIter=3, 
    terminateAtMaxObjects=True,
    maxNumSpecies=200, # first stage is until core reaches 100 species
    filterReactions=True, # should speed up model generation
)

model(
    toleranceMoveToCore=0.25,
    toleranceInterruptSimulation=1e8,
    toleranceKeepInEdge=0.01, # Pruning enabled for stage 2
    maximumEdgeSpecies=200000,
    minCoreSizeForPrune=100,
    minSpeciesExistIterationsForPrune=2,
    filterReactions=True,
    )

options(
    units='si',
    # saveRestartPeriod=(1,'hour'),
    generateOutputHTML=False,
    generatePlots=True,
    saveSimulationProfiles=True,
    saveEdgeSpecies=False,
)

Question

what happened, I get so many nan? Usually, I won't get any nan with the similar input file, I want to know is this an error? something wrong with my input? or it's normal and I can ignore it, image image

Installation Information

Describe your installation method and system information if applicable.

mjohnson541 commented 5 years ago

So the nans appear in the first time step for the cases in this job that give conversion: nan, but in other cases the simulations run fine. I believe this is a result of a reaction with a bad rate and/or bad thermo that when added to the model under certain conditions breaks the solver residual calculation.

I've made a PR that diagnoses nan presence as a DASxError, which allows RMG to handle this more properly, but the fundamental issue is the reaction/species that's causing this. It will at least have entered before you start seeing the nans, but may have entered a few iterations earlier since the nan production seems to be dependent on the temperature and pressure.

shenghuiqin commented 5 years ago

on another input file of heptane I

and i got almost all (210/212) conversion: nun image

input.py

database(thermoLibraries =['BurkeH2O2','FFCM1(-)','thermo_DFT_CCSDTF12_BAC','CBS_QB3_1dHR','DFT_QCI_thermo','primaryThermoLibrary'], # 'FFCM1(-)','primaryThermoLibrary', 'BurkeH2O2','DFT_QCI_thermo','CBS_QB3_1dHR' reactionLibraries = [('2005_Senosiain_OH_C2H2',False),('Glarborg/C3', False)], # seedMechanisms = ['BurkeH2O2inN2','FFCM1(-)',], # kineticsDepositories = ['training'], kineticsFamilies = ['default'], kineticsEstimator = 'rate rules', )

Constraints on generated species

generatedSpeciesConstraints( maximumRadicalElectrons = 2, allowed=['input species','seed mechanisms','reaction libraries'], maximumCarbonAtoms=9, maximumOxygenAtoms=4,

allowSingletO2 = True,

)

List of species

species( label='C7H16', reactive=True, structure=SMILES("CCCCCCC"), ) species(
label='O2', reactive=True, structure=adjacencyList( """ 1 O u1 p2 {2,S} 2 O u1 p2 {1,S} """), ) species( label='N2', reactive=False, structure=SMILES("N#N") )

Reaction systems

simpleReactor( temperature=[(600,'K'),(1500,'K')], pressure=[(10.0,'bar'),(40.0,'bar')], nSims=8, initialMoleFractions={

"C7H10": 1,

    "O2":   0.10885, # phi=1 means 9.5 O2 per C7H10
    "N2":   0.881684808, # 8.1 times as much N2 as O2
    "C7H16":0.00946, #  

},
terminationTime = (10.0, 's'),
terminationRateRatio = 0.001,
terminationConversion={
            'O2': 0.5,
    },

)

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

model( toleranceKeepInEdge=0, toleranceMoveToCore=0.4, toleranceInterruptSimulation=1, maxNumObjsPerIter=3, terminateAtMaxObjects=True, maxNumSpecies=200, filterReactions=True, )

model( toleranceMoveToCore=0.3, toleranceInterruptSimulation=1e8, toleranceKeepInEdge=0.01, maximumEdgeSpecies=100000, minCoreSizeForPrune=100, minSpeciesExistIterationsForPrune=2, filterReactions=True, )

options( units='si',

saveRestartPeriod=(1,'hour'),

generateOutputHTML=False,
generatePlots=True,
saveSimulationProfiles=True,
saveEdgeSpecies=False,

) pressureDependence( method='modified strong collision', maximumGrainSize=(0.5,'kcal/mol'), minimumNumberOfGrains=250, temperatures=(300,2000,'K',8), pressures=(0.01,100,'bar',5), interpolation=('Chebyshev', 6, 4),

)

shenghuiqin commented 5 years ago

I substitute 'FFCM1(-)' with 'Klippenstein_Glarborg2016' on my input file, and no "conversion: nan" shows

mjohnson541 commented 5 years ago

In that case it may be that the FFCM1(-) thermochemistry isn't compatible with the reaction libraries you're using.

shenghuiqin commented 5 years ago

yeah, I need to be more careful when selecting those libraries. thank you for your help. should I close this issue?