I have a code given by my professor in which he applies the boundary conditions for the lid driven cavity flow. All the enforcement of boundary conditions I have seen elsewhere completely differ from what he has done. In this case, he has set the link coefficients of all neighbor cells to 0 and only the considered cell to 1 for all the boundary walls and only for the top wall he has given 1 for the source term. For example when solving the U-Momentum:
! set boundary conditions for coefficients in the equations
! south
aw(:,1)=0.
ae(:,1)=0.
as(:,1)=0.
an(:,1)=0.
ap(:,1)=1.
su(:,1)=0.
! west
aw(1,:)=0.
ae(1,:)=0.
as(1,:)=0.
an(1,:)=0.
ap(1,:)=1.
su(1,:)=0.
! north
aw(:,iNyUNodes)=0.
ae(:,iNyUNodes)=0.
as(:,iNyUNodes)=0.
an(:,iNyUNodes)=0.
ap(:,iNyUNodes)=1.
su(:,iNyUNodes)=1.
! east
aw(iNxUNodes,:)=0.
ae(iNxUNodes,:)=0.
as(iNxUNodes,:)=0.
an(iNxUNodes,:)=0.
ap(iNxUNodes,:)=1.
su(iNxUNodes,:)=0.
I have tried to understand why he has done this, but I'm not getting any intuition at all. I can send a link of the code if needed. What I have tried so far:
- Tried changing all the coefficients to 1, which diverges the solution.
- Tried changing all coefficients to 1 except the corresponding wall, i.e. if south wall, as = 0. Also diverges the solution.
- Tried using a small value for the source, which resulted in expected behavior of a symmetric contour for the u-velocity since for a small lid velocity, diffusion would dominate.