Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
maggul committed Sep 11, 2024
1 parent f22d899 commit 302977f
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions examples/arkode/CXX_manyvector/plot_sod.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
sys.exit(msg)

# read solution file, storing each line as a string in a list
with open(datafile, 'r') as file:
with open(datafile, "r") as file:
lines = file.readlines()

# extract header information
Expand All @@ -55,15 +55,15 @@
line = (lines.pop(0)).split()
t[it] = line.pop(0)
for ix in range(nx):
rho[it,ix] = line.pop(0)
mx[it,ix] = line.pop(0)
my[it,ix] = line.pop(0)
mz[it,ix] = line.pop(0)
et[it,ix] = line.pop(0)
rho[it, ix] = line.pop(0)
mx[it, ix] = line.pop(0)
my[it, ix] = line.pop(0)
mz[it, ix] = line.pop(0)
et[it, ix] = line.pop(0)

gamma=1.4
u = mx/rho
p = (gamma-1.0)*(et - (mx*mx+my*my+mz*mz)/(2.0*rho))
gamma = 1.4
u = mx / rho
p = (gamma - 1.0) * (et - (mx * mx + my * my + mz * mz) / (2.0 * rho))

# generate plots
x = np.linspace(xl, xr, nx)
Expand All @@ -87,9 +87,9 @@
ax12 = fig.add_subplot(gs[1, 2])
ax22 = fig.add_subplot(gs[2, 2])
it = 0
ax00.plot(x, rho[it,:])
ax10.plot(x, u[it,:])
ax20.plot(x, p[it,:])
ax00.plot(x, rho[it, :])
ax10.plot(x, u[it, :])
ax20.plot(x, p[it, :])
ax00.set_title(r"$t =$ " + repr(t[it]).zfill(3))
ax00.set_ylabel(r"$\rho$")
ax10.set_ylabel(r"$v_x$")
Expand All @@ -102,9 +102,9 @@
ax01.set_title(r"$t =$ " + repr(t[it]).zfill(3))
ax21.set_xlabel(r"$x$")
it = nt-1
ax02.plot(x, rho[it,:])
ax12.plot(x, u[it,:])
ax22.plot(x, p[it,:])
ax02.plot(x, rho[it, :])
ax12.plot(x, u[it, :])
ax22.plot(x, p[it, :])
ax02.set_title(r"$t =$ " + repr(t[it]).zfill(3))
ax22.set_xlabel(r"$x$")
plt.savefig("sod_frames.png")
Expand Down

0 comments on commit 302977f

Please sign in to comment.