Staggered Grid representation in code
Hi all,
I want to use a Staggered grid for simulating a fluid flow. If I use a regular array structure(for instance float u[] in C/C++, etc.) I'm unable to represent the floating point coordinates such as (i+1)/2, (j+1)/2..., which are required for the velocities found on the cell faces. What is the correct way to handling these? Thanks in advance. 
RE
i think you should try more than one set of grid points, or you can use finer grids but allocate different physical values at different grid points. hope this will help.

just multiply them by 2...

I believe you should use same grid numbering for the pressure and velocity. the only diffrence is that velocity calculations will start from grid point 2.

It does not really matter too much how you denote your locations, however you yourself should understand it.
I would make all the matrices with the same kind of numbering. So U(i,j) would be the xdir velocity to the right of my pressure cell P (i,j) and V(i,j) my ydir velocity above the Pcell. If you include BCs into the problem your total matrices would have a size: P(nx+2,ny+2) with nx*ny interior points V(nx+2,ny+1) with nx1*ny '' U(nx+1,ny+2) with nx*ny1 '' 
All times are GMT 4. The time now is 07:30. 