AMReX-Combustion / PelePhysics

A collection of physics databases and implementation code for use with the Pele suite of of codes
https://amrex-combustion.github.io/PelePhysics/
Other
60 stars 52 forks source link

CEPTR: Error converting QSS mechanisms with comments in falloff reactions #514

Open baperry2 opened 3 months ago

baperry2 commented 3 months ago

I am converting the HyChem Jet-A (posf10325) mechanism for use in PelePhysics. I get an error when generating the QSS version, because it appears that some comments in the mechanism are not being parsed properly.

Comments within falloff reactions in the mechanism.inp file like the one here

!R174
 C6H5CH2 + H (+M) = C6H5CH3 (+M)              1.000E+14   0.000       0.00  !  kinf (assumed, reduced from 2.6E14)
                                       LOW   /1.100E+103 -24.63   14590.00  / !  k0 (RRKM)
                                      TROE   /0.431    383.   152.   4730.  /
                                   H2/2/ H2O/6/ CH4/2/ CO/1.5/ CO2/2/ C2H6/3/

get parsed into the subsequent reaction in mechanism.yaml (see here )

- equation: C6H5CH2 + H <=> C6H5 + CH3  # Reaction 175
  rate-constant: {A: 1.5e+66, b: -13.94, Ea: 6.458e+04}
  note: |2-
      k0 (RRKM)
    R175
      RRKM at 1 atm,

which propogates into qssa.yaml and results in the following error when running the conversion script:

$  poetry run convert -f ../../Mechanisms/posf10325_qss/qssa.yaml  --qss_format_input ../../Mechanisms/posf10325_qss/qssa_input.toml --qss_symbolic_jacobian
Converting file ../../Mechanisms/posf10325_qss/qssa.yaml
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/bperry/Software/PelePhysics/Support/ceptr/ceptr/ceptr.py", line 201, in main
    convert(
  File "/Users/bperry/Software/PelePhysics/Support/ceptr/ceptr/ceptr.py", line 60, in convert
    ct.Solution(fname) if mechanism_is_homogeneous else interface.adjacent[gas_name]
  File "cantera/solutionbase.pyx", line 37, in cantera.solutionbase._SolutionBase.__cinit__
  File "cantera/solutionbase.pyx", line 95, in cantera.solutionbase._SolutionBase._cinit
  File "cantera/solutionbase.pyx", line 180, in cantera.solutionbase._SolutionBase._init_yaml
cantera._utils.CanteraError: 
*******************************************************************************
InputFileError thrown by AnyMap::fromYamlFile:
Error on line 1711 of ./../../Mechanisms/posf10325_qss/qssa.yaml:
end of map not found
|  Line |
|  1706 |       76-KER-PAR
|  1707 |   - equation: C6H5CH2 + H <=> C6H5 + CH3
|  1708 |     rate-constant: {A: 1.5e+63, b: -13.94, Ea: 2.7020272e+08}
|  1709 |     note: |
|  1710 |         k0 (RRKM)
>  1711 >       R175
                ^
|  1712 |       RRKM at 1 atm,
|  1713 |   - equation: C6H5CH2 + O <=> C6H5CHO + H
|  1714 |     rate-constant: {A: 4.0e+11, b: 0.0, Ea: 0.0}
*******************************************************************************

The error is resolved by eliminating excess whitespace in the note for the reaction, as was done here

- equation: C6H5CH2 + H <=> C6H5 + CH3  # Reaction 175
  rate-constant: {A: 1.5e+66, b: -13.94, Ea: 6.458e+04}
  note: |
    k0 (RRKM)
    R175
      RRKM at 1 atm,

@malihass @marchdf I believe this is a Cantera problem and not our problem because it comes from something showing up in mechanism.yaml. Not super urgent because I found a workaround, but may be worth looking into this a bit more to figure out for sure what is going on.

To reproduce, run the QSS conversion process using CEPTR for the posf10325_qss mechanism in the branch linked above.

marchdf commented 3 months ago

yeah definitely feels like a cantera issue... maybe a recent version of cantera fixes it?