AMReX-Astro / AMReX-Astro/Castro

SDC2 evaluates time-dependent sources at the end of the step

Open
#3,395 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/driver/Castro_advance_sdc.cpp:64,106,134-137 and
Source/problems/Castro_problem_source.cpp:19.

Finding

The driver computes node_time = time + dt_sdc[m] * dt, but the second-order
branch passes cur_time to do_old_sources at every node. cur_time is the
full timestep's endpoint. The problem source receives this time unchanged.

State-dependent sources may still use the correct staged state, but explicitly
time-dependent forcing is sampled at the wrong time. In particular, the cached
node-zero source is evaluated at the endpoint instead of the initial time. This
reduces temporal accuracy even on a single level. The fourth-order source branch
already passes node_time.

Reproducible numerical evidence

For a spatially uniform source S(t)=t, a step starting at zero should add
h*h/2. Both Lobatto node evaluations instead return h, so SDC2 adds h*h,
regardless of additional sweeps. Over a fixed interval this becomes a
first-order endpoint quadrature error.

This is an algebraic check of the source times, not a full manufactured-source
simulation.

Proposed fix

Pass node_time to the second-order source evaluation. Keep the time used to
retrieve staged state data distinct from the physical source time. Audit any
source that internally FillPatches before changing that argument; the true-SDC
diffusion contribution is already built separately as MOL fluxes.

Validation after fixing

Add a manufactured uniform time-dependent energy source to a copy of a suitable
existing problem. Check both Lobatto and Radau with SDC2, and verify exact
integration of a linear-in-time source to roundoff. Also test time-independent
sources and diffusion to catch ghost-fill regressions.

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 by tracing the SDC2 source calls at Source/driver/Castro_advance_sdc.cpp:64,106,134-137 and Source/problems/Castro_problem_source.cpp:19, keeping staged-state retrieval distinct from physical source time. Add the manufactured uniform time-dependent source to a suitable existing problem and validate Lobatto and Radau SDC2, including exact linear-in-time integration, time-independent sources, and diffusion without ghost-fill regressions.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.