mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
added path arg to integrator.integrate (#2784)
This commit is contained in:
parent
a833c176ab
commit
124e62fc58
1 changed files with 22 additions and 7 deletions
|
|
@ -18,7 +18,7 @@ from warnings import warn
|
|||
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 @@ class Integrator(ABC):
|
|||
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 @@ class Integrator(ABC):
|
|||
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 @@ class Integrator(ABC):
|
|||
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 @@ class SIIntegrator(Integrator):
|
|||
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 @@ class SIIntegrator(Integrator):
|
|||
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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue