From b3ee0652068025a2902447c480beb7a29c2d976a Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Thu, 29 Jun 2017 13:57:25 -0400 Subject: [PATCH] Add fraction to S(a,b) test; move to PyAPI --- tests/test_salphabeta/geometry.xml | 15 ----- tests/test_salphabeta/inputs_true.dat | 60 ++++++++++++++++++ tests/test_salphabeta/materials.xml | 41 ------------- tests/test_salphabeta/results_true.dat | 2 +- tests/test_salphabeta/settings.xml | 15 ----- tests/test_salphabeta/test_salphabeta.py | 77 +++++++++++++++++++++++- 6 files changed, 136 insertions(+), 74 deletions(-) delete mode 100644 tests/test_salphabeta/geometry.xml create mode 100644 tests/test_salphabeta/inputs_true.dat delete mode 100644 tests/test_salphabeta/materials.xml delete mode 100644 tests/test_salphabeta/settings.xml diff --git a/tests/test_salphabeta/geometry.xml b/tests/test_salphabeta/geometry.xml deleted file mode 100644 index 2b978b9148..0000000000 --- a/tests/test_salphabeta/geometry.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/tests/test_salphabeta/inputs_true.dat b/tests/test_salphabeta/inputs_true.dat new file mode 100644 index 0000000000..c42b90e8c1 --- /dev/null +++ b/tests/test_salphabeta/inputs_true.dat @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + -4 -4 -4 4 4 4 + + + diff --git a/tests/test_salphabeta/materials.xml b/tests/test_salphabeta/materials.xml deleted file mode 100644 index bfe0a6224d..0000000000 --- a/tests/test_salphabeta/materials.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_salphabeta/results_true.dat b/tests/test_salphabeta/results_true.dat index bdfb98990f..e1121bce50 100644 --- a/tests/test_salphabeta/results_true.dat +++ b/tests/test_salphabeta/results_true.dat @@ -1,2 +1,2 @@ k-combined: -8.544160E-01 1.274133E-02 +8.403447E-01 2.461538E-02 diff --git a/tests/test_salphabeta/settings.xml b/tests/test_salphabeta/settings.xml deleted file mode 100644 index 70b4e802f8..0000000000 --- a/tests/test_salphabeta/settings.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - eigenvalue - 10 - 5 - 1000 - - - - -4 -4 -4 4 4 4 - - - - diff --git a/tests/test_salphabeta/test_salphabeta.py b/tests/test_salphabeta/test_salphabeta.py index b04fcc6eba..600c703324 100644 --- a/tests/test_salphabeta/test_salphabeta.py +++ b/tests/test_salphabeta/test_salphabeta.py @@ -3,9 +3,82 @@ import os import sys sys.path.insert(0, os.pardir) -from testing_harness import TestHarness + +from testing_harness import PyAPITestHarness +import openmc +import openmc.model + + +def make_model(): + model = openmc.model.Model() + + # Materials + m1 = openmc.Material() + m1.set_density('g/cc', 4.5) + m1.add_nuclide('U235', 1.0) + m1.add_nuclide('H1', 1.0) + m1.add_s_alpha_beta('c_H_in_H2O', fraction=0.5) + + m2 = openmc.Material() + m2.set_density('g/cc', 4.5) + m2.add_nuclide('U235', 1.0) + m2.add_nuclide('C0', 1.0) + m2.add_s_alpha_beta('c_Graphite') + + m3 = openmc.Material() + m3.set_density('g/cc', 4.5) + m3.add_nuclide('U235', 1.0) + m3.add_nuclide('Be9', 1.0) + m3.add_nuclide('O16', 1.0) + m3.add_s_alpha_beta('c_Be_in_BeO') + m3.add_s_alpha_beta('c_O_in_BeO') + + m4 = openmc.Material() + m4.set_density('g/cm3', 5.90168) + m4.add_nuclide('H1', 0.3) + m4.add_nuclide('Zr90', 0.15) + m4.add_nuclide('Zr91', 0.1) + m4.add_nuclide('Zr92', 0.1) + m4.add_nuclide('Zr94', 0.05) + m4.add_nuclide('Zr96', 0.05) + m4.add_nuclide('U235', 0.1) + m4.add_nuclide('U238', 0.15) + m4.add_s_alpha_beta('c_Zr_in_ZrH') + m4.add_s_alpha_beta('c_H_in_ZrH') + + model.materials += [m1, m2, m3, m4] + + # Geometry + x0 = openmc.XPlane(x0=-10, boundary_type='vacuum') + x1 = openmc.XPlane(x0=-5) + x2 = openmc.XPlane(x0=0) + x3 = openmc.XPlane(x0=5) + x4 = openmc.XPlane(x0=10, boundary_type='vacuum') + + root_univ = openmc.Universe() + + surfs = (x0, x1, x2, x3, x4) + mats = (m1, m2, m3, m4) + cells = [] + for i in range(4): + cell = openmc.Cell() + cell.region = +surfs[i] & -surfs[i+1] + cell.fill = mats[i] + root_univ.add_cell(cell) + + model.geometry.root_universe = root_univ + + # Settings + model.settings.batches = 5 + model.settings.inactive = 0 + model.settings.particles = 1000 + model.settings.source = openmc.Source(space=openmc.stats.Box( + [-4, -4, -4], [4, 4, 4])) + + return model if __name__ == '__main__': - harness = TestHarness('statepoint.10.h5') + model = make_model() + harness = PyAPITestHarness('statepoint.5.h5', model) harness.main()