CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   ribbed channel / simpleFoam / boundary conditions (http://www.cfd-online.com/Forums/openfoam-pre-processing/109651-ribbed-channel-simplefoam-boundary-conditions.html)

 beeo November 22, 2012 16:40

ribbed channel / simpleFoam / boundary conditions

Dear foamErs,

http://dl.dropbox.com/u/21134978/drawing3.png
http://dl.dropbox.com/u/21134978/drawing.pdf
---------------------------------------------------------------------------------------------------------------------------------------------
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.
http://dl.dropbox.com/u/21134978/drawing6.png
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?

Happy Thanksgiving,
Beeo

http://dl.dropbox.com/u/21134978/drawing.eps

 Lieven November 22, 2012 18:20

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

 beeo November 22, 2012 18:37

Hey L,

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

 Lieven November 22, 2012 19:17

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

 beeo November 22, 2012 23:33

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

 sunliming November 25, 2012 12:55

How to set fixed pressure gradient instead of fixed flow rate in channelFoam？

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.

 Lieven November 25, 2012 13:47

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

 sunliming November 28, 2012 08:10

Thank you Lieven, I tried it and succeeded!

 Sunxing November 30, 2012 22:32

Quote:
 Originally Posted by beeo (Post 393745) 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

 beeo December 1, 2012 16:29

1 Attachment(s)
Quote:
 Originally Posted by Sunxing (Post 395115) 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

 Sunxing December 2, 2012 07:50

Hi Beeo,

Best,

Sunxing

 demur December 8, 2012 16:11

Quote:
 Originally Posted by beeo (Post 393713) Dear foamErs, my task is as follows: http://dl.dropbox.com/u/21134978/drawing3.png http://dl.dropbox.com/u/21134978/drawing.pdf --------------------------------------------------------------------------------------------------------------------------------------------- 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. http://dl.dropbox.com/u/21134978/drawing6.png 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 http://dl.dropbox.com/u/21134978/drawing.eps

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

 beeo December 8, 2012 19:47

Hi demur,

Beeo

 Lieven December 9, 2012 04:49

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

 demur December 12, 2012 02:24

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

 Lieven December 12, 2012 08:02

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

 sam1364 April 26, 2013 14:08

1 Attachment(s)
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,

 sam1364 April 27, 2013 18:54

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 (Post 393713) Dear foamErs, my task is as follows: http://dl.dropbox.com/u/21134978/drawing3.png http://dl.dropbox.com/u/21134978/drawing.pdf --------------------------------------------------------------------------------------------------------------------------------------------- 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. http://dl.dropbox.com/u/21134978/drawing6.png 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 http://dl.dropbox.com/u/21134978/drawing.eps

 Darth2013 July 17, 2013 04:11

no more channelFoam!

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 (Post 393731) 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

 Lieven July 17, 2013 07:25

Hi Steven,