Allow temperatures to be assigned to heterogeneous cells

This commit is contained in:
Paul Romano 2016-09-23 14:49:46 -05:00
parent 459d3375ca
commit 7175f8ed44

View file

@ -291,6 +291,7 @@ class Cell(object):
@temperature.setter
def temperature(self, temperature):
# Make sure temperatures are positive
cv.check_type('cell temperature', temperature, (Iterable, Real))
if isinstance(temperature, Iterable):
cv.check_type('cell temperature', temperature, Iterable, Real)
@ -298,7 +299,15 @@ class Cell(object):
cv.check_greater_than('cell temperature', T, 0.0, True)
else:
cv.check_greater_than('cell temperature', temperature, 0.0, True)
self._temperature = temperature
# If this cell is filled with a universe or lattice, propagate
# temperatures to all cells contained. Otherwise, simply assign it.
if self.fill_type in ('universe', 'lattice'):
for c in self.get_all_cells().values():
if c.fill_type == 'material':
c._temperature = temperature
else:
self._temperature = temperature
@offsets.setter
def offsets(self, offsets):