FW-CADIS Disregard Max Realizations Setting (#3616)

This commit is contained in:
John Tramm 2025-10-28 03:22:37 -05:00 committed by GitHub
parent 70b5254662
commit 230db28d39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 11 deletions

View file

@ -133,8 +133,7 @@ random ray mode can be found in the :ref:`Random Ray User Guide <random_ray>`.
# we used for source region decomposition
wwg = openmc.WeightWindowGenerator(
method='fw_cadis',
mesh=mesh,
max_realizations=settings.batches
mesh=mesh
)
# Add generator to openmc.settings object

View file

@ -400,11 +400,8 @@ void finalize_batch()
simulation::time_tallies.stop();
// update weight windows if needed
if (settings::solver_type != SolverType::RANDOM_RAY ||
simulation::current_batch == settings::n_batches) {
for (const auto& wwg : variance_reduction::weight_windows_generators) {
wwg->update();
}
for (const auto& wwg : variance_reduction::weight_windows_generators) {
wwg->update();
}
// Reset global tally results

View file

@ -26,6 +26,7 @@
#include "openmc/random_ray/flat_source_domain.h"
#include "openmc/search.h"
#include "openmc/settings.h"
#include "openmc/simulation.h"
#include "openmc/tallies/filter_energy.h"
#include "openmc/tallies/filter_mesh.h"
#include "openmc/tallies/filter_particle.h"
@ -966,11 +967,17 @@ void WeightWindowsGenerator::update() const
Tally* tally = model::tallies[tally_idx_].get();
// if we're beyond the number of max realizations or not at the corrrect
// update interval, skip the update
if (max_realizations_ < tally->n_realizations_ ||
tally->n_realizations_ % update_interval_ != 0)
// If in random ray mode, only update on the last batch
if (settings::solver_type == SolverType::RANDOM_RAY) {
if (simulation::current_batch != settings::n_batches) {
return;
}
// If in Monte Carlo mode and beyond the number of max realizations or
// not at the correct update interval, skip the update
} else if (max_realizations_ < tally->n_realizations_ ||
tally->n_realizations_ % update_interval_ != 0) {
return;
}
wws->update_weights(tally, tally_value_, threshold_, ratio_, method_);