Error with undeclared species

114 views
Skip to first unread message

Rijk Ter Horst

unread,
May 7, 2024, 8:41:31 AM5/7/24
to Cantera Users' Group
Hi,

I have been struggling for the last week while using the ptcombust.yaml file when trying to simulate PEM Fuel Cells. The main error i get is Reaction 'CH4 + 2 PT(S) => CH3(S) + H(S)'
contains undeclared species: 'CH4'. And i get this error for more reactions. Does anyone know what I can do to fix this? I don't know if it could be the root of the error that yaml file is in cantera 2.5.0 and my virtual environment is set up with cantera 3

Kind Regards,
Rijk
test_pem_fuel_Cells.py
ptcombust.yaml

Koen Vogels

unread,
May 7, 2024, 9:14:23 AM5/7/24
to Cantera Users' Group
Hi Rijk,

I am struggling with this problem as well! Could you maybe contact me when you find a solution?

Kind Regards,

Koen

Op dinsdag 7 mei 2024 om 14:41:31 UTC+2 schreef rij...@gmail.com:

Rijk Ter Horst

unread,
May 7, 2024, 11:05:56 AM5/7/24
to Cantera Users' Group
Here is the full error and the gri 30 file I am using.


Traceback (most recent call last):
  File "c:\Users\rijkt\BEP-mammoet-1\test_pem_fuel_Cells.py", line 19, in <module>
    anode = ct.Interface('ptcombust.yaml', 'Pt_surf', [gas_h2])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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:
*******************************************************************************
CanteraError thrown by addReactions:

*******************************************************************************
InputFileError thrown by Reaction::checkSpecies:
Error on line 205 of C:\Users\rijkt\BEP-mammoet-1\.venv\Lib\site-packages\cantera\data/ptcombust.yaml:
Reaction 'CO + PT(S) => CO(S)'
contains undeclared species: 'CO'
|  Line |
|   200 |   rate-constant: {A: 3.7e+21, b: 0, Ea: 11500}
|   201 | - equation: H(S) + OH(S) <=> H2O(S) + PT(S)  # Reaction 13
|   202 |   rate-constant: {A: 3.7e+21, b: 0, Ea: 17400}
|   203 | - equation: OH(S) + OH(S) <=> H2O(S) + O(S)  # Reaction 14
|   204 |   rate-constant: {A: 3.7e+21, b: 0, Ea: 48200}
>   205 > - equation: CO + PT(S) => CO(S)  # Reaction 15
            ^
|   206 |   rate-constant: {A: 1.618e+20, b: 0.5, Ea: 0}
|   207 |   orders: {PT(S): 2}
|   208 | - equation: CO(S) => CO + PT(S)  # Reaction 16
*******************************************************************************

*******************************************************************************
InputFileError thrown by Reaction::checkSpecies:
Error on line 208 of C:\Users\rijkt\BEP-mammoet-1\.venv\Lib\site-packages\cantera\data/ptcombust.yaml:
Reaction 'CO(S) => CO + PT(S)'
contains undeclared species: 'CO'
|  Line |
|   203 | - equation: OH(S) + OH(S) <=> H2O(S) + O(S)  # Reaction 14
|   204 |   rate-constant: {A: 3.7e+21, b: 0, Ea: 48200}
|   205 | - equation: CO + PT(S) => CO(S)  # Reaction 15
|   206 |   rate-constant: {A: 1.618e+20, b: 0.5, Ea: 0}
|   207 |   orders: {PT(S): 2}
>   208 > - equation: CO(S) => CO + PT(S)  # Reaction 16
            ^
|   209 |   rate-constant: {A: 1.0e+13, b: 0, Ea: 125500}
|   210 | - equation: CO2(S) => CO2 + PT(S)  # Reaction 17
|   211 |   rate-constant: {A: 1.0e+13, b: 0, Ea: 20500}
*******************************************************************************

*******************************************************************************
InputFileError thrown by Reaction::checkSpecies:
Error on line 210 of C:\Users\rijkt\BEP-mammoet-1\.venv\Lib\site-packages\cantera\data/ptcombust.yaml:
Reaction 'CO2(S) => CO2 + PT(S)'
contains undeclared species: 'CO2'
|  Line |
|   205 | - equation: CO + PT(S) => CO(S)  # Reaction 15
|   206 |   rate-constant: {A: 1.618e+20, b: 0.5, Ea: 0}
|   207 |   orders: {PT(S): 2}
|   208 | - equation: CO(S) => CO + PT(S)  # Reaction 16
|   209 |   rate-constant: {A: 1.0e+13, b: 0, Ea: 125500}
>   210 > - equation: CO2(S) => CO2 + PT(S)  # Reaction 17
            ^
|   211 |   rate-constant: {A: 1.0e+13, b: 0, Ea: 20500}
|   212 | - equation: CO(S) + O(S) => CO2(S) + PT(S)  # Reaction 18
|   213 |   rate-constant: {A: 3.7e+21, b: 0, Ea: 105000}
*******************************************************************************

*******************************************************************************
InputFileError thrown by Reaction::checkSpecies:
Error on line 214 of C:\Users\rijkt\BEP-mammoet-1\.venv\Lib\site-packages\cantera\data/ptcombust.yaml:

Reaction 'CH4 + 2 PT(S) => CH3(S) + H(S)'
contains undeclared species: 'CH4'
|  Line |
|   209 |   rate-constant: {A: 1.0e+13, b: 0, Ea: 125500}
|   210 | - equation: CO2(S) => CO2 + PT(S)  # Reaction 17
|   211 |   rate-constant: {A: 1.0e+13, b: 0, Ea: 20500}
|   212 | - equation: CO(S) + O(S) => CO2(S) + PT(S)  # Reaction 18
|   213 |   rate-constant: {A: 3.7e+21, b: 0, Ea: 105000}
>   214 > - equation: CH4 + 2 PT(S) => CH3(S) + H(S)  # Reaction 19
            ^
|   215 |   rate-constant: {A: 4.6334e+20, b: 0.5, Ea: 0}
|   216 |   orders: {PT(S): 2.3}
|   217 | - equation: CH3(S) + PT(S) => CH2(S)s + H(S)  # Reaction 20
*******************************************************************************
*******************************************************************************

Op dinsdag 7 mei 2024 om 15:14:23 UTC+2 schreef koe...@gmail.com:
gri30.yaml

Steven DeCaluwe

unread,
May 7, 2024, 12:01:17 PM5/7/24
to Cantera Users' Group
Hi Rijk,

Apologies - I was reading from my phone earlier and did not notice you had already sent your code and yaml file.  This is helpful.

It is the use of the ‘h2o2.yaml’ input for the gas phase that is the problem.  If you look at that file, you see that it only defines the following gas phase species  species: [H2, H, O, O2, OH, H2O, HO2, H2O2, AR, N2]

Whereas the ptcombust.yaml file uses the following gas phase species
- gri30.yaml/species: [H2, H, O, O2, OH, H2O, HO2, H2O2, C, CH, CH2, CH2(S),
CH3, CH4, CO, CO2, HCO, CH2O, CH2OH, CH3O, CH3OH, C2H, C2H2, C2H3,
C2H4, C2H5, C2H6, HCCO, CH2CO, HCCOH, AR, N2]

You’ll notice that it pulls the definitions (chemical composition, thermo and transport parameters) from the gri30.yaml file.  Not all of these are required for the kinetic mechanism (notably N2 is considered inert).  But any species that do appear in any of the surface reactions must be part of the gas phase that you use in building your surface object.

My recommendations would be to do one of the following:
1. Just use the gas phase object defined in ptcombust.yaml
2. Continue as you are, but make a copy of ptcombust.yaml (give the copy a new name) and delete any reactions that use species you are not interested in.
3. I would go with option 1 or 2, but if you are interested I have a yaml file developed more specifically for PEM fuel cells. It is probably more than you need (it explicitly models the Nafion phase, which seems like it is not part of your approach), but you are welcome to take a look:
Cheers,
Steven


-- 
You received this message because you are subscribed to the Google Groups "Cantera Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cantera-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cantera-users/05c0fa0a-2b21-4b30-bb16-b2bfdc580cfbn%40googlegroups.com.
<gri30.yaml>

Reply all
Reply to author
Forward
0 new messages