Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor tweaks in Examples #201

Merged
merged 8 commits into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ examples = [
]

for example in examples
example_filepath = joinpath(EXAMPLES_DIR, example)
withenv("GITHUB_REPOSITORY" => "FourierFlows/GeophysicalFlowsDocumentation") do
example_filepath = joinpath(EXAMPLES_DIR, example)
Literate.markdown(example_filepath, OUTPUT_DIR, documenter=true)
Expand Down
8 changes: 4 additions & 4 deletions examples/singlelayerqg_betadecay.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ p2 = contourf(x, y, vars.ψ',
title = "initial streamfunction ψ",
framestyle = :box)

l = @layout Plots.grid(1, 2)
p = plot(p1, p2, layout=l, size = (900, 800))
layout = @layout Plots.grid(1, 2)
p = plot(p1, p2, layout = layout, size = (800, 360))


# ## Diagnostics
Expand Down Expand Up @@ -193,8 +193,8 @@ function plot_output(prob)
ylabel = "y")
plot!(pum, 0*y, y, linestyle=:dash, linecolor=:black)

l = @layout Plots.grid(2, 2)
p = plot(pq, pqm, pψ, pum, layout = l, size = (900, 800))
layout = @layout Plots.grid(2, 2)
p = plot(pq, pqm, pψ, pum, layout = layout, size = (800, 720))

return p
end
Expand Down
16 changes: 8 additions & 8 deletions examples/singlelayerqg_decay_topography.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ p1 = heatmap(x, y, vars.q',
p2 = contourf(x, y, vars.ψ',
aspectratio = 1,
c = :viridis,
levels = range(-0.35, stop=0.35, length=10),
clim = (-0.35, 0.35),
levels = range(-0.25, stop=0.25, length=11),
clim = (-0.25, 0.25),
xlims = (-grid.Lx/2, grid.Lx/2),
ylims = (-grid.Ly/2, grid.Ly/2),
xticks = -3:3,
Expand All @@ -119,8 +119,8 @@ p2 = contourf(x, y, vars.ψ',
title = "initial streamfunction ψ",
framestyle = :box)

l = @layout Plots.grid(1, 2)
p = plot(p1, p2, layout=l, size=(900, 400))
layout = @layout Plots.grid(1, 2)
p = plot(p1, p2, layout=layout, size = (800, 360))


# ## Diagnostics
Expand Down Expand Up @@ -180,13 +180,13 @@ function plot_output(prob)
contour!(pq, x, y, η',
levels=-2:0.5:-0.5,
lw=2, c=:black, ls=:dash, alpha=0.7)

pψ = contourf(x, y, ψ',
aspectratio = 1,
legend = false,
c = :viridis,
levels = range(-0.7, stop=0.7, length=10),
clim = (-0.7, 0.7),
levels = range(-0.75, stop=0.75, length=31),
clim = (-0.75, 0.75),
xlims = (-grid.Lx/2, grid.Lx/2),
ylims = (-grid.Ly/2, grid.Ly/2),
xticks = -3:3,
Expand All @@ -197,7 +197,7 @@ function plot_output(prob)
framestyle = :box)

l = @layout Plots.grid(1, 2)
p = plot(pq, pψ, layout = l, size = (900, 400))
p = plot(pq, pψ, layout = l, size = (800, 360))

return p
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,20 @@ nothing # hide

# ## Setting initial conditions

# We choose an initial condition with most energy around total wavenumber ``k_0``.
# For initial condition we construct a relative vorticity with energy most energy around total
# wavenumber ``k_0``.
seed!(1234)
k₀, E₀ = 6, 0.5
∇²ψ₀ = peakedisotropicspectrum(prob_bqg.grid, k₀, E₀, mask=prob_bqg.timestepper.filter)
nothing # hide

# `SingleLayerQG` allows us to set up the initial ``q`` for each problem via `set_q!()` function.
# To initialize both `prob_bqg` and `prob_eqbqg` with the same flow, we first find the streamfunction
# the corresponds to the relative vorticity structure we computed above,
# To initialize both `prob_bqg` and `prob_eqbqg` with the same flow, we first use function
# `SingleLayerQG.streamfunctionfrompv!` to get the streamfunction that corresponds to the
# relative vorticity we computed above. This works in the purely barotropic problem, `prob_bqg`
# since in that case the QGPV is simply the relative vorticity.
∇²ψ₀h = rfft(∇²ψ₀)
ψ₀h = @. 0*∇²ψ₀h
ψ₀h = @. 0 * ∇²ψ₀h
SingleLayerQG.streamfunctionfrompv!(ψ₀h, ∇²ψ₀h, prob_bqg.params, prob_bqg.grid)
nothing # hide

Expand Down
10 changes: 4 additions & 6 deletions examples/surfaceqg_decaying.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ nothing # hide
# Let's define some shortcuts.
sol, clock, vars, params, grid = prob.sol, prob.clock, prob.vars, prob.params, prob.grid
x, y = grid.x, grid.y
nothing # hide
#md nothing # hide


# ## Setting initial conditions
Expand Down Expand Up @@ -121,11 +121,9 @@ nothing # hide
# kinetic energy and buoyancy variance.

function plot_output(prob)
bₛ = prob.vars.b
uₛ = prob.vars.u
vₛ = prob.vars.v
b = prob.vars.b

pbₛ = heatmap(x, y, bₛ',
pb = heatmap(x, y, b',
aspectratio = 1,
c = :deep,
clim = (0, 1),
Expand Down Expand Up @@ -158,7 +156,7 @@ function plot_output(prob)
xlabel = "t")

layout = @layout [a{0.5w} Plots.grid(2, 1)]
p = plot(pbₛ, pKE, pb², layout=layout, size = (900, 500))
p = plot(pb, pKE, pb², layout=layout, size = (900, 500))

return p
end
Expand Down