利用可能な詳細なメカニズムからいくつかの骨格メカニズムを抽出しようとしています。ここでは、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)