Skip to content

Commit

Permalink
add progress bars to animation generation functions
Browse files Browse the repository at this point in the history
  • Loading branch information
juddmehr committed Nov 9, 2024
1 parent bebb47f commit bb72085
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DuctAPE"
uuid = "ad8e49fd-fab7-444e-af4a-0daba3b8bf11"
authors = ["Judd Mehr"]
version = "0.6"
version = "0.6.0"

[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Expand All @@ -19,6 +19,7 @@ MINPACK = "4854310b-de5a-5eb6-a2a5-c1dee2bd17f9"
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
Expand Down
1 change: 1 addition & 0 deletions src/DuctAPE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ using RecipesBase # for plotting
# - Visualization Packages - #
import Colors.RGB
using LaTeXStrings
using ProgressMeter

#---------------------------------#
# EXPORTS #
Expand Down
23 changes: 23 additions & 0 deletions src/visualization/convenience_plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ function generate_plots(
markerstrokecolor=2,
kwargs...,
)

Plots.savefig(save_path * "streamlines" * i * static_file_type)
end
end
Expand Down Expand Up @@ -240,6 +241,9 @@ function generate_plots(
if plot_pressure
verbose && println("Animating Surface Pressure")
anim = Plots.Animation()
if verbose
pbar = Progress(length(outs); desc="Generating Frames...", showspeed=true)
end
for out in outs

# underlay geometry first
Expand All @@ -260,14 +264,19 @@ function generate_plots(
)

Plots.frame(anim, plt)
verbose && next!(pbar)
end
verbose && println("Saving $(save_path)surface_pressure.gif")
Plots.gif(anim, save_path * "surface_pressure.gif")
end

# - Tangential Velocity - #
if plot_velocity
verbose && println("Animating Surface Velocity")
anim = Plots.Animation()
if verbose
pbar = Progress(length(outs); desc="Generating Frames...", showspeed=true)
end
for out in outs
# underlay geometry first
plt = Plots.plot(
Expand All @@ -287,14 +296,19 @@ function generate_plots(
(; kwargs..., background_color=:white)...,
)
Plots.frame(anim, plt)
verbose && next!(pbar)
end
verbose && println("Saving $(save_path)surface_velocity.gif")
Plots.gif(anim, save_path * "surface_velocity.gif")
end

# - Boundary Layer Stuff - #
if plot_boundary_layer
verbose && println("Animating Boundary Layer")
anim = Plots.Animation()
if verbose
pbar = Progress(length(outs); desc="Generating Frames...", showspeed=true)
end
for out in outs
# Plots.plot momentum thicknesses on top
plt = Plots.plot(
Expand All @@ -319,13 +333,18 @@ function generate_plots(
(; kwargs..., background_color=:white)...,
)
Plots.frame(anim, plt)
verbose && next!(pbar)
end
verbose && println("Saving $(save_path)boundary_layer.gif")
Plots.gif(anim, save_path * "boundary_layer.gif")
end

# - Streamlines - #
if plot_streamlines
verbose && println("Animating Streamlines")
if verbose
pbar = Progress(length(outs); desc="Generating Frames...", showspeed=true)
end
anim = Plots.Animation()
for out in outs
plt = Plots.plot(plotBodyGeometry(), body_vortex_panels; kwargs...)
Expand Down Expand Up @@ -357,8 +376,12 @@ function generate_plots(
markerstrokecolor=2,
(; kwargs..., background_color=:white)...,
)

Plots.frame(anim, plt)

verbose && next!(pbar)
end
verbose && println("Saving $(save_path)streamlines.gif")
Plots.gif(anim, save_path * "streamlines.gif")
end

Expand Down

0 comments on commit bb72085

Please sign in to comment.