From 3b5ebc0eff61594467d643cd72a8543734bb61b0 Mon Sep 17 00:00:00 2001 From: Adam Nelson Date: Sat, 4 Mar 2017 05:13:55 -0500 Subject: [PATCH] Fixed energyout filter indices in mg mode, fixed failing test_mg_convert and test_mgxs_library_ce_to_mg due to sp and su files not being closed --- src/tally.F90 | 6 +++++- tests/test_mg_convert/test_mg_convert.py | 5 +++++ .../test_mgxs_library_ce_to_mg.py | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/tally.F90 b/src/tally.F90 index 650e91b66..aed7748dc 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -2523,9 +2523,13 @@ contains if (.not. run_CE .and. eo_filt % matches_transport_groups) then - ! determine outgoing energy from fission bank + ! determine outgoing energy group from fission bank g_out = int(fission_bank(n_bank - p % n_bank + k) % E) + ! modify the value so that g_out = 1 corresponds to the highest + ! energy bin + g_out = size(eo_filt % bins) - g_out + ! change outgoing energy bin matching_bins(i) = g_out diff --git a/tests/test_mg_convert/test_mg_convert.py b/tests/test_mg_convert/test_mg_convert.py index d8a9665d8..45e703b0e 100755 --- a/tests/test_mg_convert/test_mg_convert.py +++ b/tests/test_mg_convert/test_mg_convert.py @@ -154,6 +154,11 @@ class MGXSTestHarness(PyAPITestHarness): form = '{0:12.6E} {1:12.6E}\n' outstr += form.format(sp.k_combined[0], sp.k_combined[1]) + # Enforce closing statepoint and summary files so HDF5 + # does not throw an error during the next OpenMC execution + sp._f.close() + sp._summary._f.close() + return outstr def _get_results(self, outstr, hash_output=False): diff --git a/tests/test_mgxs_library_ce_to_mg/test_mgxs_library_ce_to_mg.py b/tests/test_mgxs_library_ce_to_mg/test_mgxs_library_ce_to_mg.py index f9f9a7509..343a48a83 100644 --- a/tests/test_mgxs_library_ce_to_mg/test_mgxs_library_ce_to_mg.py +++ b/tests/test_mgxs_library_ce_to_mg/test_mgxs_library_ce_to_mg.py @@ -71,6 +71,11 @@ class MGXSTestHarness(PyAPITestHarness): if os.path.exists('./tallies.xml'): os.remove('./tallies.xml') + # Enforce closing statepoint and summary files so HDF5 + # does not throw an error during the next OpenMC execution + sp._f.close() + sp._summary._f.close() + # Re-run MG mode. if self._opts.mpi_exec is not None: mpi_args = [self._opts.mpi_exec, '-n', self._opts.mpi_np]