Skip to content

Commit

Permalink
Automate everything
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-ramadhan committed Sep 12, 2020
1 parent 05c1f77 commit eb4002b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 26 deletions.
20 changes: 9 additions & 11 deletions verification/lid_driven_cavity/lid_driven_cavity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ using Oceananigans.Diagnostics
using Oceananigans.OutputWriters
using Oceananigans.AbstractOperations

function simulate_lid_driven_cavity(; Re, end_time)
Ny = Nz = 128

function simulate_lid_driven_cavity(; Re, N, end_time)
topology = (Flat, Bounded, Bounded)
domain = (x=(0, 1), y=(0, 1), z=(0, 1))
grid = RegularCartesianGrid(topology=topology, size=(1, Ny, Nz); domain...)
grid = RegularCartesianGrid(topology=topology, size=(1, N, N); domain...)

v_bcs = VVelocityBoundaryConditions(grid,
top = ValueBoundaryCondition(1.0),
Expand Down Expand Up @@ -85,11 +83,11 @@ function print_progress(simulation)
return nothing
end

simulate_lid_driven_cavity(Re=100, end_time=15)
simulate_lid_driven_cavity(Re=400, end_time=20)
simulate_lid_driven_cavity(Re=1000, end_time=25)
simulate_lid_driven_cavity(Re=3200, end_time=50)
simulate_lid_driven_cavity(Re=5000, end_time=50)
simulate_lid_driven_cavity(Re=7500, end_time=75)
simulate_lid_driven_cavity(Re=10000, end_time=100)
simulate_lid_driven_cavity(Re=100, N=128, end_time=15)
simulate_lid_driven_cavity(Re=400, N=128, end_time=20)
simulate_lid_driven_cavity(Re=1000, N=128, end_time=25)
simulate_lid_driven_cavity(Re=3200, N=128, end_time=50)
simulate_lid_driven_cavity(Re=5000, N=256, end_time=50)
simulate_lid_driven_cavity(Re=7500, N=256, end_time=75)
simulate_lid_driven_cavity(Re=10000, N=256, end_time=100)

29 changes: 14 additions & 15 deletions verification/lid_driven_cavity/plot_lid_driven_cavity.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,18 @@ def plot_lid_driven_cavity_frame(Re, n):
plt.savefig(f"lid_driven_cavity_Re{Re}_{n:05d}.png")
plt.close("all")

Re = 100
ds = xr.open_dataset(f"lid_driven_cavity_Re{Re}.nc")

joblib.Parallel(n_jobs=-1)(
joblib.delayed(plot_lid_driven_cavity_frame)(Re, n)
for n in range(ds.time.size)
)

(
ffmpeg
.input(f"lid_driven_cavity_Re{Re}_%05d.png", framerate=30)
.output(f"lid_driven_cavity_Re{Re}.mp4", crf=15, pix_fmt='yuv420p')
.overwrite_output()
.run()
)
for Re in [100, 400, 1000, 3200, 5000, 7500, 10000]:
ds = xr.open_dataset(f"lid_driven_cavity_Re{Re}.nc")

joblib.Parallel(n_jobs=-1)(
joblib.delayed(plot_lid_driven_cavity_frame)(Re, n)
for n in range(ds.time.size)
)

(
ffmpeg
.input(f"lid_driven_cavity_Re{Re}_%05d.png", framerate=30)
.output(f"lid_driven_cavity_Re{Re}.mp4", crf=15, pix_fmt='yuv420p')
.overwrite_output()
.run()
)

0 comments on commit eb4002b

Please sign in to comment.