Skip to content

Commit

Permalink
Make MHDModes convergence figures prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
bprather committed May 21, 2024
1 parent 74aec18 commit 8c5b886
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/mhdmodes/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,25 +141,28 @@
fail = 1

# MAKE PLOTS
fig = plt.figure(figsize=(5,5))
fig = plt.figure(figsize=(3,3))

ax = fig.add_subplot(1,1,1)
for k in range(NVAR):
if abs(dvar[k]) != 0.:
ax.plot(RES, L1[:,k], marker='s', label=VARS[k])

norm = L1[0,0]*RES[0]*RES[0]
if norm < 1e-4:
norm = L1[0,3]*RES[0]*RES[0]
if "alfven" in SHORT:
norm = L1[0,4]*RES[0]*RES[0]
else:
norm = L1[0,0]*RES[0]*RES[0]

xmin = RES[0]/2.
xmax = RES[-1]*2.
ax.plot([xmin, xmax], norm*np.asarray([xmin, xmax])**-2., color='k', linestyle='--', label='N^-2')

plt.xscale('log', base=2); plt.yscale('log')
plt.xlim([RES[0]/np.sqrt(2.), RES[-1]*np.sqrt(2.)])
plt.xlabel('N'); plt.ylabel('L1')
plt.title("{}".format(LONG))
#plt.title("{}".format(LONG))
plt.legend(loc=1)
plt.savefig("convergence_modes_{}_{}.png".format(DIM,SHORT))
plt.subplots_adjust(left=0.25, bottom=0.18, top=0.97, right=0.97)
plt.savefig("convergence_modes_{}_{}.png".format(DIM,SHORT), dpi=300)

exit(fail)

0 comments on commit 8c5b886

Please sign in to comment.