From cb2a8e873572466dbe3eb83402fcfdd5d3a00a97 Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Wed, 10 Jun 2015 23:01:16 -0600 Subject: [PATCH 1/4] Fixed indexing error in YN tallies --- src/tally.F90 | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/tally.F90 b/src/tally.F90 index a4fbe01cfd..f860149f6e 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -140,7 +140,7 @@ contains end if - case (SCORE_SCATTER_PN, SCORE_SCATTER_YN) + case (SCORE_SCATTER_PN) ! Only analog estimators are available. ! Skip any event where the particle didn't scatter if (p % event /= EVENT_SCATTER) then @@ -153,6 +153,19 @@ contains score = p % last_wgt + case (SCORE_SCATTER_YN) + ! Only analog estimators are available. + ! Skip any event where the particle didn't scatter + if (p % event /= EVENT_SCATTER) then + i = i + (t % moment_order(i) + 1)**2 - 1 + cycle SCORE_LOOP + end if + ! Since only scattering events make it here, again we can use + ! the weight entering the collision as the estimator for the + ! reaction rate + score = p % last_wgt + + case (SCORE_NU_SCATTER, SCORE_NU_SCATTER_N) ! Only analog estimators are available. ! Skip any event where the particle didn't scatter @@ -163,7 +176,7 @@ contains score = p % wgt - case (SCORE_NU_SCATTER_PN, SCORE_NU_SCATTER_YN) + case (SCORE_NU_SCATTER_PN) ! Only analog estimators are available. ! Skip any event where the particle didn't scatter if (p % event /= EVENT_SCATTER) then @@ -176,6 +189,19 @@ contains score = p % wgt + case (SCORE_NU_SCATTER_YN) + ! Only analog estimators are available. + ! Skip any event where the particle didn't scatter + if (p % event /= EVENT_SCATTER) then + i = i + (t % moment_order(i) + 1)**2 - 1 + cycle SCORE_LOOP + end if + ! For scattering production, we need to use the post-collision + ! weight as the estimate for the number of neutrons exiting a + ! reaction with neutrons in the exit channel + score = p % wgt + + case (SCORE_TRANSPORT) ! Only analog estimators are available. ! Skip any event where the particle didn't scatter From 4820aa7af84274913224b862325863bc72fae73d Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Thu, 11 Jun 2015 17:54:23 -0600 Subject: [PATCH 2/4] Added test with many tally scores --- tests/test_many_scores/geometry.xml | 181 ++++++++++++++ tests/test_many_scores/materials.xml | 272 +++++++++++++++++++++ tests/test_many_scores/results.py | 37 +++ tests/test_many_scores/results_true.dat | 111 +++++++++ tests/test_many_scores/settings.xml | 19 ++ tests/test_many_scores/tallies.xml | 13 + tests/test_many_scores/test_many_scores.py | 63 +++++ 7 files changed, 696 insertions(+) create mode 100644 tests/test_many_scores/geometry.xml create mode 100644 tests/test_many_scores/materials.xml create mode 100644 tests/test_many_scores/results.py create mode 100644 tests/test_many_scores/results_true.dat create mode 100644 tests/test_many_scores/settings.xml create mode 100644 tests/test_many_scores/tallies.xml create mode 100644 tests/test_many_scores/test_many_scores.py diff --git a/tests/test_many_scores/geometry.xml b/tests/test_many_scores/geometry.xml new file mode 100644 index 0000000000..b85dd04df9 --- /dev/null +++ b/tests/test_many_scores/geometry.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 17 17 + -10.71 -10.71 + 1.26 1.26 + + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 + 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 2 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 8 8 8 7 7 7 7 + 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 + 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 + 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 + 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 + 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 + 7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 + 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 + 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 + + + + diff --git a/tests/test_many_scores/materials.xml b/tests/test_many_scores/materials.xml new file mode 100644 index 0000000000..9c0b74f3f1 --- /dev/null +++ b/tests/test_many_scores/materials.xml @@ -0,0 +1,272 @@ + + + + 71c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_many_scores/results.py b/tests/test_many_scores/results.py new file mode 100644 index 0000000000..79b9e806e5 --- /dev/null +++ b/tests/test_many_scores/results.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +import sys +import numpy as np + +sys.path.insert(0, '../..') +from openmc.statepoint import StatePoint + +# read in statepoint file +if len(sys.argv) > 1: + sp = StatePoint(sys.argv[1]) +else: + sp = StatePoint('statepoint.10.binary') + +sp.read_results() + +# extract tally results and convert to vector +tally1 = sp._tallies[1] +results1 = np.zeros((tally1._sum.size + tally1._sum.size, )) +results1[0::2] = tally1._sum.ravel() +results1[1::2] = tally1._sum_sq.ravel() + +# 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) + +# write results to file +with open('results_test.dat','w') as fh: + fh.write(outstr) diff --git a/tests/test_many_scores/results_true.dat b/tests/test_many_scores/results_true.dat new file mode 100644 index 0000000000..a942298579 --- /dev/null +++ b/tests/test_many_scores/results_true.dat @@ -0,0 +1,111 @@ +k-combined: +1.093844E+00 1.626801E-02 +tally 1: +3.279262E+01 +2.221651E+02 +1.467000E+01 +4.436530E+01 +1.238000E+01 +3.168320E+01 +1.239000E+01 +3.172630E+01 +6.199204E-01 +1.441510E-01 +1.238000E+01 +3.168320E+01 +1.437080E+00 +4.234943E-01 +6.199204E-01 +1.441510E-01 +6.192790E-01 +1.440589E-01 +1.239000E+01 +3.172630E+01 +1.431689E+00 +4.209133E-01 +6.192790E-01 +1.440589E-01 +1.299248E+01 +3.535385E+01 +1.237000E+01 +3.164030E+01 +2.290000E+00 +1.070700E+00 +2.621040E+00 +1.432626E+00 +2.121307E+02 +9.243355E+03 +3.279262E+01 +2.221651E+02 +7.953554E-01 +2.794413E-01 +-5.651323E-01 +5.451242E-01 +7.808576E-01 +4.643154E-01 +-3.339898E-02 +2.214820E-01 +8.240703E-01 +3.604286E-01 +-3.480671E-01 +5.570757E-02 +9.439222E-02 +1.270253E-01 +-7.433958E-02 +2.442051E-01 +1.467000E+01 +4.436530E+01 +2.078102E-01 +7.212449E-02 +-2.504352E-01 +6.843464E-02 +2.485680E-01 +5.434798E-02 +1.706243E-02 +3.852278E-02 +3.951701E-01 +4.706380E-02 +-1.535042E-01 +6.678803E-03 +-1.897513E-02 +2.508393E-02 +-6.471447E-02 +3.180139E-02 +1.238000E+01 +3.168320E+01 +-1.570048E-01 +1.067590E-02 +-4.730723E-02 +2.307294E-02 +6.490976E-02 +1.426908E-02 +-2.426427E-02 +5.909294E-03 +9.534163E-02 +6.333588E-03 +-1.023123E-02 +2.132217E-03 +-2.609941E-03 +2.406916E-03 +1.035322E-01 +1.128320E-02 +1.239000E+01 +3.172630E+01 +-1.558408E-01 +1.069360E-02 +-4.768057E-02 +2.298561E-02 +7.015981E-02 +1.366523E-02 +-2.449791E-02 +5.899048E-03 +9.535825E-02 +6.335188E-03 +-9.915129E-03 +2.116965E-03 +-2.535001E-03 +2.410993E-03 +1.030312E-01 +1.128648E-02 +1.458000E+01 +4.391620E+01 diff --git a/tests/test_many_scores/settings.xml b/tests/test_many_scores/settings.xml new file mode 100644 index 0000000000..517637a59f --- /dev/null +++ b/tests/test_many_scores/settings.xml @@ -0,0 +1,19 @@ + + + + + 10 + 5 + 100 + + + + + + -160 -160 -183 + 160 160 183 + + + + + diff --git a/tests/test_many_scores/tallies.xml b/tests/test_many_scores/tallies.xml new file mode 100644 index 0000000000..1832acf67a --- /dev/null +++ b/tests/test_many_scores/tallies.xml @@ -0,0 +1,13 @@ + + + + + + + flux total scatter nu-scatter scatter-2 scatter-p2 nu-scatter-2 + nu-scatter-p2 transport n1n absorption nu-fission kappa-fission + flux-y2 total-y2 scatter-y2 nu-scatter-y2 events + + + + diff --git a/tests/test_many_scores/test_many_scores.py b/tests/test_many_scores/test_many_scores.py new file mode 100644 index 0000000000..fd3b3ed5b2 --- /dev/null +++ b/tests/test_many_scores/test_many_scores.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +import os +import sys +from subprocess import Popen, STDOUT, PIPE, call +import filecmp +import glob +from optparse import OptionParser + +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() + +def test_run(): + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], + stderr=STDOUT, stdout=PIPE) + else: + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) + print(proc.communicate()[0]) + returncode = proc.returncode + assert returncode == 0, 'OpenMC did not exit successfully.' + +def test_created_statepoint(): + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' + +def test_output_exists(): + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' + +def test_results(): + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + call([sys.executable, '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, 'Results do not agree.' + +def teardown(): + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) + for f in output: + if os.path.exists(f): + os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe is None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() From adcd8bb20cc47b99b2ffede0fadbd2d254ab8fff Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Fri, 12 Jun 2015 00:34:05 -0600 Subject: [PATCH 3/4] Minor test adjustments for #399 --- tests/test_many_scores/results.py | 2 +- tests/test_many_scores/results_true.dat | 218 ++++++++++----------- tests/test_many_scores/settings.xml | 6 +- tests/test_many_scores/test_many_scores.py | 20 +- 4 files changed, 124 insertions(+), 122 deletions(-) diff --git a/tests/test_many_scores/results.py b/tests/test_many_scores/results.py index 79b9e806e5..8214d394c6 100644 --- a/tests/test_many_scores/results.py +++ b/tests/test_many_scores/results.py @@ -10,7 +10,7 @@ from openmc.statepoint import StatePoint if len(sys.argv) > 1: sp = StatePoint(sys.argv[1]) else: - sp = StatePoint('statepoint.10.binary') + sp = StatePoint('statepoint.5.binary') sp.read_results() diff --git a/tests/test_many_scores/results_true.dat b/tests/test_many_scores/results_true.dat index a942298579..50040117df 100644 --- a/tests/test_many_scores/results_true.dat +++ b/tests/test_many_scores/results_true.dat @@ -1,111 +1,111 @@ k-combined: -1.093844E+00 1.626801E-02 +0.000000E+00 0.000000E+00 tally 1: -3.279262E+01 -2.221651E+02 -1.467000E+01 -4.436530E+01 -1.238000E+01 -3.168320E+01 -1.239000E+01 -3.172630E+01 -6.199204E-01 -1.441510E-01 -1.238000E+01 -3.168320E+01 -1.437080E+00 -4.234943E-01 -6.199204E-01 -1.441510E-01 -6.192790E-01 -1.440589E-01 -1.239000E+01 -3.172630E+01 -1.431689E+00 -4.209133E-01 -6.192790E-01 -1.440589E-01 -1.299248E+01 -3.535385E+01 -1.237000E+01 -3.164030E+01 -2.290000E+00 -1.070700E+00 -2.621040E+00 -1.432626E+00 -2.121307E+02 -9.243355E+03 -3.279262E+01 -2.221651E+02 -7.953554E-01 -2.794413E-01 --5.651323E-01 -5.451242E-01 -7.808576E-01 -4.643154E-01 --3.339898E-02 -2.214820E-01 -8.240703E-01 -3.604286E-01 --3.480671E-01 -5.570757E-02 -9.439222E-02 -1.270253E-01 --7.433958E-02 -2.442051E-01 -1.467000E+01 -4.436530E+01 -2.078102E-01 -7.212449E-02 --2.504352E-01 -6.843464E-02 -2.485680E-01 -5.434798E-02 -1.706243E-02 -3.852278E-02 -3.951701E-01 -4.706380E-02 --1.535042E-01 -6.678803E-03 --1.897513E-02 -2.508393E-02 --6.471447E-02 -3.180139E-02 -1.238000E+01 -3.168320E+01 --1.570048E-01 -1.067590E-02 --4.730723E-02 -2.307294E-02 -6.490976E-02 -1.426908E-02 --2.426427E-02 -5.909294E-03 -9.534163E-02 -6.333588E-03 --1.023123E-02 -2.132217E-03 --2.609941E-03 -2.406916E-03 -1.035322E-01 -1.128320E-02 -1.239000E+01 -3.172630E+01 --1.558408E-01 -1.069360E-02 --4.768057E-02 -2.298561E-02 -7.015981E-02 -1.366523E-02 --2.449791E-02 -5.899048E-03 -9.535825E-02 -6.335188E-03 --9.915129E-03 -2.116965E-03 --2.535001E-03 -2.410993E-03 -1.030312E-01 -1.128648E-02 -1.458000E+01 -4.391620E+01 +2.254760E+01 +1.695439E+02 +1.017400E+01 +3.450623E+01 +8.690000E+00 +2.517771E+01 +8.696000E+00 +2.521248E+01 +5.224881E-01 +9.127522E-02 +8.690000E+00 +2.517771E+01 +9.665236E-01 +3.121401E-01 +5.224881E-01 +9.127522E-02 +5.199964E-01 +9.041516E-02 +8.696000E+00 +2.521248E+01 +9.666447E-01 +3.122176E-01 +5.199964E-01 +9.041516E-02 +9.262308E+00 +2.859762E+01 +8.684000E+00 +2.514296E+01 +1.484000E+00 +7.346160E-01 +1.804688E+00 +1.089100E+00 +1.334833E+02 +5.960573E+03 +2.254760E+01 +1.695439E+02 +-6.230152E-02 +1.023784E-02 +-2.696818E-01 +8.525477E-02 +-1.670294E-01 +4.366614E-02 +1.331953E-02 +8.064039E-05 +-2.490295E-01 +2.511425E-02 +8.289978E-02 +2.753446E-03 +-1.390686E-01 +1.592673E-02 +1.600203E-01 +1.344513E-02 +1.017400E+01 +3.450623E+01 +-6.564301E-02 +2.564587E-03 +-1.245391E-01 +1.143479E-02 +-5.550309E-02 +9.334547E-03 +4.671277E-02 +1.795787E-03 +-9.901000E-02 +4.609654E-03 +2.619012E-02 +3.011793E-04 +-7.090362E-02 +2.450750E-03 +4.059073E-02 +8.841300E-04 +8.690000E+00 +2.517771E+01 +-2.685052E-02 +2.769798E-04 +4.047919E-03 +3.384947E-03 +-1.325869E-01 +8.610169E-03 +-1.594962E-02 +5.528670E-04 +-1.320550E-02 +1.856248E-04 +1.185337E-02 +3.428536E-04 +2.622196E-02 +3.774884E-04 +2.938463E-02 +6.660370E-04 +8.696000E+00 +2.521248E+01 +-2.634867E-02 +2.718345E-04 +4.042613E-03 +3.367272E-03 +-1.328903E-01 +8.576852E-03 +-1.632965E-02 +5.577169E-04 +-1.408565E-02 +1.815109E-04 +1.202519E-02 +3.685250E-04 +2.634054E-02 +3.730853E-04 +2.941341E-02 +6.479457E-04 +8.662000E+00 +2.501365E+01 diff --git a/tests/test_many_scores/settings.xml b/tests/test_many_scores/settings.xml index 517637a59f..08dc0d2e12 100644 --- a/tests/test_many_scores/settings.xml +++ b/tests/test_many_scores/settings.xml @@ -2,9 +2,9 @@ - 10 - 5 - 100 + 5 + 2 + 500 diff --git a/tests/test_many_scores/test_many_scores.py b/tests/test_many_scores/test_many_scores.py index fd3b3ed5b2..6b3ddeccae 100644 --- a/tests/test_many_scores/test_many_scores.py +++ b/tests/test_many_scores/test_many_scores.py @@ -25,7 +25,7 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.5.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' @@ -34,15 +34,15 @@ def test_output_exists(): assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.5.*')) call([sys.executable, 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: - os.rename('results_test.dat', 'results_error.dat') + os.rename('results_test.dat', 'results_error.dat') assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output = glob.glob(os.path.join(cwd, 'statepoint.5.*')) output.append(os.path.join(cwd, 'tallies.out')) output.append(os.path.join(cwd, 'results_test.dat')) for f in output: @@ -56,8 +56,10 @@ if __name__ == '__main__': raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests - test_run() - test_created_statepoint() - test_output_exists() - test_results() - teardown() + try: + test_run() + test_created_statepoint() + test_output_exists() + test_results() + finally: + teardown() From 38d1761335df5c69c1a26d09b71d00846be56d21 Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Fri, 12 Jun 2015 11:56:27 -0600 Subject: [PATCH 4/4] Fixed tests for #399 --- tests/test_many_scores/results_true.dat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_many_scores/results_true.dat b/tests/test_many_scores/results_true.dat index 50040117df..191122f13e 100644 --- a/tests/test_many_scores/results_true.dat +++ b/tests/test_many_scores/results_true.dat @@ -107,5 +107,5 @@ tally 1: 3.730853E-04 2.941341E-02 6.479457E-04 -8.662000E+00 -2.501365E+01 +1.014000E+01 +3.427460E+01