From c4567b6d9d17c6d81aa5dfb9074d4ecad3657e29 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 30 Jul 2019 09:19:26 -0500 Subject: [PATCH] Remove print_out options to Operator.__call__, deplete Time spent running openmc is already presented in after each transport run. Time spent performing depletion is written in the depletion file. --- openmc/deplete/abc.py | 4 +--- openmc/deplete/integrator/cram.py | 17 +++++------------ openmc/deplete/operator.py | 11 +---------- 3 files changed, 7 insertions(+), 25 deletions(-) diff --git a/openmc/deplete/abc.py b/openmc/deplete/abc.py index 5e2f1dc64f..f1321379d9 100644 --- a/openmc/deplete/abc.py +++ b/openmc/deplete/abc.py @@ -87,15 +87,13 @@ class TransportOperator(metaclass=ABCMeta): self.chain = Chain.from_xml(chain_file, fission_q) @abstractmethod - def __call__(self, vec, print_out=True): + def __call__(self, vec): """Runs a simulation. Parameters ---------- vec : list of numpy.ndarray Total atoms to be used in function. - print_out : bool, optional - Whether or not to print out time. Returns ------- diff --git a/openmc/deplete/integrator/cram.py b/openmc/deplete/integrator/cram.py index f5da6d696b..c57ff53132 100644 --- a/openmc/deplete/integrator/cram.py +++ b/openmc/deplete/integrator/cram.py @@ -14,7 +14,7 @@ import scipy.sparse.linalg as sla from .. import comm -def deplete(chain, x, rates, dt, print_out=True, matrix_func=None): +def deplete(chain, x, rates, dt, matrix_func=None): """Deplete materials using given reaction rates for a specified time Parameters @@ -27,29 +27,22 @@ def deplete(chain, x, rates, dt, print_out=True, matrix_func=None): Reaction rates (from transport operator) dt : float Time in [s] to deplete for - print_out : bool, optional - Whether to show elapsed time - maxtrix_func : function, optional - Function to form the depletion matrix + maxtrix_func : Callable, optional + Function of two variables: ``chain`` and ``rates``. + Expected to return the depletion matrix required by + :func:`CRAM48`. Returns ------- x_result : list of numpy.ndarray Updated atom number vectors for each material - """ - t_start = time.time() # Use multiprocessing pool to distribute work with Pool() as pool: iters = zip(repeat(chain), x, rates, repeat(dt), repeat(matrix_func)) x_result = list(pool.starmap(_cram_wrapper, iters)) - t_end = time.time() - if comm.rank == 0: - if print_out: - print("Time to matexp: ", t_end - t_start) - return x_result diff --git a/openmc/deplete/operator.py b/openmc/deplete/operator.py index e9c41093aa..6ee992c4fd 100644 --- a/openmc/deplete/operator.py +++ b/openmc/deplete/operator.py @@ -153,7 +153,7 @@ class Operator(TransportOperator): self.reaction_rates = ReactionRates( self.local_mats, self._burnable_nucs, self.chain.reactions) - def __call__(self, vec, power, print_out=True): + def __call__(self, vec, power): """Runs a simulation. Parameters @@ -162,8 +162,6 @@ class Operator(TransportOperator): Total atoms to be used in function. power : float Power of the reactor in [W] - print_out : bool, optional - Whether or not to print out time. Returns ------- @@ -192,13 +190,6 @@ class Operator(TransportOperator): # Extract results op_result = self._unpack_tallies_and_normalize(power) - if comm.rank == 0: - time_unpack = time.time() - - if print_out: - print("Time to openmc: ", time_openmc - time_start) - print("Time to unpack: ", time_unpack - time_openmc) - return copy.deepcopy(op_result) def _differentiate_burnable_mats(self):