Skip to content

Commit

Permalink
Merge pull request #78 from FourierFlows/PlotsReplacePyPlot
Browse files Browse the repository at this point in the history
Removes previews; fix plotting bug in multilayeqg_2layer.jl
  • Loading branch information
navidcy committed May 20, 2020
2 parents bb9f473 + ad6c077 commit ca6993c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
3 changes: 1 addition & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,5 @@ sitename = "GeophysicalFlows.jl",
)

deploydocs( repo = "github.com/FourierFlows/GeophysicalFlows.jl.git",
versions = ["stable" => "v^", "v#.#.#"],
push_preview = true,
versions = ["stable" => "v^", "v#.#.#"]
)
26 changes: 17 additions & 9 deletions examples/multilayerqg_2layer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

using FourierFlows, Plots, Printf

using FFTW: rfft, irfft
import GeophysicalFlows.MultilayerQG
import GeophysicalFlows.MultilayerQG: energies

Expand Down Expand Up @@ -54,8 +55,14 @@ nothing # hide

# ## Setting initial conditions

# Our initial condition is some small amplitude random noise.
MultilayerQG.set_q!(prob, 4e-3randn((nx, ny, nlayers)))
# Our initial condition is some small amplitude random noise. We smooth our initial
# condidtion using the `timestepper`'s high-wavenumber `filter`.

q_i = 4e-3randn((nx, ny, nlayers))
qh_i = prob.timestepper.filter .* rfft(q_i, (1, 2)) # only apply rfft in dims=1, 2
q_i = irfft(qh_i, gr.nx, (1, 2)) # only apply irfft in dims=1, 2

MultilayerQG.set_q!(prob, q_i)
nothing # hide


Expand Down Expand Up @@ -104,8 +111,8 @@ function plot_output(prob)
l = @layout grid(2, 3)
p = plot(layout=l, size = (1000, 600), dpi=150)

for j in 1:nlayers
heatmap!(p[(j-1)*3+1], x, y, vs.q[:, :, j],
for m in 1:nlayers
heatmap!(p[(m-1)*3+1], x, y, vs.q[:, :, m],
aspectratio = 1,
legend = false,
c = :balance,
Expand All @@ -115,10 +122,11 @@ function plot_output(prob)
yticks = -3:3,
xlabel = "x",
ylabel = "y",
title = "q_"*string(j),
title = "q_"*string(m),
framestyle = :box)

heatmap!(p[(j-1)*3+2], x, y, vs.psi[:, :, j],
contourf!(p[(m-1)*3+2], x, y, vs.psi[:, :, m],
levels = 8,
aspectratio = 1,
legend = false,
c = :viridis,
Expand All @@ -128,7 +136,7 @@ function plot_output(prob)
yticks = -3:3,
xlabel = "x",
ylabel = "y",
title = "ψ_"*string(j),
title = "ψ_"*string(m),
framestyle = :box)
end

Expand Down Expand Up @@ -176,8 +184,8 @@ anim = @animate for j=0:Int(nsteps/nsubs)
if j%(1000/nsubs)==0; println(log) end

for m in 1:nlayers
p[m][1][:z] = @. vs.q[:, :, m]
p[m+nlayers+1][1][:z] = @. vs.psi[:, :, m]
p[(m-1)*3+1][1][:z] = @. vs.q[:, :, m]
p[(m-1)*3+2][1][:z] = @. vs.psi[:, :, m]
end

push!(p[3][1], μ*E.t[E.i], E.data[E.i][1][1])
Expand Down

2 comments on commit ca6993c

@navidcy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/15023

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.2 -m "<description of version>" ca6993c47ff4a3280e930d897cc77aaf8f354a07
git push origin v0.4.2

Please sign in to comment.