forked from agdestein/IncompressibleNavierStokes.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RayleighTaylor2D.jl
75 lines (64 loc) · 1.7 KB
/
RayleighTaylor2D.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
74
75
# # Rayleigh-Taylor instability in 2D
#
# Two fluids with different temperatures start mixing.
#md using CairoMakie
using GLMakie #!md
using IncompressibleNavierStokes
# Output directory for saving results
outdir = joinpath(@__DIR__, "output", "RayleighTaylor2D")
# Hardware
backend = CPU()
## using CUDA, CUDSS
## backend = CUDABackend()
# Precision
T = Float64
# Grid
n = 50
x = tanh_grid(T(0), T(1), n, T(1.5)), tanh_grid(T(0), T(2), 2n, T(1.5))
plotgrid(x...; figure = (; size = (300, 600)))
# Setup
temperature = temperature_equation(;
Pr = T(0.71),
Ra = T(1e6),
Ge = T(1.0),
dodissipation = true,
boundary_conditions = ((SymmetricBC(), SymmetricBC()), (SymmetricBC(), SymmetricBC())),
gdir = 2,
nondim_type = 1,
)
setup = Setup(;
x,
boundary_conditions = ((DirichletBC(), DirichletBC()), (DirichletBC(), DirichletBC())),
Re = 1 / temperature.α1,
temperature,
);
# Initial conditions
ustart = velocityfield(setup, (dim, x, y) -> zero(x));
tempstart = temperaturefield(setup, (x, y) -> one(x) * (1 + sinpi(x) / 50 > y));
# Solve equation
state, outputs = solve_unsteady(;
setup,
ustart,
tempstart,
tlims = (T(0), T(10)),
Δt = T(5e-3),
processors = (;
rtp = realtimeplotter(;
setup,
nupdate = 20,
fieldname = :temperature,
size = (400, 600),
),
log = timelogger(; nupdate = 200),
),
);
#md # ```@raw html
#md # <video src="/RayleighTaylor2D.mp4" controls="controls" autoplay="autoplay" loop="loop"></video>
#md # ```
#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 # ```