Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix indent issue, add some description
  • Loading branch information
lewisgross1296 committed Mar 4, 2025
commit 09df7c1289b9c5a2d21a7788294059f7d91b202b
50 changes: 27 additions & 23 deletions openmc/deplete/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,29 +659,33 @@ def __init__(
seconds, source_rates = _normalize_timesteps(
timesteps, source_rates, timestep_units, operator)

# validate existing depletion steps are consistent with those passed to operator
if continue_timesteps:
completed_times = operator.prev_res.get_times(time_units=timestep_units)
completed_timesteps = completed_times[1:] - completed_times[:-1] # convert absolute t to dt
completed_source_rates = operator.prev_res.get_source_rates()
num_previous_steps_run = len(completed_timesteps)
if (np.array_equal(completed_timesteps, timesteps[:num_previous_steps_run])):
seconds = seconds[num_previous_steps_run:]
else:
raise ValueError(
"You are attempting to continue a run in which the previous timesteps "
"do not have the same initial timesteps as those provided to the "
"Integrator. Please make sure you are using the correct timesteps."
)
if(np.array_equal(completed_source_rates, np.asarray(source_rates)[:num_previous_steps_run] )):
source_rates = source_rates[num_previous_steps_run:]
else:
raise ValueError(
"You are attempting to continue a run in which the previous results "
"do not have the same initial source rates, powers, or power densities "
"as those provided to the Integrator. Please make sure you are using "
"the correct powers, power densities, or source rates and previous results file."
)
# validate existing depletion steps are consistent with those passed to operator
# if the timesteps retrieved from operator.prev_res.get_times match the first set
# of time steps provided to the continue run, and the same is true for the source_rates
# retrieved from operator.prev_res.get_source_rates(), then run a depletion simulations
# with only the new time steps and source rates provided

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# retrieved from operator.prev_res.get_source_rates(), then run a depletion simulations
# with only the new time steps and source rates provided
# retrieved from operator.prev_res.get_source_rates(), then run a depletion simulation
# with only the new time steps and source rates provided

if continue_timesteps:
completed_times = operator.prev_res.get_times(time_units=timestep_units)
completed_timesteps = completed_times[1:] - completed_times[:-1] # convert absolute t to dt
completed_source_rates = operator.prev_res.get_source_rates()
Comment thread
pshriwise marked this conversation as resolved.
Resolved
num_previous_steps_run = len(completed_timesteps)
if (np.array_equal(completed_timesteps, timesteps[:num_previous_steps_run])):
seconds = seconds[num_previous_steps_run:]
else:
raise ValueError(
"You are attempting to continue a run in which the previous timesteps "
"do not have the same initial timesteps as those provided to the "
"Integrator. Please make sure you are using the correct timesteps."
)
if(np.array_equal(completed_source_rates, np.asarray(source_rates)[:num_previous_steps_run] )):
source_rates = source_rates[num_previous_steps_run:]
else:
raise ValueError(
"You are attempting to continue a run in which the previous results "
"do not have the same initial source rates, powers, or power densities "
"as those provided to the Integrator. Please make sure you are using "
"the correct powers, power densities, or source rates and previous results file."
)
self.timesteps = np.asarray(seconds)
self.source_rates = np.asarray(source_rates)

Expand Down