Creation of yaml datafile with surface kinetics

101 views
Skip to first unread message

Mikael Larsen

unread,
Apr 29, 2024, 9:47:27 AM4/29/24
to Cantera Users' Group
Hi Cantera folks

I am going to model calcination of CaCO3 and am trying to create my own yaml data file by copying existing yaml files and adding the remaining data from chemical thermodynamics and statistical thermodynamics.

However running the following code: 
import cantera as ct

p = ct.one_atm # pressure
T = 1173.0 # surface temperature

surf_phase = ct.Interface("CaCO3-calcination-surface.yaml", "CaO_surf")
gas = surf_phase.adjacent("gas")
CaCO3_phase = surf_phase.adjacent("CaCO3_s")
CaO_phase = surf_phase.adjacent("CaO_s")

surf_phase.TPX = T, p, 'CaO(S): 1, CO2(S):1 '
gas.TPX = T, p, 'N2:1, O2:0.01'
CaCO3_phase.TP = T, p
CaO_phase.TP = T, p

print(surf_phase.reactions())
print(surf_phase.forward_rate_constants)
print(surf_phase.forward_rates_of_progress)

I get the following error:
Traceback (most recent call last):
  File "C:\Users\rml\PycharmProjects\ThermoChemistry\test.py", line 7, in <module>
    surf_phase = ct.Interface("CaCO3-calcination-surface.yaml", "CaO_surf")
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "build\\python\\cantera\\solutionbase.pyx", line 37, in cantera.solutionbase._SolutionBase.__cinit__
  File "build\\python\\cantera\\solutionbase.pyx", line 95, in cantera.solutionbase._SolutionBase._cinit
  File "build\\python\\cantera\\solutionbase.pyx", line 180, in cantera.solutionbase._SolutionBase._init_yaml
cantera._utils.CanteraError:
*******************************************************************************
InputFileError thrown by AnyMap::fromYamlFile:
Error on line 71 of C:\Users\rml\AppData\Local\miniconda3\Lib\site-packages\cantera\data/CaCO3-calcination-surface.yaml:
illegal map value
|  Line |
|    66 |     - [41780.19968, 0, 5.06587319, 0.001976948, -4.17802E-07, 0, 0, -7.78E+04, -24.60]
|    67 |   equation-of-state:
|    68 |     model: constant-volume
|    69 |     density: 2.71 g/cm^3
|    70 | - name: CaO(S)
>    71 >     composition: {Ca: 1, O: 1}
                         ^
|    72 |     sites: 1.0
|    73 |   thermo:
|    74 |     model: NASA7
*******************************************************************************


Obviously there is an error with the composition definition, but I can not see what's the problem.
I have attached my data file.

Thanks for your time
Mikael
CaCO3-calcination-surface.yaml

Ray Speth

unread,
Apr 29, 2024, 9:51:18 AM4/29/24
to Cantera Users' Group

Hi Mikael,

You just have a problem with the indentation that makes the YAML file invalid. All you need to do is adjust the indentation of the composition and sites fields for this species to match the other primary fields (name and thermo). So, instead of:

- name: CaO(S) composition: {Ca: 1, O: 1} sites: 1.0 thermo: model: NASA7 temperature-ranges: [200.0, 1500.0] data: - [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

you should write:

- name: CaO(S) composition: {Ca: 1, O: 1} sites: 1.0 thermo: model: NASA7 temperature-ranges: [200.0, 1500.0] data: - [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

Regards,
Ray

Mikael Larsen

unread,
Apr 30, 2024, 2:28:37 AM4/30/24
to Cantera Users' Group
Thanks Ray, should have seen it.
Reply all
Reply to author
Forward
0 new messages