Periodic boundary conditions for solving Navier Stokes Equations on a Staggered Grid
Hello,
I want to solve two dimensional Navier Stokes equations on a staggered grid for the case of TaylorGreen Vortex. As I am aware, we should use periodic boundary conditions on all the four boundaries. I am facing some trouble regarding implementation of this BC as I could not find enough literature about it. Suppose, if my index ranges from 0 to N. Then, is this the correct way to use periodic BC? u_vel(N) = u_vel(1) u_vel(0) = u_vel(N1) and similarly for v_vel and pressure variables? Thanks! 
Yes you should use periodic bc.
I'd make it in a way that u_vel(N+1) = u_vel(0). So my derivative matrix will be say 3diagonal and a point at the corners. Not that you can't do u_vel(N) = u_vel(1) but why wasting computation if you know the values 
be carefull to the link between the periodic nodes if you use staggered grid!

Quote:
If I just write u(0) = u(Nu1), u(Nu) = u(2) v(0) = v(Nv1), v(Nv) = v(2) p(0) = p(Np1), p(Np) = p(2) for their respective grids. Will it create some problem? BTW, I am doing exactly this and my result diverges. I am using analytic solution as my initial conditions. 
I depends on the grid topology you are using...
For example, given L the periodicity lenght in the interval (0,L) and Nx the number of step sizes dx, the nodal grid can be written as x(i) =i*dx i=0:Nx or x(i)=(i1)*dx i=1:Nx+1 now you have to define the staggering for the variables, for example in 2D u(i,j) at x(i),y(j)dy/2 v(i,j) at x(i)dx/2,y(j) p(i,j) at x(i)dx/2, y(j)dy/2 
Usually, if you solve between 1 and N, periodicity is such that:
0 = N1 N+1 = 2 so that: 1 = N 
Quote:
So, as in my case of a staggered grid, I have three separate grids for U, V and P. Their grid sizes being [N,N+1],[N+1,N],[N+1,N+1] respectively. For the U velocity, I solve NS equations for the interior points i.e. upto N1 points in x and N points in ydirection, and similarly for the other two primitive variables. I am using an explicit finite difference based method. So, to apply the periodic BC, can I use your " 0 = N1, N+1 = 2 " for all the three grids INDEPENDENTLY? Or, there has to be some correlation between applying periodicity for the three variables (may be because of staggered grid). Since my results are still diverging, I can not understand where I am implementing BC wrong (my code works for Dirichlet BC where I specify a fix value on all the boundaries). 
You should be able to use it independently for each grid. Maybe is something hardcoded in the implicit part?

Quote:
http://oi68.tinypic.com/118eyh2.jpg P(N,j)=P(1,j) j=1...N P(i,N)=P(i,1) i=1...N u(N,j)=u(1,j) v(i,N)=v(i,1) 
I might have seriously overlooked at the matter (i only did staggered grid once, around 10 years ago, and without periodicity). Actually, what i suggested works properly for colocated finite difference schemes.
Now i took my old program and put the variables down, and it is more clear to me. When you go to staggered you need to do different things for different variables/direction. In practice the grid has to be considered a la finite volume, which means you have: 1) Nx x Ny cell centers, where pressure is stored 2) (Nx+1) x Ny xnormal faces where Ux velocity is stored 3) Nx x (Ny+1) ynormal faces where Uy velocity is stored Thus, what to do? For the pressure, you strictly work a la finite volume: 0x = Nx 0y = Ny Nx+1 = 1x Ny+1 = 1y For the Ux velocity you work a la finite volume along y, but finite difference along x: 0x = Nx1 Nx+1 = 2x 0y = Ny Ny+1 = 1y For the Uy velocity it is the converse, finite difference along y and finite volume along x: 0y = Ny1 Ny+1 = 2y 0x = Nx Nx+1 = 1x This implies that your variables are decleared as: P(Nx,Ny), Ux(Nx+1,Ny), Uy (Nx,Ny+1) This should work but, as i said, i never tried. 
@sbaffini For an arbitrary problem and staggered scheme; lets say we have another variable (e.g shear stress component) grid Sxy (Nx+1) x (Ny+1) what has to be done?

For an arbitrary problem and staggered scheme; lets say we have another variable (e.g shear stress component) grid Sxy (Nx+1) x (Ny+1) what has to be done?
Quote:

Quote:
This is not a new variable, you compute it from the velocity. 
Quote:

1 Attachment(s)
I have a scheme as in the picture for an FDTD simulation. I want to use periodic BC in left and right, for velocity components I do the same procedure but I dont know what to do for Sxy to make periodicity. Without periodicity I am making stress mirroring and the become zero in boundary.
Quote:

So should I compute again Sxy from the copied velocity values ?
Quote:

Very generally speaking, for periodicity (but applies to the distributed parallel case as well) one should only exchange the independent variables (say, velocity) and compute everything in place. So, as mentioned by Filippo, the stress should be recomputed once you have the correct velocity in the periodic nodes.
EDIT: ok, this doesn't sound really correct in general, but for staggered grids might be your best option 
Quote:

All times are GMT 4. The time now is 19:04. 