using IncompressibleNavierStokes
n = 40
x = LinRange(0.0, 10.0, 5n + 1), LinRange(-2.0, 2.0, 2n + 1)
plotgrid(x...; figure = (; size = (600, 300)))
inflow(dim, x, y, t) = sinpi(sinpi(t / 6) / 6 + (dim == 1) / 2)
boundary_conditions = ((DirichletBC(inflow), PressureBC()), (PressureBC(), PressureBC()))
xc, yc = 2.0, 0.0 # Disk center
D = 1.0 # Disk diameter
δ = 0.11 # Disk thickness
C = 0.2 # Thrust coefficient
c = C / (D * δ) # Normalize
inside(x, y) = abs(x - xc) ≤ δ / 2 && abs(y - yc) ≤ D / 2
bodyforce(dim, x, y, t) = -c * (dim == 1) * inside(x, y)
setup = Setup(; x, Re = 100.0, boundary_conditions, bodyforce, issteadybodyforce = true);
ustart = velocityfield(setup, (dim, x, y) -> inflow(dim, x, y, 0.0))
state, outputs = solve_unsteady(;
setup,
ustart,
tlims = (0.0, 12.0),
method = RKMethods.RK44P2(),
Δt = 0.05,
processors = (
anim = animator(;
setup,
path = "navier_stokes_animation.mp4",
fieldname = :vorticity,
colorrange = (-0.3, 0.5),
size = (600, 300),
colormap = :bam,
nupdate = 5,
),
log = timelogger(; nupdate = 24),
),
);