Cantera / cantera

Chemical kinetics, thermodynamics, and transport tool suite
https://cantera.org
Other
580 stars 341 forks source link

yaml2ck does not remove third body efficiencies for undeclared species #1683

Closed speth closed 3 weeks ago

speth commented 3 months ago

Problem description

yaml2ck includes third body efficiencies for species that are not defined in the mechanism, but were only excluded by the use of the YAML option skip-undeclared-third-bodies: true appearing in the phase definition. This prevents successful validation of the mechanism, though I think the resulting CK file is probably usable (depending on how the software using the resulting CK file handles such efficiencies).

Steps to reproduce

  1. Create the following YAML file:

    phases:
    - name: test
    thermo: ideal-gas
    elements: [O, H, C, Ar]
    species:
    - gri30.yaml/species: all
    kinetics: gas
    skip-undeclared-elements: true
    skip-undeclared-third-bodies: true
    reactions:
    - gri30.yaml/reactions: declared-species
    transport: mixture-averaged
    state: {T: 300.0, P: 1 atm}
  2. Convert: python -m cantera.yaml2ck test.yaml --overwrite

Behavior

ck2yaml writes a CK file, but fails on validation:

Validating mechanism...FAILED.

*******************************************************************************
CanteraError thrown by addReactions:

*******************************************************************************
InputFileError thrown by ThirdBody::checkSpecies:
Error on line 700 of /x/y/z/test_mech.yaml:
Reaction 'H + O2 + M <=> HO2 + M'
defines third-body efficiencies for undeclared species: 'N2'
|  Line |
|   695 | - equation: CH2O + O2 <=> HCO + HO2  # Reaction 32
|   696 |   rate-constant: {A: 1.0000000000000002e+14, b: 0.0, Ea: 4.0e+04}
|   697 | - equation: H + O2 + M <=> HO2 + M  # Reaction 33
|   698 |   type: three-body
|   699 |   rate-constant: {A: 2.8000000000000005e+18, b: -0.86, Ea: 0.0}
>   700 >   efficiencies: {AR: 0.0, C2H6: 1.5, CO: 0.75, CO2: 1.5, H2O: 0.0, N2: 0.0,
                          ^
|   701 |     O2: 0.0}
|   702 | - equation: H + O2 + O2 <=> HO2 + O2  # Reaction 34
|   703 |   rate-constant: {A: 2.0800000000000004e+19, b: -1.24, Ea: 0.0}
*******************************************************************************
*******************************************************************************

System information

Additional context

Originally reported on the Cantera Users' Group.