# ribbed channel / simpleFoam / boundary conditions

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

 November 22, 2012, 16:40 ribbed channel / simpleFoam / boundary conditions #1 New Member   Join Date: Sep 2012 Posts: 10 Rep Power: 4 Dear foamErs, my task is as follows: --------------------------------------------------------------------------------------------------------------------------------------------- GENERAL ASPECTS --------------------------------------------------------------------------------------------------------------------------------------------- I want to simulate a rib-roughened channel and compare the results to experiments. Along with the experiments only the Reynolds number is given (and thus U_bulk). In addition, the experiments consider a set of periodically located ribs in order to guarantee fully developed flow. In order to save time and cost I want to simulate only a section of the mentioned frame (shown in the picture as 'region of interest'). --------------------------------------------------------------------------------------------------------------------------------------------- PROBLEM --------------------------------------------------------------------------------------------------------------------------------------------- I have problems setting proper boundary conditions to match the Reynolds number of the experiments and guarantee fully developed flow in the region of interest. In addition, I am not familiar with setting periodic boundary conditions. --------------------------------------------------------------------------------------------------------------------------------------------- APPROACHES --------------------------------------------------------------------------------------------------------------------------------------------- 1. cyclic boundary conditions I tried applying the boundary conditions at the inlet and outlet to cyclic (concerning all variables) while setting the velocity of the internal field to a finite value. Code: ```internalField uniform (2.98 0 0); boundaryField { inlet { type cyclic; } outlet { type cyclic; }``` Here, the resulting bulk velocity strongly deviates from the previously specified value. Furthermore, I repeated the first approach but specified a uniform velocity at the inlet accompanied with an internal field of ( 0 0 0 ). Code: ```internalField uniform (0 0 0); boundaryField { inlet { type cyclic; value uniform (2.98 0 0); } outlet { type cyclic; }``` Here, the velocity field is not solved at all. 3. Extend the computational region at the left-hand-side. This would allow a uniform velocity which meets the experimental Reynolds number to be defined at the new inlet. Afterwards, the computation should run in a cyclic matter between 'internal patch' and 'outlet'. Hence, the extension would only serve as a developing region. Here, blockMeshDict did not allow the definition of a patch located in the internal field. --------------------------------------------------------------------------------------------------------------------------------------------- QUESTIONS --------------------------------------------------------------------------------------------------------------------------------------------- 1. Can anyone explain if the 'cyclic' - approach is adequate and how to define it properly? 2. Can anyone describe further approaches to specify periodic boundary conditions? (I have read some threads dealing with 'flowRateInletVelocity', 'directMapped' and so on but cannot find an extensive documentation) 3. If specifying a fixed value for the velocity at the inlet in combination with cyclic-related boundary conditions (see approach 2.), is this value treated as initial conditions or boundary conditions? While the former would be a reasonable approach, the latter would not guarantee fully developed flow but prevent the development of a boundary layer at the inlet. 4. With respect to approach 3, is it possible to define a patch located in the internal field? Plus, is it possible to run the solver in a cyclic manner after a finite spatial region? Sorry for double-posting and thanks for your answers. Happy Thanksgiving, Beeo utkunun likes this.

 November 22, 2012, 18:20 #2 Senior Member   Lieven Join Date: Dec 2011 Location: Mol, Belgium Posts: 295 Rep Power: 13 Dear Beeo, I'd recommend you to have a look at channelFoam and its tutorial. Channelfoam is specifically developed to simulate the flow in a duct using cyclic inlet-outlet boundary conditions with a constant mass flow rate (which can be derived quite easily from Re). I'm pretty sure you can simply replace the mesh of the tuturial by yours and keep the BC (that is, if you're happy with the wall treatment and the turbulence modelling). To give you some feedback on the three approaches: 1. If you solve this with simple/piso/pimpleFoam the flow will slow down untill it stops cause you're lacking a driving force i.e. a pressure gradient. This you can't impose as BC if you're using cyclic boundary conditions. In channelFoam this pressure gradient is directly included in the momentum equation 2. This is simply not how "value ..." works. It serves as initial value for the boundary but depending of the BC this value might even never be used (in case of cyclic I doubt that this value is even read). 3. Same problem as (1), you need a driving force (e.g. use channelFoam). If you want to work with some sort of 'infinite inlet', you should have a look at the directMapped boundary conditions (mapped in v2.1.1). The pisoFoam/les/pitzDailyDirectMapped tutorial is an example on how this BC can be used. Regards, L sunliming likes this.

 November 22, 2012, 18:37 #3 New Member   Join Date: Sep 2012 Posts: 10 Rep Power: 4 Hey L, thanks for your comment. I had a look at the channelFoam solver. Since I want to evaluate several RANS models, channelFoam is not appropriate being a LES solver. However, as you mentioned, the boundary condition-related options are exactly what I am looking for. 1. Is there a way to fix the mass flow rate (or U_bulk) in combination with simpleFoam, though? 2. When specifying the inlet and outlet boundary condition to cyclic (simpleFoam), the driving force has to be a pressure gradient? Do you know how to properly determine and define it respectively? 3. Or would you recommend to modify channelFoam in order to compute the RANS models mentioned above? Kind regards, Beeo

 November 22, 2012, 19:17 #4 Senior Member   Lieven Join Date: Dec 2011 Location: Mol, Belgium Posts: 295 Rep Power: 13 Hey Beeo, Now that I think about it, you might get it working using simpleFoam if you use the directMapped (or mapped) boundary condition and set the 'setAverage' to 'true' in 0/U. In this case you don't need to impose an external pressure gradient to keep the flow running. However, it is not as trivial as it might seem (see below). If you're not affraid of creating a modified solver, I recommend you to go for option number 3. It actually surprises me a bit that the turbulence modelling is not generic like pisoFoam cause channelFoam is in the end just an extension of pisoFoam. Anyway, if you open the source code of both solvers you will see that this is easy to modify. However, a problem with the mapped BC for your case is that you need to be very careful where to set the mapping plane. The BC basically looks for the cells closest to where you want to have the plane so the location becomes directly dependent on your mesh. A coarser mesh with therefore map from an other plane that a fine mesh and both will therefore result in a different spacing between the ribs. Modifying channelFoam to include RANS-models is pretty straightforward and using cyclic bc is a lot easier than mapped BC and, more importantly, the geometry won't change if you change the mesh. Just as a side note. One difference between both approaches will be in the pressure field. simpleFoam will give you a solution which includes the pressure gradient while channelFoam will give you the pressure field without the externally imposed pressure gradient. Regards, L

 November 22, 2012, 23:33 #5 New Member   Join Date: Sep 2012 Posts: 10 Rep Power: 4 Dear L, thanks a lot. You made my day. Your proposals directed me to the results I was looking for. After comparing simpleFoam with channelFoam I was able to modify simpleFoam in such a way to allow for specifying a given value of U_bar in combination with cyclic boundary conditions. If someone is interested in the modified solver, please let me know. Beeo

 November 25, 2012, 12:55 How to set fixed pressure gradient instead of fixed flow rate in channelFoam？ #6 Member   Nick Join Date: Nov 2011 Location: Tongji University,Shanghai,China Posts: 33 Blog Entries: 6 Rep Power: 5 I need to fix pressure gradient rather than flow rate which is adopted in channelFoam， does anyone know how to achieve this？Thank you for giving help.

 November 25, 2012, 13:47 #7 Senior Member   Lieven Join Date: Dec 2011 Location: Mol, Belgium Posts: 295 Rep Power: 13 It's pretty straightforward to change channelFoam for this. Have a look at the source code. Change the gradP-variable to the value you would like (line 134) i.e. link it to a new input variable instead of it being calculated based on the Ubar-input. Regards, L

 November 28, 2012, 08:10 #8 Member   Nick Join Date: Nov 2011 Location: Tongji University,Shanghai,China Posts: 33 Blog Entries: 6 Rep Power: 5 Thank you Lieven, I tried it and succeeded!

November 30, 2012, 22:32
#9
Member

sqing
Join Date: Sep 2012
Location: Dalian
Posts: 77
Rep Power: 4
Quote:
 Originally Posted by beeo Dear L, thanks a lot. You made my day. Your proposals directed me to the results I was looking for. After comparing simpleFoam with channelFoam I was able to modify simpleFoam in such a way to allow for specifying a given value of U_bar in combination with cyclic boundary conditions. If someone is interested in the modified solver, please let me know. Beeo
Hi Beeo,

I have met with the similar problem with you. I want to modify the channelFoam to include Rans-model, but I didn't compile it successfully. So may I have a look at your modified solver?

Regards,
Sunxing

December 1, 2012, 16:29
#10
New Member

Join Date: Sep 2012
Posts: 10
Rep Power: 4
Quote:
 Originally Posted by Sunxing Hi Beeo, I have met with the similar problem with you. I want to modify the channelFoam to include Rans-model, but I didn't compile it successfully. So may I have a look at your modified solver? Regards, Sunxing
Hey Sunxing,

of course. Please find attached the corresponding file. Let me know if you are facing further problems.

Beeo
Attached Files
 simpleFoam_cyclic.C (4.5 KB, 137 views)

 December 2, 2012, 07:50 #11 Member   sqing Join Date: Sep 2012 Location: Dalian Posts: 77 Rep Power: 4 Hi Beeo, Thanks for your shared file. Best, Sunxing

December 8, 2012, 16:11
#12
New Member

Join Date: Nov 2012
Posts: 2
Rep Power: 0
Quote:
 Originally Posted by beeo Dear foamErs, my task is as follows: --------------------------------------------------------------------------------------------------------------------------------------------- GENERAL ASPECTS --------------------------------------------------------------------------------------------------------------------------------------------- I want to simulate a rib-roughened channel and compare the results to experiments. Along with the experiments only the Reynolds number is given (and thus U_bulk). In addition, the experiments consider a set of periodically located ribs in order to guarantee fully developed flow. In order to save time and cost I want to simulate only a section of the mentioned frame (shown in the picture as 'region of interest'). --------------------------------------------------------------------------------------------------------------------------------------------- PROBLEM --------------------------------------------------------------------------------------------------------------------------------------------- I have problems setting proper boundary conditions to match the Reynolds number of the experiments and guarantee fully developed flow in the region of interest. In addition, I am not familiar with setting periodic boundary conditions. --------------------------------------------------------------------------------------------------------------------------------------------- APPROACHES --------------------------------------------------------------------------------------------------------------------------------------------- 1. cyclic boundary conditions I tried applying the boundary conditions at the inlet and outlet to cyclic (concerning all variables) while setting the velocity of the internal field to a finite value. Code: ```internalField uniform (2.98 0 0); boundaryField { inlet { type cyclic; } outlet { type cyclic; }``` Here, the resulting bulk velocity strongly deviates from the previously specified value. Furthermore, I repeated the first approach but specified a uniform velocity at the inlet accompanied with an internal field of ( 0 0 0 ). Code: ```internalField uniform (0 0 0); boundaryField { inlet { type cyclic; value uniform (2.98 0 0); } outlet { type cyclic; }``` Here, the velocity field is not solved at all. 3. Extend the computational region at the left-hand-side. This would allow a uniform velocity which meets the experimental Reynolds number to be defined at the new inlet. Afterwards, the computation should run in a cyclic matter between 'internal patch' and 'outlet'. Hence, the extension would only serve as a developing region. Here, blockMeshDict did not allow the definition of a patch located in the internal field. --------------------------------------------------------------------------------------------------------------------------------------------- QUESTIONS --------------------------------------------------------------------------------------------------------------------------------------------- 1. Can anyone explain if the 'cyclic' - approach is adequate and how to define it properly? 2. Can anyone describe further approaches to specify periodic boundary conditions? (I have read some threads dealing with 'flowRateInletVelocity', 'directMapped' and so on but cannot find an extensive documentation) 3. If specifying a fixed value for the velocity at the inlet in combination with cyclic-related boundary conditions (see approach 2.), is this value treated as initial conditions or boundary conditions? While the former would be a reasonable approach, the latter would not guarantee fully developed flow but prevent the development of a boundary layer at the inlet. 4. With respect to approach 3, is it possible to define a patch located in the internal field? Plus, is it possible to run the solver in a cyclic manner after a finite spatial region? Sorry for double-posting and thanks for your answers. Happy Thanksgiving, Beeo

hi,

i m new on openFoam and i have a graduation project same as your problem. just i have 14 rib and i need to examine a few points on it. please help me.

best regards,
demur

 December 8, 2012, 19:47 #13 New Member   Join Date: Sep 2012 Posts: 10 Rep Power: 4 Hi demur, what is your question actually? Beeo

 December 9, 2012, 04:49 #14 Senior Member   Lieven Join Date: Dec 2011 Location: Mol, Belgium Posts: 295 Rep Power: 13 Dear Demur, Where are the 14 ribs located exactly? Since you have a finite number of ribs, periodic boundaries (mapped or cyclic) might not be appropriate. If not, I would simply recommend you to use channelFoam. Kind regards, L

 December 12, 2012, 02:24 #15 New Member   Join Date: Nov 2012 Posts: 2 Rep Power: 0 hi firstly thank you for advice and my ribs will be on one side of the channel and it will be open channel. there is no problem with constructing geometry but i dont know how can i change BC in channelFoam tutorial as i want. in tutorial there is cyclic conditions and i only want to define atmosphere empty and top-bottom. thank you demur

 December 12, 2012, 08:02 #16 Senior Member   Lieven Join Date: Dec 2011 Location: Mol, Belgium Posts: 295 Rep Power: 13 Hi Demur, If I understand your problem correctly (correct me if I'm wrong), your problem is not periodic i.e. it has a finite number of ribs. In this case you can better use the pisoFoam solver. Impose a mass flow rate at the inlet and a pressure at the outlet... Cheers, L

April 26, 2013, 14:08
#17
Member

pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 5
Dear Forum User,

I have recently tried to simulate 2D Periodic Hill Using OpenFoam. my case is very similar to Beeo case. So, based on what I have read from this forum I need to modify ChannelFoam for RANS calculation and fix Ubar in transportDict in order to have fixed mass flow rate. However my question is this:

Since I am going to calculate Re based on bulk velocity at inlet, I need to define Ubar as the average of velocities over the periodic inlet/outlet patches (because the area in the streamwise direction is changing, volume average of velocities in the entire domain calculated by (flowDirection & U)().weightedAverage(mesh.V()); is not appropriate for my case)

Is there any suggestion how I can fix my issue?

Thanks alot,
Attached Images
 Hill Image.jpeg (9.4 KB, 44 views)

April 27, 2013, 18:54
#18
Member

pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 5
Dear sir,

my geometry is like yours. How did you make your inflow and outflow cyclic? I tried to do that by importing my grid from pointwise but it failed to create cyclic patches in OpenFoam. Can anyone send me an example of createPatchDict?

Quote:
 Originally Posted by beeo Dear foamErs, my task is as follows: --------------------------------------------------------------------------------------------------------------------------------------------- GENERAL ASPECTS --------------------------------------------------------------------------------------------------------------------------------------------- I want to simulate a rib-roughened channel and compare the results to experiments. Along with the experiments only the Reynolds number is given (and thus U_bulk). In addition, the experiments consider a set of periodically located ribs in order to guarantee fully developed flow. In order to save time and cost I want to simulate only a section of the mentioned frame (shown in the picture as 'region of interest'). --------------------------------------------------------------------------------------------------------------------------------------------- PROBLEM --------------------------------------------------------------------------------------------------------------------------------------------- I have problems setting proper boundary conditions to match the Reynolds number of the experiments and guarantee fully developed flow in the region of interest. In addition, I am not familiar with setting periodic boundary conditions. --------------------------------------------------------------------------------------------------------------------------------------------- APPROACHES --------------------------------------------------------------------------------------------------------------------------------------------- 1. cyclic boundary conditions I tried applying the boundary conditions at the inlet and outlet to cyclic (concerning all variables) while setting the velocity of the internal field to a finite value. Code: ```internalField uniform (2.98 0 0); boundaryField { inlet { type cyclic; } outlet { type cyclic; }``` Here, the resulting bulk velocity strongly deviates from the previously specified value. Furthermore, I repeated the first approach but specified a uniform velocity at the inlet accompanied with an internal field of ( 0 0 0 ). Code: ```internalField uniform (0 0 0); boundaryField { inlet { type cyclic; value uniform (2.98 0 0); } outlet { type cyclic; }``` Here, the velocity field is not solved at all. 3. Extend the computational region at the left-hand-side. This would allow a uniform velocity which meets the experimental Reynolds number to be defined at the new inlet. Afterwards, the computation should run in a cyclic matter between 'internal patch' and 'outlet'. Hence, the extension would only serve as a developing region. Here, blockMeshDict did not allow the definition of a patch located in the internal field. --------------------------------------------------------------------------------------------------------------------------------------------- QUESTIONS --------------------------------------------------------------------------------------------------------------------------------------------- 1. Can anyone explain if the 'cyclic' - approach is adequate and how to define it properly? 2. Can anyone describe further approaches to specify periodic boundary conditions? (I have read some threads dealing with 'flowRateInletVelocity', 'directMapped' and so on but cannot find an extensive documentation) 3. If specifying a fixed value for the velocity at the inlet in combination with cyclic-related boundary conditions (see approach 2.), is this value treated as initial conditions or boundary conditions? While the former would be a reasonable approach, the latter would not guarantee fully developed flow but prevent the development of a boundary layer at the inlet. 4. With respect to approach 3, is it possible to define a patch located in the internal field? Plus, is it possible to run the solver in a cyclic manner after a finite spatial region? Sorry for double-posting and thanks for your answers. Happy Thanksgiving, Beeo

July 17, 2013, 04:11
no more channelFoam!
#19
New Member

Steven
Join Date: Jul 2013
Posts: 5
Rep Power: 4
Hi Lieven,
Channelfoam is not included in OF 2.2.1. Do you know what solver we can use instead which has the same features (you mentioned), I mean having the grad P with itself and no need for externally implementation?
Thanks.

Quote:
 Originally Posted by Lieven Hey Beeo, Now that I think about it, you might get it working using simpleFoam if you use the directMapped (or mapped) boundary condition and set the 'setAverage' to 'true' in 0/U. In this case you don't need to impose an external pressure gradient to keep the flow running. However, it is not as trivial as it might seem (see below). If you're not affraid of creating a modified solver, I recommend you to go for option number 3. It actually surprises me a bit that the turbulence modelling is not generic like pisoFoam cause channelFoam is in the end just an extension of pisoFoam. Anyway, if you open the source code of both solvers you will see that this is easy to modify. However, a problem with the mapped BC for your case is that you need to be very careful where to set the mapping plane. The BC basically looks for the cells closest to where you want to have the plane so the location becomes directly dependent on your mesh. A coarser mesh with therefore map from an other plane that a fine mesh and both will therefore result in a different spacing between the ribs. Modifying channelFoam to include RANS-models is pretty straightforward and using cyclic bc is a lot easier than mapped BC and, more importantly, the geometry won't change if you change the mesh. Just as a side note. One difference between both approaches will be in the pressure field. simpleFoam will give you a solution which includes the pressure gradient while channelFoam will give you the pressure field without the externally imposed pressure gradient. Regards, L

 July 17, 2013, 07:25 #20 Senior Member   Lieven Join Date: Dec 2011 Location: Mol, Belgium Posts: 295 Rep Power: 13 Hi Steven, You should be able to set the gradP using the fvOptions-functionallity in OF 2.2. I'm still working with OF 2.1.x so I can't really help you with the details about this. Alternatively (but less favourable option) you can simply look up the channelFoam.C file of OF 2.1.x via Google and check how it is implemented in there. Cheers, Lieven

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post shayan_mv ANSYS Meshing & Geometry 20 November 4, 2012 08:42 Env FLUENT 3 October 21, 2012 14:36 HMR CFX 3 March 6, 2011 21:10 Aloex FLUENT 1 February 22, 2011 13:28 pavan FLUENT 1 March 6, 2007 16:46

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