From 730623246f53e25fd6875b04953ae3633aab4e75 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 14 Feb 2018 15:36:00 -0600 Subject: [PATCH] Rename results.h5 -> depletion_results.h5. Use /materials in HDF5 file --- openmc/deplete/integrator/save_results.py | 4 ++-- openmc/deplete/results.py | 12 ++++-------- scripts/example_plot.py | 2 +- scripts/example_run.py | 1 - tests/regression_tests/test_deplete_full.py | 2 +- tests/regression_tests/test_reference.h5 | Bin 165384 -> 231608 bytes tests/unit_tests/test_deplete_cecm.py | 2 +- tests/unit_tests/test_deplete_integrator.py | 2 +- tests/unit_tests/test_deplete_predictor.py | 2 +- 9 files changed, 11 insertions(+), 16 deletions(-) diff --git a/openmc/deplete/integrator/save_results.py b/openmc/deplete/integrator/save_results.py index 4f20b52fde..f580af838c 100644 --- a/openmc/deplete/integrator/save_results.py +++ b/openmc/deplete/integrator/save_results.py @@ -9,7 +9,7 @@ def save_results(op, x, rates, eigvls, seeds, t, step_ind): Parameters ---------- - op : Function + op : openmc.deplete.Operator The operator used to generate these results. x : list of list of numpy.array The prior x vectors. Indexed [i][cell] using the above equation. @@ -44,4 +44,4 @@ def save_results(op, x, rates, eigvls, seeds, t, step_ind): results.time = t results.rates = rates - write_results(results, "results.h5", step_ind) + write_results(results, "depletion_results.h5", step_ind) diff --git a/openmc/deplete/results.py b/openmc/deplete/results.py index 1a2ee4e437..fd48bb4df1 100644 --- a/openmc/deplete/results.py +++ b/openmc/deplete/results.py @@ -52,7 +52,6 @@ class Results(object): self.k = None self.seeds = None self.time = None - self.p_terms = None self.rates = None self.volume = None @@ -192,7 +191,7 @@ class Results(object): n_rxn = len(rxn_list) n_stages = self.n_stages - mat_group = handle.create_group("cells") + mat_group = handle.create_group("materials") for mat in mat_list: mat_single_group = mat_group.create_group(mat) @@ -333,24 +332,21 @@ class Results(object): rxn_nuc_to_ind = OrderedDict() rxn_to_ind = OrderedDict() - for mat in handle["/cells"]: - mat_handle = handle["/cells/" + mat] + for mat, mat_handle in handle["/materials"].items(): vol = mat_handle.attrs["volume"] ind = mat_handle.attrs["index"] results.volume[mat] = vol results.mat_to_ind[mat] = ind - for nuc in handle["/nuclides"]: - nuc_handle = handle["/nuclides/" + nuc] + for nuc, nuc_handle in handle["/nuclides"].items(): ind_atom = nuc_handle.attrs["atom number index"] results.nuc_to_ind[nuc] = ind_atom if "reaction rate index" in nuc_handle.attrs: rxn_nuc_to_ind[nuc] = nuc_handle.attrs["reaction rate index"] - for rxn in handle["/reactions"]: - rxn_handle = handle["/reactions/" + rxn] + for rxn, rxn_handle in handle["/reactions"].items(): rxn_to_ind[rxn] = rxn_handle.attrs["index"] results.rates = [] diff --git a/scripts/example_plot.py b/scripts/example_plot.py index c92fef6bf2..ab5ac204d8 100644 --- a/scripts/example_plot.py +++ b/scripts/example_plot.py @@ -8,7 +8,7 @@ from openmc.deplete import (read_results, evaluate_single_nuclide, result_folder = "test" # Load data -results = read_results(result_folder + "/results.h5") +results = read_results(result_folder + "/deplete_results.h5") cell = "5" nuc = "Gd157" diff --git a/scripts/example_run.py b/scripts/example_run.py index 56d42b21a7..30b6bdc2ee 100644 --- a/scripts/example_run.py +++ b/scripts/example_run.py @@ -28,7 +28,6 @@ settings.particles = 1000 settings.batches = 100 settings.inactive = 40 settings.source = openmc.Source(space=openmc.stats.Box(lower_left, upper_right)) -settings.verbosity = 3 op = openmc.deplete.OpenMCOperator(geometry, settings) diff --git a/tests/regression_tests/test_deplete_full.py b/tests/regression_tests/test_deplete_full.py index fcaa60eee5..e775e7af86 100644 --- a/tests/regression_tests/test_deplete_full.py +++ b/tests/regression_tests/test_deplete_full.py @@ -61,7 +61,7 @@ def test_full(run_in_tmpdir): openmc.deplete.integrator.predictor(op) # Load the files - res_test = results.read_results(settings.output_dir + "/results.h5") + res_test = results.read_results(settings.output_dir + "/depletion_results.h5") # Load the reference filename = str(Path(__file__).with_name('test_reference.h5')) diff --git a/tests/regression_tests/test_reference.h5 b/tests/regression_tests/test_reference.h5 index ef3ae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9G8>gLU4KN=q>Vd z(sBT9h!qHQ=z+NddIdL0E{v*^9BN)%rmuN2jy1>v$DfO3&za}7TxnmN!=dtL^(qU? zQDqf4uCo2AQK?c1({eJQciFfFUABSaE|aermnxTVsJue2viEsZ83vB4Y+Ueu+ES!M z&D@NP8?e%qK;%n_Iy%ezoRl7ds}L8V^10(lO9QweR;8X4JvbNi>TZ%<7*!{GX`5{& z^<~d}5ldA9j+fne-K-#Pv@h5pjk>G!E^A*#mo3gc@ut~eDm=pZ@@l=s&R5YQst$8Vp!V(hnpbW^wGGbgf5)sHuCp)6;c$7qUgN|%)Y$t* zuzcl`(Wuf0(=oYG?=iFiJvzW$F&c+!#pZisaVtZwv!Ud>IK3!~~Z?_9R6&HA!8??khm zZ;G;yw}Jt)H|I+G5*?x_p4H2o+>A0Kz|C4R9>3bigz2e}XL<%(fLvWMSQOf$q zlU4?BLkwS;p1-j3RzK*K-6Xp(s!n!DBWH)c=-nKu4ebbyAO2Xt?2Ne2z9fPZ=6m%X zqxYc41m^~BG#XVJVLn!N>OH2viyrekgX06U&3uIA-8UcMhaK_5=+WDf+p>gV?S<#D96j zygfW-s*8Td~DAh#l)3SqRp9Yh-&m}};ai3nMG;hnh7Me?q$|Ib9^X000%N%)G Q!*hq`vcUB6KWAq7$Bg66+$yY`3sm<}8}c9W2{B cSQs0YbHWrkOgv~leZqD|r|n&980&5V0K4QAp8x;= diff --git a/tests/unit_tests/test_deplete_cecm.py b/tests/unit_tests/test_deplete_cecm.py index 264ad21671..7fe8c6a043 100644 --- a/tests/unit_tests/test_deplete_cecm.py +++ b/tests/unit_tests/test_deplete_cecm.py @@ -24,7 +24,7 @@ def test_cecm(run_in_tmpdir): openmc.deplete.cecm(op, print_out=False) # Load the files - res = results.read_results(settings.output_dir + "/results.h5") + res = results.read_results(settings.output_dir + "/depletion_results.h5") _, y1 = utilities.evaluate_single_nuclide(res, "1", "1") _, y2 = utilities.evaluate_single_nuclide(res, "1", "2") diff --git a/tests/unit_tests/test_deplete_integrator.py b/tests/unit_tests/test_deplete_integrator.py index 3b6eed42dc..964f99eee3 100644 --- a/tests/unit_tests/test_deplete_integrator.py +++ b/tests/unit_tests/test_deplete_integrator.py @@ -80,7 +80,7 @@ def test_save_results(run_in_tmpdir): integrator.save_results(op, x2, rate2, eigvl2, seed2, t2, 1) # Load the files - res = results.read_results("results.h5") + res = results.read_results("depletion_results.h5") for i in range(stages): for mat_i, mat in enumerate(burn_list): diff --git a/tests/unit_tests/test_deplete_predictor.py b/tests/unit_tests/test_deplete_predictor.py index d808c46b8e..8ec8964bbd 100644 --- a/tests/unit_tests/test_deplete_predictor.py +++ b/tests/unit_tests/test_deplete_predictor.py @@ -24,7 +24,7 @@ def test_predictor(run_in_tmpdir): openmc.deplete.predictor(op, print_out=False) # Load the files - res = results.read_results(settings.output_dir + "/results.h5") + res = results.read_results(settings.output_dir + "/depletion_results.h5") _, y1 = utilities.evaluate_single_nuclide(res, "1", "1") _, y2 = utilities.evaluate_single_nuclide(res, "1", "2")