WaterLily-jl / WaterLily.jl

Fast and simple fluid simulator in Julia
Other
636 stars 78 forks source link

Courant number (CFL) #109

Closed meysamrajabi95 closed 8 months ago

meysamrajabi95 commented 8 months ago

Hi, I have an issue with having too much noise for the force signal acting on a body. I want to know how can I change/optimize the CFL number here [https://github.com/weymouth/WaterLily.jl/blob/master/src/Flow.jl#L165] ? ? what are these 0.5 showing in these lines:

    BDIM!(a); scale_u!(a,0.5); BC!(a.u,U,a.exitBC,a.perdir)
    project!(a,b,0.5); BC!(a.u,U,a.exitBC,a.perdir)
marinlauber commented 8 months ago

Hi @meysamrajabi95,

To adjust the CFL, you can overwrite the WaterLily.CFL function to limit the maximum value based on your criterion. This would look something like with 1.234 replaced by your desired CFL value. (This goes into your main script)

WaterLily.CFL(a::Flow) = WaterLily.CFL(a;Δt_max=1.234)

For your second question, this is just the classical scaling of the corrector step; see here

meysamrajabi95 commented 8 months ago

Great. Thank you!