AMReX-Astro / AMReX-Astro/Castro

Should we remove update_sources_after_reflux?

Open
#1,019 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

driver question :grey_question:
Dominant language
C++
Stars
340
Forks
105
Avg merge
3d 8h
Merged PRs (30d)
8

Description

update_sources_after_reflux re-evaluates all source terms after a reflux on all levels. The logic is that the distribution of matter on the grid has changed, so the new-time source terms we evaluated will not have reflected this.

Historically, this approach originates with Miniati and Colella (2007), Section 3.2, and was in the original Castro code (see section 6.2.3 of the Castro paper), but it only dealt with self-gravity and was written in a way that the source correction due to the reflux was added. This was later turned into the current approach where we subtract the full new-time source and then re-calculate it and add it after accounting for the reflux contribution, and was also generalized to include all source terms.

The discussion question is: should we keep this approach, or should we just leave the source terms alone after a reflux? The argument for keeping it is that the evolution is more accurate. In particular, the evolution is approximately what it would be in an ideal case without subcycling (because in a no-subcycling mode like what FLASH does, we could calculate the fluxes on all levels first, before calculating the new-time sources). This enhanced accuracy matters if significant amounts of material move through a refinement boundary. It is not clear to me how the presence of this term affects convergence though. The argument for removing it is that it generally adds code complexity and it's easy for us to make mistakes in the advance that break the correctness of the source term update (cf. #1020). It also means we have to store more memory, because now we're keeping the fluxes array alive on every level indefinitely.

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 update_sources_after_reflux entry point and inspect issue #1020 for the cited source-term correctness problems. Read Miniati and Colella (2007), Section 3.2, and the Castro paper's Section 6.2.3, then compare the accuracy, convergence, complexity, and memory implications; done means reaching a documented decision on whether to retain or remove the approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
hpc
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.