CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Staggered Grid representation in code (http://www.cfd-online.com/Forums/main/86090-staggered-grid-representation-code.html)

 batabek March 14, 2011 09:55

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.

 nathand July 17, 2011 07:08

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.

 houkensjtu July 17, 2011 08:06

just multiply them by 2...

 mazhar July 17, 2011 10:30

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.

 VincentD July 23, 2011 19:08

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 x-dir velocity to the right of my pressure cell P (i,j) and V(i,j) my y-dir 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 nx-1*ny ''
U(nx+1,ny+2) with nx*ny-1 ''

 All times are GMT -4. The time now is 02:03.