diff --git a/include/openmc/particle.h b/include/openmc/particle.h index 1c3e64bf88..134ebc1050 100644 --- a/include/openmc/particle.h +++ b/include/openmc/particle.h @@ -169,6 +169,13 @@ public: int64_t parent_id; bool operator < (const Bank & bank) const{ return (parent_id < bank.parent_id); } }; + + //! Saved ("banked") state of a particle, for nu-fission tallying + struct NuBank { + double E; + double wgt; + int delayed_group; + }; //========================================================================== // Constructors @@ -321,6 +328,8 @@ public: std::vector filter_matches_; std::vector> tracks_; + + NuBank nu_bank_[10]; }; } // namespace openmc diff --git a/src/physics.cpp b/src/physics.cpp index 0321aa87bb..8d0af575c6 100644 --- a/src/physics.cpp +++ b/src/physics.cpp @@ -205,6 +205,14 @@ create_fission_sites(Particle* p, int i_nuclide, const Reaction* rx, if (p->delayed_group_ > 0) { nu_d[p->delayed_group_-1]++; } + + // Write fission particles to nuBank + if(use_fission_bank) + { + p->nu_bank_[i].wgt = site->wgt; + p->nu_bank_[i].E = site->E; + p->nu_bank_[i].delayed_group = site->delayed_group; + } } // Store the total weight banked for analog fission tallies diff --git a/src/tallies/tally_scoring.cpp b/src/tallies/tally_scoring.cpp index b3f1b36763..5782907184 100644 --- a/src/tallies/tally_scoring.cpp +++ b/src/tallies/tally_scoring.cpp @@ -331,8 +331,9 @@ score_fission_eout(Particle* p, int i_tally, int i_score, int score_bin) // loop over number of particles banked for (auto i = 0; i < p->n_bank_; ++i) { - auto i_bank = simulation::fission_bank.size() - p->n_bank_ + i; - const auto& bank = simulation::fission_bank[i_bank]; + //auto i_bank = simulation::fission_bank.size() - p->n_bank_ + i; //TODO: This is breaking event-based right here + //const auto& bank = simulation::fission_bank[i_bank]; + const auto& bank = p->nu_bank_[i]; // get the delayed group auto g = bank.delayed_group; @@ -952,9 +953,11 @@ score_general_ce(Particle* p, int i_tally, int start_index, // ones are delayed. If a delayed neutron is encountered, add its // contribution to the fission bank to the score. score = 0.; + // TODO: This breaks event-based for (auto i = 0; i < p->n_bank_; ++i) { - auto i_bank = simulation::fission_bank.size() - p->n_bank_ + i; - const auto& bank = simulation::fission_bank[i_bank]; + //auto i_bank = simulation::fission_bank.size() - p->n_bank_ + i; + //const auto& bank = simulation::fission_bank[i_bank]; + const auto& bank = p->nu_bank_[i]; auto g = bank.delayed_group; if (g != 0) { const auto& nuc {*data::nuclides[p->event_nuclide_]}; @@ -1871,9 +1874,15 @@ score_general_mg(Particle* p, int i_tally, int start_index, // ones are delayed. If a delayed neutron is encountered, add its // contribution to the fission bank to the score. score = 0.; + // TODO: This breaks event-based + // Needs: + // delayed_group + // wgt + // for (auto i = 0; i < p->n_bank_; ++i) { - auto i_bank = simulation::fission_bank.size() - p->n_bank_ + i; - const auto& bank = simulation::fission_bank[i_bank]; + //auto i_bank = simulation::fission_bank.size() - p->n_bank_ + i; + //const auto& bank = simulation::fission_bank[i_bank]; + const auto& bank = p->nu_bank_[i]; auto d = bank.delayed_group - 1; if (d != -1) { if (i_nuclide >= 0) {