Skip to content

Commit

Permalink
fixed bug with 3-layer example figure axes, added multi-panel figures…
Browse files Browse the repository at this point in the history
…, replaced figures for example 5 with single svg
  • Loading branch information
mncrowe committed Nov 12, 2024
1 parent f8b300f commit 8e4256d
Show file tree
Hide file tree
Showing 7 changed files with 579 additions and 26 deletions.
548 changes: 548 additions & 0 deletions docs/src/Ex_5.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/src/Ex_5a.png
Binary file not shown.
Binary file removed docs/src/Ex_5b.png
Binary file not shown.
31 changes: 15 additions & 16 deletions docs/src/Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,21 +402,20 @@ We can plot our initial condition and solution at ``t = 10.0`` using:
```julia
using Plots

heatmap(prob.grid.x, prob.grid.y, device_array(CPU())(transpose(q₀));
colormap = :balance,
aspect_ratio=1,
xlims = (-Lx/2, Lx/2),
ylims = (-Ly/2, Ly/2),
xlabel = "x",
ylabel = "y")

heatmap(prob.grid.x, prob.grid.y, device_array(CPU())(transpose(prob.vars.q));
colormap = :balance,
aspect_ratio=1,
xlims = (-Lx/2, Lx/2),
ylims = (-Ly/2, Ly/2),
xlabel = "x",
ylabel = "y")
plot(heatmap(prob.grid.x, prob.grid.y, device_array(CPU())(transpose(q₀));
colormap = :balance,
aspect_ratio=1,
xlims= (-Lx/2, Lx/2),
ylims = (-Ly/2, Ly/2),
xlabel = "x",
ylabel = "y"),
heatmap(prob.grid.x, prob.grid.y, device_array(CPU())(transpose(prob.vars.q));
colormap = :balance,
aspect_ratio=1,
xlims= (-Lx/2, Lx/2),
ylims = (-Ly/2, Ly/2),
xlabel = "x",
ylabel = "y"))

```

Expand All @@ -425,7 +424,7 @@ The two plots are shown below and are approximately identical.
Therefore, we observe that the vortex remains centred at the origin.
Over long times, numerical error will result in the vortex moving at a slightly different speed to `U` and hence moving away from the origin.

![image](Ex_5a.png)![image](Ex_5b.png)
![image](Ex_5.png)

See the `GeophyiscalFlows.jl` documentation [here](https://fourierflows.github.io/GeophysicalFlowsDocumentation/stable/) for more details on how to run QG simulations.

Expand Down
13 changes: 10 additions & 3 deletions examples/2_Layer_Modon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,21 @@ K, a = SolveInhomEVP(A, B, c, d; tol)
grid = CreateGrid(Nx, Ny, Lx, Ly; cuda)
ψ, q = Calc_ψq(a, U, ℓ, R, β, grid)

# Plot streamfunction ψ in layer 1
# Plot streamfunction ψ in both layers

using Plots

heatmap(grid.x, grid.y, transpose(ψ[:, :, 1]);
plot(heatmap(grid.x, grid.y, transpose(ψ[:, :, 1]);
colormap = :balance,
aspect_ratio = 1,
xlims = (-Lx/2, Lx/2),
ylims = (-Ly/2, Ly/2),
xlabel = "x",
ylabel = "y")
ylabel = "y"),
heatmap(grid.x, grid.y, transpose(ψ[:, :, 2]);
colormap = :balance,
aspect_ratio = 1,
xlims = (-Lx/2, Lx/2),
ylims = (-Ly/2, Ly/2),
xlabel = "x",
ylabel = "y"))
4 changes: 2 additions & 2 deletions examples/3_Layer_Modon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ using Plots
heatmap(grid.x, grid.y, transpose(ψ[:, :, 2]);
colormap = :balance,
aspect_ratio = 1,
xlims = (-Lx/2, Lx/2),
ylims = (-Ly/2, Ly/2),
xlims = Lx,
ylims = Ly,
xlabel = "x",
ylabel = "y")
9 changes: 4 additions & 5 deletions examples/GeophysicalFlows_Example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,17 @@ SingleLayerQG.updatevars!(prob)

using Plots

heatmap(prob.grid.x, prob.grid.y, device_array(CPU())(transpose(q₀));
plot(heatmap(prob.grid.x, prob.grid.y, device_array(CPU())(transpose(q₀));
colormap = :balance,
aspect_ratio=1,
xlims= (-Lx/2, Lx/2),
ylims = (-Ly/2, Ly/2),
xlabel = "x",
ylabel = "y")

heatmap(prob.grid.x, prob.grid.y, device_array(CPU())(transpose(prob.vars.q));
ylabel = "y"),
heatmap(prob.grid.x, prob.grid.y, device_array(CPU())(transpose(prob.vars.q));
colormap = :balance,
aspect_ratio=1,
xlims= (-Lx/2, Lx/2),
ylims = (-Ly/2, Ly/2),
xlabel = "x",
ylabel = "y")
ylabel = "y"))

0 comments on commit 8e4256d

Please sign in to comment.