mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Generalize russian_roulette function
This commit is contained in:
parent
f18caa1712
commit
de50a7bfca
5 changed files with 18 additions and 23 deletions
|
|
@ -9,15 +9,13 @@ namespace openmc {
|
|||
// RUSSIAN_ROULETTE
|
||||
//==============================================================================
|
||||
|
||||
void russian_roulette(Particle& p)
|
||||
void russian_roulette(Particle& p, double weight_survive)
|
||||
{
|
||||
if (p.wgt() < settings::weight_cutoff) {
|
||||
if (settings::weight_survive * prn(p.current_seed()) < p.wgt()) {
|
||||
p.wgt() = settings::weight_survive;
|
||||
} else {
|
||||
p.wgt() = 0.;
|
||||
p.alive() = false;
|
||||
}
|
||||
if (weight_survive * prn(p.current_seed()) < p.wgt()) {
|
||||
p.wgt() = weight_survive;
|
||||
} else {
|
||||
p.wgt() = 0.;
|
||||
p.alive() = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue