AMReX-Astro / AMReX-Astro/Castro
`construct_new_source()` omits `thermo_src` handling for non-MHD while `source_flag()` enables it in SDC
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 340
- Forks
- 105
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 8
Description
Summary
source_flag(thermo_src) returns true for non-MHD when time_integration_method == SpectralDeferredCorrections, but construct_new_source() only handles thermo_src under #ifdef MHD. This creates a dispatch inconsistency where thermo_src can be marked active yet never constructed in new-source assembly.
Location
Source/sources/Castro_sources.cpp:52Source/sources/Castro_sources.cpp:368
Problem Details
Current behavior:
- Non-MHD:
case thermo_src:
if (time_integration_method == SpectralDeferredCorrections) return true;
- New-source dispatcher:
#ifdef MHD
case thermo_src:
construct_new_thermo_source(...);
break;
#endif
So non-MHD SDC can report active thermo source, but the new-source switch has no matching case.
Impact
- Inconsistent source accounting/dispatch logic.
- Potentially missing thermodynamic contribution in code paths that rely on
do_new_sources()and expectsource_flag()/construct_new_source()consistency.
Suggested Patch
Always dispatch thermo_src; let construct_new_thermo_source() decide behavior internally:
diff --git a/Source/sources/Castro_sources.cpp b/Source/sources/Castro_sources.cpp
--- a/Source/sources/Castro_sources.cpp
+++ b/Source/sources/Castro_sources.cpp
@@
-#ifdef MHD
case thermo_src:
construct_new_thermo_source(source, state_old, state_new, time, dt);
break;
-#endif
Prepared by Codex
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
Start in Source/sources/Castro_sources.cpp at the source_flag() logic around line 52 and construct_new_source() around line 368. Compare the non-MHD SDC thermo_src path with the new-source dispatcher, then verify the relevant non-MHD SDC code path so source accounting and construction are consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- hpc
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100