mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 05:05:30 -04:00
Merge pull request #2323 from joshmay1/unset_temp
Add capability to unset cell temperatures
This commit is contained in:
commit
a8a6f6c49b
2 changed files with 5 additions and 2 deletions
|
|
@ -318,12 +318,12 @@ class Cell(IDManagerMixin):
|
|||
@temperature.setter
|
||||
def temperature(self, temperature):
|
||||
# Make sure temperatures are positive
|
||||
cv.check_type('cell temperature', temperature, (Iterable, Real))
|
||||
cv.check_type('cell temperature', temperature, (Iterable, Real), none_ok=True)
|
||||
if isinstance(temperature, Iterable):
|
||||
cv.check_type('cell temperature', temperature, Iterable, Real)
|
||||
for T in temperature:
|
||||
cv.check_greater_than('cell temperature', T, 0.0, True)
|
||||
else:
|
||||
elif isinstance(temperature, Real):
|
||||
cv.check_greater_than('cell temperature', temperature, 0.0, True)
|
||||
|
||||
# If this cell is filled with a universe or lattice, propagate
|
||||
|
|
|
|||
|
|
@ -92,6 +92,9 @@ def test_temperature(cell_with_lattice):
|
|||
assert c2.temperature == 400.0
|
||||
with pytest.raises(ValueError):
|
||||
c.temperature = -100.
|
||||
c.temperature = None
|
||||
assert c1.temperature == None
|
||||
assert c2.temperature == None
|
||||
|
||||
# distributed temperature
|
||||
cells, _, _, _ = cell_with_lattice
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue