Skip to content

Commit 4b6153b

Browse files
committed
fixed format issues
1 parent af5db5a commit 4b6153b

2 files changed

Lines changed: 31 additions & 26 deletions

File tree

advection_nonuniform/advective_fluxes.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,27 +78,27 @@ def unsplit_fluxes(my_data, rp, dt, scalar_name):
7878

7979
for index, vel in np.ndenumerate(u.v(buf=1)):
8080
if vel < 0:
81-
a_x.v(buf=1)[index] = a.ip(shift_x.v(buf=1)[index], buf=1)[index] - \
82-
0.5*(1.0 + cx.v(buf=1)[index]) * \
83-
ldelta_ax.ip(shift_x.v(buf=1)[index], buf=1)[index]
81+
a_x.v(buf=1)[index] = a.ip(shift_x.v(buf=1)[index], buf=1)[index]\
82+
- 0.5*(1.0 + cx.v(buf=1)[index]) \
83+
* ldelta_ax.ip(shift_x.v(buf=1)[index], buf=1)[index]
8484
else:
85-
a_x.v(buf=1)[index] = a.ip(shift_x.v(buf=1)[index], buf=1)[index] + \
86-
0.5*(1.0 - cx.v(buf=1)[index]) * \
87-
ldelta_ax.ip(shift_x.v(buf=1)[index], buf=1)[index]
85+
a_x.v(buf=1)[index] = a.ip(shift_x.v(buf=1)[index], buf=1)[index]\
86+
+ 0.5*(1.0 - cx.v(buf=1)[index]) \
87+
* ldelta_ax.ip(shift_x.v(buf=1)[index], buf=1)[index]
8888

8989
# upwind in y-direction
9090
a_y = myg.scratch_array()
9191
shift_y = my_data.get_var("y-shift").astype(int)
9292

9393
for index, vel in np.ndenumerate(v.v(buf=1)):
9494
if vel < 0:
95-
a_y.v(buf=1)[index] = a.jp(shift_y.v(buf=1)[index], buf=1)[index] - \
96-
0.5*(1.0 + cy.v(buf=1)[index]) * \
97-
ldelta_ay.jp(shift_y.v(buf=1)[index], buf=1)[index]
95+
a_y.v(buf=1)[index] = a.jp(shift_y.v(buf=1)[index], buf=1)[index]\
96+
- 0.5*(1.0 + cy.v(buf=1)[index]) \
97+
* ldelta_ay.jp(shift_y.v(buf=1)[index], buf=1)[index]
9898
else:
99-
a_y.v(buf=1)[index] = a.jp(shift_y.v(buf=1)[index], buf=1)[index] + \
100-
0.5*(1.0 - cy.v(buf=1)[index]) * \
101-
ldelta_ay.jp(shift_y.v(buf=1)[index], buf=1)[index]
99+
a_y.v(buf=1)[index] = a.jp(shift_y.v(buf=1)[index], buf=1)[index]\
100+
+ 0.5*(1.0 - cy.v(buf=1)[index]) \
101+
* ldelta_ay.jp(shift_y.v(buf=1)[index], buf=1)[index]
102102

103103
# compute the transverse flux differences. The flux is just (u a)
104104
# HOTF
@@ -114,13 +114,13 @@ def unsplit_fluxes(my_data, rp, dt, scalar_name):
114114
dtdy2 = 0.5*dt/myg.dy
115115

116116
for index, vel in np.ndenumerate(u.v(buf=1)):
117-
F_x.v(buf=1)[index] = vel*(a_x.v(buf=1)[index] -
118-
dtdy2*(F_yt.ip_jp(shift_x.v(buf=1)[index], 1, buf=1)[index] -
119-
F_yt.ip(shift_x.v(buf=1)[index], buf=1)[index]))
117+
F_x.v(buf=1)[index] = vel * (a_x.v(buf=1)[index] - dtdy2 *
118+
(F_yt.ip_jp(shift_x.v(buf=1)[index], 1, buf=1)[index] -
119+
F_yt.ip(shift_x.v(buf=1)[index], buf=1)[index]))
120120

121121
for index, vel in np.ndenumerate(v.v(buf=1)):
122-
F_y.v(buf=1)[index] = vel*(a_y.v(buf=1)[index] -
123-
dtdx2*(F_xt.ip_jp(1, shift_y.v(buf=1)[index], buf=1)[index] -
124-
F_xt.jp(shift_y.v(buf=1)[index], buf=1)[index]))
122+
F_y.v(buf=1)[index] = vel * (a_y.v(buf=1)[index] - dtdx2 *
123+
(F_xt.ip_jp(1, shift_y.v(buf=1)[index], buf=1)[index] -
124+
F_xt.jp(shift_y.v(buf=1)[index], buf=1)[index]))
125125

126126
return F_x, F_y

advection_nonuniform/simulation.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,16 @@ def shift(velocity):
5252

5353
if self.rp.get_param("particles.do_particles") == 1:
5454
n_particles = self.rp.get_param("particles.n_particles")
55-
particle_generator = self.rp.get_param("particles.particle_generator")
56-
self.particles = particles.Particles(self.cc_data, bc, n_particles, particle_generator)
55+
particle_generator = \
56+
self.rp.get_param("particles.particle_generator")
57+
self.particles = particles.Particles(self.cc_data,
58+
bc,
59+
n_particles,
60+
particle_generator)
5761

5862
# now set the initial conditions for the problem
59-
problem = importlib.import_module("advection_nonuniform.problems.{}".format(self.problem_name))
63+
problem = importlib.import_module("advection_nonuniform.problems.{}"
64+
.format(self.problem_name))
6065
problem.init_data(self.cc_data, self.rp)
6166

6267
# compute the required shift for each node using corresponding velocity at the node
@@ -131,14 +136,14 @@ def dovis(self):
131136

132137
myg = self.cc_data.grid
133138

134-
_, axes, cbar_title = plot_tools.setup_axes(myg, 1)
139+
_, axes, _ = plot_tools.setup_axes(myg, 1)
135140

136141
# plot density
137142
ax = axes[0]
138143
img = ax.imshow(np.transpose(dens.v()),
139-
interpolation="nearest", origin="lower",
140-
extent=[myg.xmin, myg.xmax, myg.ymin, myg.ymax],
141-
cmap=self.cm)
144+
interpolation="nearest", origin="lower",
145+
extent=[myg.xmin, myg.xmax, myg.ymin, myg.ymax],
146+
cmap=self.cm)
142147

143148
ax.set_xlabel("x")
144149
ax.set_ylabel("y")
@@ -158,7 +163,7 @@ def dovis(self):
158163

159164
# plot particles
160165
ax.scatter(particle_positions[:, 0],
161-
particle_positions[:, 1], c=colors, cmap="Greys")
166+
particle_positions[:, 1], c=colors, cmap="Greys")
162167
ax.set_xlim([myg.xmin, myg.xmax])
163168
ax.set_ylim([myg.ymin, myg.ymax])
164169

0 commit comments

Comments
 (0)