Repository navigation
Description
Severity: low · Category: correctness
Locations: Source/CAMR.cpp:207-216, Source/Hydro/Godunov/PPM.cpp:16,170-182, Source/Params/_cpp_parameters:63-65
Based on commit 17997db (line numbers refer to that tree).
The defect
ppm_trace_sources is documented in Source/Params/_cpp_parameters:63-65 as
"do we reconstruct and trace under the parabolas of the source terms to the
velocity". It is read by pp.query (CAMR_queries.H:20) and stored in
CAMR::ppm_trace_sources, but the only place it is inspected is
CAMR::read_params:
if (ppm_type == 0 && ppm_trace_sources == 1) {
amrex::Print() << "WARNING: ppm_trace_sources = 1 not implemented for ppm_type = 0" ...
ppm_trace_sources = 0;
For ppm_type = 1 the value survives, and nothing consumes it. trace_ppm
takes srcQ as an unnamed, unused parameter (PPM.cpp:16), and the source
tracing block (Ip_src/Im_src, PPM.cpp:170-182 and every
/*+ hdt * Im_src[..]*/ term) is commented out. Grepping Source/ for
ppm_trace_sources finds only the query, the default, and the block above.
So the user-facing switch is a no-op in exactly the configuration where the
code accepts it without comment.
The sources are still applied to the interface states, but in the transverse
step (hydro_transd in 2D, hydro_transdd in 3D, hdt * srcQ), for both
ppm_type = 0 and 1. The answer is therefore first-order in time in the
sources either way; the option cannot change it.
Why it matters
Same class as issue 003: an input the documentation describes as changing the
discretisation is parsed and then ignored, with no diagnostic. A user setting
CAMR.ppm_type = 1 and CAMR.ppm_trace_sources = 1 (e.g. to reproduce a
Castro/Nyx-style traced-gravity run) gets the untraced scheme and no warning,
while the same key with ppm_type = 0 prints a warning. The warning text also
says "not implemented for ppm_type = 0", implying it is implemented for
ppm_type = 1.
How to reach it
Any non-EB Godunov case, 2D or 3D (EB builds abort on ppm_type != 0 at
CAMR.cpp:196-198), e.g. Exec/Sod with
CAMR.ppm_type = 1 and CAMR.ppm_trace_sources = 1. No output differs from
ppm_trace_sources = 0.
Suggested fix
Warn (and reset) for every ppm_type, since the tracing is not implemented
for either reconstruction; alternatively abort. Re-enabling the commented-out
PPM block would also require removing the hdt*srcQ terms from
hydro_transd/hydro_transdd for the PPM path, otherwise the sources are
applied twice; that is a larger change and not proposed here.
--- a/Source/CAMR.cpp
+++ b/Source/CAMR.cpp
@@ -204,12 +204,13 @@
}
#endif
- // for the moment, ppm_type = 0 does not support ppm_trace_sources --
- // we need to add the momentum sources to the states (and not
- // add it in trans_3d
- if (ppm_type == 0 && ppm_trace_sources == 1) {
+ // Source tracing is not implemented for either reconstruction: the
+ // PPM source block in PPM.cpp is commented out and PLM never had one.
+ // Sources are added in hydro_transd/hydro_transdd instead.
+ if (ppm_trace_sources == 1) {
amrex::Print()
- << "WARNING: ppm_trace_sources = 1 not implemented for ppm_type = 0"
+ << "WARNING: ppm_trace_sources = 1 is not implemented (ppm_type = "
+ << ppm_type << "); sources are added in the transverse step instead"
<< std::endl;
ppm_trace_sources = 0;
pp.add("ppm_trace_sources", ppm_trace_sources);Checked with git apply --check against 17997db
(audit/notes/T4-scratch/005-ppm-trace-sources.diff).
Activity
fix issues 117 118 119 120 121 122 (AMReX-Fluids#124)