From 87a1139f6232cc7521991c7f59e6cf69b5c85eb7 Mon Sep 17 00:00:00 2001 From: guillaume Date: Fri, 14 Jul 2017 15:13:27 -0400 Subject: [PATCH] cleaned up test and generated results --- tests/test_surface_tally/geometry.xml | 11 --- tests/test_surface_tally/materials.xml | 21 ----- tests/test_surface_tally/results_true.dat | 90 +------------------ tests/test_surface_tally/settings.xml | 12 --- tests/test_surface_tally/tallies.xml | 52 ----------- .../test_surface_tally/test_surface_tally.py | 59 ++++++------ 6 files changed, 32 insertions(+), 213 deletions(-) delete mode 100644 tests/test_surface_tally/geometry.xml delete mode 100644 tests/test_surface_tally/materials.xml delete mode 100644 tests/test_surface_tally/settings.xml delete mode 100644 tests/test_surface_tally/tallies.xml diff --git a/tests/test_surface_tally/geometry.xml b/tests/test_surface_tally/geometry.xml deleted file mode 100644 index 19eae6333b..0000000000 --- a/tests/test_surface_tally/geometry.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/tests/test_surface_tally/materials.xml b/tests/test_surface_tally/materials.xml deleted file mode 100644 index 506f5f74ae..0000000000 --- a/tests/test_surface_tally/materials.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_surface_tally/results_true.dat b/tests/test_surface_tally/results_true.dat index f9f473b19c..e47a0635c8 100644 --- a/tests/test_surface_tally/results_true.dat +++ b/tests/test_surface_tally/results_true.dat @@ -1,87 +1,3 @@ -k-combined: -1.177844E+00 1.713522E-02 -tally 1: -9.400000E-01 -1.778300E-01 -2.561000E+00 -1.315759E+00 -8.618000E+00 -1.487929E+01 -2.559600E+01 -1.311144E+02 -4.700000E-02 -4.870000E-04 -1.010000E-01 -2.207000E-03 -3.780000E-01 -2.889000E-02 -1.089000E+00 -2.432570E-01 -tally 2: -9.400000E-01 -1.778300E-01 -2.561000E+00 -1.315759E+00 -8.618000E+00 -1.487929E+01 -2.559600E+01 -1.311144E+02 -4.700000E-02 -4.870000E-04 -1.010000E-01 -2.207000E-03 -3.780000E-01 -2.889000E-02 -1.089000E+00 -2.432570E-01 -tally 3: -9.070000E-01 -1.648450E-01 -2.495000E+00 -1.247251E+00 -8.515000E+00 -1.452994E+01 -2.539500E+01 -1.290580E+02 -3.800000E-02 -3.220000E-04 -8.400000E-02 -1.480000E-03 -3.540000E-01 -2.528400E-02 -9.770000E-01 -1.957910E-01 -tally 4: -9.070000E-01 -1.648450E-01 -2.495000E+00 -1.247251E+00 -8.515000E+00 -1.452994E+01 -2.539500E+01 -1.290580E+02 -3.800000E-02 -3.220000E-04 -8.400000E-02 -1.480000E-03 -3.540000E-01 -2.528400E-02 -9.770000E-01 -1.957910E-01 -tally 5: -1.847000E+00 -6.843910E-01 -5.056000E+00 -5.124718E+00 -1.713300E+01 -5.881492E+01 -5.099100E+01 -5.203348E+02 -8.500000E-02 -1.595000E-03 -1.850000E-01 -7.259000E-03 -7.320000E-01 -1.080440E-01 -2.066000E+00 -8.753660E-01 +tally 0: +sum = 8.800000E-02 +sum_sq = 1.582000E-03 diff --git a/tests/test_surface_tally/settings.xml b/tests/test_surface_tally/settings.xml deleted file mode 100644 index d97ee454a4..0000000000 --- a/tests/test_surface_tally/settings.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - eigenvalue - 1000 - 10 - 5 - - - -0.62992 -0.62992 -1 0.62992 0.62992 1 - - - diff --git a/tests/test_surface_tally/tallies.xml b/tests/test_surface_tally/tallies.xml deleted file mode 100644 index fd76a84d22..0000000000 --- a/tests/test_surface_tally/tallies.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - 10000 - - - 10001 - - - 0.0 4000000.0 20000000.0 - - - 0.0 0.785398163397 3.14159265359 - - - 0.0 0.785398163397 3.14159265359 - - - 1 - - - 10001 - - - 10000 - - - 10003 10004 10000 10001 10002 - total-current - analog - - - 10003 10005 10000 10001 10002 - total-current - analog - - - 10006 10007 10000 10001 10002 - total-current - analog - - - 10006 10005 10000 10001 10002 - total-current - analog - - - 10005 10000 10001 10002 - total-current - analog - - diff --git a/tests/test_surface_tally/test_surface_tally.py b/tests/test_surface_tally/test_surface_tally.py index d4d1c8aaa9..31850462ce 100644 --- a/tests/test_surface_tally/test_surface_tally.py +++ b/tests/test_surface_tally/test_surface_tally.py @@ -4,6 +4,7 @@ import os import sys sys.path.insert(0, os.pardir) from testing_harness import PyAPITestHarness +import numpy as np import openmc @@ -30,7 +31,7 @@ class CreateSurfaceTallyTestHarness(PyAPITestHarness): # Instantiate ZCylinder surfaces fuel_or = openmc.ZCylinder(surface_id=1, x0=0, y0=0, R=0.4, name='Fuel OR') left = openmc.XPlane(surface_id=2, x0=-0.62992, name='left') - right = openmc.XPlane(x0=0.62992, name='right') + right = openmc.XPlane(surface_id=3, x0=0.62992, name='right') bottom = openmc.YPlane(y0=-0.62992, name='bottom') top = openmc.YPlane(y0=0.62992, name='top') @@ -83,6 +84,7 @@ class CreateSurfaceTallyTestHarness(PyAPITestHarness): # Cell to cell tallies # These filters are same for all tallies + two_groups = np.array([0., 4, 20.]) * 1e6 energy_filter = openmc.EnergyFilter(two_groups) polar_filter = openmc.PolarFilter([0, np.pi / 4, np.pi]) azimuthal_filter = openmc.AzimuthalFilter([0, np.pi / 4, np.pi]) @@ -100,46 +102,43 @@ class CreateSurfaceTallyTestHarness(PyAPITestHarness): cell_from_filter = openmc.CellFromFilter(cell1) cell_to_filter = openmc.CellFilter(cell2) - cell_to_cell_tallies.append(openmc.Tally(tally_id=2*tally_index, name=str(cell1)+'-'+str(cell2))) - cell_to_cell_tallies[2*tally_index].filters = [cell_from_filter, cell_to_filter, energy_filter, polar_filter, azimuthal_filter] - cell_to_cell_tallies[2*tally_index].scores = ['current'] - cell_to_cell_tallies[2*tally_index].estimator = 'analog' - - tallies_file.append(cell_to_cell_tallies[2*tally_index]) + cell_to_cell_tallies.append(openmc.Tally(tally_id=tally_index, name=str(cell1)+'-'+str(cell2))) + cell_to_cell_tallies[tally_index].filters = [cell_from_filter, cell_to_filter, energy_filter, polar_filter, azimuthal_filter] + cell_to_cell_tallies[tally_index].scores = ['current'] + tallies_file.append(cell_to_cell_tallies[tally_index]) + tally_index += 1 # Cell from + surface filters for partial current surface_filter = openmc.SurfaceFilter([1]) - cell_to_cell_tallies.append(openmc.Tally(tally_id=2*tally_index+1, name=str(cell1)+'-surface1')) - cell_to_cell_tallies[2*tally_index+1].filters = [cell_from_filter, surface_filter, energy_filter, polar_filter, azimuthal_filter] - cell_to_cell_tallies[2*tally_index+1].scores = ['current'] - cell_to_cell_tallies[2*tally_index+1].estimator = 'analog' - tallies_file.append(cell_to_cell_tallies[2*tally_index+1]) - + cell_to_cell_tallies.append(openmc.Tally(tally_id=tally_index, name=str(cell1)+'-surface1')) + cell_to_cell_tallies[tally_index].filters = [cell_from_filter, surface_filter, energy_filter, polar_filter, azimuthal_filter] + cell_to_cell_tallies[tally_index].scores = ['current'] + tallies_file.append(cell_to_cell_tallies[tally_index]) tally_index += 1 # Surface filter on inner surface, for net current surface_filter = openmc.SurfaceFilter([1]) - cell_to_cell_tallies.append(openmc.Tally(tally_id=2*tally_index, name='surface1')) - cell_to_cell_tallies[2*tally_index].filters = [surface_filter, energy_filter, polar_filter, azimuthal_filter] - cell_to_cell_tallies[2*tally_index].scores = ['current'] - cell_to_cell_tallies[2*tally_index].estimator = 'analog' - tallies_file.append(cell_to_cell_tallies[2*tally_index]) + surf_tally1 = openmc.Tally(tally_id=tally_index, name='net_cylinder') + surf_tally1.filters = [surface_filter, energy_filter, polar_filter, azimuthal_filter] + surf_tally1.scores = ['current'] + tallies_file.append(surf_tally1) + tally_index += 1 # Surface filter on left surface, vacuum BC, for net current = leakage - surface_filter = openmc.SurfaceFilter([1]) - cell_to_cell_tallies.append(openmc.Tally(tally_id=2*tally_index, name='surface1')) - cell_to_cell_tallies[2*tally_index].filters = [surface_filter, energy_filter, polar_filter, azimuthal_filter] - cell_to_cell_tallies[2*tally_index].scores = ['current'] - cell_to_cell_tallies[2*tally_index].estimator = 'analog' - tallies_file.append(cell_to_cell_tallies[2*tally_index]) + surface_filter = openmc.SurfaceFilter([2]) + surf_tally2 = openmc.Tally(tally_id=tally_index, name='leakage_left') + surf_tally2.filters = [surface_filter, energy_filter, polar_filter, azimuthal_filter] + surf_tally2.scores = ['current'] + tallies_file.append(surf_tally2) + tally_index += 1 # Surface filter on right surface, reflective, for net current = 0 - surface_filter = openmc.SurfaceFilter([1]) - cell_to_cell_tallies.append(openmc.Tally(tally_id=2*tally_index, name='surface1')) - cell_to_cell_tallies[2*tally_index].filters = [surface_filter, energy_filter, polar_filter, azimuthal_filter] - cell_to_cell_tallies[2*tally_index].scores = ['current'] - cell_to_cell_tallies[2*tally_index].estimator = 'analog' - tallies_file.append(cell_to_cell_tallies[2*tally_index]) + surface_filter = openmc.SurfaceFilter([3]) + surf_tally3 = openmc.Tally(tally_id=tally_index, name='net_right') + surf_tally3.filters = [surface_filter, energy_filter, polar_filter, azimuthal_filter] + surf_tally3.scores = ['current'] + tallies_file.append(surf_tally3) + tally_index += 1 tallies_file.export_to_xml()