RMS reactors: hard-coded unpreconditioned GMRES linear solver makes stiff surface/electrochemical edge simulations fail

Đang mở
#3,034 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@rwest đang làm issue này rồi.

Từ ngày 7/11/2026.

  • #3036 của @rwest — đang mở

Đá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
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend, databases

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:

  1. Go back to a direct solver by default, or pick by size (dense below a few hundred species, :KLU sparse or GMRES with a preconditioner above). First find out what "not being initialized" meant in #2741, so we don't bring that bug back.
  2. Expose the choice in the input file, e.g. simulator(atol=..., rtol=..., linearSolver='dense'|'GMRES'|'KLU'), and document it in input.rst.
  3. 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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ReactionMechanismGenerator/RMG-Py

Tất cả issue của ReactionMechanismGenerator/RMG-Py

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.