mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
FW-CADIS Disregard Max Realizations Setting (#3616)
This commit is contained in:
parent
70b5254662
commit
230db28d39
3 changed files with 14 additions and 11 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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_);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue