mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
fix universe's get_nuclide_density without volumes present
This commit is contained in:
parent
a601088e8b
commit
71631ada04
2 changed files with 12 additions and 1 deletions
|
|
@ -469,7 +469,7 @@ class Universe(UniverseBase):
|
|||
"""
|
||||
nuclides = OrderedDict()
|
||||
|
||||
if self._atoms is not None:
|
||||
if len(self._atoms) > 0:
|
||||
volume = self.volume
|
||||
for name, atoms in self._atoms.items():
|
||||
nuclide = openmc.Nuclide(name)
|
||||
|
|
|
|||
|
|
@ -132,3 +132,14 @@ def test_create_xml(cell_with_lattice):
|
|||
assert all(c.get('universe') == str(u.id) for c in cell_elems)
|
||||
assert not (set(c.get('id') for c in cell_elems) ^
|
||||
set(str(c.id) for c in cells))
|
||||
|
||||
|
||||
def test_get_nuclide_densities():
|
||||
surf = openmc.Sphere()
|
||||
material = openmc.Material()
|
||||
material.add_elements_from_formula("H2O")
|
||||
material.set_density("g/cm3", 1)
|
||||
cell = openmc.Cell(region=-surf,fill=material)
|
||||
universe = openmc.Universe(cells=[cell])
|
||||
with pytest.raises(RuntimeError):
|
||||
universe.get_nuclide_densities()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue