diff --git a/openmc/filter.py b/openmc/filter.py
index 7ad901b59..4d14f054e 100644
--- a/openmc/filter.py
+++ b/openmc/filter.py
@@ -777,8 +777,9 @@ class MeshSurfaceFilter(MeshFilter):
self._mesh = mesh
# Take the product of mesh indices and current names
+ n_dim = mesh.n_dimension
self.bins = [mesh_tuple + (surf,) for mesh_tuple, surf in
- product(mesh.indices, _CURRENT_NAMES[:4*3])]
+ product(mesh.indices, _CURRENT_NAMES[:4*n_dim])]
def get_pandas_dataframe(self, data_size, stride, **kwargs):
"""Builds a Pandas DataFrame for the Filter's bins.
diff --git a/openmc/mesh.py b/openmc/mesh.py
index 9370e305d..0961b238e 100644
--- a/openmc/mesh.py
+++ b/openmc/mesh.py
@@ -128,6 +128,10 @@ class Mesh(MeshBase):
def dimension(self):
return self._dimension
+ @property
+ def n_dimension(self):
+ return len(self._dimension)
+
@property
def lower_left(self):
return self._lower_left
@@ -417,6 +421,10 @@ class RectilinearMesh(MeshBase):
def __init__(self, mesh_id=None, name=''):
super().__init__(mesh_id, name)
+ @property
+ def n_dimension(self):
+ return 3
+
@property
def indices(self):
nx = len(self.x_grid) - 1
diff --git a/tests/regression_tests/filter_mesh/inputs_true.dat b/tests/regression_tests/filter_mesh/inputs_true.dat
index 511b29848..7afd834cd 100644
--- a/tests/regression_tests/filter_mesh/inputs_true.dat
+++ b/tests/regression_tests/filter_mesh/inputs_true.dat
@@ -324,30 +324,41 @@
-182.07 -182.07 -183.0
182.07 182.07 183.0
+
+ -182.07 -160.65 -139.23 -117.81 -96.39 -74.97 -53.55000000000001 -32.129999999999995 -10.710000000000008 10.70999999999998 32.129999999999995 53.54999999999998 74.96999999999997 96.38999999999999 117.81 139.22999999999996 160.64999999999998 182.07
+ -182.07 -160.65 -139.23 -117.81 -96.39 -74.97 -53.55000000000001 -32.129999999999995 -10.710000000000008 10.70999999999998 32.129999999999995 53.54999999999998 74.96999999999997 96.38999999999999 117.81 139.22999999999996 160.64999999999998 182.07
+ 1.0 1.683624003879018 2.8345897864376153 4.772383405596668 8.034899257376447 13.52774925846868 22.77564337001445 38.34561988154435 64.55960607618856 108.69410247084474 182.99999999999991
+
1
-
+
1
2
-
+
2
3
-
+
3
+
+ 4
+
+
+ 4
+
1
total
- 4
+ 5
current
@@ -355,7 +366,7 @@
total
- 5
+ 6
current
@@ -363,7 +374,15 @@
total
- 6
+ 7
+ current
+
+
+ 4
+ total
+
+
+ 8
current
diff --git a/tests/regression_tests/filter_mesh/results_true.dat b/tests/regression_tests/filter_mesh/results_true.dat
index 227d0d608..05efffe2f 100644
--- a/tests/regression_tests/filter_mesh/results_true.dat
+++ b/tests/regression_tests/filter_mesh/results_true.dat
@@ -1 +1 @@
-cc306dfd3e3669827cb2f3bdc38005c0616f6faecb9277f3b0f869fdecf826ae662c65d67a402705956f100d2e13c7c11332364fa41ccc2e215ab100709b627f
\ No newline at end of file
+35f04a6f062ef64116ef4eb0e9b803cd44cff7e185e2b53c9174afad8a26ca1a436ca9b800d6a228e006a9129f4536d7dce289d7a11cd56c6949d71d6a201b31
\ No newline at end of file
diff --git a/tests/regression_tests/filter_mesh/test.py b/tests/regression_tests/filter_mesh/test.py
index 8a7f7a6fc..79e2082da 100644
--- a/tests/regression_tests/filter_mesh/test.py
+++ b/tests/regression_tests/filter_mesh/test.py
@@ -1,3 +1,5 @@
+import numpy as np
+
import openmc
from tests.testing_harness import HashedPyAPITestHarness
@@ -26,13 +28,20 @@ class FilterMeshTestHarness(HashedPyAPITestHarness):
mesh_3d.lower_left = [-182.07, -182.07, -183.00]
mesh_3d.upper_right = [182.07, 182.07, 183.00]
+ recti_mesh = openmc.RectilinearMesh(mesh_id=4)
+ recti_mesh.x_grid = np.linspace(-182.07, 182.07, 18)
+ recti_mesh.y_grid = np.linspace(-182.07, 182.07, 18)
+ recti_mesh.z_grid = np.logspace(0, np.log10(183), 11)
+
# Initialize the filters
mesh_1d_filter = openmc.MeshFilter(mesh_1d)
mesh_2d_filter = openmc.MeshFilter(mesh_2d)
mesh_3d_filter = openmc.MeshFilter(mesh_3d)
+ recti_mesh_filter = openmc.MeshFilter(recti_mesh)
meshsurf_1d_filter = openmc.MeshSurfaceFilter(mesh_1d)
meshsurf_2d_filter = openmc.MeshSurfaceFilter(mesh_2d)
meshsurf_3d_filter = openmc.MeshSurfaceFilter(mesh_3d)
+ recti_meshsurf_filter = openmc.MeshSurfaceFilter(recti_mesh)
# Initialized the tallies
tally = openmc.Tally(name='tally 1')
@@ -65,6 +74,16 @@ class FilterMeshTestHarness(HashedPyAPITestHarness):
tally.scores = ['current']
self._model.tallies.append(tally)
+ tally = openmc.Tally(name='tally 7')
+ tally.filters = [recti_mesh_filter]
+ tally.scores = ['total']
+ self._model.tallies.append(tally)
+
+ tally = openmc.Tally(name='tally 8')
+ tally.filters = [recti_meshsurf_filter]
+ tally.scores = ['current']
+ self._model.tallies.append(tally)
+
def test_filter_mesh():
harness = FilterMeshTestHarness('statepoint.10.h5')