# Boundary conditions for streamlines in enclosed flow

I am trying to solve Lid driven square cavity flow problem of Stokes equation using finite element method. I have boundary conditions for velocity as zeros on every boundary but u=1 on top boundary. can you please help me with the boundary conditions of stream function and how to obtain ? especially on top boundary.

I have gone through many literature but why most of them considered as zero on every boundary.

The velocity and stream function are related by $$u = \psi_y, \qquad v = - \psi_x$$ This can be related to the vorticity $$-\Delta \psi = \omega = v_y - u_x$$ On left and right, we have $(u,v)=(0,0)$ $$\psi = const, \quad \psi_x = 0$$ On bottom $(u,v) = (0,0)$ $$\psi_y = 0, \qquad \psi = const$$ On top $(u,v)=(u_0,0)$ $$\psi_y = u_0, \qquad \psi = const$$ You cannot enforce two boundary conditions. Let us use Dirichlet bc $$\psi = const$$ on all boundaries. Since $\psi$ must be continuous (assuming $\omega$ in $L^2$ atleast), the constant must be same on all sides which you can set to zero.
• On top boundary $\psi = const$ implies $\psi$ does not depend on $x$. $y$ is already fixed on the top boundary.. The other condition says $\psi_y(x,y_{top}) = u_0$ but you cannot integrate this as you seem to do, because that condition holds only at $y=y_{top}$. The thing is you have two bc on the top, a dirichlet and neumann. I am suggesting to use dirichlet bc. The solution you get must satisfy the other bc, maybe only in a weak sense. – cfdlab Aug 24 '18 at 3:27
For the streamline formulation the divergence equation for the velocity $\vec{v}=(u,v)^{T}$ $$\mathrm{div}\,\vec{v}=0$$ holds identically if $$\vec{v} =(u,v)^{T}= \left( \frac{\partial \Psi}{\partial y},-\frac{\partial \Psi}{\partial x}\right)^{T}\tag{*}$$
For boundaries in which the velocity is $\vec{v}=\vec{0}$, it is easy to see from $(*)$ that $\Psi=constant$ and $\vec{n}\cdot\vec{\mathrm{grad}}\,\Psi=0$. Without any loss of generality you can set this constant to $0$.
On the other hand, on the top of the cavity in which $\vec{v}=(u_0,0)^{T}$ the streamline function $\Psi$ must fulfill: $$\frac{\partial\Psi}{\partial y}=v_0\qquad \frac{\partial\Psi}{\partial x}=0$$