mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Add type/value checks on timestep, power, and units
This commit is contained in:
parent
39a60c361c
commit
3682f7adcb
1 changed files with 8 additions and 1 deletions
|
|
@ -665,7 +665,7 @@ class Integrator(ABC):
|
|||
|
||||
if len(power) != len(timesteps):
|
||||
raise ValueError(
|
||||
"Number of time steps != number of powers. {} vs {}".format(
|
||||
"Number of time steps ({}) != number of powers ({})".format(
|
||||
len(timesteps), len(power)))
|
||||
|
||||
# Get list of times / units
|
||||
|
|
@ -678,6 +678,13 @@ class Integrator(ABC):
|
|||
# Determine number of seconds for each timestep
|
||||
seconds = []
|
||||
for time, unit, watts in zip(times, units, power):
|
||||
# Make sure values passed make sense
|
||||
check_type('timestep', time, Real)
|
||||
check_greater_than('timestep', time, 0.0, True)
|
||||
check_type('timestep units', unit, str)
|
||||
check_type('power', watts, Real)
|
||||
check_greater_than('power', watts, 0.0, True)
|
||||
|
||||
if unit in ('s', 'sec'):
|
||||
seconds.append(time)
|
||||
elif unit in ('min', 'minute'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue