using WaterLily using StaticArrays function block(L=2^5;Re=250,U=1,amp=0,ϵ=0.5,thk=2ϵ+√2) # Set viscosity ν=U*L/Re # Create dynamic block geometry function sdf(x,t) # SDF defines form a paddle (a rectangle) y = x .- SVector(0.,clamp(x[2],-L/2,L)) # this confuses me! the last line of function is returned. # so this the same as `return √sum(abs2,y)-thk/2` √sum(abs2,y)-thk/2 end function map(x,t) α = -t*U/L # rotation of paddle at time 't' in simulation R = @SMatrix [cos(α) sin(α); -sin(α) cos(α)] #2D rotation matrix val = R * (x.-SVector(3L+L*sin(t*U/L)+0.01,3L+L*cos(t*U/L)+0.01)) return val end body = AutoBody(sdf,map) Simulation((6L+2,6L+2),zeros(2),L;U,ν,body,ϵ) # new instance of Simulation end include("TwoD_plots.jl") sim_gif!(block();duration=20π,step=π/32,remeasure=true,μbody=true,cfill=:Blues,legend=false,border=:none)