python - 在 Cantera react 器中使用生物质热解动力学

标签 python chemistry cantera

我正在尝试使用 Cantera 和生物质热解动力学方案来观察间歇式 react 器中浓度随时间的变化。下面显示了动力学概述以及对该论文的引用。请注意,物种浓度以质量为基础,例如 kg/m^3

primary

secondary

  • 木材=生物质,通常是松树
  • 气体 = 含有轻质不凝性气体的集总物质
  • tar = 可冷凝热解 Vapor 的集总物质
  • 炭=完全热解的木材,主要是碳

引用:Colomba Di Blasi。热解多孔固体燃料内的对流和二次 react 效应分析。燃烧科学与技术,卷。 90,第 315-340 页,1993 年。

假设初始木材浓度为1.0,我可以求解以下系统: 使用 Python 绘制 react 速率方程并绘制转化率随时间变化的图,如下所示。

plot

不幸的是,我在 Cantera 中使用动力学方案的尝试给出了有关不兼容相类型的错误。我的 blasi.cti 文件包含以下内容:

#-------------------------------------------------------------------------------
#  Phases data
#-------------------------------------------------------------------------------


stoichiometric_solid(
    name = "wood",
    species = "wood",
    density = (700, "kg/m3")
)

ideal_gas(
    name = "gas",
    species = "gas"
)

ideal_gas(
    name = "tar",
    species = "tar"
)

stoichiometric_solid(
    name = "char",
    species = "char",
    density = (110, "kg/m3")
)

#-------------------------------------------------------------------------------
#  Species data
#-------------------------------------------------------------------------------

species(
    name="wood"
)

species(
    name = "gas"
)

species(
    name = "tar"
)

species(
    name = "char"
)

#-------------------------------------------------------------------------------
#  Reaction data
#-------------------------------------------------------------------------------

# Reaction 1
reaction("wood => gas", [1.4345e4, 0, 88.6])

# Reaction 2
reaction("wood => tar", [4.125e6, 0, 112.7])

# Reaction 3
reaction("wood => char", [7.3766e5, 0, 106.5])

# Reaction 4
reaction("tar => gas", [4.28e6, 0, 108])

# Reaction 5
reaction("tar => char", [1.0e6, 0, 108])

使用上述 cti 文件的 Python 文件 blasi_reactor.py 是:

import cantera as ct
import matplotlib.pyplot as plt

tk = 773.15     # temperature [K]
p = 101325.0    # pressure [Pa]

gas = ct.Solution('blasi.cti')
gas.TP = tk, p
r = ct.IdealGasConstPressureReactor(gas)

sim = ct.ReactorNet([r])
time = 0.0
states = ct.SolutionArray(gas, extra=['t'])

for n in range(50):
    time += 1.0
    sim.advance(time)
    states.append(r.thermo.state, t=time)

plt.figure()
plt.plot(states.t, states.X[:, gas.species_index('wood')])
plt.plot(states.t, states.X[:, gas.species_index('gas')])
plt.plot(states.t, states.X[:, gas.species_index('tar')])
plt.plot(states.t, states.X[:, gas.species_index('char')])
plt.xlabel('Time [s]')
plt.ylabel('Concentration [kg/m^3]')
plt.show()

来自 Cantera 的错误消息是:

Traceback (most recent call last):
  File "blasi_cantera.py", line 9, in <module>
    r = ct.IdealGasConstPressureReactor(gas)
  File "interfaces/cython/cantera/reactor.pyx", line 191, in cantera._cantera.Reactor.__init__
  File "interfaces/cython/cantera/reactor.pyx", line 28, in cantera._cantera.ReactorBase.__init__
  File "interfaces/cython/cantera/reactor.pyx", line 199, in cantera._cantera.Reactor.insert
  File "interfaces/cython/cantera/reactor.pyx", line 50, in cantera._cantera.ReactorBase.insert
cantera._cantera.CanteraError:
***********************************************************************
CanteraError thrown by IdealGasReactor::setThermoMgr:
Incompatible phase type provided
***********************************************************************

如何使用 Cantera 定义木材、天然气、 tar 和炭等集总物质? Cantera 是否有可能使用这样的动力学方案?我通常创建 我自己使用Python的热解模型,但我想使用 react 器 坎特拉的特色。这也让我可以比较之间的结果 Cantera 和我个人的 Python 模型。

注意 - 我查看了 Cantera 文档网站上的示例,但是 一切都是针对明确定义的气相物质,您知道元素组成和 NASA 系数。

最佳答案

只要热力学数据(具有比热系数的数据存在并且正确),就可以使用您自己的,甚至是人造的元素和物质,但是,找到此类散装 Material 的正确系数(检查这些:https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19940013151.pdf)。

此外,对于动力学计算和 react 器链,使用 ct.IdealGasReactor 更容易使用,它也应该支持多相。

此外,您至少需要 react 器之间的上游水库并在每次迭代时同步它们。

附:您可以查看 Cantera 撰写的这份出版物: https://www.researchgate.net/publication/320592565_Modelling_of_biomass_combustion_chemistry_to_investigate_gas_phase_alkali_sulfate_formation

关于python - 在 Cantera react 器中使用生物质热解动力学,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53639820/

相关文章:

python - 是否有用于 Python 数组同步改组的惯用语或 API?

python - "Mark directory as sources root"到底是做什么的?

python - 如何最多处理列表中一定数量的元素?

MySQL - 选择所有其他列 = 0

python - 如何将数据保存到 csv Cantera 和错误 <cantera.composite.SolutionArray object at 0x7f4badca0fd0>

python - 如何将 pd.grouper 系列转换为 DataFrame

machine-learning - 机器学习技术在化学中的应用

python - 用 Python 计算分子化合物中的元素数量(如果可能的话递归)?

python - 如何反转 CANTERA Python 模块中的 adiabetic.py 程序,使其输入绝热温度并给出输出入口温度?