please can you help me with my problem with Stokes flow written using Marker and cell method (MAC)? I need only to solve the eq. of continuity + momentum eq. for a given condition (steady state). I don't understand how to do the things on boundaries (lets say I want to have v=0 on boundaries), how to fill the matrix - I will solve it as Ax=b where A is matrix 3*N*Nx3*N*N and b right hand side vector of dim 3*N*N if my box is NxN and I have 3 unknowns (vx,vy,p) and three eq. ( eq. of continuity + 2 momentum eq.) Or is there any code I can have a look at to get a flavor of it? Many thanks
The original publications by Harlow and Welch discusses this. If you search for "Harlow Welch marker cell" in your favorite search engine, you should get a few links to copies. If this does not help, my own article in Int. J. Num. Meth. Fluids titled "Divergence-free discontinuous Galerkin schemes for the Stokes equations and the MAC scheme", available in preprint version at http://www.isc.tamu.edu/publications-reports/tr/0705.pdf may help.
For the condition u dot n = f, you set the degrees of freedom on the boundary to the values of f.
For the condition on the tangential velocity, you apply a penalty formulation, which can for instance be reduced to additional terms of the form alpha (u-f) = 0 for all degrees of freedom which are on edges originating from the boundary, but not subset of the boundary.