cantera
它能做什么
这个工具用来计算一种气体混合物在特定条件下点燃(开始燃烧)所需的时间。它借助化学反应模型来预测这段时间。
适用场景
- ✓想了解不同气体混合物在受热和加压时如何反应。
- ✓想比较不同燃料的点火速度。
- ✓想检查某个化学反应模型在模拟点火时是否准确。
技能链接
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/cantera/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“计算氢气、氧气和氩气混合物在 1000 开尔文和 1 个大气压下的点火延迟时间。”
每周 5 个新技能,1 分钟读完。
工作原理
你需要提供气体种类、用量、温度和压力。工具会利用化学反应模型模拟这一过程,并算出从开始到点火所经过的确切时间。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Cantera: homogeneous ignition calculations
When to use
Use for a closed, adiabatic, homogeneous ideal-gas reactor with a known kinetic mechanism, initial temperature, pressure, and mole composition. The bundled helper runs both constant volume and constant pressure cases and reports a precisely defined temperature-based delay. It is not a flame solver or a general reactor-network builder.
A calculation completing successfully establishes numerical execution, not mechanism validity for the fuel, pressure, temperature, diluent, or measured ignition observable. Read references/interpretation.md when choosing a mechanism, comparing experiments, or interpreting unresolved/two-stage ignition.
Workflow
- Identify the mechanism and its validated condition range. Preserve its source, version,
citation, and any modifications. Check that its phase is
ideal-gasand that every reactant, diluent, and tracked species exists. For custom YAML with imports, retain the original dependency files as well as the generated phase snapshot. Custom Python rate extensions additionally need their original code and environment for replay. - Choose constant volume or constant pressure from the physical experiment. Supply K,
Pa, seconds, and mole amounts explicitly.
mole_amountsis normalized to mole fractions; it is not a mass-fraction mapping. The report includes the normalized initial composition. - Copy assets/hydrogen-ignition.json and change its conditions.
The supplied H2/O2/Ar case uses Cantera's bundled
h2o2.yamlfor an executable numerical example; it is not a recommendation for every hydrogen experiment. - Set a time horizon long enough to observe the temperature rise and the decline of the heating-rate peak. Choose output spacing fine enough to locate that peak. Set a minimum temperature rise to distinguish ignition from negligible heating or numerical noise.
- Run the helper and inspect all four histories and the report. Refine again if the delay changes materially, if the maximum approaches a time boundary, or if conservation fails. Compare the temperature and tracked-species histories with the actual ignition definition.
- Report the condition set, mechanism hash, reactor constraint, delay definition, output spacing, numerical changes, and scientific limits together with the delay.
Execute the tested example
From the collection root:
uv run --no-project --python 3.12 --with cantera==3.2.0 --with numpy==2.5.3 \
python skills/cantera/scripts/ignition_delay.py \
skills/cantera/assets/hydrogen-ignition.json hydrogen-result
Tested on Python 3.12, Cantera 3.2.0, and NumPy 2.5.3. No external solver executable or credentials are needed. Local relative mechanism paths resolve against the configuration file directory before Cantera's built-in data search. Use a new output directory each run.
The 1000 K, 101325 Pa, H2:O2:Ar = 2:1:7 constant-volume example gives about 0.313 ms
using the stated max(dT/dt) definition. At 3 ms its temperature is approximately
2920.67 K and agrees with a separate UV equilibrium calculation. These are package
regression values, not experimental validation data.
Exact delay and refinement contract
Delay is the time of the global maximum of numpy.gradient(T, time, edge_order=2) on
a uniform output grid. It is reported only if the maximum temperature rise reaches
minimum_temperature_rise_k and the maximum is at least two sample indices from each
boundary. Otherwise delay_s is null and a status explains why. No delay beyond the
simulation horizon is extrapolated.
The helper explicitly uses Cantera 3.2's clone=True and reads evolving properties from
reactor.phase. The original Solution retains the initial state; do not read it as
the reactor's final state. ReactorNet.advance(t) requests an absolute time, and no
advance limits are configured, so the output grid remains uniform.
It runs four independent fresh reactors:
| Run | Change from configured conditions |
|---|---|
| baseline | Original settings |
| finer_output | Half output spacing, same horizon and solver controls |
| tighter_solver | Both solver tolerances divided by ten; maximum internal time step halved |
| longer_horizon | Twice the horizon with the original output spacing |
numerically_resolved requires all runs to yield delays, relative delay changes within
…
常见问题
什么是“机理”(mechanism)?
它是一套化学规则和反应的集合,用来描述一种气体混合物的行为方式。
这里的“点火”是什么意思?
指气体混合物开始剧烈反应、释放能量并使温度升高的那个时刻。
这个工具能预测爆炸吗?
不能。它主要关注最初的点火时间,而不是爆炸或火焰的传播过程。
详情
作者的原始描述
Runs Cantera homogeneous chemical reactors and evaluates ignition delay with mechanism provenance, conservation checks, and numerical refinement. Use for combustion kinetics, closed adiabatic ideal-gas constant-volume or constant-pressure ignition, temperature histories, or mechanism-specific ignition-delay comparisons.
热度
- GitHub 星标
- 51k
- 排名
- #3435
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …