mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Fix void distribmats
This commit is contained in:
parent
e2a8b96cfd
commit
9505744291
5 changed files with 24 additions and 14 deletions
|
|
@ -113,8 +113,11 @@ class Cell(object):
|
|||
string += '{0: <16}{1}{2}\n'.format('\tMaterial', '=\t',
|
||||
self._fill._id)
|
||||
elif isinstance(self._fill, Iterable):
|
||||
string += ('{0: <16}{1}'.format('\tMaterial', '=\t')
|
||||
+ '[' + ', '.join([str(m.id) for m in self.fill]) + ']\n')
|
||||
string += '{0: <16}{1}'.format('\tMaterial', '=\t')
|
||||
string += '['
|
||||
string += ', '.join(['void' if m == 'void' else str(m.id)
|
||||
for m in self.fill])
|
||||
string += ']\n'
|
||||
elif isinstance(self._fill, (Universe, Lattice)):
|
||||
string += '{0: <16}{1}{2}\n'.format('\tFill', '=\t',
|
||||
self._fill._id)
|
||||
|
|
@ -209,7 +212,8 @@ class Cell(object):
|
|||
self._type = 'normal'
|
||||
|
||||
elif isinstance(fill, Iterable):
|
||||
cv.check_type('cell.fill', fill, Iterable, openmc.Material)
|
||||
cv.check_type('cell.fill', fill, Iterable,
|
||||
(openmc.Material, basestring))
|
||||
self._type = 'normal'
|
||||
|
||||
elif isinstance(fill, Universe):
|
||||
|
|
@ -402,7 +406,8 @@ class Cell(object):
|
|||
element.set("material", str(self._fill._id))
|
||||
|
||||
elif isinstance(self._fill, Iterable):
|
||||
element.set("material", ' '.join([str(m.id) for m in self.fill]))
|
||||
element.set("material", ' '.join([m if m == 'void' else str(m.id)
|
||||
for m in self.fill]))
|
||||
|
||||
elif isinstance(self._fill, (Universe, Lattice)):
|
||||
element.set("fill", str(self._fill._id))
|
||||
|
|
|
|||
|
|
@ -152,12 +152,20 @@ contains
|
|||
case (CELL_NORMAL)
|
||||
call write_dataset(cell_group, "fill_type", "normal")
|
||||
if (size(c % material) == 1) then
|
||||
call write_dataset(cell_group, "material", &
|
||||
materials(c % material(1)) % id)
|
||||
if (c % material(1) == MATERIAL_VOID) then
|
||||
call write_dataset(cell_group, "material", MATERIAL_VOID)
|
||||
else
|
||||
call write_dataset(cell_group, "material", &
|
||||
materials(c % material(1)) % id)
|
||||
end if
|
||||
else
|
||||
allocate(cell_materials(size(c % material)))
|
||||
do j = 1, size(c % material)
|
||||
cell_materials(j) = materials(c % material(j)) % id
|
||||
if (c % material(j) == MATERIAL_VOID) then
|
||||
cell_materials(j) = MATERIAL_VOID
|
||||
else
|
||||
cell_materials(j) = materials(c % material(j)) % id
|
||||
end if
|
||||
end do
|
||||
call write_dataset(cell_group, "material", cell_materials)
|
||||
deallocate(cell_materials)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
24a3537446feafcf79fc84d268b43130e9521ad7cccfcf733ba35ca50bf3c644e0b8e91bfdef7bdb4073783197cfdd730d1e459fc622aa3ce6dcf3143c805a1f
|
||||
bdc2acd3a4f5078c61d7cb83ff30e07b76c89b21d8131c1b0ce86a43156da7bd0b9ebb5d6acc0b98a7d8128667f99403ef12a6d76ed2ec6cb187810222e4f6b3
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
k-combined:
|
||||
1.433669E+00 7.069157E-03
|
||||
1.309285E+00 1.263629E-02
|
||||
Cell
|
||||
ID = 11
|
||||
Name =
|
||||
Material = [2, 3, 2, 2]
|
||||
Material = [2, 3, void, 2]
|
||||
Region = -10000
|
||||
Rotation = None
|
||||
Translation = None
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class DistribmatTestHarness(PyAPITestHarness):
|
|||
r0 = openmc.ZCylinder(R=0.3)
|
||||
c11 = openmc.Cell(cell_id=11)
|
||||
c11.region = -r0
|
||||
c11.fill = [dense_fuel, light_fuel] + [dense_fuel]*2
|
||||
c11.fill = [dense_fuel, light_fuel, 'void', dense_fuel]
|
||||
c12 = openmc.Cell(cell_id=12)
|
||||
c12.region = +r0
|
||||
c12.fill = moderator
|
||||
|
|
@ -122,9 +122,6 @@ class DistribmatTestHarness(PyAPITestHarness):
|
|||
outstr += str(su.get_cell_by_id(11))
|
||||
return outstr
|
||||
|
||||
# def _cleanup(self):
|
||||
# return None
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = DistribmatTestHarness('statepoint.5.*')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue