-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathDecayingTurbulence2D.jl
73 lines (62 loc) · 1.78 KB
/
DecayingTurbulence2D.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# # Decaying Homogeneous Isotropic Turbulence - 2D
#
# In this example we consider decaying homogeneous isotropic turbulence,
# similar to the cases considered in [Kochkov2021](@cite) and
# [Kurz2022](@cite). The initial velocity field is created randomly, but with a
# specific energy spectrum. Due to viscous dissipation, the turbulent features
# eventually group to form larger visible eddies.
# ## Packages
#
# We just need IncompressibleNavierStokes and a Makie plotting backend.
if false #src
include("src/Examples.jl") #src
end #src
#md using CairoMakie
using GLMakie #!md
using IncompressibleNavierStokes
# Setup
n = 256
ax = LinRange(0.0, 1.0, n + 1)
setup = Setup(; x = (ax, ax), Re = 4e3);
ustart = random_field(setup, 0.0);
# Solve unsteady problem
state, outputs = solve_unsteady(;
setup,
ustart,
tlims = (0.0, 1.0),
processors = (
rtp = realtimeplotter(; setup, nupdate = 10),
ehist = realtimeplotter(;
setup,
plot = energy_history_plot,
nupdate = 10,
displayfig = false,
),
espec = realtimeplotter(;
setup,
plot = energy_spectrum_plot,
nupdate = 10,
displayfig = false,
),
log = timelogger(; nupdate = 100),
),
);
#md # ```@raw html
#md # <video src="/DecayingTurbulence2D.mp4" controls="controls" autoplay="autoplay" loop="loop"></video>
#md # ```
# ## Post-process
#
# We may visualize or export the computed fields
# Energy history
outputs.ehist
# Energy spectrum
outputs.espec
# Plot field
fieldplot(state; setup)
#md # ## Copy-pasteable code
#md #
#md # Below is the full code for this example stripped of comments and output.
#md #
#md # ```julia
#md # CODE_CONTENT
#md # ```