Repository navigation
Three accepted options do nothing or abort later: incflo.test_tracer_conservation (consumer commented out; 8 decks set it), incflo.ic_p (sets m_p000, which nothing reads), amr.plt_divu / "divu" (documented, aborts "xxxxx TODO" at the first plotfile) #264
Description
Severity: low · Category: correctness
Locations: src/setup/init.cpp:70, src/incflo_advance.cpp:89-94, src/setup/init.cpp:146, src/setup/set_background_pressure.cpp:7, src/incflo.H:513, src/setup/init.cpp:383-386, src/setup/init.cpp:426-429, src/utilities/io.cpp:675-678, Docs/sphinx_documentation/source/InputsPlotFiles.rst:69
Based on commit 46de3367 (line numbers refer to that tree).
The defect
Three inputs are parsed by ReadParameters/ReadIOParameters and then have no live consumer:
incflo.test_tracer_conservation(init.cpp:70 ->m_test_tracer_conservation). Its only use is the
commented-out block at the end ofAdvance(incflo_advance.cpp:89-94):Eight shipped decks set it to// // This sums over all levels // if (m_test_tracer_conservation) { // Real sum = volumeWeightedSum(get_tracer_new_const(),0,geom,ref_ratio);
true(test_{2d,3d}/benchmark.tracer_advection,
benchmark.tracer_adv_diff,benchmark.tracer_adv_diff_cn,benchmark.bds_tracer_advection; the three
test_3d/test_redistribution/benchmark.periodic_box_{x,y,z}decks set it tofalse) -- they are
the tracer-advection regression tests, i.e. exactly the runs the diagnostic was written for -- and get no
output.amrex::volumeWeightedSum(Vector<MultiFab const*>, int, Vector<Geometry> const&, Vector<IntVect> const&, bool)
exists in the pinned AMReX (Src/Base/AMReX_MultiFabUtil.H:552, EB-volume weighted), so the block was
disabled for no remaining reason.incflo.ic_p(init.cpp:146 ->m_ic_p).set_background_pressurecopies it intom_p000
(set_background_pressure.cpp:7, "background pressure at node (0,0,0)", incflo.H:513) and no code reads
m_p000(grep -rn m_p000 srcfinds only those two lines). 41 shipped decks setincflo.ic_p(all to 0.0,
so no shipped result changes); a user setting a non-zero initial pressure getsp = 0.amr.plt_divu/ the plot variabledivu.ReadIOParametersacceptsplt_divu(init.cpp:383-386) and
amr.plotVariables = ... divu(426-429) andWritePlotVariablesthen does
amrex::Abort("plt_divu: xxxxx TODO")(io.cpp:675-678). The option is documented as working
(InputsPlotFiles.rst:69, "Save velocity divergence to plot file"). Because plotfiles are written after
the whole initialisation (EB generation, initial projection, initial iterations), the abort comes at the
end ofInitData, not at read time; issue 001 (steady_state) and PR fix issue 177 178 179 #212'sKE_intfix are the same
pattern.
Why it matters
Options that are accepted and silently do nothing (1, 2) hide the fact that the tracer-conservation check
the regression decks request is not being made, and that an initial pressure cannot be prescribed; option 3
costs a full initialisation before failing with a message that reads like an internal note. No wrong numbers
in shipped runs (all ic_p values are 0).
How to reach it
Any build. test_2d/benchmark.tracer_advection (sets incflo.test_tracer_conservation = true): no
"Sum tracer" line is ever printed. test_no_eb_2d/benchmark.taylor_green_vortices with
amr.plot_per_exact=-1 amr.plot_int=1 amr.plt_divu=1: amrex::Abort::0::plt_divu: xxxxx TODO after
InitialIterations, at the step-0 plotfile (confirmed with a DEBUG 2D build). Any deck with
incflo.ic_p = 5: p in plt00000 is 0.
Suggested fix
Re-enable the conservation print with the AMReX helper, and refuse divu when the plot list is read (the
m_p000 member should either be wired into the pressure initialisation or removed together with ic_p;
that is a design decision, so no diff for item 2). Diff checked with git apply --check
(audit/notes/T9-scratch/034.diff) and compiled/run with a DEBUG 2D no-EB build: bouss_bubble_god with
incflo.test_tracer_conservation=1 prints Sum tracer volume wgt2 = 0.2 0.004697265625 after each step;
amr.plotVariables="velx divu" aborts in ReadIOParameters.
--- a/src/incflo_advance.cpp
+++ b/src/incflo_advance.cpp
@@ -86,12 +86,12 @@
particleData.Redistribute();
#endif
- // // This sums over all levels
- // if (m_test_tracer_conservation) {
- // Real sum = volumeWeightedSum(get_tracer_new_const(),0,geom,ref_ratio);
- // amrex::Print() << "Sum tracer volume wgt2 = " << m_cur_time+m_dt << " " <<
- // sum << "\n";
- // }
+ // This sums over all levels (and weights by the EB volume fraction)
+ if (m_test_tracer_conservation && m_advect_tracer) {
+ Real sum = amrex::volumeWeightedSum(get_tracer_new_const(),0,geom,ref_ratio);
+ amrex::Print() << "Sum tracer volume wgt2 = " << m_cur_time+m_dt << " " <<
+ sum << "\n";
+ }
// Stop timing current time step
Real end_step = static_cast<Real>(ParallelDescriptor::second()) - strt_step;
--- a/src/setup/init.cpp
+++ b/src/setup/init.cpp
@@ -428,6 +428,14 @@
pp.queryarr("plotVariables", m_plotVars);
}
+ // "divu" is accepted by the parser but WritePlotVariables only aborts on
+ // it; refuse it here rather than at the first plotfile.
+ for (auto const& v : m_plotVars) {
+ if (v == "divu") {
+ amrex::Abort("plotfile variable 'divu' (amr.plt_divu) is not implemented");
+ }
+ }
+
// Small plot options
pp.query("smallplot_file" , m_smallplot_file);
pp.query("smallplot_int" , m_smallplot_int);
Activity
Fix issues AMReX-Fluids#250-264 (AMReX-Fluids#267)