Skip to content

Commit 767db7e

Browse files
Fix IFP implementation (#3580)
1 parent 66e7d86 commit 767db7e

File tree

22 files changed

+12
-14
lines changed

22 files changed

+12
-14
lines changed

include/openmc/ifp.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,14 @@ vector<T> _ifp(const T& value, const vector<T>& data)
6868
//!
6969
//! Add the IFP information in the IFP banks using the same index
7070
//! as the one used to append the fission site to the fission bank.
71+
//! The information stored are the delayed group number and lifetime
72+
//! of the neutron that created the fission event.
7173
//! Multithreading protection is guaranteed by the index returned by the
7274
//! thread_safe_append call in physics.cpp.
7375
//!
74-
//! Needs to be done after the delayed group is found.
75-
//!
7676
//! \param[in] p Particle
77-
//! \param[in] site Fission site
7877
//! \param[in] idx Bank index from the thread_safe_append call in physics.cpp
79-
void ifp(const Particle& p, const SourceSite& site, int64_t idx);
78+
void ifp(const Particle& p, int64_t idx);
8079

8180
//! Resize the IFP banks used in the simulation
8281
void resize_simulation_ifp_banks();

include/openmc/particle_data.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ class ParticleData : public GeometryState {
631631
int& event_mt() { return event_mt_; } // MT number of collision
632632
const int& event_mt() const { return event_mt_; }
633633
int& delayed_group() { return delayed_group_; } // delayed group
634+
const int& delayed_group() const { return delayed_group_; }
634635
const int& parent_nuclide() const { return parent_nuclide_; }
635636
int& parent_nuclide() { return parent_nuclide_; } // Parent nuclide
636637

src/ifp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ bool is_generation_time_or_both()
2828
return false;
2929
}
3030

31-
void ifp(const Particle& p, const SourceSite& site, int64_t idx)
31+
void ifp(const Particle& p, int64_t idx)
3232
{
3333
if (is_beta_effective_or_both()) {
3434
const auto& delayed_groups =
3535
simulation::ifp_source_delayed_group_bank[p.current_work() - 1];
3636
simulation::ifp_fission_delayed_group_bank[idx] =
37-
_ifp(site.delayed_group, delayed_groups);
37+
_ifp(p.delayed_group(), delayed_groups);
3838
}
3939
if (is_generation_time_or_both()) {
4040
const auto& lifetimes =

src/particle.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ void Particle::from_source(const SourceSite* src)
144144
time() = src->time;
145145
time_last() = src->time;
146146
parent_nuclide() = src->parent_nuclide;
147+
delayed_group() = src->delayed_group;
147148

148149
// Convert signed surface ID to signed index
149150
if (src->surf_id != SURFACE_NONE) {

src/physics.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,18 +246,15 @@ void create_fission_sites(Particle& p, int i_nuclide, const Reaction& rx)
246246
}
247247
// Iterated Fission Probability (IFP) method
248248
if (settings::ifp_on) {
249-
ifp(p, site, idx);
249+
ifp(p, idx);
250250
}
251251
} else {
252252
p.secondary_bank().push_back(site);
253253
}
254254

255-
// Set the delayed group on the particle as well
256-
p.delayed_group() = site.delayed_group;
257-
258255
// Increment the number of neutrons born delayed
259-
if (p.delayed_group() > 0) {
260-
nu_d[p.delayed_group() - 1]++;
256+
if (site.delayed_group > 0) {
257+
nu_d[site.delayed_group - 1]++;
261258
}
262259

263260
// Write fission particles to nuBank

tests/regression_tests/ifp/results_true.dat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ k-combined:
33
tally 1:
44
9.109384E-08
55
5.667165E-16
6-
6.500000E-02
7-
6.710000E-04
6+
5.200000E-02
7+
5.420000E-04
88
1.489000E+01
99
1.480036E+01
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)