mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Fix Weight Window Infinite Loop Bug (#3457)
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
eaef13b9bc
commit
7c6aaf7204
2 changed files with 15 additions and 1 deletions
|
|
@ -47,7 +47,7 @@ struct SourceSite {
|
|||
double time {0.0};
|
||||
double wgt {1.0};
|
||||
int delayed_group {0};
|
||||
int surf_id {0};
|
||||
int surf_id {SURFACE_NONE};
|
||||
ParticleType particle;
|
||||
|
||||
// Extra attributes that don't show up in source written to file
|
||||
|
|
|
|||
|
|
@ -104,6 +104,14 @@ void Particle::split(double wgt)
|
|||
bank.u = u();
|
||||
bank.E = settings::run_CE ? E() : g();
|
||||
bank.time = time();
|
||||
|
||||
// Convert signed index to a singed surface ID
|
||||
if (surface() == SURFACE_NONE) {
|
||||
bank.surf_id = SURFACE_NONE;
|
||||
} else {
|
||||
int surf_id = model::surfaces[surface_index()]->id_;
|
||||
bank.surf_id = (surface() > 0) ? surf_id : -surf_id;
|
||||
}
|
||||
}
|
||||
|
||||
void Particle::from_source(const SourceSite* src)
|
||||
|
|
@ -140,6 +148,12 @@ void Particle::from_source(const SourceSite* src)
|
|||
time() = src->time;
|
||||
time_last() = src->time;
|
||||
parent_nuclide() = src->parent_nuclide;
|
||||
|
||||
// Convert signed surface ID to signed index
|
||||
if (src->surf_id != SURFACE_NONE) {
|
||||
int index_plus_one = model::surface_map[std::abs(src->surf_id)] + 1;
|
||||
surface() = (src->surf_id > 0) ? index_plus_one : -index_plus_one;
|
||||
}
|
||||
}
|
||||
|
||||
void Particle::event_calculate_xs()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue