Niemeyer-Research-Group / pyMARS

Python-based (chemical kinetic) Model Automatic Reduction Software
https://niemeyer-research-group.github.io/pyMARS/
MIT License
57 stars 45 forks source link

Don't assume that CH4 is present in the mechanism. #59

Closed jcsutherland closed 4 years ago

jcsutherland commented 4 years ago

It appears that CH4 is assumed to be part of the mechanism somewhere?

Error description:

When running against a mechanism that does not have CH4 as a species, an exception occurs.

  File "interfaces/cython/cantera/thermo.pyx", line 603, in cantera._cantera.ThermoPhase.set_equivalence_ratio
  File "interfaces/cython/cantera/thermo.pyx", line 999, in cantera._cantera.ThermoPhase.TPX.__set__
  File "interfaces/cython/cantera/thermo.pyx", line 561, in cantera._cantera.ThermoPhase.X.__set__
cantera._cantera.CanteraError: 
***********************************************************************
CanteraError thrown by Phase::setMoleFractionsByName:
Unknown species 'CH4'
***********************************************************************

Steps to Reproduce

Unzip the attached file and then run the following:

pymars \
    --targets CO O2 H2 \
    --retained_species N2 CO CO2 H2O \
    --conditions coh2-conditions.yaml \
    --method DRGEP \
    --error 10 \
    -m coh2-yetter.cti

The cti and conditions files are contained in the attached zip file. coh2files.zip

kyleniemeyer commented 4 years ago

@jcsutherland it looks like your coh2-conditions.yaml file with autoignition initial conditions has CH4 listed as the fuel in the first two items:

  fuel:
      CH4: 1.0

so the code raises an error when attempting to specify the initial mole fractions.

However, the check_inputs() function should really raise an error message for this, so that it can be better diagnosed.

jcsutherland commented 4 years ago

Hehe - you're right. That was a copy/paste error on my part.

kyleniemeyer commented 4 years ago

@jcsutherland no problem. I'm still going to leave this issue open, since such an issue should be caught by the code.