CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Channel with repeated geometry (

santos May 6, 2005 19:44

Hello! I am a new OpenFOAM

I am a new OpenFOAM user, and I am trying to use it to simulate the laminar water flow on a nanofiltration spiral wound channel. It is a rectangular cross section channel with about 200 cylindrical spacers:

The goal of this work is to verify for which Re number the flux become unsteady.

The geometry _o_o_ repeats itself throughout the channel, so what I want to know if the rigth way to do it is simulate only one section of the geometry, and to define the inlet and outlet of that repeated geometry as "cyclic".

And how can I specify the channel Reynolds, since I dont have the possibilty to enter any inlet fluid velocity on cyclic patch type?

Hope someone can help me on this!

Jose Santos

eugene May 7, 2005 05:49

Hi Jose, Just for interests
Hi Jose,

Just for interests sake, which way is the fluid flowing in this channel:


From left to right -> or from front to back?

In either case you can almost certainly specify the inlet-outlet patch combination as a cyclic pair provided you capture enough ribbs. To find out how the mass flux would be fixed, take a look at the code channelOodles
and its tutorial example. The code adjusts an imposed pressure-gradient in the domain along the direction of your specified bulk velocity such that the actual mass flow rate tends toward the target value. The pressure gradient driving force is not a 100% accurate approximation for your case, but it should suffice for most such applications.

The channelOodles solver should be sufficient for your purposes as well, just change the LESmodel to laminar.

santos May 8, 2005 18:15

Hello Eugene! Thank you ver
Hello Eugene!

Thank you very much for your help, I think I am making some progress!

Instead of using the geometry that I described before, I am using a baffled channel, because I have some experimental data to compare with (Roberts, A numerical and experimental study of transition processes in an obstructed channel flow, 1994, J.Fluid.Mech.).

The geometry is the following:


I have chosen to simulate only one baffled cell:



The fluid is flowing from left to rigth. Like you suggested, I have used the channelOodles code, changed the LESmodel to laminar, and specified the inlet-outlet patch combination as cyclic. I changed Ubar to the velocity that corresponds to Re=134, 0.0048 m/s. As for the initial U field, I specified it also as 0.0048 m/s (is this correct, or should I keep it as zero?).

I tried to run it with a course grid for 30 seconds and for these conditions, the flux eventually becomes steady after 20-25 seconds, with some large recirculation regions on upper and lower sections of the cell, and a straigth flux region connecting the inlet and outlet with U~0.0048 m/s.

However, in accordance with the previously mentioned work of Roberts, for this Re, the flux becomes assymetric and unsteady, leading to a eddy shedding regime.

A coleague of mine successfully obtained an unsteady flux exactly for these conditions on Ansys CFX, but he had to add a source term, proportional to the gravity.

Do you think that my approach was correct? And should I follow my colleague advice and try to add a source term to obtain unsteady flux?

Jose Santos

henry May 9, 2005 04:06

Is the mesh you are using as f
Is the mesh you are using as fine as that used by your colleague? What discretisation schemes are you using?

eugene May 9, 2005 05:43

Hi Jose, Glad to hear you a
Hi Jose,

Glad to hear you are making progress. From your comments thus far you seem to be doing everything correctly, but as Henry implied we need to know the details of your setup to be able to comment on your solution. Specifically, it would be useful if you post a copy of your fvSchemes and fvSolution files (unless of course they are identical to the channelOodles tutorial versions).

From what little I know of your problem, it seems highly unlikely that the addition of a gravity source term would (or should) affect the solution in any significant way. In CFX the additional term might just introduce some initial instabilities because of numerical errors, but thats the only influence I can imagine.

Things you might want to try in the mean time:
1) Increase your mesh resolution. You can only resolve perturbations on the scale of the mesh or larger.
2) Add a tiny little bit of asymmetry via your boundary conditions (i.e. shift baffle height). I always find it helps to get things started and if you make it small enough, it wont effect the overall solution.
3) Perturb the initial velocity field.
4) Try the CrankNicholson time discretisation scheme. It is less dissipative than backward differencing.

Remember predicting transition from laminar to unsteady flow in symmetric problems is notoriously difficult even at the best of times. Anyway, let us know how it turns out.

santos May 9, 2005 13:17

Hello Henry Weller and Eugene!
Hello Henry Weller and Eugene!

I have used blockMesh to generate my mesh, while my colleague used the CFX mesh generator. Anyway, I think his mesh is finer than mine.

I have used the standard chanelOodles discretisation schemes, and also the standard fvSolution file.

Today I tried to simulate the flux for a Re number of 400 (previously was 134) and for 100 seconds. After 50-60 seconds the flux become unsteady and oscillatory, so I guess I should have waited longer for the other Re simulation, which I am repeating right now.

Now a question arises: is it possible to disturb my system to obtain this oscillatory behaviour sooner? Maybe using Eugene suggestion of shifting baffle height (I will try this as soon as the current simulation ends)?

Other question: how can I monitor in OpenFOAM an hypothetical solute concentration distribution inside the cell, for example NaCl (sodium chloride)? Do I need to change the solver code? I have looked at all the tutorials and didnt find anything related to this.

Best regards,
Jose Santos

henry May 9, 2005 15:35

A good way of starting unstead
A good way of starting unsteady problems is to map the solution from a previous run. In your case you could try scaling the velocity field from the higher Re run to the lower speed and start from that. If you change mesh you could map the previous solution using mapFields.

I am not sure what you mean by "concentration distribution inside the cell", do you mean you wish to solve a transport equation for the concentration distribution of NaCl?

eugene May 9, 2005 17:36

Hi Jose, There are several
Hi Jose,

There are several ways to perturb a system. Some that I have used in the past:
1. Add random fluctuations to the velocity field. (doesnt always work as the perturbations get damped out real quick)
2. Add unstable structures like undulating streaks or vortices to the velocity field. (generally works very well but requires different perturbations for different cases)
3. Bias the inlet velocity distribution (not applicable in your case)
4. Add some asymmetry to the domain boundaries (particularly effective in regions of high velocity gradient, like sudden contractions).

Options 1 and 2 require you to write some code, but it should be fairly simple and a good learning experience. See the engineSwirl app for some pointers.

To track a passive scalar you will have to modify one of the solvers, channelOodles in your case. Don't worry though, adding a scalar transport equation is very easy to do. There are lots of examples throughout the code.

santos May 10, 2005 22:45

Hi Henry Weller: Thank yo

Henry Weller:
Thank you for your suggestions for starting unsteady problems. Ill try them as soon as possible. Concerning the concentration distribution, I want to calculate the NaCl (or other compound) concentration distribution inside the channel.

Eugene de Villiers:
I tried to add some assymmetry to the baffle sizes, and it worked quite well! I obtained an oscillatory flux earlier than before.

So what you both say is that I can introduce a transport equation for NaCl in the solver code. And what about the properties of NaCl? Should I define them elsewhere?

P.S. I think OpenFOAM developers should be proud for providing a tool that can solve, at least, the same problems that Ansys CFX solves. On the other hand, the user is not overwhelmed with the thousands of CFX options, and can actually learn a bit more about CFD - at least that is my experience with OpenFOAM.

eugene May 11, 2005 05:39

What kind of problem exactly a
What kind of problem exactly are you trying to solve with the NaCl model, i.e. what are the boundary conditions, what does the transport equation look like. If you can provide this information, I should be able to give you a rough idea of what you need to do to implement the model. Typically, you will put the NaCl properties in a dictionary file from where the code will read them at the start of you calculation. You will also need to make a NaCl consentration field with the proper concentration boundary conditions.

santos May 15, 2005 07:29

Hello Eugene! I am not tryi
Hello Eugene!

I am not trying to solve anything specific, I just want to track the concentration of a given compound (I have referred to NaCl as an example).

Lets say I have an inlet concentration of 10 mol/m of NaCl. The concentration is zero inside the channel for t=0. So, I want to calculate what will be the concentration profile in the channel for a given time period.

I guess this may be very easy to implement in OpenFOAM, but I am bit lost!

eugene May 16, 2005 09:32

Hi Jose So you want to do a
Hi Jose

So you want to do a basic passive scalar transport. The reason I was uncertain is that we were discussing a period channel before, where there are no "inlets" to introduce the scalar at, so I assumed you wanted some other kind of source.

For example scalar transport implementation, look at the source code for "scalarTransportFoam". Stick this somewhere in the business end of your channelOodles solver. Some modifications might be neccesary, but the should be minor and self-evident.

santos May 16, 2005 12:31

Hello Eugene Apologize me,
Hello Eugene

Apologize me, because I guess you were rigth. I want to have a cyclic inlet-outlet. So in this case there are no inlets to introduce the scalar!

Should I try to stick the code from "scalarTransportFoam" in channelOodles, or for the case of cyclic inlet-outlet this doesnt apply?

Thanks for the help!

santos May 30, 2005 07:45

Hello again! For my case of
Hello again!

For my case of cyclic inlet-outlet, is there an easy way of calculating the pressure drop and friction factor inside the channel?

Best regards,
Jose Santos

henry May 30, 2005 07:54

channelOodles calculates and p
channelOodles calculates and prints the pressure-drop from which you can calculate the friction-factor.

santos May 30, 2005 11:07

Hello Henry Weller So the "
Hello Henry Weller

So the "pressure gradient" that is printed is in fact the pressure-drop! Thank you very much for the help!

henry May 30, 2005 11:13

No the pressure gradient is th
No the pressure gradient is the pressure gradient, if you want the pressure-drop please just multiply by the length of the channel. If that is a problem you can change the code to print out the pressure-drop directly by including a multiplication by the length of the channel in the print-statement.

santos May 30, 2005 14:11

I noticed that earlier by look
I noticed that earlier by looking at the pressure gradient dimensions. In fact, I needed to multiply it by the density and divide it by the length to get Pa unit.

I think I will take your good suggestion, and change the code to print directly the pressure drop!

Anyway, I am glad that OpenFOAM is predicting quite well the pressure drop and friction factor inside my channel for low Re (<100), for which I have some experimental data. Now lets see how good it works for higher Re number!

santos May 30, 2005 14:15

On the previous message, pleas
On the previous message, please read "multiply it by the density and by the length"

cedric_duprat January 17, 2008 10:07

Hi OF, In France, we have o
Hi OF,

In France, we have one month to whish a new year so ... happy new year to all the community.
I need some help on the modelisation of a turbulent channel flow by LES, using one transport equation for the sub-grid kinetic energy.

I have a channel which is twice longer than the tutorial one (8*2*2). I use directMapped patch for inlet wich is suppose to feed the flow in the second part of my channel.
the outlet is a convective outlet (from Takuya).
My mesh is correct everywhere (wall) (checkMesh OK) with a size of 2e6 nodes

I changed oodles.C to keep the massflow average in the directMapped area (between inlet and inlet + offset)
the problem is that my subgrid kinetic energy is growing slowly and after 10 000 iterations it becomes more and more significant.

with paraFoam I see that the highest point is at the outlet (or at the end of the channel). I feel strange because convective outlet is supposed to "convect" high value outside of my channel.

I use Gauss linear Scheme for gradient and for div. terms. Except for div(phi,k), div(phi,B) and div(phi,nuTilda) where I use Gauss limitedLinear 1;

I hope some one will have an idee to bypass my problem or will tell me if I did something wrong ...
For example, did someone play with convective outlet in LES



All times are GMT -4. The time now is 22:29.