mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Fix weight modification for uniform source sampling (#3395)
Co-authored-by: Patrick Shriwise <pshriwise@gmail.com>
This commit is contained in:
parent
dc619eac17
commit
e4f55a57b6
6 changed files with 34 additions and 23 deletions
|
|
@ -620,13 +620,6 @@ void read_settings_xml(pugi::xml_node root)
|
|||
model::external_sources.push_back(make_unique<FileSource>(path));
|
||||
}
|
||||
|
||||
// Build probability mass function for sampling external sources
|
||||
vector<double> source_strengths;
|
||||
for (auto& s : model::external_sources) {
|
||||
source_strengths.push_back(s->strength());
|
||||
}
|
||||
model::external_sources_probability.assign(source_strengths);
|
||||
|
||||
// If no source specified, default to isotropic point source at origin with
|
||||
// Watt spectrum. No default source is needed in random ray mode.
|
||||
if (model::external_sources.empty() &&
|
||||
|
|
@ -639,6 +632,13 @@ void read_settings_xml(pugi::xml_node root)
|
|||
UPtrDist {new Discrete(T, p, 1)}));
|
||||
}
|
||||
|
||||
// Build probability mass function for sampling external sources
|
||||
vector<double> source_strengths;
|
||||
for (auto& s : model::external_sources) {
|
||||
source_strengths.push_back(s->strength());
|
||||
}
|
||||
model::external_sources_probability.assign(source_strengths);
|
||||
|
||||
// Check if we want to write out source
|
||||
if (check_for_node(root, "write_initial_source")) {
|
||||
write_initial_source = get_node_value_bool(root, "write_initial_source");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue