diff --git a/openmc/deplete/abc.py b/openmc/deplete/abc.py index 5d906efd840..dd4df21fb5d 100644 --- a/openmc/deplete/abc.py +++ b/openmc/deplete/abc.py @@ -18,7 +18,7 @@ from numpy import nonzero, empty, asarray from uncertainties import ufloat -from openmc.checkvalue import check_type, check_greater_than +from openmc.checkvalue import check_type, check_greater_than, PathLike from openmc.mpi import comm from .stepresult import StepResult from .chain import Chain @@ -762,7 +762,12 @@ def _get_start_data(self): return (self.operator.prev_res[-1].time[-1], len(self.operator.prev_res) - 1) - def integrate(self, final_step=True, output=True): + def integrate( + self, + final_step: bool = True, + output: bool = True, + path: PathLike = 'depletion_results.h5' + ): """Perform the entire depletion process across all steps Parameters @@ -776,6 +781,10 @@ def integrate(self, final_step=True, output=True): Indicate whether to display information about progress .. versionadded:: 0.13.1 + path : PathLike + Path to file to write. Defaults to 'depletion_results.h5'. + + .. versionadded:: 0.14.1 """ with change_directory(self.operator.output_dir): n = self.operator.initial_condition() @@ -802,7 +811,7 @@ def integrate(self, final_step=True, output=True): n = n_list.pop() StepResult.save(self.operator, n_list, res_list, [t, t + dt], - source_rate, self._i_res + i, proc_time) + source_rate, self._i_res + i, proc_time, path) t += dt @@ -954,15 +963,21 @@ def _get_bos_data_from_operator(self, step_index, step_power, n_bos): self.operator.settings.particles //= self.n_steps return inherited - def integrate(self, output=True): + def integrate( + self, + output: bool = True, + path: PathLike = "depletion_results.h5" + ): """Perform the entire depletion process across all steps Parameters ---------- output : bool, optional Indicate whether to display information about progress + path : PathLike + Path to file to write. Defaults to 'depletion_results.h5'. - .. versionadded:: 0.13.1 + .. versionadded:: 0.14.1 """ with change_directory(self.operator.output_dir): n = self.operator.initial_condition() @@ -992,13 +1007,13 @@ def integrate(self, output=True): n = n_list.pop() StepResult.save(self.operator, n_list, res_list, [t, t + dt], - p, self._i_res + i, proc_time) + p, self._i_res + i, proc_time, path) t += dt # No final simulation for SIE, use last iteration results StepResult.save(self.operator, [n], [res_list[-1]], [t, t], - p, self._i_res + len(self), proc_time) + p, self._i_res + len(self), proc_time, path) self.operator.write_bos_data(self._i_res + len(self)) self.operator.finalize()