From 2e94189b1bcfa60c70fd6f06912c0757c72f6cdd Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 20 Mar 2019 22:33:54 -0500 Subject: [PATCH] Make sure subcrit multiplication problems abort gracefully when k > 1 --- src/physics.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/physics.cpp b/src/physics.cpp index 3edaf4545e..1cfd316580 100644 --- a/src/physics.cpp +++ b/src/physics.cpp @@ -95,6 +95,14 @@ void sample_neutron_reaction(Particle* p) } else if (settings::run_mode == RUN_MODE_FIXEDSOURCE && settings::create_fission_neutrons) { create_fission_sites(p, i_nuclide, rx, simulation::secondary_bank); + + // Make sure particle population doesn't grow out of control for + // subcritical multiplication problems. + if (simulation::secondary_bank.size() >= 10000) { + fatal_error("The secondary particle bank appears to be growing without " + "bound. You are likely running a subcritical multiplication problem " + "with k-effective close to or greater than one."); + } } }