doyubkim / fluid-engine-dev

Fluid simulation engine for computer graphics applications
https://fluidenginedevelopment.org/
MIT License
1.9k stars 266 forks source link

Incorrect formula for collider boundary conditions (Equation 3.18 in the book) #327

Open zx-82 opened 2 years ago

zx-82 commented 2 years ago

Equation 3.18 takes the relative fluid-collider velocity for boundary projection. This does not seem correct. Consider the simple case of of verctical wall (normal_collider=(1,0) uv_collider = (0,1) and uv_liquid_boundary=(0,0). Relative velocity then is uv_rel = (0,-1) and the forumla in the book projects this to the wall which gives boundary_constrained = (0,-1)
This does not seem physically plausible, because the uncontrained velocity was (0,0) and is "suddeny accelerated" to (0,-1). So I think we must take the liquid velocity and replace its boundary-normal component by the boundar-normal-component of the collider. (Using relative velocity is important in other contexts such as friction forces, but should not be taken here IMO)

P.S.: It would be really useful to always give some source from the literature for such kind of formula, as Prof. Bridsen does in his book about fluid simulation development)

Projecting this
The formula in the book would project the relative velocity , i.e. .-1 which

While relative velocity is necessary for drag forces,