AMReX-Astro / AMReX-Astro/Castro
The SDC4 pressure-work source has only second-order derivatives
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 340
- Forks
- 105
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 8
Description
Locations: Source/sources/Castro_thermo.cpp:120-196 and
Source/driver/Castro_advance_sdc.cpp:99-131.
Finding
SDC4 converts the state to cell centers, evaluates its sources, and averages
them back. However, fill_thermo_source computes velocity divergence with the
same two-point centered derivative for both SDC orders. That derivative is
second-order accurate even on exact cell-center data.
A center-to-average conversion cannot remove its leading derivative error. The
internal-energy pressure-work source therefore remains second order in a path
documented as fourth order in space. This matters when internal energy is
retained by the dual-energy logic or affects reaction rates; resetting internal
energy from total energy can mask the defect in some hydro tests.
Reproducible numerical evidence
For constant rho and p, and u(x)=sin(x), the implemented derivative is
cos(x)*sin(dx)/dx, differing from cos(x) by -dx*dx*cos(x)/6 + O(dx**4).
Averaging the approximate source adds the legitimate averaging correction but
leaves that derivative error. The numerical check script confirms a factor of
approximately four under refinement, not sixteen.
This is a local spatial-operator check; no end-to-end convergence failure is
claimed for a problem whose dual-energy reset masks the source error.
Proposed fix
Provide a fourth-order pressure-work discretization when sdc_order==4. One
option is a fourth-order centered velocity derivative on cell-center states,
with compatible boundary stencils and sufficient cell-center ghost cells.
Another is a consistent fourth-order face-based formulation. The current
one-cell centered-state halo is insufficient for the usual five-point centered
derivative, so update the data preparation as well.
Validation after fixing
Test the source operator directly on smooth manufactured density, pressure, and
velocity fields, including physical boundaries. Verify fourth-order convergence
after averaging. Then run a coupled reacting or dual-energy case where UEINT is
not overwritten from UEDEN.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read Source/sources/Castro_thermo.cpp:120-196 and Source/driver/Castro_advance_sdc.cpp:99-131 to trace fill_thermo_source and the SDC4 state preparation. Reproduce the local spatial-operator check, then validate the completed change with smooth manufactured fields, physical boundaries, and a coupled reacting or dual-energy case where UEINT is not overwritten; fourth-order convergence after averaging is the completion criterion.
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
- 42/100