mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
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.
This commit is contained in:
parent
afe1b5b68c
commit
c4567b6d9d
3 changed files with 7 additions and 25 deletions
|
|
@ -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
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue