mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
helpful error message for excessive energy spectrum rejection rate
This commit is contained in:
parent
11f8d6eb29
commit
cf278af281
1 changed files with 13 additions and 4 deletions
|
|
@ -201,14 +201,12 @@ SourceSite IndependentSource::sample(uint64_t* seed) const
|
|||
if (n_reject >= EXTSRC_REJECT_THRESHOLD &&
|
||||
static_cast<double>(n_accept) / n_reject <= EXTSRC_REJECT_FRACTION) {
|
||||
fatal_error("More than 95% of external source sites sampled were "
|
||||
"rejected. Please check your external source definition.");
|
||||
"rejected. Please check your external source's spatial "
|
||||
"definition.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Increment number of accepted samples
|
||||
++n_accept;
|
||||
|
||||
// Sample angle
|
||||
site.u = angle_->sample(seed);
|
||||
|
||||
|
|
@ -233,11 +231,22 @@ SourceSite IndependentSource::sample(uint64_t* seed) const
|
|||
// Resample if energy falls outside minimum or maximum particle energy
|
||||
if (site.E < data::energy_max[p] && site.E > data::energy_min[p])
|
||||
break;
|
||||
|
||||
n_reject++;
|
||||
if (n_reject >= EXTSRC_REJECT_THRESHOLD &&
|
||||
static_cast<double>(n_accept) / n_reject <= EXTSRC_REJECT_FRACTION) {
|
||||
fatal_error("More than 95% of external source sites sampled were "
|
||||
"rejected. Please check your external source energy spectrum "
|
||||
"definition.");
|
||||
}
|
||||
}
|
||||
|
||||
// Sample particle creation time
|
||||
site.time = time_->sample(seed);
|
||||
|
||||
// Increment number of accepted samples
|
||||
++n_accept;
|
||||
|
||||
return site;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue