Skip to content

Commit 02a1cfe

Browse files
committed
Removed redundant array initialization
1 parent 1670e5d commit 02a1cfe

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

advection_nonuniform/advective_fluxes.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,8 @@ def unsplit_fluxes(my_data, rp, dt, scalar_name):
6060
u = my_data.get_var("x-velocity")
6161
v = my_data.get_var("y-velocity")
6262

63-
cx = myg.scratch_array()
64-
cy = myg.scratch_array()
65-
66-
cx.v(buf=1)[:, :] = u.v(buf=1)*dt/myg.dx
67-
cy.v(buf=1)[:, :] = v.v(buf=1)*dt/myg.dy
63+
cx = u*dt/myg.dx
64+
cy = v*dt/myg.dy
6865

6966
#--------------------------------------------------------------------------
7067
# monotonized central differences
@@ -75,12 +72,11 @@ def unsplit_fluxes(my_data, rp, dt, scalar_name):
7572
ldelta_ax = reconstruction.limit(a, myg, 1, limiter)
7673
ldelta_ay = reconstruction.limit(a, myg, 2, limiter)
7774

78-
# x-direction
75+
# upwind in x-direction
7976
a_x = myg.scratch_array()
8077
shift_x = my_data.get_var("x-shift").astype(int)
8178

8279
for index, vel in np.ndenumerate(u.v(buf=1)):
83-
# upwind
8480
if vel < 0:
8581
a_x.v(buf=1)[index] = a.ip(shift_x.v(buf=1)[index], buf=1)[index] - \
8682
0.5*(1.0 + cx.v(buf=1)[index]) * \
@@ -90,12 +86,11 @@ def unsplit_fluxes(my_data, rp, dt, scalar_name):
9086
0.5*(1.0 - cx.v(buf=1)[index]) * \
9187
ldelta_ax.ip(shift_x.v(buf=1)[index], buf=1)[index]
9288

93-
# y-direction
89+
# upwind in y-direction
9490
a_y = myg.scratch_array()
9591
shift_y = my_data.get_var("y-shift").astype(int)
9692

9793
for index, vel in np.ndenumerate(v.v(buf=1)):
98-
# upwind
9994
if vel < 0:
10095
a_y.v(buf=1)[index] = a.jp(shift_y.v(buf=1)[index], buf=1)[index] - \
10196
0.5*(1.0 + cy.v(buf=1)[index]) * \

advection_nonuniform/problems/inputs.slotted

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ yrboundary = periodic
3232
u = 1.0
3333
v = 1.0
3434

35-
limiter = 2
35+
limiter = 1
3636

3737
[particles]
3838
do_particles = 0

0 commit comments

Comments
 (0)