mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-25 20:45:35 -04:00
Implementation of time distribution for the source
This commit is contained in:
parent
d12e390f1a
commit
d93df33dfb
3 changed files with 48 additions and 8 deletions
|
|
@ -46,11 +46,12 @@ vector<unique_ptr<Source>> external_sources;
|
|||
// IndependentSource implementation
|
||||
//==============================================================================
|
||||
|
||||
IndependentSource::IndependentSource(
|
||||
UPtrSpace space, UPtrAngle angle, UPtrDist energy)
|
||||
: space_ {std::move(space)}, angle_ {std::move(angle)}, energy_ {
|
||||
std::move(energy)}
|
||||
{}
|
||||
IndependentSource::IndependentSource(UPtrSpace space, UPtrAngle angle, UPtrDist energy, UPtrDist time)
|
||||
: space_{std::move(space)},
|
||||
angle_{std::move(angle)},
|
||||
energy_{std::move(energy)},
|
||||
time_{std::move(time)}
|
||||
{ }
|
||||
|
||||
IndependentSource::IndependentSource(pugi::xml_node node)
|
||||
{
|
||||
|
|
@ -140,6 +141,17 @@ IndependentSource::IndependentSource(pugi::xml_node node)
|
|||
// Default to a Watt spectrum with parameters 0.988 MeV and 2.249 MeV^-1
|
||||
energy_ = UPtrDist {new Watt(0.988e6, 2.249e-6)};
|
||||
}
|
||||
|
||||
// Determine external source time distribution
|
||||
if (check_for_node(node, "time")) {
|
||||
pugi::xml_node node_dist = node.child("time");
|
||||
time_ = distribution_from_xml(node_dist);
|
||||
} else {
|
||||
// Default to a Constant time T=0
|
||||
double T[] {0.0};
|
||||
double p[] {1.0};
|
||||
time_ = UPtrDist {new Discrete{T, p, 1}};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -224,6 +236,9 @@ SourceSite IndependentSource::sample(uint64_t* seed) const
|
|||
break;
|
||||
}
|
||||
|
||||
// Sample particle creation time
|
||||
site.time = time_->sample(seed);
|
||||
|
||||
return site;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue