CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Periodic boundary conditions for solving Navier Stokes Equations on a Staggered Grid

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree4Likes
  • 1 Post By sbaffini
  • 1 Post By FMDenaro
  • 1 Post By sbaffini
  • 1 Post By sbaffini

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 22, 2016, 00:06
Default Periodic boundary conditions for solving Navier Stokes Equations on a Staggered Grid
  #1
New Member
 
Tanmay Agrawal
Join Date: May 2015
Location: Taiwan
Posts: 29
Rep Power: 8
tanmayagrawal7 is on a distinguished road
Send a message via Skype™ to tanmayagrawal7
Hello,

I want to solve two dimensional Navier Stokes equations on a staggered grid for the case of Taylor-Green 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(N-1)

and similarly for v_vel and pressure variables?

Thanks!
tanmayagrawal7 is offline   Reply With Quote

Old   February 22, 2016, 05:26
Default
  #2
Member
 
Kaya Onur Dag
Join Date: Apr 2013
Posts: 94
Rep Power: 10
kaya is on a distinguished road
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 3-diagonal 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
kaya is offline   Reply With Quote

Old   February 22, 2016, 05:30
Default
  #3
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 5,905
Rep Power: 63
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
be carefull to the link between the periodic nodes if you use staggered grid!
FMDenaro is offline   Reply With Quote

Old   February 22, 2016, 22:12
Default
  #4
New Member
 
Tanmay Agrawal
Join Date: May 2015
Location: Taiwan
Posts: 29
Rep Power: 8
tanmayagrawal7 is on a distinguished road
Send a message via Skype™ to tanmayagrawal7
Quote:
Originally Posted by FMDenaro View Post
be carefull to the link between the periodic nodes if you use staggered grid!
I do not clearly get what you mean.
If I just write

u(0) = u(Nu-1), u(Nu) = u(2)
v(0) = v(Nv-1), v(Nv) = v(2)
p(0) = p(Np-1), 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.
tanmayagrawal7 is offline   Reply With Quote

Old   February 23, 2016, 06:09
Default
  #5
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 5,905
Rep Power: 63
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
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)=(i-1)*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
FMDenaro is offline   Reply With Quote

Old   February 23, 2016, 08:22
Default
  #6
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 1,686
Blog Entries: 20
Rep Power: 34
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Usually, if you solve between 1 and N, periodicity is such that:

0 = N-1
N+1 = 2

so that:

1 = N
sbaffini is offline   Reply With Quote

Old   February 23, 2016, 23:52
Default
  #7
New Member
 
Tanmay Agrawal
Join Date: May 2015
Location: Taiwan
Posts: 29
Rep Power: 8
tanmayagrawal7 is on a distinguished road
Send a message via Skype™ to tanmayagrawal7
Quote:
Originally Posted by sbaffini View Post
Usually, if you solve between 1 and N, periodicity is such that:

0 = N-1
N+1 = 2

so that:

1 = N
Thanks for your answer!

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 N-1 points in x and N points in y-direction, 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 = N-1, 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).
tanmayagrawal7 is offline   Reply With Quote

Old   February 26, 2016, 17:13
Default
  #8
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 1,686
Blog Entries: 20
Rep Power: 34
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
You should be able to use it independently for each grid. Maybe is something hardcoded in the implicit part?
sbaffini is offline   Reply With Quote

Old   February 26, 2016, 17:46
Default
  #9
Member
 
Kaya Onur Dag
Join Date: Apr 2013
Posts: 94
Rep Power: 10
kaya is on a distinguished road
Quote:
Originally Posted by tanmayagrawal7 View Post
Thanks for your answer!

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 N-1 points in x and N points in y-direction, 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 = N-1, 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).
For the sake of simplicity lets say your indices start from 1 and N=5 i=1,2,3,4,5 j=1,2,3,4,5




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)
kaya is offline   Reply With Quote

Old   February 27, 2016, 06:32
Default
  #10
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 1,686
Blog Entries: 20
Rep Power: 34
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
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 x-normal faces where Ux velocity is stored
3) Nx x (Ny+1) y-normal 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 = Nx-1
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 = Ny-1
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.
aero_head likes this.
sbaffini is offline   Reply With Quote

Old   June 15, 2021, 09:04
Default
  #11
New Member
 
enes senyurt
Join Date: Oct 2015
Posts: 4
Rep Power: 8
ened89 is on a distinguished road
@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?
ened89 is offline   Reply With Quote

Old   June 15, 2021, 09:05
Default
  #12
New Member
 
enes senyurt
Join Date: Oct 2015
Posts: 4
Rep Power: 8
ened89 is on a distinguished road
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:
Originally Posted by sbaffini View Post
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 x-normal faces where Ux velocity is stored
3) Nx x (Ny+1) y-normal 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 = Nx-1
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 = Ny-1
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.
ened89 is offline   Reply With Quote

Old   June 15, 2021, 10:45
Default
  #13
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 5,905
Rep Power: 63
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by ened89 View Post
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?



This is not a new variable, you compute it from the velocity.
aero_head likes this.
FMDenaro is offline   Reply With Quote

Old   June 15, 2021, 10:48
Default
  #14
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 1,686
Blog Entries: 20
Rep Power: 34
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Quote:
Originally Posted by ened89 View Post
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?
What is exactly your question? What has to be done for what?
sbaffini is offline   Reply With Quote

Old   June 15, 2021, 11:00
Default
  #15
New Member
 
enes senyurt
Join Date: Oct 2015
Posts: 4
Rep Power: 8
ened89 is on a distinguished road
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:
Originally Posted by sbaffini View Post
What is exactly your question? What has to be done for what?
Attached Images
File Type: png scheme.PNG (5.6 KB, 5 views)
ened89 is offline   Reply With Quote

Old   June 15, 2021, 11:03
Default
  #16
New Member
 
enes senyurt
Join Date: Oct 2015
Posts: 4
Rep Power: 8
ened89 is on a distinguished road
So should I compute again Sxy from the copied velocity values ?



Quote:
Originally Posted by FMDenaro View Post
This is not a new variable, you compute it from the velocity.
ened89 is offline   Reply With Quote

Old   June 15, 2021, 11:04
Default
  #17
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 1,686
Blog Entries: 20
Rep Power: 34
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
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
aero_head likes this.
sbaffini is offline   Reply With Quote

Old   June 15, 2021, 11:05
Default
  #18
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 1,686
Blog Entries: 20
Rep Power: 34
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Quote:
Originally Posted by ened89 View Post
So should I compute again Sxy from the copied velocity values ?
yes indeed
aero_head likes this.
sbaffini is offline   Reply With Quote

Reply

Tags
boundary, boundary condition, navier stoke solver, periodic bc, solver

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 08:38
Centrifugal fan j0hnny CFX 13 October 1, 2019 14:55
Radiation interface hinca CFX 15 January 26, 2014 18:11
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 08:00
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 16:55


All times are GMT -4. The time now is 09:13.