cylindrical mesh lower left Z value corrected (#2684)

This commit is contained in:
Jonathan Shimwell 2023-09-06 04:25:47 +01:00 committed by GitHub
parent a125f81500
commit be7a9c375a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View file

@ -1320,7 +1320,7 @@ class CylindricalMesh(StructuredMesh):
return np.array((
self.origin[0] - self.r_grid[-1],
self.origin[1] - self.r_grid[-1],
self.origin[2] - self.z_grid[-1]
self.origin[2] + self.z_grid[0]
))
@property

View file

@ -56,21 +56,26 @@ def test_cylindrical_mesh_bounding_box():
origin=(0, 0, 0)
)
np.testing.assert_array_equal(mesh.upper_right, (1, 1, 1))
np.testing.assert_array_equal(mesh.lower_left, (-1, -1, -1))
np.testing.assert_array_equal(mesh.lower_left, (-1, -1, 0.1))
bb = mesh.bounding_box
assert isinstance(bb, openmc.BoundingBox)
np.testing.assert_array_equal(bb.lower_left, (-1, -1, -1))
np.testing.assert_array_equal(bb.lower_left, (-1, -1, 0.1))
np.testing.assert_array_equal(bb.upper_right, (1, 1, 1))
# test with mesh at origin (3, 5, 7)
mesh.origin = (3, 5, 7)
np.testing.assert_array_equal(mesh.upper_right, (4, 6, 8))
np.testing.assert_array_equal(mesh.lower_left, (2, 4, 6))
np.testing.assert_array_equal(mesh.lower_left, (2, 4, 7.1))
bb = mesh.bounding_box
assert isinstance(bb, openmc.BoundingBox)
np.testing.assert_array_equal(bb.lower_left, (2, 4, 6))
np.testing.assert_array_equal(bb.lower_left, (2, 4, 7.1))
np.testing.assert_array_equal(bb.upper_right, (4, 6, 8))
# changing z grid to contain negative numbers
mesh.z_grid = [-10, 0, 10]
np.testing.assert_array_equal(mesh.lower_left, (2, 4, -3))
np.testing.assert_array_equal(mesh.upper_right, (4, 6, 17))
def test_spherical_mesh_bounding_box():
# test with mesh at origin (0, 0, 0)