AMReX-Astro / AMReX-Astro/Castro

The VODE-only option does not solve the SDC equation

Open
#3,393 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ai-code-audit sdc
Dominant language
C++
Stars
340
Forks
105
Avg merge
3d 8h
Merged PRs (30d)
8

Description

Locations: Source/sdc/Castro_sdc_util.H:71-74,181-199,
Source/sdc/sdc_vode_solve.H:26-30,91, and Source/sdc/Castro_sdc.cpp:245-265.

Finding

The correction requires an endpoint satisfying U - h R(U) = U_old + h C.
Solver 2 instead integrates the different equation dU/dt = R(U) + C over h,
then returns that ODE endpoint without a nonlinear correction.

Both SDC orders subsequently evaluate the instantaneous reaction rate at that
endpoint and rebuild the update as U_old + h (C + R(endpoint)). An ODE
endpoint generally does not satisfy this backward-Euler equation, so this
reconstruction does not preserve the integrated result or solve the required
correction. More SDC sweeps do not generally eliminate the mismatch.

Solver 3 already uses VODE as an initial guess followed by Newton; this
particular omission concerns solver 2.

Reproducible numerical evidence

Take R(u)=-u, u_old=1, h=1, and C=0. The required root is 0.5. Exact ODE
integration returns exp(-1)=0.3678794412. The caller then stores
1-exp(-1)=0.6321205588, which is neither result. This is an equation-level
check, not a simulation using a nuclear network.

For second-order Lobatto, repeatedly applying the implemented correction for
this scalar problem approaches about 0.5492, whereas the converged trapezoidal
equation gives 1/3. The numerical check script in this directory reproduces this
discrepancy.

Proposed fix

Use the VODE result only as an initial guess and require a successful
full-interval nonlinear solve before returning. Alternatively, remove solver 2
as a standalone option and document that VODE is a predictor. A genuine
ODE-based SDC preconditioner would require rederiving the correction and its
conservative update; simply keeping the ODE endpoint is insufficient.

Validation after fixing

Test the scalar linear reaction model against the exact nonlinear correction,
checking its residual rather than only ODE integration success. Then compare
reacting_convergence results and temporal convergence across solvers 1, 2, and
3, including stiff steps.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Source/sdc/Castro_sdc_util.H:71-74,181-199, Source/sdc/sdc_vode_solve.H:26-30,91, and Source/sdc/Castro_sdc.cpp:245-265 to trace solver 2 and solver 3. Run the numerical check script in the SDC directory and validate the scalar linear reaction model by checking the nonlinear residual. Done means the scalar correction is correct and reacting_convergence plus temporal-convergence tests pass across solvers 1, 2, and 3, including stiff steps.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.