AMReX-Astro / AMReX-Astro/Castro

Self-gravity is frozen at the old-time density during SDC sweeps

Open
#3,397 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Locations: Source/driver/Castro_advance_sdc.cpp:94-96,
Source/gravity/Castro_gravity.cpp:45-53,125,300-328, and
Source/gravity/Gravity.cpp:3476-3486.

Finding

Each SDC node stages its current solution in S_new/Sborder, but calls
construct_old_gravity(prev_time). The gravity source then reads
get_old_data(Gravity_Type), not a gravity field solved from the current node's
density.

For Poisson gravity, construct_old_gravity explicitly skips the old solve in
single-level runs. True SDC rejects AMR, so all supported Poisson/true-SDC runs
follow this skip. Repeated SDC sweeps therefore do not update the gravitational
field as the density changes within the step.

The integrated system uses frozen g(t_n), rather than g(rho_node). This loses
the intended temporal order for evolving self-gravitating flows. Constant
prescribed gravity is not affected by this particular defect.

Evidence

Static inspection of the stage driver, old-gravity constructor, source lookup,
and gravity RHS selection confirms that no stage Poisson solve occurs. The
driver already has a TODO acknowledging that it is not using the current stage
density. This report does not claim that post-timestep gravity solves are
absent; such solves cannot correct the preceding stage evaluations.

No self-gravity convergence run was performed.

Proposed fix

Introduce a stage-gravity evaluation that solves from the staged node density
and passes its acceleration explicitly to the source builder. Keep physical
old/new gravity state and metadata intact rather than overloading old-time
fields. Refresh the final gravity state consistently after the last update. If
this cannot be supported yet, explicitly reject evolving self-gravity with true
SDC rather than silently claiming its formal order.

Validation after fixing

Use a smooth single-level self-gravitating problem with changing density.
Compare temporal convergence at fixed fine spatial resolution for SDC2 and SDC4.
Check that node acceleration changes within the step and that constant-gravity
regressions remain unchanged.

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 the listed locations in Source/driver/Castro_advance_sdc.cpp, Source/gravity/Castro_gravity.cpp, and Source/gravity/Gravity.cpp; trace how staged SDC density reaches gravity source construction and old-data lookup. Use the proposed stage-gravity evaluation and explicit acceleration flow as the design target. Done means node acceleration changes with density, SDC2 and SDC4 show temporal convergence on a smooth single-level self-gravitating problem, and constant-gravity regressions remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
hpc
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.