RMS reactors: hard-coded unpreconditioned GMRES linear solver makes stiff surface/electrochemical edge simulations fail
维护者通常 1 天内回复
评估
调研方向
Start with Reactor.simulate in rmgpy/rmg/reactionmechanismsimulator_reactors.py and the referenced #2741 change to understand why the linear solver was set explicitly. Reproduce the reported solver comparison in the RMS standalone test described in the issue, then assess the proposed default or size-based choice, input-file option and logging change. Done means the selected solver configuration is exposed and documented, solver failures are visible in RMG.log, and the reported stiff simulations complete reliably.
由索引模型根据 Issue 内容生成。
描述
Note: This issue was drafted by Claude (Anthropic's AI assistant, via Claude Code), based on its diagnosis of the run described below, and posted at Richard West's request.
Context
Torrie Asifor's CO2RR-on-Cu(111) run (liquidSurfaceReactor, RMS backend, echem branch of RMS) slowed to ~4.4 h per iteration after 3 days. 67 of its 69 edge simulations ended with CVODE "corrector convergence test failed repeatedly or with |h| = hmin", most at t ≈ 1e-11 s with h ≈ 1e-19 s. Each failure takes RMS's "resurrect" branch, which adds the edge species with the largest rate, so the model was being grown by solver crashes, not by flux criteria (and the RMG log never says so).
Reactor.simulate in rmgpy/rmg/reactionmechanismsimulator_reactors.py always calls selectobjects with
solver=Main.Sundials.CVODE_BDF(linear_solver=Main.Symbol("GMRES")),
This came in with #2741 (commit 60c412573, "explicitly pass linear solver to CVODE to avoid it not being initialized"). Before that it was CVODE_BDF(), which uses a dense direct linear solve.
GMRES without a preconditioner is a poor fit for small, very stiff kinetic systems. The Newton iteration needs an accurate linear solve, and an unpreconditioned Krylov solve on an ill-conditioned Jacobian often fails to converge. That shows up as exactly the corrector-convergence failure above. A model with about 150 core+edge species is far too small to need a matrix-free method: a dense LU of a 150×150 Jacobian is trivial.
Evidence: standalone RMS test of the 84-species core (1785 reactions) from that run. It rebuilds the same ConstantTLiquidSurfaceReactor domains and interface and steps with step! as selectobjects does, but without edge analysis. tf = 1000 s, same initial conditions:
| surfPotential | GMRES, atol 1e-16 rtol 1e-8 (current) | dense CVODE_BDF(), same tolerances |
dense, atol 1e-20 rtol 1e-6 |
|---|---|---|---|
| −2.0 V | ConvergenceFailure at t = 1.1e-5 s after 213,458 steps (63 s) | reached tf in 3,381 steps (1.1 s) | reached tf in 2,893 steps (0.3 s) |
| −1.5 V | ConvergenceFailure at t = 1.6e-5 s after 178,765 steps (54 s) | reached tf in 3,499 steps (1.2 s) | reached tf in 2,706 steps (0.3 s) |
| −1.0 V | ConvergenceFailure at t = 1.8e-5 s after 187,611 steps (58 s) | reached tf in 3,155 steps (1.1 s) | reached tf in 2,629 steps (0.3 s) |
Same model, same tolerances: switching only the linear solver goes from failing after about 2×10⁵ steps to finishing in about 3×10³ steps, about 50× faster even ignoring the failure. In the full RMG run, with edge flux analysis after every step, each failing simulation took hours.
Proposal:
- Go back to a direct solver by default, or pick by size (dense below a few hundred species,
:KLUsparse or GMRES with a preconditioner above). First find out what "not being initialized" meant in #2741, so we don't bring that bug back. - Expose the choice in the input file, e.g.
simulator(atol=..., rtol=..., linearSolver='dense'|'GMRES'|'KLU'), and document it ininput.rst. - Log RMS's "Solver failed with code … resurrecting job" in
RMG.log(it doesn't reach the log now), so users can see when species are being added because the solver crashed.
See also: ReactionMechanismGenerator/ReactionMechanismSimulator.jl#280 (rate caps) and #3035 (diffusion interfaces), which came out of the same diagnosis.
🤖 Generated with Claude Code
- 主要语言
- Python
- 星标
- 550
- 派生
- 267
- 平均合并
- 8 小时 49 分钟
- 30 天内合并 PR
- 1
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ReactionMechanismGenerator/RMG-Py 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
ReactionMechanismGenerator/RMG-Py#3044 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 88/100
ReactionMechanismGenerator/RMG-Py#3014 ·
维护者通常 1 天内回复
-
Intel Mac: Julia killed with "Code Signature Invalid" when loading RMS (conda leaves invalid signatures on osx-64 binaries)可能已有人在做 @rwest 于 28 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 25/100
ReactionMechanismGenerator/RMG-Py#3037 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 38/100
ReactionMechanismGenerator/RMG-Py#3035 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 57/100
ReactionMechanismGenerator/RMG-Py#3030 ·
维护者通常 1 天内回复
查看 ReactionMechanismGenerator/RMG-Py 的全部 Issue
相似的 Issue
-
docs(contributing): the two things that silently block a PR可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭available documentation good first issue
难度 1/5 1-3 小时 新手友好度 95/100
Nixitov/Riptide-Native#944 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
JTHCode/secretguard#24 ·
维护者通常 1 天内回复
-
area: middleware documentation good first issue
难度 2/5 1-3 小时 新手友好度 88/100
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
good first issue
难度 1/5 1 小时以内 新手友好度 95/100
omarelshamy25x/shamy-hijri#63 ·
维护者通常 1 天内回复