---------------------------------------------------------------------------------------------------------------------------------------------
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.

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.

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?

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.

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?

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.

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？

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.

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?

---------------------------------------------------------------------------------------------------------------------------------------------
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.

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.

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?

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.

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...

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)

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.

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.

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?

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.