Skip to content

Commit

Permalink
minor polishing of the example scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
navidcy committed Jun 30, 2019
1 parent 4be218b commit 89b2c68
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
5 changes: 4 additions & 1 deletion examples/barotropicqg_betadecay.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ function plot_output(prob, fig, axs; drawcolorbar=false)

sca(axs[2])
cla()
pcolormesh(x, y, v.psi)
contourf(x, y, v.psi)
if maximum(abs.(v.psi))>0
contour(x, y, v.psi, colors="k")
end
axis("square")
xticks(-2:2:2)
yticks(-2:2:2)
Expand Down
7 changes: 5 additions & 2 deletions examples/barotropicqg_betaforced.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ nx = 256 # 2D resolution = nx^2
stepper = "FilteredRK4" # timestepper
dt = 0.01 # timestep
nsteps = 40000 # total number of time-steps
nsubs = 1000 # number of time-steps for plotting
nsubs = 500 # number of time-steps for plotting
# (nsteps must be multiple of nsubs)

# Physical parameters
Expand Down Expand Up @@ -112,7 +112,10 @@ function plot_output(prob, fig, axs; drawcolorbar=false)

sca(axs[2])
cla()
pcolormesh(x, y, v.psi)
contourf(x, y, v.psi)
if maximum(abs.(v.psi))>0
contour(x, y, v.psi, colors="k")
end
axis("square")
xticks(-2:2:2)
yticks(-2:2:2)
Expand Down
9 changes: 6 additions & 3 deletions examples/barotropicqgql_betaforced.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ function plot_output(prob, fig, axs; drawcolorbar=false)

sca(axs[2])
cla()
pcolormesh(x, y, v.psi)
contourf(x, y, v.psi)
if maximum(abs.(v.psi))>0
contour(x, y, v.psi, colors="k")
end
axis("square")
xticks(-3:1:3)
yticks(-3:1:3)
Expand Down Expand Up @@ -147,8 +150,8 @@ function plot_output(prob, fig, axs; drawcolorbar=false)
plot(mu*Z.t[1:Z.i], Z.data[1:E.i], label="enstrophy")
xlabel(L"\mu t")
legend()

pause(0.001)
drawnow()
end

fig, axs = subplots(ncols=3, nrows=2, figsize=(14, 8))
Expand Down
6 changes: 3 additions & 3 deletions examples/twodturb_mcwilliams1984.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import GeophysicalFlows.TwoDTurb: energy, enstrophy
import GeophysicalFlows: peakedisotropicspectrum

# Parameters
n = 128
n = 256
L = 2π
nnu = 2
nu = 0.0
dt = 5e-3
nsteps = 8000
dt = 1e-2
nsteps = 5000
nsubs = 200

# Files
Expand Down
2 changes: 1 addition & 1 deletion examples/twodturb_randomdecay.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ylabel(L"\int | \hat{E} | k_r \mathrm{d} k_{\theta}")
title("Radial energy spectrum")

xlim(0, nx/4)
axs[2][:set_yscale]("log")
axs[2].set_yscale("log")

tight_layout(w_pad=0.1)
show()

0 comments on commit 89b2c68

Please sign in to comment.