You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to be able to create a Cantera object (see rmgpy.tools.canteramodel.py) from memory using an RMG surface mechanism. Right now, or even after PR #2514, the only way to load the model is from a yaml file. This is slower than doing it from memory.
Desired Solution=
We'll also need to implement the to_cantera_kinetics() functions for the Surface kinetics classes: #2573
We should add the functionality to the Cantera.load() function. Basically the following line, except for a Cantera Interface
The holdup is that I'm pretty sure this hasn't been implemented in Cantera yet and may require more external collaboration...
Additional Context
Here are the results from my first attempts playing around with this:
# notebook to define a surface interface from memory instead of loading from file
# # Attempt 1
import cantera as ct
canteraFile = 'chem_annotated-gas.yaml'
surface = ct.Interface(canteraFile, 'surface1')
model = surface.adjacent['gas']
# The goal is to do this, but for a surface interface
new_solution = ct.Solution(thermo='IdealGas', kinetics='GasKinetics',species=model.species(), reactions=model.reactions())
# But this complains about "element not found: X"
new_surface = ct.Interface(thermo='Surf', kinetics='Surf', adjacent=new_solution, species=surface.species(), reactions=surface.reactions())
# ---------------------------------------------------------------------------
# CanteraError Traceback (most recent call last)
# /tmp/ipykernel_24067/3316666504.py in <module>
# ----> 1 new_surface = ct.Interface(thermo='Surf', kinetics='Surf', adjacent=new_solution, species=surface.species(), reactions=surface.reactions())
# build/python/cantera/base.pyx in cantera._cantera._SolutionBase.__cinit__()
# build/python/cantera/base.pyx in cantera._cantera._SolutionBase._cinit()
# build/python/cantera/base.pyx in cantera._cantera._SolutionBase._init_parts()
# CanteraError:
# *******************************************************************************
# CanteraError thrown by getElementWeight:
# element not found: X
# *******************************************************************************
# # Attempt 2
# so I tried changing 'X' to Platinum
canteraFile2 = 'chem_annotated-gas2.yaml'
surface2 = ct.Interface(canteraFile2, 'surface1')
model2 = surface.adjacent['gas']
new_solution2 = ct.Solution(thermo='IdealGas', kinetics='GasKinetics',species=model2.species(), reactions=model2.reactions())
# and this time it's complaining about not recognizing certain species
new_surface2 = ct.Interface(thermo='Surf', kinetics='Surf', adjacent=new_solution2, species=surface2.species(), reactions=surface2.reactions())
# ---------------------------------------------------------------------------
# ValueError Traceback (most recent call last)
# /tmp/ipykernel_24067/2220161716.py in <module>
# ----> 1 new_surface2 = ct.Interface(thermo='Surf', kinetics='Surf', adjacent=new_solution2, species=surface2.species(), reactions=surface2.reactions())
# build/python/cantera/base.pyx in cantera._cantera._SolutionBase.__cinit__()
# build/python/cantera/base.pyx in cantera._cantera._SolutionBase._cinit()
# build/python/cantera/base.pyx in cantera._cantera._SolutionBase._init_parts()
# build/python/cantera/base.pyx in cantera._cantera._SolutionBase.__getitem__()
# build/python/cantera/base.pyx in cantera._cantera._SolutionBase.selected_species.__set__()
# build/python/cantera/thermo.pyx in cantera._cantera.ThermoPhase.species_index()
# build/python/cantera/thermo.pyx in cantera._cantera.ThermoPhase.species_index()
# ValueError: No such species 28.
Motivation or Problem
It would be nice to be able to create a Cantera object (see rmgpy.tools.canteramodel.py) from memory using an RMG surface mechanism. Right now, or even after PR #2514, the only way to load the model is from a yaml file. This is slower than doing it from memory.
Desired Solution=
We'll also need to implement the to_cantera_kinetics() functions for the Surface kinetics classes:
#2573
We should add the functionality to the Cantera.load() function. Basically the following line, except for a Cantera Interface
The holdup is that I'm pretty sure this hasn't been implemented in Cantera yet and may require more external collaboration...
Additional Context
Here are the results from my first attempts playing around with this:
Cantera Mechanism files:
chem_annotated-gas2.txt
chem_annotated-gas.txt
The text was updated successfully, but these errors were encountered: