Diffusion ring problems miss MHD guard
Summary
The diffusion problem generator rejects Euler runs for magnetic iprob values 0, 1,
2, 10, 20, and 40, but not for iprob=21 or iprob=22.
Why this is a bug
Both iprob=21 and iprob=22 initialize magnetic field components (IB1..IB3).
With hydro/fluid=euler, those components are not allocated. The current guard lets
those inputs through and then writes out of bounds inside the initialization kernel.
Patch
diff --git a/src/pgen/diffusion.cpp b/src/pgen/diffusion.cpp
--- a/src/pgen/diffusion.cpp
+++ b/src/pgen/diffusion.cpp
@@
- PARTHENON_REQUIRE_THROWS(mhd_enabled || !(iprob == 0 || iprob == 1 || iprob == 2 ||
- iprob == 10 || iprob == 20 || iprob == 40),
+ PARTHENON_REQUIRE_THROWS(mhd_enabled || !(iprob == 0 || iprob == 1 || iprob == 2 ||
+ iprob == 10 || iprob == 20 || iprob == 21 ||
+ iprob == 22 || iprob == 40),
"Selected iprob for diffusion pgen requires MHD enabled.")
Diffusion ring problems miss MHD guard
Summary
The diffusion problem generator rejects Euler runs for magnetic
iprobvalues 0, 1,2, 10, 20, and 40, but not for
iprob=21oriprob=22.Why this is a bug
Both
iprob=21andiprob=22initialize magnetic field components (IB1..IB3).With
hydro/fluid=euler, those components are not allocated. The current guard letsthose inputs through and then writes out of bounds inside the initialization kernel.
Patch