Resolve conflict with weight windows and global russian roulette (#3751)

Co-authored-by: Patrick Shriwise <pshriwise@gmail.com>
This commit is contained in:
GuySten 2026-02-25 22:01:33 +02:00 committed by GitHub
parent 5a85bd92f2
commit c0427dd40a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 748 additions and 154 deletions

View file

@ -13,5 +13,9 @@ namespace openmc {
//! \param[in] weight_survive Weight assigned to particles that survive
void russian_roulette(Particle& p, double weight_survive);
//! \brief Performs the global russian roulette operation on a particle
//! \param[in,out] p Particle object
void apply_russian_roulette(Particle& p);
} // namespace openmc
#endif // OPENMC_PHYSICS_COMMON_H

View file

@ -25,17 +25,6 @@ enum class WeightWindowUpdateMethod { MAGIC, FW_CADIS };
constexpr double DEFAULT_WEIGHT_CUTOFF {1.0e-38}; // default low weight cutoff
//==============================================================================
// Non-member functions
//==============================================================================
//! Apply weight windows to a particle
//! \param[in] p Particle to apply weight windows to
void apply_weight_windows(Particle& p);
//! Free memory associated with weight windows
void free_memory_weight_windows();
//==============================================================================
// Global variables
//==============================================================================
@ -137,7 +126,7 @@ public:
//! Retrieve the weight window for a particle
//! \param[in] p Particle to get weight window for
WeightWindow get_weight_window(const Particle& p) const;
std::pair<bool, WeightWindow> get_weight_window(const Particle& p) const;
std::array<int, 2> bounds_size() const;
@ -236,6 +225,26 @@ public:
double ratio_ {5.0}; //<! ratio of lower to upper weight window bounds
};
//==============================================================================
// Non-member functions
//==============================================================================
//! Apply weight windows to a particle
//! \param[in] p Particle to apply weight windows to
void apply_weight_windows(Particle& p);
//! Apply weight window to a particle
//! \param[in] p Particle to apply weight window to
//! \param[in] weight_window WeightWindow to apply
void apply_weight_window(Particle& p, WeightWindow weight_window);
//! Free memory associated with weight windows
void free_memory_weight_windows();
//! Search weight window that apply to a particle
//! \param[in] p Particle to search weight window for
std::pair<bool, WeightWindow> search_weight_window(const Particle& p);
//! Finalize variance reduction objects after all inputs have been read
void finalize_variance_reduction();