diff --git a/tests/regression_tests/filter_translations/__init__.py b/tests/regression_tests/filter_translations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/regression_tests/filter_translations/input_dat_-10_-5_0.dat b/tests/regression_tests/filter_translations/input_dat_-10_-5_0.dat new file mode 100644 index 0000000000..ed062f2aa9 --- /dev/null +++ b/tests/regression_tests/filter_translations/input_dat_-10_-5_0.dat @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + + + 9 9 9 + 1 -4 -9 + 19 14 9 + + + 1.0 2.125 3.25 4.375 5.5 6.625 7.75 8.875 10.0 11.125 12.25 13.375 14.5 15.625 16.75 17.875 19.0 + -4.0 -2.875 -1.75 -0.625 0.5 1.625 2.75 3.875 5.0 6.125 7.25 8.375 9.5 10.625 11.75 12.875 14.0 + -9.0 -7.875 -6.75 -5.625 -4.5 -3.375 -2.25 -1.125 0.0 1.125 2.25 3.375 4.5 5.625 6.75 7.875 9.0 + + + 13 + + + 14 + + + 13 + total + + + 14 + total + + diff --git a/tests/regression_tests/filter_translations/input_dat_-10_0_-5.dat b/tests/regression_tests/filter_translations/input_dat_-10_0_-5.dat new file mode 100644 index 0000000000..e9a1119bb1 --- /dev/null +++ b/tests/regression_tests/filter_translations/input_dat_-10_0_-5.dat @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + + + 9 9 9 + 1 -9 -4 + 19 9 14 + + + 1.0 2.125 3.25 4.375 5.5 6.625 7.75 8.875 10.0 11.125 12.25 13.375 14.5 15.625 16.75 17.875 19.0 + -9.0 -7.875 -6.75 -5.625 -4.5 -3.375 -2.25 -1.125 0.0 1.125 2.25 3.375 4.5 5.625 6.75 7.875 9.0 + -4.0 -2.875 -1.75 -0.625 0.5 1.625 2.75 3.875 5.0 6.125 7.25 8.375 9.5 10.625 11.75 12.875 14.0 + + + 15 + + + 16 + + + 15 + total + + + 16 + total + + diff --git a/tests/regression_tests/filter_translations/input_dat_-5_-10_0.dat b/tests/regression_tests/filter_translations/input_dat_-5_-10_0.dat new file mode 100644 index 0000000000..88ae5c4346 --- /dev/null +++ b/tests/regression_tests/filter_translations/input_dat_-5_-10_0.dat @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + + + 9 9 9 + -4 1 -9 + 14 19 9 + + + -4.0 -2.875 -1.75 -0.625 0.5 1.625 2.75 3.875 5.0 6.125 7.25 8.375 9.5 10.625 11.75 12.875 14.0 + 1.0 2.125 3.25 4.375 5.5 6.625 7.75 8.875 10.0 11.125 12.25 13.375 14.5 15.625 16.75 17.875 19.0 + -9.0 -7.875 -6.75 -5.625 -4.5 -3.375 -2.25 -1.125 0.0 1.125 2.25 3.375 4.5 5.625 6.75 7.875 9.0 + + + 17 + + + 18 + + + 17 + total + + + 18 + total + + diff --git a/tests/regression_tests/filter_translations/input_dat_-5_0_-10.dat b/tests/regression_tests/filter_translations/input_dat_-5_0_-10.dat new file mode 100644 index 0000000000..d523149d0f --- /dev/null +++ b/tests/regression_tests/filter_translations/input_dat_-5_0_-10.dat @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + + + 9 9 9 + -4 -9 1 + 14 9 19 + + + -4.0 -2.875 -1.75 -0.625 0.5 1.625 2.75 3.875 5.0 6.125 7.25 8.375 9.5 10.625 11.75 12.875 14.0 + -9.0 -7.875 -6.75 -5.625 -4.5 -3.375 -2.25 -1.125 0.0 1.125 2.25 3.375 4.5 5.625 6.75 7.875 9.0 + 1.0 2.125 3.25 4.375 5.5 6.625 7.75 8.875 10.0 11.125 12.25 13.375 14.5 15.625 16.75 17.875 19.0 + + + 19 + + + 20 + + + 19 + total + + + 20 + total + + diff --git a/tests/regression_tests/filter_translations/input_dat_0_-10_-5.dat b/tests/regression_tests/filter_translations/input_dat_0_-10_-5.dat new file mode 100644 index 0000000000..a29f8f63df --- /dev/null +++ b/tests/regression_tests/filter_translations/input_dat_0_-10_-5.dat @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + + + 9 9 9 + -9 1 -4 + 9 19 14 + + + -9.0 -7.875 -6.75 -5.625 -4.5 -3.375 -2.25 -1.125 0.0 1.125 2.25 3.375 4.5 5.625 6.75 7.875 9.0 + 1.0 2.125 3.25 4.375 5.5 6.625 7.75 8.875 10.0 11.125 12.25 13.375 14.5 15.625 16.75 17.875 19.0 + -4.0 -2.875 -1.75 -0.625 0.5 1.625 2.75 3.875 5.0 6.125 7.25 8.375 9.5 10.625 11.75 12.875 14.0 + + + 21 + + + 22 + + + 21 + total + + + 22 + total + + diff --git a/tests/regression_tests/filter_translations/input_dat_0_-5_-10.dat b/tests/regression_tests/filter_translations/input_dat_0_-5_-10.dat new file mode 100644 index 0000000000..17c7af7dd3 --- /dev/null +++ b/tests/regression_tests/filter_translations/input_dat_0_-5_-10.dat @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + + + 9 9 9 + -9 -4 1 + 9 14 19 + + + -9.0 -7.875 -6.75 -5.625 -4.5 -3.375 -2.25 -1.125 0.0 1.125 2.25 3.375 4.5 5.625 6.75 7.875 9.0 + -4.0 -2.875 -1.75 -0.625 0.5 1.625 2.75 3.875 5.0 6.125 7.25 8.375 9.5 10.625 11.75 12.875 14.0 + 1.0 2.125 3.25 4.375 5.5 6.625 7.75 8.875 10.0 11.125 12.25 13.375 14.5 15.625 16.75 17.875 19.0 + + + 23 + + + 24 + + + 23 + total + + + 24 + total + + diff --git a/tests/regression_tests/filter_translations/input_dat_0_10_5.dat b/tests/regression_tests/filter_translations/input_dat_0_10_5.dat new file mode 100644 index 0000000000..ce4d481e57 --- /dev/null +++ b/tests/regression_tests/filter_translations/input_dat_0_10_5.dat @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + + + 9 9 9 + -9 -19 -14 + 9 -1 4 + + + -9.0 -7.875 -6.75 -5.625 -4.5 -3.375 -2.25 -1.125 0.0 1.125 2.25 3.375 4.5 5.625 6.75 7.875 9.0 + -19.0 -17.875 -16.75 -15.625 -14.5 -13.375 -12.25 -11.125 -10.0 -8.875 -7.75 -6.625 -5.5 -4.375 -3.25 -2.125 -1.0 + -14.0 -12.875 -11.75 -10.625 -9.5 -8.375 -7.25 -6.125 -5.0 -3.875 -2.75 -1.625 -0.5 0.625 1.75 2.875 4.0 + + + 9 + + + 10 + + + 9 + total + + + 10 + total + + diff --git a/tests/regression_tests/filter_translations/input_dat_0_5_10.dat b/tests/regression_tests/filter_translations/input_dat_0_5_10.dat new file mode 100644 index 0000000000..bdd361ce7f --- /dev/null +++ b/tests/regression_tests/filter_translations/input_dat_0_5_10.dat @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + + + 9 9 9 + -9 -14 -19 + 9 4 -1 + + + -9.0 -7.875 -6.75 -5.625 -4.5 -3.375 -2.25 -1.125 0.0 1.125 2.25 3.375 4.5 5.625 6.75 7.875 9.0 + -14.0 -12.875 -11.75 -10.625 -9.5 -8.375 -7.25 -6.125 -5.0 -3.875 -2.75 -1.625 -0.5 0.625 1.75 2.875 4.0 + -19.0 -17.875 -16.75 -15.625 -14.5 -13.375 -12.25 -11.125 -10.0 -8.875 -7.75 -6.625 -5.5 -4.375 -3.25 -2.125 -1.0 + + + 11 + + + 12 + + + 11 + total + + + 12 + total + + diff --git a/tests/regression_tests/filter_translations/input_dat_10_0_5.dat b/tests/regression_tests/filter_translations/input_dat_10_0_5.dat new file mode 100644 index 0000000000..72c17754b9 --- /dev/null +++ b/tests/regression_tests/filter_translations/input_dat_10_0_5.dat @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + + + 9 9 9 + -19 -9 -14 + -1 9 4 + + + -19.0 -17.875 -16.75 -15.625 -14.5 -13.375 -12.25 -11.125 -10.0 -8.875 -7.75 -6.625 -5.5 -4.375 -3.25 -2.125 -1.0 + -9.0 -7.875 -6.75 -5.625 -4.5 -3.375 -2.25 -1.125 0.0 1.125 2.25 3.375 4.5 5.625 6.75 7.875 9.0 + -14.0 -12.875 -11.75 -10.625 -9.5 -8.375 -7.25 -6.125 -5.0 -3.875 -2.75 -1.625 -0.5 0.625 1.75 2.875 4.0 + + + 3 + + + 4 + + + 3 + total + + + 4 + total + + diff --git a/tests/regression_tests/filter_translations/input_dat_10_5_0.dat b/tests/regression_tests/filter_translations/input_dat_10_5_0.dat new file mode 100644 index 0000000000..73a11537a7 --- /dev/null +++ b/tests/regression_tests/filter_translations/input_dat_10_5_0.dat @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + + + 9 9 9 + -19 -14 -9 + -1 4 9 + + + -19.0 -17.875 -16.75 -15.625 -14.5 -13.375 -12.25 -11.125 -10.0 -8.875 -7.75 -6.625 -5.5 -4.375 -3.25 -2.125 -1.0 + -14.0 -12.875 -11.75 -10.625 -9.5 -8.375 -7.25 -6.125 -5.0 -3.875 -2.75 -1.625 -0.5 0.625 1.75 2.875 4.0 + -9.0 -7.875 -6.75 -5.625 -4.5 -3.375 -2.25 -1.125 0.0 1.125 2.25 3.375 4.5 5.625 6.75 7.875 9.0 + + + 1 + + + 2 + + + 1 + total + + + 2 + total + + diff --git a/tests/regression_tests/filter_translations/input_dat_5_0_10.dat b/tests/regression_tests/filter_translations/input_dat_5_0_10.dat new file mode 100644 index 0000000000..753930f7db --- /dev/null +++ b/tests/regression_tests/filter_translations/input_dat_5_0_10.dat @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + + + 9 9 9 + -14 -9 -19 + 4 9 -1 + + + -14.0 -12.875 -11.75 -10.625 -9.5 -8.375 -7.25 -6.125 -5.0 -3.875 -2.75 -1.625 -0.5 0.625 1.75 2.875 4.0 + -9.0 -7.875 -6.75 -5.625 -4.5 -3.375 -2.25 -1.125 0.0 1.125 2.25 3.375 4.5 5.625 6.75 7.875 9.0 + -19.0 -17.875 -16.75 -15.625 -14.5 -13.375 -12.25 -11.125 -10.0 -8.875 -7.75 -6.625 -5.5 -4.375 -3.25 -2.125 -1.0 + + + 7 + + + 8 + + + 7 + total + + + 8 + total + + diff --git a/tests/regression_tests/filter_translations/input_dat_5_10_0.dat b/tests/regression_tests/filter_translations/input_dat_5_10_0.dat new file mode 100644 index 0000000000..98a93483e3 --- /dev/null +++ b/tests/regression_tests/filter_translations/input_dat_5_10_0.dat @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + + + 9 9 9 + -14 -19 -9 + 4 -1 9 + + + -14.0 -12.875 -11.75 -10.625 -9.5 -8.375 -7.25 -6.125 -5.0 -3.875 -2.75 -1.625 -0.5 0.625 1.75 2.875 4.0 + -19.0 -17.875 -16.75 -15.625 -14.5 -13.375 -12.25 -11.125 -10.0 -8.875 -7.75 -6.625 -5.5 -4.375 -3.25 -2.125 -1.0 + -9.0 -7.875 -6.75 -5.625 -4.5 -3.375 -2.25 -1.125 0.0 1.125 2.25 3.375 4.5 5.625 6.75 7.875 9.0 + + + 5 + + + 6 + + + 5 + total + + + 6 + total + + diff --git a/tests/regression_tests/filter_translations/results_true.dat b/tests/regression_tests/filter_translations/results_true.dat new file mode 100644 index 0000000000..105ef304ba --- /dev/null +++ b/tests/regression_tests/filter_translations/results_true.dat @@ -0,0 +1 @@ +3e9446ca032f10b5d2c65529a55264eb7f995f9890180547a838d8cc130c7258e094742b7b20578e95667c63b5634eadab5b53273c9cf297e58536abb411b985 \ No newline at end of file diff --git a/tests/regression_tests/filter_translations/test.py b/tests/regression_tests/filter_translations/test.py new file mode 100644 index 0000000000..075cabcbcf --- /dev/null +++ b/tests/regression_tests/filter_translations/test.py @@ -0,0 +1,70 @@ +from itertools import permutations +import numpy as np + +import openmc +import pytest + +from tests.testing_harness import HashedPyAPITestHarness + + +translations = list(permutations((10, 5, 0))) + list(permutations((-10, -5, 0))) +@pytest.fixture(params=translations) +def model(request): + + translation = np.array(request.param) + + model = openmc.model.Model() + + fuel = openmc.Material() + fuel.set_density('g/cm3', 10.0) + fuel.add_nuclide('U235', 1.0) + zr = openmc.Material() + zr.set_density('g/cm3', 1.0) + zr.add_nuclide('Zr90', 1.0) + model.materials.extend([fuel, zr]) + + box1 = openmc.model.rectangular_prism(10.0, 10.0) + box2 = openmc.model.rectangular_prism(20.0, 20.0, boundary_type='reflective') + top = openmc.ZPlane(z0=10.0, boundary_type='vacuum') + bottom = openmc.ZPlane(z0=-10.0, boundary_type='vacuum') + cell1 = openmc.Cell(fill=fuel, region=box1 & +bottom & -top) + cell2 = openmc.Cell(fill=zr, region=~box1 & box2 & +bottom & -top) + model.geometry = openmc.Geometry([cell1, cell2]) + + model.settings.batches = 5 + model.settings.inactive = 0 + model.settings.particles = 1000 + + llc = np.array([-9, -9, -9]) - translation + urc = np.array([9, 9, 9]) - translation + + reg_mesh = openmc.RegularMesh() + reg_mesh.dimension = [9, 9, 9] + reg_mesh.lower_left = llc + reg_mesh.upper_right = urc + + recti_mesh = openmc.RectilinearMesh() + recti_mesh.x_grid = np.linspace(llc[0], urc[0], 17) + recti_mesh.y_grid = np.linspace(llc[1], urc[1], 17) + recti_mesh.z_grid = np.linspace(llc[2], urc[2], 17) + + # Create filters + filters = [openmc.MeshFilter(reg_mesh, translation=translation), + openmc.MeshFilter(recti_mesh, translation=translation)] + + # Create tallies + for f in filters: + tally = openmc.Tally() + tally.filters = [f] + tally.scores = ['total'] + model.tallies.append(tally) + + input_name = 'input_dat_' + '_'.join(map(str, translation)) + '.dat' + return model, input_name + + +def test_filter_mesh_translations(model): + harness = HashedPyAPITestHarness('statepoint.5.h5', *model) + harness.main() + +