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

Implementation of Periodic Boundary Condition

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

Like Tree6Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   April 23, 2012, 11:14
Default Implementation of Periodic Boundary Condition
  #1
Member
 
Mosi Owa
Join Date: Nov 2011
Posts: 35
Rep Power: 5
BMCombustor is on a distinguished road
Hi all,

I am going to implement periodic boundary condition in my own code. FYI, I am modeling a 2D duct with two wall mounted objects at top and bottom walls with a code that works with both SIMPLE and PISO algorithms. Does anyone have an idea how to get started? I've already done that in FLUENT but I don't know how to implement it in my code. Suggestion of papers or CFD books in this area are highly appreciated.

Thanks
BMCombustor is offline   Reply With Quote

Old   April 23, 2012, 14:11
Default
  #2
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 551
Rep Power: 11
cfdnewbie is on a distinguished road
Well, just connect your cells / grid points in a periodic way, i.e. in your grid management logic, and you are done!
cfdnewbie is offline   Reply With Quote

Old   April 23, 2012, 14:57
Default
  #3
Member
 
Mosi Owa
Join Date: Nov 2011
Posts: 35
Rep Power: 5
BMCombustor is on a distinguished road
Quote:
Originally Posted by cfdnewbie View Post
Well, just connect your cells / grid points in a periodic way, i.e. in your grid management logic, and you are done!
Thanks cfdnewbie, but could you explain more or refer me to a detailed source?
BMCombustor is offline   Reply With Quote

Old   April 23, 2012, 15:06
Default
  #4
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 551
Rep Power: 11
cfdnewbie is on a distinguished road
I'm sorry, I don't have a good source for that. Just imagine how you would do it in one dimension with a traveling wave, that should show you how it is done...what do you find confusing about it?
cfdnewbie is offline   Reply With Quote

Old   April 23, 2012, 15:28
Default
  #5
Member
 
Mosi Owa
Join Date: Nov 2011
Posts: 35
Rep Power: 5
BMCombustor is on a distinguished road
Quote:
Originally Posted by cfdnewbie View Post
I'm sorry, I don't have a good source for that. Just imagine how you would do it in one dimension with a traveling wave, that should show you how it is done...what do you find confusing about it?
I just don't know how to start!
BMCombustor is offline   Reply With Quote

Old   April 23, 2012, 15:42
Default
  #6
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 551
Rep Power: 11
cfdnewbie is on a distinguished road
well let's say your grid (in 1D) goes from 1 to N, which denotes the number of cells or grid points. So the periodic neighbor of cell 1 is N, and vice versa. (the other one being 2 and N-1, of course). So just when you compute your fluxes or your derivatives from your stencil, you use the periodic neighbor at the boundaries.

Did that clear it up a bit?
BMCombustor likes this.
cfdnewbie is offline   Reply With Quote

Old   April 23, 2012, 16:36
Default
  #7
Senior Member
 
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 387
Rep Power: 6
cdegroot is on a distinguished road
As stated before it is a matter of connecting your inlets and outlets as neighbours in your code. However, if you want to specify a certain mass flow you need to be able to determine the appropriate pressure drop to drive such a flow. Similarly for a constant wall temperature; you need the temperature change across the domain. A good reference for that is

"Use of Streamwise Periodic Boundary Conditions for Problems in Heat and Mass Transfer", J. Heat Transfer, Volume 129, Issue 4, 601.

I use a similar methodology in my 3D unstructured code.
BMCombustor likes this.
cdegroot is offline   Reply With Quote

Old   April 23, 2012, 16:50
Default
  #8
Member
 
Mosi Owa
Join Date: Nov 2011
Posts: 35
Rep Power: 5
BMCombustor is on a distinguished road
Quote:
Originally Posted by cfdnewbie View Post
well let's say your grid (in 1D) goes from 1 to N, which denotes the number of cells or grid points. So the periodic neighbor of cell 1 is N, and vice versa. (the other one being 2 and N-1, of course). So just when you compute your fluxes or your derivatives from your stencil, you use the periodic neighbor at the boundaries.

Did that clear it up a bit?
It makes sense. At least I think that I have something to start with. I will be back to you in case I face any problem.
BMCombustor is offline   Reply With Quote

Old   April 24, 2012, 17:22
Default
  #9
Senior Member
 
Join Date: Aug 2011
Posts: 251
Rep Power: 6
leflix is on a distinguished road
Let's recall the notation of cfdnewbie.

The way you can connect your boudary cells in a periodic way is very simple.
You just have to specify for every variables involved in your simulation just set:
PHI(1)= PHY(N-1)
PHI(N)=PHI(2)

However it's true as cdegroot mentioned it that if you have a infllow mass rate, you have to specify as source term of your Navier-Stokes equation a pressure drop which will verify the mass rate you want to impose...
leflix is offline   Reply With Quote

Old   April 24, 2012, 23:11
Default
  #10
Member
 
Mosi Owa
Join Date: Nov 2011
Posts: 35
Rep Power: 5
BMCombustor is on a distinguished road
Quote:
Originally Posted by leflix View Post
Let's recall the notation of cfdnewbie.

The way you can connect your boudary cells in a periodic way is very simple.
You just have to specify for every variables involved in your simulation just set:
PHI(1)= PHY(N-1)
PHI(N)=PHI(2)

However it's true as cdegroot mentioned it that if you have a infllow mass rate, you have to specify as source term of your Navier-Stokes equation a pressure drop which will verify the mass rate you want to impose...
I am pretty confused. As long as I am model a square (2D cube) in a duct flow, I have no problem and the solution converges. For this case I have velocity inlet and outflow boundary conditions. (outlet velocity is corrected in any iteration to satisfy continuity). But when I start periodicity as you mentioned, it gets diverged rapidly. I set those two above mentioned equalities for U, V and P; however I am dubious about what happens to my outflow after setting this condition! Is there probably any trick that I am missing?!
BMCombustor is offline   Reply With Quote

Old   April 24, 2012, 23:21
Default
  #11
New Member
 
JMC
Join Date: Apr 2012
Posts: 9
Rep Power: 5
DeepElm is on a distinguished road
It sounds like your problem might be that the physics are not periodic. Do you want to model it periodic in the direction of the flow? As CDE stated, there is a pressure drop that is driving the flow. If all your variables are not periodic, then you need to do adjust them to be periodic. After all, you want to conserve mass, momentum and energy, right?
DeepElm is offline   Reply With Quote

Old   April 24, 2012, 23:46
Default
  #12
Member
 
Mosi Owa
Join Date: Nov 2011
Posts: 35
Rep Power: 5
BMCombustor is on a distinguished road
Quote:
Originally Posted by DeepElm View Post
It sounds like your problem might be that the physics are not periodic. Do you want to model it periodic in the direction of the flow? As CDE stated, there is a pressure drop that is driving the flow. If all your variables are not periodic, then you need to do adjust them to be periodic. After all, you want to conserve mass, momentum and energy, right?
The single cube problem is not periodic but I want to model a chain of cubes in a line so that any cube (or block) is in the flow downstream of the previous block (and not in fully developed flow). Thus, the problem is periodic in the direction of the flow. I set periodicity right before solving velocity and pressure. Am I doing it correct?
BMCombustor is offline   Reply With Quote

Old   April 25, 2012, 00:28
Default
  #13
New Member
 
JMC
Join Date: Apr 2012
Posts: 9
Rep Power: 5
DeepElm is on a distinguished road
Quote:
Originally Posted by BMCombustor View Post
The single cube problem is not periodic but I want to model a chain of cubes in a line so that any cube (or block) is in the flow downstream of the previous block (and not in fully developed flow). Thus, the problem is periodic in the direction of the flow. I set periodicity right before solving velocity and pressure. Am I doing it correct?

I'm not sure I understand how it is periodic. Probably this is my fault. What are the reasons for running this simulation with periodic boundary conditions?
DeepElm is offline   Reply With Quote

Old   April 25, 2012, 04:11
Default
  #14
Senior Member
 
Join Date: Aug 2011
Posts: 251
Rep Power: 6
leflix is on a distinguished road
Quote:
Originally Posted by BMCombustor View Post
The single cube problem is not periodic but I want to model a chain of cubes in a line so that any cube (or block) is in the flow downstream of the previous block (and not in fully developed flow). Thus, the problem is periodic in the direction of the flow.
I think as DeepElm stated it that if the geometry and the pattern of the flow is not periodic it may be the reason why it diverges.
I'm not convinced that it is the case in your situation.
To be precise there is periodic boundary conditions and cyclic boundary conditions (it is periodic without pressure drop).
So you have to think what is the best option in your case...

Quote:
I set periodicity right before solving velocity and pressure. Am I doing it correct?
yes ! that is what I would do...

What is your velocity-pressure coupling algorithm ?
Generally Neumann boundary conditions are used for pressure equation.
What did you do for pressure in your case ? (still neumann or periodic boundary conditions for pressure too ?)
leflix is offline   Reply With Quote

Old   April 25, 2012, 09:16
Default
  #15
Member
 
Mosi Owa
Join Date: Nov 2011
Posts: 35
Rep Power: 5
BMCombustor is on a distinguished road
Quote:
Originally Posted by leflix View Post
What is your velocity-pressure coupling algorithm ?
Generally Neumann boundary conditions are used for pressure equation.
What did you do for pressure in your case ? (still neumann or periodic boundary conditions for pressure too ?)
I use SIMPLE to solve velocity-pressure coupling. I use zero gradient to set pressure of boundaries.
BMCombustor is offline   Reply With Quote

Old   April 25, 2012, 09:22
Default
  #16
Member
 
Mosi Owa
Join Date: Nov 2011
Posts: 35
Rep Power: 5
BMCombustor is on a distinguished road
[QUOTE=leflix;356824]...
To be precise there is periodic boundary conditions and cyclic boundary conditions (it is periodic without pressure drop).
So you have to think what is the best option in your case...

Quote:
Originally Posted by DeepElm View Post
I'm not sure I understand how it is periodic. Probably this is my fault. What are the reasons for running this simulation with periodic boundary conditions?
Maybe I am wrong and as leflix mentioned, I need to consider it as cyclic. The reason I consider it as periodic (or cyclic) is that the flow is repeating. I don't want to model 10 blocks because of computational cost. If I want to model the 3 middle ones (as an example), I do not have the inlet flow because it is neither uniform in velocity or pressure nor fully developed.
BMCombustor is offline   Reply With Quote

Old   April 25, 2012, 09:51
Default
  #17
Senior Member
 
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 387
Rep Power: 6
cdegroot is on a distinguished road
You definitely need to specify a pressure drop then across the domain. However, you might be seeing the simulation diverge if you aren't setting the pressure level anywhere in the domain. If you just link up the inlet and outlet and specify a pressure drop, the actual pressure level is free to go wherever it wants and certainly will diverge. What I do is choose one volume adjacent to the outlet and set the pressure to zero at its neighbour. This keeps the pressure level from going to +/- infinity.
BMCombustor likes this.
cdegroot is offline   Reply With Quote

Old   April 25, 2012, 11:25
Default
  #18
Member
 
Mosi Owa
Join Date: Nov 2011
Posts: 35
Rep Power: 5
BMCombustor is on a distinguished road
Quote:
Originally Posted by cdegroot View Post
You definitely need to specify a pressure drop then across the domain. However, you might be seeing the simulation diverge if you aren't setting the pressure level anywhere in the domain. If you just link up the inlet and outlet and specify a pressure drop, the actual pressure level is free to go wherever it wants and certainly will diverge. What I do is choose one volume adjacent to the outlet and set the pressure to zero at its neighbour. This keeps the pressure level from going to +/- infinity.
From your underlined comment, you might probably mean to consider a reference pressure. If so, I do consider a point, but adjacent to my inlet at (2,2), and subtract its pressure correction (from SIMPLE) from pressure corrections at all nodes. Is it what you mean or not? However, I am still confused about implementing pressure drop in my code
BMCombustor is offline   Reply With Quote

Old   April 25, 2012, 11:44
Default
  #19
Senior Member
 
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 387
Rep Power: 6
cdegroot is on a distinguished road
Sounds like you are probably correctly setting a reference pressure. Monitor your residuals though and make sure this isn't the place where the simulations starts diverging. I have found though that zeroing the pressure within an open domain can sometimes cause problems. If it is closed (like a lid driven cavity problem) there seems to be no issue. I use a fully coupled method though, so I'm not sure if you'd see the same issue using SIMPLE.

Adding the pressure drop is probably the most challenging part of implementing periodic boundary conditions. It sounds like you are considering flow past a series of bluff bodies which you are considering as periodic. I think we can agree that there should be a pressure drop across this domain. Thus, it is not sufficient to consider pressure as being periodic since the pressure at the outlet will be lower than the pressure at the inlet. Below is the way I approach the pressure drop in my code.

Consider a volume "I" adjacent to the outlet and its periodic neighbour "J" adjacent to the inlet. Instead of taking the pressure at the neighbour of "I" to be P(J) take it to be P(J)+DELTAP. Similarly take the pressure at the neighbour of "J" to be P(I)-DELTAP. DELTAP can either be specified if you know the pressure drop and want to find the mass flow. If you know the mass flow, then find DELTAP iteratively using the method of Beale described in his article "Use of Streamwise Periodic Boundary Conditions for Problems in Heat and Mass Transfer".

To set the reference pressure I choose one volume adjacent to the outlet and instead of using P(J)+DELTAP as its neighbour pressure I instead use zero. Thus I am not actually forcing the pressure to zero in any of my internal control volumes, just at a "virtual" volume adjacent to the outlet. This is sufficient to keep the pressure bounded. I hope that made sense!
BMCombustor likes this.
cdegroot is offline   Reply With Quote

Old   April 26, 2012, 18:47
Default
  #20
Member
 
Mosi Owa
Join Date: Nov 2011
Posts: 35
Rep Power: 5
BMCombustor is on a distinguished road
Quote:
Originally Posted by cdegroot View Post
....

Consider a volume "I" adjacent to the outlet and its periodic neighbour "J" adjacent to the inlet. Instead of taking the pressure at the neighbour of "I" to be P(J) take it to be P(J)+DELTAP. Similarly take the pressure at the neighbour of "J" to be P(I)-DELTAP. DELTAP can either be specified if you know the pressure drop and want to find the mass flow. If you know the mass flow, then find DELTAP iteratively using the method of Beale described in his article "Use of Streamwise Periodic Boundary Conditions for Problems in Heat and Mass Transfer". ...
I'm back and feeling pretty miserable
There is something with your comment that doesn't make sense to me. I am working with a collocated grid (not a staggered one). In my new geometry, my boundaries are 1 as left and N as right. As you can see it in attached file (Geometry.jpg), this is a cavity like problem with one inlet at 1 and one outlet at N. At 1, the lower half is wall and at N the upper half is wall. As long as I run this geometry as a single chamber, I have no problem and you could see the result. I just solve the equations from 2 to N-1. At 1 the velocity is prescribed and at N it is derived using outflow assumption. The contours are for U (x direction) velocity. But suppose that this is periodic problem and I am going to have the same chamber (but upside down) immediately after the current chamber. Therefore, the outlet velocity profile for the first chamber would be the inlet profile for the next one (In fact, the outlet lower half U will be the same as inlet upper half U. the same story goes with V velocity but with a negative sign). As you see, my boundary condition at 1 and N are equal with each other and not with each other's neighbors. I impose the outlet velocity to inlet at every iteration. The code converges but the problem is that this new profile does not go forward and I have it and its effect only at the very first cells (You could probably see the very narrow red area in at the inlet). After that, the velocity profile is similar to single chamber (See Geometry2.jpg). I have no idea what to do!
Attached Images
File Type: jpg Geometry.jpg (95.4 KB, 28 views)
File Type: jpg Geometry2.jpg (46.2 KB, 20 views)
BMCombustor is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Periodic boundary condition Arif FLUENT 2 January 17, 2014 07:48
Implementation of a relaxation boundary condition fs82 OpenFOAM 2 December 19, 2011 08:04
Simulating A water bubble in air with periodic boundary condition cubicmatrixist Main CFD Forum 0 October 14, 2010 12:26
vorticity boundary condition bearcharge Main CFD Forum 0 May 14, 2010 11:32
periodic boundary condition? Sima Baheri Phoenics 5 October 20, 2007 09:20


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