Merge pull request #1911 from paulromano/lost-particle-fix

Ensure particles lost during event_calculate_xs are terminated
This commit is contained in:
Patrick Shriwise 2021-11-23 15:07:01 -06:00 committed by GitHub
commit 3e195382e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -95,13 +95,11 @@ void run_particle_restart()
int64_t particle_seed;
switch (previous_run_mode) {
case RunMode::EIGENVALUE:
case RunMode::FIXED_SOURCE:
particle_seed = (simulation::total_gen + overall_generation() - 1) *
settings::n_particles +
p.id();
break;
case RunMode::FIXED_SOURCE:
particle_seed = p.id();
break;
default:
throw std::runtime_error {
"Unexpected run mode: " +

View file

@ -679,6 +679,8 @@ void transport_history_based_single_particle(Particle& p)
{
while (true) {
p.event_calculate_xs();
if (!p.alive())
break;
p.event_advance();
if (p.collision_distance() > p.boundary().distance) {
p.event_cross_surface();