Skip to content

Commit

Permalink
should work now
Browse files Browse the repository at this point in the history
  • Loading branch information
simone-silvestri committed Jan 30, 2025
1 parent 76fa65c commit abb1f74
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,49 +63,3 @@ arch = Distributed(CPU(), partition = Partition(2, 2))

# Run the simulation
run_simulation(Nx, Ny, arch)

# Visualize the plane
# Produce a video for variable `var`
try
using GLMakie

function visualize_simulation(var)
iter = Observable(1)

v = Vector(undef, 4)
V = Vector(undef, 4)
x = Vector(undef, 4)
y = Vector(undef, 4)

for r in 1:4
v[r] = FieldTimeSeries("mpi_hydrostatic_turbulence_rank$(r-1).jld2", var)
nx, ny, _ = size(v[r])
V[r] = @lift(interior(v[r][$iter], 1:nx, 1:ny, 1))

x[r] = xnodes(v[r])
y[r] = ynodes(v[r])
end

fig = Figure()
ax = Axis(fig[1, 1])
for r in 1:4
heatmap!(ax, x[r], y[r], V[r], colorrange = (-1.0, 1.0))
end

GLMakie.record(fig, "hydrostatic_test_" * var * ".mp4", 1:length(v[1].times), framerate = 11) do i
@info "step $i";
iter[] = i;
end
end

if MPI.Comm_rank(MPI.COMM_WORLD) == 0
visualize_simulation("u")
visualize_simulation("v")
visualize_simulation("c")
end
catch err
@info err
end

MPI.Barrier(arch.communicator)

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using GLMakie
using Oceananigans

function visualize_simulation(var)
iter = Observable(1)

v = Vector(undef, 4)
V = Vector(undef, 4)
x = Vector(undef, 4)
y = Vector(undef, 4)

for r in 1:4
v[r] = FieldTimeSeries("mpi_hydrostatic_turbulence_rank$(r-1).jld2", var; boundary_conditions=nothing)
nx, ny, _ = size(v[r])
V[r] = @lift(interior(v[r][$iter], 1:nx, 1:ny, 1))

x[r] = xnodes(v[r])
y[r] = ynodes(v[r])
end

fig = Figure()
ax = Axis(fig[1, 1])
for r in 1:4
heatmap!(ax, x[r], y[r], V[r], colorrange = (-1.0, 1.0))
end

GLMakie.record(fig, "hydrostatic_test_" * var * ".mp4", 1:length(v[1].times), framerate = 11) do i
@info "step $i";
iter[] = i;
end
end

visualize_simulation("u")
visualize_simulation("v")
visualize_simulation("c")

0 comments on commit abb1f74

Please sign in to comment.