We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 048f1c6 commit aba4ce8Copy full SHA for aba4ce8
examples/shallow_water.py
@@ -204,14 +204,6 @@ def bathymetry(x_t_2d, y_t_2d, lx, ly):
204
bath = 1.0
205
return bath * create_full(T_shape, 1.0, dtype)
206
207
- # inital elevation
208
- u0, v0, e0 = exact_solution(
209
- 0, x_t_2d, y_t_2d, x_u_2d, y_u_2d, x_v_2d, y_v_2d
210
- )
211
- e[:, :] = e0
212
- u[:, :] = u0
213
- v[:, :] = v0
214
-
215
# set bathymetry
216
h[:, :] = bathymetry(x_t_2d, y_t_2d, lx, ly)
217
# steady state potential energy
@@ -328,6 +320,18 @@ def step(u, v, e, u1, v1, e1, u2, v2, e2):
328
320
v[:, 1:-1] = v[:, 1:-1] / 3.0 + 2.0 / 3.0 * (v2[:, 1:-1] + dt * dvdt)
329
321
e[:, :] = e[:, :] / 3.0 + 2.0 / 3.0 * (e2[:, :] + dt * dedt)
330
322
323
+ # warm up jit cache
324
+ step(u, v, e, u1, v1, e1, u2, v2, e2)
325
+ sync()
326
+
327
+ # initial solution
+ u0, v0, e0 = exact_solution(
+ 0, x_t_2d, y_t_2d, x_u_2d, y_u_2d, x_v_2d, y_v_2d
+ )
331
+ e[:, :] = e0
332
+ u[:, :] = u0
333
+ v[:, :] = v0
334
335
t = 0
336
i_export = 0
337
next_t_export = 0
0 commit comments