mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Allow Cell::set_temperature to work when not all temperatures were originally
specified
This commit is contained in:
parent
9ddbfd26c9
commit
671e8b49b9
1 changed files with 5 additions and 0 deletions
|
|
@ -258,8 +258,13 @@ Cell::set_temperature(double T, int32_t instance)
|
|||
}
|
||||
|
||||
if (instance >= 0) {
|
||||
// If temperature vector is not big enough, resize it first
|
||||
if (sqrtkT_.size() != n_instances_) sqrtkT_.resize(n_instances_, sqrtkT_[0]);
|
||||
|
||||
// Set temperature for the corresponding instance
|
||||
sqrtkT_.at(instance) = std::sqrt(K_BOLTZMANN * T);
|
||||
} else {
|
||||
// Set temperature for all instances
|
||||
for (auto& T_ : sqrtkT_) {
|
||||
T_ = std::sqrt(K_BOLTZMANN * T);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue