# Singular matrix for 2D Stokes flow in finite differences

I have a problem by solving stokes flow in 2D by finite differences. I am using a marker and cell method, my scheme is

 o-------vx1.1-------o-------vx1.2-------o | | | vz1.1 P1.1 vz1.2 P1.2 vz1.3 | | | o-------vx2.1-------o-------vx2.2-------o | | | vz2.1 P2.1 vz2.2 P2.2 vz2.3 | | | o-------vx3.1-------o-------vx3.2-------o 

and I'm solving it with boundary condition $$v=0$$ at the boundary. My equations are

$$\nabla\cdot v =0$$

$$- \nabla P + \eta \nabla^2 v = \text{RHS}$$

My matrix looks like (point . is a zero)

 1.0........ 1.0................... . 1.0.. 1.0........................ .. 1.0.......................... ... 1.0........ 1.0................ .... 1.0........................ ..... 1.0....................... ...... 1.0........ 1.0............. ....... 1.0..................... ........ 1.0.................... ......... 1.0................... .......... 1.0.. 1.0............... ........... 1.0................. ... 4.5 4.5.. -4.5. -4.5.. -9.0 -4.5 1.5 4.5 4.5 -1.5... 4.5....... ... 4.5 4.5.. -4.5.... -9.0-13.5. 4.5 4.5 -1.5.... 4.5 1.5..... .... -1.5.... -1.5.. 1.5 1.5............... ............... 1.0............. ...... 4.5 4.5.. -4.5.... -9.0-13.5. 4.5. -1.5.... 4.5 1.5 4.5. ....... -1.5.... -1.5.. 1.5 1.5............ .................. 1.0.......... ................... 1.0.. 1.0...... .................... 1.0........ ............ 4.5 4.5.. -4.5. -4.5.. -9.0 -4.5 1.5 4.5 4.5 -1.5. 4.5 ...................... 1.0...... ............. -1.5.... -1.5.. 1.5 1.5...... ........................ 1.0.... ......................... 1.0... ................ -1.5.... -1.5.. 1.5 1.5... ................ 1.0.......... 1.0. ......... 1.0.................. 1.0 

this is for a net 1.1 - 3.2 like I have written it down above but then net is mirrored. The matrix is filled as (columns) vx, vz, P of 1.1, vx,vz,P of 1.2, vx,vz,P of 1.3 (points for vx and P are arbitrary), vx,vz,P for 2.1 and so one. The matrix seems me to be regular but SVD decomposition says that not, these are the sorted singular values of the matrix:

 27.5420715513798 17.4983644162386 13.0585213530020 7.91769353816330 2.90355494070429 2.47099309663979 2.01114749046610 1.78190740642182 1.54014039952304 1.48327145289315 1.38900389385430 1.26550776173684 1.12306273303955 1.01704742320595 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 0.931474730095686 0.924742536722870 0.799653920064005 0.602280940813348 0.569579284384847 0.488475169437247 0.202063898865890 0.177767300574206 

and simple Gaussian elimination ("Numerical recipes") says during dividing the pivot row by a pivot element that pivot element a(24,24)=0 so the matrix is singular. The point 24 is exactly the eq. of continuity for pressure at boundary P 2.2 Can you please give me some hint on how to find the problem in the formulation or how can I find the mistake in the program?

## 1 Answer

Since you have Dirichlet boundary conditions everywhere, the pressure is only determined up to a constant. If you use a direct solver, the easiest fix is to pin pressure at one point. With iterative solvers, it's usually preferable to work with the original system, but project out the constant mode.

• Dear Jed, I have tried to do as you have written me and set pressure on one of the boundary point to 1 (line 24, in the right hand side is also 1 on line 24), but the matrix is said to be still singular - the singular values from SVD are still the same. I have also tried to set a value for another pressure point but the result is unchanged. I am very confused, what can I do? Apr 3 '13 at 8:47