Skip to content

Commit 8196337

Browse files
committed
misc: Raise exception for time_order not equal 2
1 parent 504f5d1 commit 8196337

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

devito/timestepping/superstep.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,22 @@ def superstep_generator(field, stencil, k, nt=0):
5151
name = field.name
5252
grid = field.grid
5353
# time_order of `field` needs to be 2
54-
u = TimeFunction(name=f'{name}_ss', grid=grid, time_order=2, space_order=2*k)
55-
u_prev = TimeFunction(name=f'{name}_ss_p', grid=grid, time_order=2, space_order=2*k)
54+
if field.time_order != 2:
55+
raise ValueError(
56+
'Superstepping is currently only supports `time_order=2`'
57+
)
58+
u = TimeFunction(
59+
name=f'{name}_ss',
60+
grid=grid,
61+
time_order=field.time_order,
62+
space_order=2*k
63+
)
64+
u_prev = TimeFunction(
65+
name=f'{name}_ss_p',
66+
grid=grid,
67+
time_order=field.time_order,
68+
space_order=2*k
69+
)
5670

5771
superstep_solution_transfer(field, u, u_prev, nt)
5872

0 commit comments

Comments
 (0)