mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Fix Material try/catch and unit test assertion
This commit is contained in:
parent
f9f5187c04
commit
862524c26a
2 changed files with 8 additions and 6 deletions
|
|
@ -413,6 +413,8 @@ class Material(IDManagerMixin):
|
|||
Z, _, _ = openmc.data.zam(nuclide)
|
||||
except ValueError as e:
|
||||
warnings.warn(str(e))
|
||||
except KeyError as e:
|
||||
warnings.warn(repr(e))
|
||||
else:
|
||||
# For actinides, have the material be depletable by default
|
||||
if Z >= 89:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Tests for constructing Pin universes
|
||||
"""
|
||||
|
||||
import numpy
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
import openmc
|
||||
|
|
@ -98,8 +98,8 @@ def test_subdivide(pin_mats, good_radii, surf_type):
|
|||
# check volumes of new rings
|
||||
radii = get_pin_radii(div0)
|
||||
bounds = [0] + radii[:N]
|
||||
sqrs = numpy.square(bounds)
|
||||
assert sqrs[1:] - sqrs[:-1] == pytest.approx(good_radii[0] ** 2 / N)
|
||||
sqrs = np.square(bounds)
|
||||
assert np.all(sqrs[1:] - sqrs[:-1] == pytest.approx(good_radii[0] ** 2 / N))
|
||||
|
||||
# subdivide non-inner most region
|
||||
new_pin = pin(surfs, pin_mats, {1: N})
|
||||
|
|
@ -112,6 +112,6 @@ def test_subdivide(pin_mats, good_radii, surf_type):
|
|||
|
||||
# check volumes of new rings
|
||||
radii = get_pin_radii(new_pin)
|
||||
sqrs = numpy.square(radii[:N + 1])
|
||||
assert sqrs[1:] - sqrs[:-1] == pytest.approx(
|
||||
(good_radii[1] ** 2 - good_radii[0] ** 2) / N)
|
||||
sqrs = np.square(radii[:N + 1])
|
||||
assert np.all(sqrs[1:] - sqrs[:-1] == pytest.approx(
|
||||
(good_radii[1] ** 2 - good_radii[0] ** 2) / N))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue