diff --git a/docs/source/pythonapi/deplete.rst b/docs/source/pythonapi/deplete.rst index 383268f8b..41be2d88a 100644 --- a/docs/source/pythonapi/deplete.rst +++ b/docs/source/pythonapi/deplete.rst @@ -133,8 +133,8 @@ data, such as number densities and reaction rates for each material. AtomNumber OperatorResult ReactionRates - Results ResultsList + StepResult The following class and functions are used to solve the depletion equations, with :func:`cram.CRAM48` being the default. diff --git a/openmc/deplete/abc.py b/openmc/deplete/abc.py index 7c3fc42f7..7d6e33924 100644 --- a/openmc/deplete/abc.py +++ b/openmc/deplete/abc.py @@ -22,7 +22,7 @@ from uncertainties import ufloat from openmc.lib import MaterialFilter, Tally from openmc.checkvalue import check_type, check_greater_than from openmc.mpi import comm -from .results import Results +from .results import StepResult from .chain import Chain from .results_list import ResultsList from .pool import deplete @@ -889,7 +889,7 @@ class Integrator(ABC): # Remove actual EOS concentration for next step conc = conc_list.pop() - Results.save(self.operator, conc_list, res_list, [t, t + dt], + StepResult.save(self.operator, conc_list, res_list, [t, t + dt], source_rate, self._i_res + i, proc_time) t += dt @@ -901,7 +901,7 @@ class Integrator(ABC): if output and final_step: print(f"[openmc.deplete] t={t} (final operator evaluation)") res_list = [self.operator(conc, source_rate if final_step else 0.0)] - Results.save(self.operator, [conc], res_list, [t, t], + StepResult.save(self.operator, [conc], res_list, [t, t], source_rate, self._i_res + len(self), proc_time) self.operator.write_bos_data(len(self) + self._i_res) @@ -1048,13 +1048,13 @@ class SIIntegrator(Integrator): # Remove actual EOS concentration for next step conc = conc_list.pop() - Results.save(self.operator, conc_list, res_list, [t, t + dt], + StepResult.save(self.operator, conc_list, res_list, [t, t + dt], p, self._i_res + i, proc_time) t += dt # No final simulation for SIE, use last iteration results - Results.save(self.operator, [conc], [res_list[-1]], [t, t], + StepResult.save(self.operator, [conc], [res_list[-1]], [t, t], p, self._i_res + len(self), proc_time) self.operator.write_bos_data(self._i_res + len(self)) diff --git a/openmc/deplete/results.py b/openmc/deplete/results.py index 9ff07b049..bfd165481 100644 --- a/openmc/deplete/results.py +++ b/openmc/deplete/results.py @@ -16,10 +16,10 @@ from .reaction_rates import ReactionRates VERSION_RESULTS = (1, 1) -__all__ = ["Results"] +__all__ = ["StepResult"] -class Results: +class StepResult: """Output of a depletion run Attributes @@ -72,7 +72,7 @@ class Results: def __repr__(self): t = self.time[0] dt = self.time[1] - self.time[0] - return f"" + return f"" def __getitem__(self, pos): """Retrieves an item from results. @@ -139,7 +139,7 @@ class Results: return self.data.shape[0] def allocate(self, volume, nuc_list, burn_list, full_burn_list, stages): - """Allocates memory of Results. + """Allocate memory for depletion step data Parameters ---------- @@ -177,10 +177,10 @@ class Results: Returns ------- - Results + StepResult New results object """ - new = Results() + new = StepResult() new.volume = {lm: self.volume[lm] for lm in local_materials} new.mat_to_ind = {mat: idx for (idx, mat) in enumerate(local_materials)} @@ -485,7 +485,7 @@ class Results: stages = len(x) # Create results - results = Results() + results = StepResult() results.allocate(vol_dict, nuc_list, burn_list, full_burn_list, stages) n_mat = len(burn_list) diff --git a/openmc/deplete/results_list.py b/openmc/deplete/results_list.py index 843e3aec6..97170f226 100644 --- a/openmc/deplete/results_list.py +++ b/openmc/deplete/results_list.py @@ -6,7 +6,7 @@ from warnings import warn import h5py import numpy as np -from .results import Results, VERSION_RESULTS +from .results import StepResult, VERSION_RESULTS import openmc.checkvalue as cv from openmc.data.library import DataLibrary from openmc.material import Material, Materials @@ -27,7 +27,11 @@ def _get_time_as(seconds, units): class ResultsList(list): - """A list of openmc.deplete.Results objects + """Results from a depletion simulation + + The :class:`ResultsList` class acts as a list that stores the results from + each depletion step and provides extra methods for interrogating these + results. Parameters ---------- @@ -44,7 +48,7 @@ class ResultsList(list): n = fh["number"][...].shape[0] for i in range(n): - data.append(Results.from_hdf5(fh, i)) + data.append(StepResult.from_hdf5(fh, i)) super().__init__(data) @@ -59,7 +63,7 @@ class ResultsList(list): Returns ------- - new : ResultsList + ResultsList New instance of depletion results """ diff --git a/tests/unit_tests/test_deplete_integrator.py b/tests/unit_tests/test_deplete_integrator.py index 9c53ad7e2..4348b8c34 100644 --- a/tests/unit_tests/test_deplete_integrator.py +++ b/tests/unit_tests/test_deplete_integrator.py @@ -16,7 +16,7 @@ import pytest from openmc.mpi import comm from openmc.deplete import ( - ReactionRates, Results, ResultsList, OperatorResult, PredictorIntegrator, + ReactionRates, StepResult, ResultsList, OperatorResult, PredictorIntegrator, CECMIntegrator, CF4Integrator, CELIIntegrator, EPCRK4Integrator, LEQIIntegrator, SICELIIntegrator, SILEQIIntegrator, cram) @@ -99,8 +99,8 @@ def test_results_save(run_in_tmpdir): for k, rates in zip(eigvl1, rate1)] op_result2 = [OperatorResult(ufloat(*k), rates) for k, rates in zip(eigvl2, rate2)] - Results.save(op, x1, op_result1, t1, 0, 0) - Results.save(op, x2, op_result2, t2, 0, 1) + StepResult.save(op, x1, op_result1, t1, 0, 0) + StepResult.save(op, x2, op_result2, t2, 0, 1) # Load the files res = ResultsList("depletion_results.h5") diff --git a/tests/unit_tests/test_deplete_resultslist.py b/tests/unit_tests/test_deplete_resultslist.py index 2554d2188..2a2669920 100644 --- a/tests/unit_tests/test_deplete_resultslist.py +++ b/tests/unit_tests/test_deplete_resultslist.py @@ -87,7 +87,7 @@ def test_get_steps(unit): conversion_to_seconds = 1 for ix in range(times.size): - res = openmc.deplete.Results() + res = openmc.deplete.StepResult() res.time = times[ix:ix + 1] * conversion_to_seconds results.append(res)