I'm trying to learn how to use finite volume methods and I want to solve a more general case of Stokes' second problem i.e. an infinite half-plane oscillating harmonically with no-slip boundary conditions.

I've been following the code from this lecture and changed the boundary conditions to:

u[1:-1, 1]  = u[1:-1, 2]                #left 
u[1:-1, -1] = u[1:-1, -2]               #right
u[-1,1:]    = 2*np.cos(n*dt) - u[-1,1:] #top
u[0, 1:]    = u[1,1:]                   #bottom

v[1:,0] = v[1:,1]      #left
v[1:,-1] = v[1:,-2]    #right
v[-1,1:-1] = 0.0       #top
v[1,1:-1] = 0.0        #bottom

(My thinking was that this would imply no gradients at the left, right, and bottom boundary so the flow would just continue out of/into the volume and to oscillate the top by setting the value through a ghost cell.)

This leads to vortex formations however enter image description here

But we know by the analytical solution $$ u(y,t) = e^{-y\sqrt{\frac{\omega}{2\nu}} } \cos\left(\omega t - y\sqrt{\frac{\omega}{2\nu} } \right)$$ that there will be no velocity component in the y-direction. And it's not like this vortex is just a small deviation.

However if I simply exclude the projection step/set the pressure to 0 everywhere I recover the analytical solution. Why does this happen? From what I understand the pressure is essentially used to enforce that the flow field is divergenceless, however $u(y)$ obviously also has 0 divergence so why does the projection method fail here?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.