我正在尝试从可用的详细机制中提取一些骨架机制。在这里你可以看到从 GRI3.0 机制中提取子机制。有什么办法可以导出CANTERA中的子机制。更具体地说,我可以以某种方式将以下示例中的 gas2 导出到 .cti 或 .xml 文件吗?
from cantera import *
import numpy as np
reaction_mech = 'gri30.cti'
all_species = Species.listFromFile(reaction_mech)
species = []
# Filter species
for S in all_species:
comp = S.composition
if 'C' in comp and comp.get('C') >= 2:
# Exclude all C compounds with more than 2 C atoms
continue
species.append(S)
species_names = {S.name for S in species}
print('Species: {0}'.format(', '.join(S.name for S in species)))
all_reactions = Reaction.listFromFile(reaction_mech)
reactions = []
for R in all_reactions:
if not all(reactant in species_names for reactant in R.reactants):
continue
if not all(product in species_names for product in R.products):
continue
reactions.append(R)
gas1 = Solution('gri30.xml')
gas2 = Solution(thermo='IdealGas', kinetics='GasKinetics',
species=species, reactions=reactions)