Fix IFP implementation (#3580)

This commit is contained in:
Joffrey Dorville 2025-09-25 14:58:29 -05:00 committed by GitHub
parent 66e7d8634c
commit 767db7e6a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 12 additions and 14 deletions

View file

@ -68,15 +68,14 @@ vector<T> _ifp(const T& value, const vector<T>& data)
//!
//! Add the IFP information in the IFP banks using the same index
//! as the one used to append the fission site to the fission bank.
//! The information stored are the delayed group number and lifetime
//! of the neutron that created the fission event.
//! Multithreading protection is guaranteed by the index returned by the
//! thread_safe_append call in physics.cpp.
//!
//! Needs to be done after the delayed group is found.
//!
//! \param[in] p Particle
//! \param[in] site Fission site
//! \param[in] idx Bank index from the thread_safe_append call in physics.cpp
void ifp(const Particle& p, const SourceSite& site, int64_t idx);
void ifp(const Particle& p, int64_t idx);
//! Resize the IFP banks used in the simulation
void resize_simulation_ifp_banks();

View file

@ -631,6 +631,7 @@ public:
int& event_mt() { return event_mt_; } // MT number of collision
const int& event_mt() const { return event_mt_; }
int& delayed_group() { return delayed_group_; } // delayed group
const int& delayed_group() const { return delayed_group_; }
const int& parent_nuclide() const { return parent_nuclide_; }
int& parent_nuclide() { return parent_nuclide_; } // Parent nuclide

View file

@ -28,13 +28,13 @@ bool is_generation_time_or_both()
return false;
}
void ifp(const Particle& p, const SourceSite& site, int64_t idx)
void ifp(const Particle& p, int64_t idx)
{
if (is_beta_effective_or_both()) {
const auto& delayed_groups =
simulation::ifp_source_delayed_group_bank[p.current_work() - 1];
simulation::ifp_fission_delayed_group_bank[idx] =
_ifp(site.delayed_group, delayed_groups);
_ifp(p.delayed_group(), delayed_groups);
}
if (is_generation_time_or_both()) {
const auto& lifetimes =

View file

@ -144,6 +144,7 @@ void Particle::from_source(const SourceSite* src)
time() = src->time;
time_last() = src->time;
parent_nuclide() = src->parent_nuclide;
delayed_group() = src->delayed_group;
// Convert signed surface ID to signed index
if (src->surf_id != SURFACE_NONE) {

View file

@ -246,18 +246,15 @@ void create_fission_sites(Particle& p, int i_nuclide, const Reaction& rx)
}
// Iterated Fission Probability (IFP) method
if (settings::ifp_on) {
ifp(p, site, idx);
ifp(p, idx);
}
} else {
p.secondary_bank().push_back(site);
}
// Set the delayed group on the particle as well
p.delayed_group() = site.delayed_group;
// Increment the number of neutrons born delayed
if (p.delayed_group() > 0) {
nu_d[p.delayed_group() - 1]++;
if (site.delayed_group > 0) {
nu_d[site.delayed_group - 1]++;
}
// Write fission particles to nuBank

View file

@ -3,7 +3,7 @@ k-combined:
tally 1:
9.109384E-08
5.667165E-16
6.500000E-02
6.710000E-04
5.200000E-02
5.420000E-04
1.489000E+01
1.480036E+01