首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在CANTERA中编写.cti或.xml文件

在CANTERA中编写.cti或.xml文件
EN

Stack Overflow用户
提问于 2016-11-15 20:16:43
回答 1查看 1.2K关注 0票数 0

我试图从现有的详细机制中提取一些骨架机制。在这里你可以看到从GRI3.0机制中提取子机制。有没有办法在CANTERA中导出子机制。更具体地说,我能以某种方式将以下示例中的gas2导出到.cti或.xml文件中吗?

代码语言:javascript
复制
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)
EN

回答 1

Stack Overflow用户

发布于 2016-11-17 14:56:56

在Cantera用户论坛中解决:Cantera Froum

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40609645

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档