RMS reactors: hard-coded unpreconditioned GMRES linear solver makes stiff surface/electrochemical edge simulations fail
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 550
- Fork
- 267
- Merge trung bình
- 8 giờ 49 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ReactionMechanismGenerator/RMG-Py
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ReactionMechanismGenerator/RMG-Py#3044 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
ReactionMechanismGenerator/RMG-Py#3014 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Intel Mac: Julia killed with "Code Signature Invalid" when loading RMS (conda leaves invalid signatures on osx-64 binaries)Có thể đã có người làm @rwest đã nhận 29 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
ReactionMechanismGenerator/RMG-Py#3037 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
ReactionMechanismGenerator/RMG-Py#3035 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
ReactionMechanismGenerator/RMG-Py#3030 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của ReactionMechanismGenerator/RMG-Py
Issue tương tự
-
docs(contributing): the two things that silently block a PRCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởavailable documentation good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 95/100
Nixitov/Riptide-Native#944 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
JTHCode/secretguard#24 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: middleware documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
omarelshamy25x/shamy-hijri#63 ·
Maintainer thường phản hồi trong vòng 1 ngày