Open ddeboerfluid opened 3 weeks ago
Hey Dirk,
Thanks for picking this up. Maybe next time try to come up with a true MWE, without fileIO and this kind of stuff. It took me a while to make sure I was doing the same as you. Here is my MWE script
using WaterLily,StaticArrays
function make_sim_acc(; N=128, R=32, a=0.5, U=1, Re=1e3, mem=Array)
circle(x,t) = √sum(abs2,x.-2N)-R # move the center
Ut(i,t::T) where T = i==1 ? convert(T,ifelse(t≤U*R/a,a*t/R,U)) : zero(T) # velocity BC
Simulation((4N,4N), Ut, R; U,ν=U*R/Re, body=AutoBody(circle), mem)
end
function make_sim(; N=128, R=32, a=0.5, U=1, Re=1e3, mem=Array)
circle(x,t) = √sum(abs2,x.-2N)-R # move the center
s(t) = ifelse(t≤U/a,0.5a*t^2,U*(t-0.5U/a)) # displacement
move(x,t) = x + SA[R*s(t/R)-2R,0]
Simulation((4N,4N), (0,0), R; U,ν=U*R/Re, body=AutoBody(circle,move), mem)
end
include("src/TwoD_plots.jl")
N = 2^7; R = N/4
acc = false
sim = acc ? make_sim_acc(mem=Array;N,R,Re=250) : make_sim(mem=Array;N,R,Re=250)
domain = inside(sim.flow.p)
forces = []
@gif for t in range(0,5;step=0.05)
while sim_time(sim)<t
measure!(sim,sum(@views(sim.flow.Δt))) # this is the same time as the force computation
mom_step!(sim.flow,sim.pois)
f = 2WaterLily.pressure_force(sim)
push!(forces,[sim_time(sim),f[1]])
end
flood(sim.flow.p[domain],clims=(-1,1)); body_plot!(sim)
@show t
end
if you use those you will realise the pressure field are different in the acceleration phase. This will directly translate into different forces and thus added-mass. I am not quite sure what the issue is, I suspect the pressure solver tolerances.
The forces match after the steady phase, but obviously not in the accelerating frame (y1=accelerating frame, y2 accelerating body)
Thanks @marinlauber for the detailed reply. @ddeboerfluid, does this solve your issue?
Hi @b-fg, I talked with @marinlauber about it and as I am interested mostly in the post-acceleration phase, it will have no influence on my results (the flow fields after the acceleration are identical). However, I think the issue should still be open as it is still present: the drag force during acceleration is overestimated (seems to be an integer factor) when accelerating the flow.
Dear all,
I have noticed a significant difference between the added mass force from WaterLily when using a moving domain, compared to a moving body (see figure). Interestingly, after the acceleration stops the forces are very similar again. I noticed it for a plate in 3D first, but it seems to happen in 2D and with other bodies as well. From theoretical added mass values I found for a plate, it seems like the moving body case is approximately correct, and the moving domain case overestimates the force.
What I did:
Below I added the code generating the data for the figure (csv file with t* and c_d).
Thank you for helping and I hope you can find out what is causing this.
Moving body code:
Moving domain code:
CSV writer code: