From 5e640f79ab8912046a404deebcbcade586cb1d25 Mon Sep 17 00:00:00 2001 From: John Tramm Date: Wed, 8 Jan 2020 21:04:48 +0000 Subject: [PATCH] fixed event-based issue. Moving particle allocation to once per simulation was causing incorrect answers. The cause was that the particle tally accumulators were not being reset to 0 each iteration. The fix was to reset the particle acccumulation variables at particle death (could instead be done in initialize_history() function, if desired). --- .travis.yml | 4 ++-- src/particle.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3df52ab41..f2794d051 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,9 +32,9 @@ env: matrix: include: - python: "3.7" - env: OMP=y MPI=y PHDF5=y DAGMC=y EVENT_BASED=y + env: OMP=y MPI=n PHDF5=n DAGMC=n EVENT_BASED=y - python: "3.7" - env: OMP=y MPI=y PHDF5=y DAGMC=y EVENT_BASED=n + env: OMP=y MPI=n PHDF5=n DAGMC=n EVENT_BASED=n notifications: webhooks: https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN install: diff --git a/src/particle.cpp b/src/particle.cpp index b2f32a8a2..7a9e20deb 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -391,6 +391,12 @@ Particle::event_death() global_tally_tracklength += tally_tracklength_; #pragma omp atomic global_tally_leakage += tally_leakage_; + + // Reset particle tallies once accumulated + tally_absorption_ = 0.0; + tally_collision_ = 0.0; + tally_tracklength_ = 0.0; + tally_leakage_ = 0.0; }