cj_detonation uses inconsistent density-grid spacing and misses amrex::Finalize()
Summary
util/cj_detonation/main.cpp computes dlogrho using npts (100) but iterates over npts_ad (150), so sampled densities overshoot intended rho_max. The same function returns without calling amrex::Finalize().
Severity
High
Affected Code
util/cj_detonation/main.cpp
- grid setup around lines 41-42 and 97
- sampling loop around lines 134-137
- process exit around line 159
Why This Is a Bug
- Density spacing mismatch distorts Hugoniot/adiabat sampling and can produce out-of-range physical states.
- Missing
amrex::Finalize() is inconsistent with other AMReX drivers in this repo and can skip orderly runtime teardown.
Proposed Patch
- Compute
dlogrho from the same point count used by the loop (npts_ad).
- Call
amrex::Finalize() before returning from main().
--- a/util/cj_detonation/main.cpp
+++ b/util/cj_detonation/main.cpp
@@
- Real dlogrho = (std::log10(rho_max) - std::log10(rho_min)) / static_cast<Real>(npts-1);
+ Real dlogrho = (std::log10(rho_max) - std::log10(rho_min)) / static_cast<Real>(npts_ad-1);
@@
- return 0;
+ amrex::Finalize();
+ return 0;
Validation
- Verify first/last sampled
rho in output match rho_min and rho_max (within floating-point tolerance).
- Run executable and confirm normal completion with AMReX teardown behavior consistent with other tools.
cj_detonationuses inconsistent density-grid spacing and missesamrex::Finalize()Summary
util/cj_detonation/main.cppcomputesdlogrhousingnpts(100) but iterates overnpts_ad(150), so sampled densities overshoot intendedrho_max. The same function returns without callingamrex::Finalize().Severity
High
Affected Code
util/cj_detonation/main.cppWhy This Is a Bug
amrex::Finalize()is inconsistent with other AMReX drivers in this repo and can skip orderly runtime teardown.Proposed Patch
dlogrhofrom the same point count used by the loop (npts_ad).amrex::Finalize()before returning frommain().Validation
rhoin output matchrho_minandrho_max(within floating-point tolerance).