Using the code from http://math.mit.edu/~gs/cse/codes/mit18086_navierstokes.pdf, I simulated cavity flow with an external force with the boundary conditions on the all 4 sides are $u=v=0$ and $\frac{\partial p}{\partial n}=0$. I just added external force to u direction in the step that calculates nonlinear term$$\text{(1)} \quad \frac{U^*-U^n}{\Delta t} = -((U^n)^2)_x - (U^nV^n)_y $$to$$\text{(1)} \quad \frac{U^*-U^n}{\Delta t} = -((U^n)^2)_x - (U^nV^n)_y +f $$. So the code was changed only 2 lines, fromuN = x*0+1U = U-dt*(UVy(2:end-1,:)+U2x);touN = x*0U = U-dt*(UVy(2:end-1,:)+U2x+10);, and I got this result.I am confused with this result. This external force is like gravity, so I thought, when applying only gravity the fluid inside a cavity does not circulate. It is like water in a glass. Why does it circulate? Is this physically correct or because of the numerical simulation method?
cavity flow with only an external force. Why does it circulate?
navier stokes;incompressible
@Wolfgang Bangerth has a very important point about what $f$ is. The constant external force will not affect your solution unless your BCs allow for motion. In your case, they do not. An easy conceptual proof of this is to look at the vorticity equation (by taking the curl of your equations). The source term disappears, which means no motion will ensue. Therefore, the motion you're see is from an non-physical setup.