From c4a10e63b37581356e0c7f30a0a6f6734695b751 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 28 Aug 2013 17:18:32 -0400 Subject: [PATCH] added no feedback and feedback CMFD tests --- tests/test_cmfd_feed/cmfd.xml | 16 + tests/test_cmfd_feed/geometry.xml | 43 ++ tests/test_cmfd_feed/materials.xml | 12 + tests/test_cmfd_feed/results.py | 58 ++ tests/test_cmfd_feed/results_true.dat | 654 +++++++++++++++++++++ tests/test_cmfd_feed/settings.xml | 32 + tests/test_cmfd_feed/tallies.xml | 16 + tests/test_cmfd_feed/test_cmfd_nofeed.py | 49 ++ tests/test_cmfd_nofeed/cmfd.xml | 16 + tests/test_cmfd_nofeed/geometry.xml | 43 ++ tests/test_cmfd_nofeed/materials.xml | 12 + tests/test_cmfd_nofeed/results.py | 58 ++ tests/test_cmfd_nofeed/results_true.dat | 654 +++++++++++++++++++++ tests/test_cmfd_nofeed/settings.xml | 32 + tests/test_cmfd_nofeed/tallies.xml | 16 + tests/test_cmfd_nofeed/test_cmfd_nofeed.py | 49 ++ 16 files changed, 1760 insertions(+) create mode 100644 tests/test_cmfd_feed/cmfd.xml create mode 100644 tests/test_cmfd_feed/geometry.xml create mode 100644 tests/test_cmfd_feed/materials.xml create mode 100644 tests/test_cmfd_feed/results.py create mode 100644 tests/test_cmfd_feed/results_true.dat create mode 100644 tests/test_cmfd_feed/settings.xml create mode 100644 tests/test_cmfd_feed/tallies.xml create mode 100644 tests/test_cmfd_feed/test_cmfd_nofeed.py create mode 100644 tests/test_cmfd_nofeed/cmfd.xml create mode 100644 tests/test_cmfd_nofeed/geometry.xml create mode 100644 tests/test_cmfd_nofeed/materials.xml create mode 100644 tests/test_cmfd_nofeed/results.py create mode 100644 tests/test_cmfd_nofeed/results_true.dat create mode 100644 tests/test_cmfd_nofeed/settings.xml create mode 100644 tests/test_cmfd_nofeed/tallies.xml create mode 100644 tests/test_cmfd_nofeed/test_cmfd_nofeed.py diff --git a/tests/test_cmfd_feed/cmfd.xml b/tests/test_cmfd_feed/cmfd.xml new file mode 100644 index 0000000000..51def74088 --- /dev/null +++ b/tests/test_cmfd_feed/cmfd.xml @@ -0,0 +1,16 @@ + + + + + -10 -1 -1 + 10 1 1 + 10 1 1 + 0.0 0.0 1.0 1.0 1.0 1.0 + + + 5 + dominance + power + true + + diff --git a/tests/test_cmfd_feed/geometry.xml b/tests/test_cmfd_feed/geometry.xml new file mode 100644 index 0000000000..57c4aa2285 --- /dev/null +++ b/tests/test_cmfd_feed/geometry.xml @@ -0,0 +1,43 @@ + + + + + + 0 + -1 2 -3 4 -5 6 + 1 + + + + + x-plane + 10 + vacuum + + + x-plane + -10 + vacuum + + + y-plane + 1 + reflective + + + y-plane + -1 + reflective + + + z-plane + 1 + reflective + + + z-plane + -1 + reflective + + + diff --git a/tests/test_cmfd_feed/materials.xml b/tests/test_cmfd_feed/materials.xml new file mode 100644 index 0000000000..496774661e --- /dev/null +++ b/tests/test_cmfd_feed/materials.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/tests/test_cmfd_feed/results.py b/tests/test_cmfd_feed/results.py new file mode 100644 index 0000000000..533a624558 --- /dev/null +++ b/tests/test_cmfd_feed/results.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +import sys +import numpy as np + +# import statepoint +sys.path.append('../../src/utils') +import statepoint + +# read in statepoint file +if len(sys.argv) > 1: + sp = statepoint.StatePoint(sys.argv[1]) +else: + sp = statepoint.StatePoint('statepoint.20.binary') +sp.read_results() + +# extract tally results and convert to vector +results1 = sp.tallies[0].results +shape1 = results1.shape +size1 = (np.product(shape1)) +results1 = np.reshape(results1, size1) +results2 = sp.tallies[1].results +shape2 = results2.shape +size2 = (np.product(shape2)) +results2 = np.reshape(results2, size2) +results3 = sp.tallies[2].results +shape3 = results3.shape +size3 = (np.product(shape3)) +results3 = np.reshape(results3, size3) +results4 = sp.tallies[3].results +shape4 = results4.shape +size4 = (np.product(shape4)) +results4 = np.reshape(results4, size4) + +# set up output string +outstr = '' + +# write out k-combined +outstr += 'k-combined:\n' +outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1]) + +# write out tally results +outstr += 'tally 1:\n' +for item in results1: + outstr += "{0:12.6E}\n".format(item) +outstr += 'tally 2:\n' +for item in results2: + outstr += "{0:12.6E}\n".format(item) +outstr += 'tally 3:\n' +for item in results3: + outstr += "{0:12.6E}\n".format(item) +outstr += 'tally 4:\n' +for item in results4: + outstr += "{0:12.6E}\n".format(item) + +# write results to file +with open('results_test.dat','w') as fh: + fh.write(outstr) diff --git a/tests/test_cmfd_feed/results_true.dat b/tests/test_cmfd_feed/results_true.dat new file mode 100644 index 0000000000..ad4c85c761 --- /dev/null +++ b/tests/test_cmfd_feed/results_true.dat @@ -0,0 +1,654 @@ +k-combined: +1.167124E+00 1.217343E-02 +tally 1: +1.126891E+01 +1.275755E+01 +2.086556E+01 +4.369501E+01 +2.853629E+01 +8.169559E+01 +3.404506E+01 +1.165019E+02 +3.723908E+01 +1.389881E+02 +3.760048E+01 +1.416691E+02 +3.455469E+01 +1.197186E+02 +2.837503E+01 +8.086291E+01 +2.151789E+01 +4.648315E+01 +1.194541E+01 +1.432331E+01 +tally 2: +2.292173E+01 +2.650792E+01 +1.598183E+01 +1.288692E+01 +2.194143E+00 +2.510557E-01 +4.217816E+01 +8.938583E+01 +2.974466E+01 +4.447038E+01 +3.939269E+00 +7.882413E-01 +5.742289E+01 +1.654599E+02 +4.067581E+01 +8.308454E+01 +5.566955E+00 +1.570072E+00 +6.810586E+01 +2.331019E+02 +4.831543E+01 +1.174673E+02 +6.244999E+00 +1.967938E+00 +7.258131E+01 +2.646756E+02 +5.185146E+01 +1.351425E+02 +6.622488E+00 +2.231695E+00 +7.246115E+01 +2.641295E+02 +5.159542E+01 +1.339441E+02 +6.702239E+00 +2.277825E+00 +6.716397E+01 +2.266815E+02 +4.765063E+01 +1.141627E+02 +6.384098E+00 +2.063760E+00 +5.549542E+01 +1.545361E+02 +3.940819E+01 +7.794880E+01 +5.183375E+00 +1.369483E+00 +4.155685E+01 +8.679439E+01 +2.926744E+01 +4.307145E+01 +3.938852E+00 +7.877949E-01 +2.335180E+01 +2.758241E+01 +1.622683E+01 +1.331996E+01 +2.248921E+00 +2.594934E-01 +tally 3: +1.537807E+01 +1.193746E+01 +1.044189E+00 +5.627797E-02 +2.861614E+01 +4.118322E+01 +1.846208E+00 +1.729007E-01 +3.921462E+01 +7.723576E+01 +2.427723E+00 +2.983153E-01 +4.653207E+01 +1.089818E+02 +3.128394E+00 +4.945409E-01 +4.989896E+01 +1.251503E+02 +3.242191E+00 +5.330743E-01 +4.967378E+01 +1.241657E+02 +3.184751E+00 +5.164524E-01 +4.592989E+01 +1.061019E+02 +2.936424E+00 +4.356307E-01 +3.783939E+01 +7.188489E+01 +2.485680E+00 +3.117618E-01 +2.819358E+01 +3.997588E+01 +1.875908E+00 +1.772000E-01 +1.562421E+01 +1.236020E+01 +1.013140E+00 +5.260420E-02 +tally 4: +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +3.126365E+00 +4.930682E-01 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.456410E+00 +1.499416E+00 +2.727755E+00 +3.788867E-01 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +7.453480E+00 +2.790159E+00 +5.240103E+00 +1.386895E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.741563E+00 +3.830225E+00 +7.137968E+00 +2.555042E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.221731E+00 +4.266573E+00 +8.474116E+00 +3.604647E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.054937E+00 +4.124537E+00 +9.066119E+00 +4.133833E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.362253E+00 +3.517245E+00 +9.086548E+00 +4.156118E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +6.871573E+00 +2.369190E+00 +8.399584E+00 +3.549784E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +4.998103E+00 +1.258194E+00 +7.145296E+00 +2.568115E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.716076E+00 +3.753568E-01 +5.427593E+00 +1.484154E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +3.056645E+00 +4.702349E-01 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 diff --git a/tests/test_cmfd_feed/settings.xml b/tests/test_cmfd_feed/settings.xml new file mode 100644 index 0000000000..41de07f569 --- /dev/null +++ b/tests/test_cmfd_feed/settings.xml @@ -0,0 +1,32 @@ + + + + + + 20 + 10 + 1000 + + + + + + + + + box + -10 -1 -1 10 1 1 + + + + + + 10 1 1 + -10.0 -1.0 -1.0 + 10.0 1.0 1.0 + + + + true + + diff --git a/tests/test_cmfd_feed/tallies.xml b/tests/test_cmfd_feed/tallies.xml new file mode 100644 index 0000000000..b20c0ad613 --- /dev/null +++ b/tests/test_cmfd_feed/tallies.xml @@ -0,0 +1,16 @@ + + + + + rectangular + -10 -1 -1 + 10 1 1 + 10 1 1 + + + + + flux + + + diff --git a/tests/test_cmfd_feed/test_cmfd_nofeed.py b/tests/test_cmfd_feed/test_cmfd_nofeed.py new file mode 100644 index 0000000000..090137fbe1 --- /dev/null +++ b/tests/test_cmfd_feed/test_cmfd_nofeed.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +import os +from subprocess import Popen, STDOUT, PIPE, call +import filecmp +from nose_mpi import NoseMPI +import glob + +pwd = os.path.dirname(__file__) + +def setup(): + os.putenv('PWD', pwd) + os.chdir(pwd) + +def test_run(): + openmc_path = pwd + '/../../src/openmc' + if int(NoseMPI.mpi_np) > 0: + proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + stderr=STDOUT, stdout=PIPE) + else: + proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + returncode = proc.wait() + print(proc.communicate()[0]) + assert returncode == 0 + +def test_created_statepoint(): + statepoint = glob.glob(pwd + '/statepoint.20.*') + assert len(statepoint) == 1 + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + +def test_output_exists(): + assert os.path.exists(pwd + '/tallies.out') + +def test_results(): + statepoint = glob.glob(pwd + '/statepoint.20.*') + call(['python', 'results.py', statepoint[0]]) + compare = filecmp.cmp('results_test.dat', 'results_true.dat') + if not compare: + os.rename('results_test.dat', 'results_error.dat') + assert compare + +def teardown(): + output = glob.glob(pwd + '/statepoint.20.*') + output.append(pwd + '/tallies.out') + output.append(pwd + '/results_test.dat') + for f in output: + if os.path.exists(f): + os.remove(f) + diff --git a/tests/test_cmfd_nofeed/cmfd.xml b/tests/test_cmfd_nofeed/cmfd.xml new file mode 100644 index 0000000000..c36a396043 --- /dev/null +++ b/tests/test_cmfd_nofeed/cmfd.xml @@ -0,0 +1,16 @@ + + + + + -10 -1 -1 + 10 1 1 + 10 1 1 + 0.0 0.0 1.0 1.0 1.0 1.0 + + + 5 + dominance + power + false + + diff --git a/tests/test_cmfd_nofeed/geometry.xml b/tests/test_cmfd_nofeed/geometry.xml new file mode 100644 index 0000000000..57c4aa2285 --- /dev/null +++ b/tests/test_cmfd_nofeed/geometry.xml @@ -0,0 +1,43 @@ + + + + + + 0 + -1 2 -3 4 -5 6 + 1 + + + + + x-plane + 10 + vacuum + + + x-plane + -10 + vacuum + + + y-plane + 1 + reflective + + + y-plane + -1 + reflective + + + z-plane + 1 + reflective + + + z-plane + -1 + reflective + + + diff --git a/tests/test_cmfd_nofeed/materials.xml b/tests/test_cmfd_nofeed/materials.xml new file mode 100644 index 0000000000..496774661e --- /dev/null +++ b/tests/test_cmfd_nofeed/materials.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/tests/test_cmfd_nofeed/results.py b/tests/test_cmfd_nofeed/results.py new file mode 100644 index 0000000000..533a624558 --- /dev/null +++ b/tests/test_cmfd_nofeed/results.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +import sys +import numpy as np + +# import statepoint +sys.path.append('../../src/utils') +import statepoint + +# read in statepoint file +if len(sys.argv) > 1: + sp = statepoint.StatePoint(sys.argv[1]) +else: + sp = statepoint.StatePoint('statepoint.20.binary') +sp.read_results() + +# extract tally results and convert to vector +results1 = sp.tallies[0].results +shape1 = results1.shape +size1 = (np.product(shape1)) +results1 = np.reshape(results1, size1) +results2 = sp.tallies[1].results +shape2 = results2.shape +size2 = (np.product(shape2)) +results2 = np.reshape(results2, size2) +results3 = sp.tallies[2].results +shape3 = results3.shape +size3 = (np.product(shape3)) +results3 = np.reshape(results3, size3) +results4 = sp.tallies[3].results +shape4 = results4.shape +size4 = (np.product(shape4)) +results4 = np.reshape(results4, size4) + +# set up output string +outstr = '' + +# write out k-combined +outstr += 'k-combined:\n' +outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1]) + +# write out tally results +outstr += 'tally 1:\n' +for item in results1: + outstr += "{0:12.6E}\n".format(item) +outstr += 'tally 2:\n' +for item in results2: + outstr += "{0:12.6E}\n".format(item) +outstr += 'tally 3:\n' +for item in results3: + outstr += "{0:12.6E}\n".format(item) +outstr += 'tally 4:\n' +for item in results4: + outstr += "{0:12.6E}\n".format(item) + +# write results to file +with open('results_test.dat','w') as fh: + fh.write(outstr) diff --git a/tests/test_cmfd_nofeed/results_true.dat b/tests/test_cmfd_nofeed/results_true.dat new file mode 100644 index 0000000000..6f00290374 --- /dev/null +++ b/tests/test_cmfd_nofeed/results_true.dat @@ -0,0 +1,654 @@ +k-combined: +1.137460E+00 1.215114E-02 +tally 1: +1.168490E+01 +1.400522E+01 +2.192157E+01 +4.824543E+01 +2.936949E+01 +8.648246E+01 +3.435607E+01 +1.185184E+02 +3.612841E+01 +1.309721E+02 +3.552232E+01 +1.266988E+02 +3.314322E+01 +1.107274E+02 +2.765588E+01 +7.705156E+01 +2.044445E+01 +4.210167E+01 +1.125932E+01 +1.276689E+01 +tally 2: +2.372613E+01 +2.862691E+01 +1.660400E+01 +1.404387E+01 +2.237703E+00 +2.562122E-01 +4.397041E+01 +9.722086E+01 +3.107800E+01 +4.859826E+01 +4.052018E+00 +8.364586E-01 +5.850026E+01 +1.715533E+02 +4.157400E+01 +8.666187E+01 +5.420325E+00 +1.492090E+00 +6.875182E+01 +2.377104E+02 +4.875600E+01 +1.196878E+02 +6.167355E+00 +1.922001E+00 +7.240156E+01 +2.639189E+02 +5.161800E+01 +1.342800E+02 +6.657325E+00 +2.248300E+00 +7.074222E+01 +2.516854E+02 +5.016500E+01 +1.266005E+02 +6.598272E+00 +2.224189E+00 +6.625191E+01 +2.209754E+02 +4.694400E+01 +1.110192E+02 +6.197674E+00 +1.947375E+00 +5.574790E+01 +1.561211E+02 +3.963100E+01 +7.893339E+01 +5.104628E+00 +1.314367E+00 +4.068463E+01 +8.316576E+01 +2.878400E+01 +4.165629E+01 +4.000895E+00 +8.100229E-01 +2.238335E+01 +2.532998E+01 +1.555300E+01 +1.221694E+01 +2.312206E+00 +2.751529E-01 +tally 3: +1.599200E+01 +1.304060E+01 +1.075546E+00 +5.989825E-02 +2.991600E+01 +4.504778E+01 +2.016558E+00 +2.060921E-01 +4.008500E+01 +8.057644E+01 +2.465241E+00 +3.073562E-01 +4.690900E+01 +1.108192E+02 +3.050094E+00 +4.696181E-01 +4.972600E+01 +1.246434E+02 +3.127136E+00 +4.939882E-01 +4.836400E+01 +1.176964E+02 +3.102574E+00 +4.868820E-01 +4.524800E+01 +1.031819E+02 +2.966738E+00 +4.482948E-01 +3.809700E+01 +7.295318E+01 +2.526411E+00 +3.226394E-01 +2.772600E+01 +3.866039E+01 +1.852304E+00 +1.725388E-01 +1.494500E+01 +1.129101E+01 +9.995136E-01 +5.115569E-02 +tally 4: +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +3.251000E+00 +5.355770E-01 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.759000E+00 +1.676451E+00 +2.883000E+00 +4.269210E-01 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +7.633000E+00 +2.922951E+00 +5.354000E+00 +1.442474E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.787000E+00 +3.871605E+00 +7.137000E+00 +2.553987E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.343000E+00 +4.385923E+00 +8.470000E+00 +3.603838E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.076000E+00 +4.142704E+00 +8.977000E+00 +4.056459E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.252000E+00 +3.428360E+00 +8.957000E+00 +4.041545E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +6.868000E+00 +2.375736E+00 +8.404000E+00 +3.562144E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +4.914000E+00 +1.211724E+00 +7.074000E+00 +2.511368E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.634000E+00 +3.523220E-01 +5.349000E+00 +1.437693E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +3.050000E+00 +4.687600E-01 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 diff --git a/tests/test_cmfd_nofeed/settings.xml b/tests/test_cmfd_nofeed/settings.xml new file mode 100644 index 0000000000..41de07f569 --- /dev/null +++ b/tests/test_cmfd_nofeed/settings.xml @@ -0,0 +1,32 @@ + + + + + + 20 + 10 + 1000 + + + + + + + + + box + -10 -1 -1 10 1 1 + + + + + + 10 1 1 + -10.0 -1.0 -1.0 + 10.0 1.0 1.0 + + + + true + + diff --git a/tests/test_cmfd_nofeed/tallies.xml b/tests/test_cmfd_nofeed/tallies.xml new file mode 100644 index 0000000000..b20c0ad613 --- /dev/null +++ b/tests/test_cmfd_nofeed/tallies.xml @@ -0,0 +1,16 @@ + + + + + rectangular + -10 -1 -1 + 10 1 1 + 10 1 1 + + + + + flux + + + diff --git a/tests/test_cmfd_nofeed/test_cmfd_nofeed.py b/tests/test_cmfd_nofeed/test_cmfd_nofeed.py new file mode 100644 index 0000000000..090137fbe1 --- /dev/null +++ b/tests/test_cmfd_nofeed/test_cmfd_nofeed.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +import os +from subprocess import Popen, STDOUT, PIPE, call +import filecmp +from nose_mpi import NoseMPI +import glob + +pwd = os.path.dirname(__file__) + +def setup(): + os.putenv('PWD', pwd) + os.chdir(pwd) + +def test_run(): + openmc_path = pwd + '/../../src/openmc' + if int(NoseMPI.mpi_np) > 0: + proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + stderr=STDOUT, stdout=PIPE) + else: + proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + returncode = proc.wait() + print(proc.communicate()[0]) + assert returncode == 0 + +def test_created_statepoint(): + statepoint = glob.glob(pwd + '/statepoint.20.*') + assert len(statepoint) == 1 + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + +def test_output_exists(): + assert os.path.exists(pwd + '/tallies.out') + +def test_results(): + statepoint = glob.glob(pwd + '/statepoint.20.*') + call(['python', 'results.py', statepoint[0]]) + compare = filecmp.cmp('results_test.dat', 'results_true.dat') + if not compare: + os.rename('results_test.dat', 'results_error.dat') + assert compare + +def teardown(): + output = glob.glob(pwd + '/statepoint.20.*') + output.append(pwd + '/tallies.out') + output.append(pwd + '/results_test.dat') + for f in output: + if os.path.exists(f): + os.remove(f) +