CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Calculation of Pressure Loss (

jason October 25, 2007 11:43

Hi, I would like to use OF for
Hi, I would like to use OF for estimating the pressure losses in a piping arrangement. The problem consists of an inlet and an outlet and some pipes, bends, reductions and enlargements inbetween. The inlet has a known flowrate and the outlet has a known pressure. I would like to estimate what the inlet pressure would be so that a suitable pump can be chosen for the system.

I appreciate this is a straightforward problem and that I can to some extent calculate this by hand. I have tried to do this in OF using a decent mesh of a 300mm dia pipe, a fixed velocity inlet (eg 3m/s) and a pressure outlet (eg 2.5bar) and no-slip walls. I have two problems:

1/ Using simpleFoam set to laminar or turbulent, everything converges fine. The velocity predictions are as expected however the pressure losses are miniscule (eg 0.001 bar) which I cannot believe. I have a nice believable velocity profile in the pipe sections and separation where expected.

2/ If I set the initial (0) internal field to anything other than the same as the outlet pressure (2.5bar) the solution diverges. I've tried the nonorthogonal correction but it doesn't help.

Not wanting to blow my own trumpet but I have worked in CFD for 15 years so hopefully I havent made too many mistakes in the problem setup. I would also be confident of obtaining a decent solution using this mesh in say Star or Fluent.

Hope you can enlighten.


jason October 25, 2007 12:41

Ok, I got it, simpleFoam uses
Ok, I got it, simpleFoam uses normalised pressure, found the answer here

Now I know what to do,

Many thanks


hjasak October 25, 2007 16:45

This is resolved, right? Hr
This is resolved, right?


gabriel October 25, 2007 17:40

Hi Jason, i have a similar
Hi Jason,

i have a similar test case. Do you have a method to calculate a mean pressure over a surface/cut. In paraview i can plot the pressure in the cut and estimate the averaged pressure over the cut, but do you have an idea how to get an exact value.

Bests Gabriel

jason October 26, 2007 05:39

Hi, Issue is resolved, than

Issue is resolved, thanks.

Gabriel, the calcPressureForces routine found at the link above outputs the Surface area, mean pressure and total forces on each patch you specify.

Not sure how you can do this in paraview, you can do it in Fieldview using the integrate over a surface option.



jlpelerin February 14, 2008 11:32

Hi OpenFOAMers, I made some
Hi OpenFOAMers,

I made some pressure loss computations inside a straight pipe using simpleFoam at different Reynolds.
Compared to Moody diagram, results are quite disappointing as they give errors up to 30%.
I have tried several schemes, k-epsilon and k-omega, several convergence criteria and several meshes (Y+ around 2).
Note : I use the development version of OpenFOAM.

Has anybody got good results on such cases?
Does anybody have an idea on where I could be wrong?

Thank you,

Jean-Luc Pelerin

ngj February 15, 2008 05:17

Hi Jean-Luc The 30% is not
Hi Jean-Luc

The 30% is not surprising, if it comes from the k-epsilon model. It has been reported in [1] for channel flows that the k-epsilon model deviates up to 30% from the Moody diagrams at k+=1200 / k/H = 0.02, H being channel height and k Nikuradses roughness height.

Though, if you get the the order of magnitude error using the k-omega model I would get surprised. [1] reportes error in the order of magnitude 1-3% and I have made some tests myself and get the same order of magnitude for a channel flow. Both [1] and I have been using the Wilcox 1993 model.

By the way, are you using a rough or smooth boundary? All the above mentioned are for completely rough boundaries.

Best regards,


[1] V. C. Patel and J. Y. Yoon, Application of Turbulence Models to Seperated Flow Over Rough Surfaces, Journal of Fluid Engineering, June 1995

jlpelerin February 15, 2008 09:05

Hi Niels, Thank you for you
Hi Niels,

Thank you for your enlightenments. I will have a look at this paper asap.

I cannot find the Wilcox implementation in OpenFOAM. Can you tell me where it is?

I am working on smooth walls. I want to validate OF before going on with rough walls. (By the way, is there a repository for OF test cases/benchmarks ?)

I have enclosed one of my problem set up: Smooth-ko-Long-Re2e4-steady.tar.gz
Could someone have a look?

And this is the evolution of the friction factor obtained with simpleFoam:
- Reynolds is Re = 2e4
- Moody gives 0.026
- OF gives 0.031
- the pseudo time step is 0.005

Thank you very much,

Best regards,


ngj February 15, 2008 10:22

Hi It should be said that

It should be said that I have never worked with smooth surfaces (main interest: sediment transport, but I have found the following by looking in Wilcox (2006) p383-386 and I'll give a small summary on the k-omega part:

For smooth wall boundary layers with k-omega, the main issue is how to treat the boundary condition for omega. He states that a good solution can be obtained for such things as pipe flows, etc, if the analytic solution to omega is applied in the 10 grid points closed to the boundary under the constraint that they are all below y+ < 2.5!
This is not an acceptable solution and becomes problematic for complex geometry and unstructured meshed.
The solution to this is to apply the rough boundary layer condition under the restriction that ks+ < 5. I have not worked with the k-omega model in OF, thus I do not know if such a boundary condition exists.
The limit ks+ < 5 is due to the fact that the viscous sublayer in terms of wall coordinates is 11.7, thus the roughness elements are covered by the vicous sublayer and the wall is therefore considered hydraulicly smooth from a physical point on view.
The Wilcox (1993) model is as far as I know not implemented in OF, but as k-omega SST is closed related (and improved) with a limitation and the eddy viscosity in the far field among other thing, I would not recommend you to use time om implementing it ... simply use SST.

Best regards,


ngj February 18, 2008 09:18

BTW, if you do not have Wilcox
BTW, if you do not have Wilcox (2006) the BC on omega is

omega = 40000 nu_wall / ks^2

where nu_wall is the kinematic viscosity of the fluid and ks is the DIMENSIONED roughness height. Make sure that ks+ < 5 and further that the location of the first grid point above the surface is less than 1 in wall coordinates.

Jean-Luc: Please tell if you get an improved prediction of the pressure loss.

Best regards,


jlpelerin February 18, 2008 09:55

Hi Niels, Thanks a lot for
Hi Niels,

Thanks a lot for your help. I don't have Wilcox (2006), but I have a paper on roughness and SST (Extension of the k-w SST turbulence model for flows over rough surfaces - Antti Hellsen and Seppo Laine). I will try to implement it asap. I have also started to implement formula found in Fluent manual... It seems promising but results are not yet good enough for me to present them. Anyway, if I manage to have good results on smooth and rough pipes, I will let you know!

Best regards,


jlpelerin February 18, 2008 09:59

Sorry the authors are "Antti H
Sorry the authors are "Antti Hellsten and Seppo Laine"

jlpelerin February 22, 2008 04:44

Hi Niels, I have much bette
Hi Niels,

I have much better results on smooth pipes with k-omega SST (less than 5%). (It was just a newbie error : y+ really has to be between 30 and 300, as close as possible from 30)

I have started to implement the log law used in Fluent for rough walls and first results are not too bad in some cases... But I still have to work.


ngj February 22, 2008 06:16

Hi Jean-Luc Well, that's ho
Hi Jean-Luc

Well, that's how it goes, but it is good to hear that the results are as expected. Did you implement the omega condition?

I have read the Hellsten article, and it is short. Thus it does not cover the boundary condition for k using SST. There are three regimes regarding roughness, namely 'hydraulically smooth', 'rough-transitional' and 'completely rough'. For the smooth case the viscous sublayer is present and therefor k=0 for y=0. In the completely rough case, the viscous sublayer is not present. In the near wall area vortices are shed from behind the roughness elements ([1], page 32), thus the turbulence does not go to zero. Experiments have shown that dk/dn is a better approximation. For a discussion of the boundaries see [2]. Regarding the transitional regime your engineering hunch is what you have to rely on
The effect of having dk/dn instead is that k does not go to zero, Thus nu_t becomes different from zero which gives larger bed shear stress since tau/rho = (nu+nu_t)du/dy.

I am not familiar with the log law from Fluent, but you might want to consider the boundary evaluation of tau discussed in [2], as they have been able to use coarser grids using a van Driest profile to evaluate tau.

/ Niels

[1]: (Free notes of turbulence in smooth and rough regimes in both current and waves)

[2]: Numerical and experimental investigation of flow and scour around a circular pile, A. Roulund, B. M. Sumer, J. Fredsoe and J. Michelsen, Journal of Fluid Mechanics, 2005

jlpelerin February 28, 2008 06:26

Hi OpenFoamers, I am still
Hi OpenFoamers,

I am still working on pressure losses in rough pipes and I think I am on the right way for the modified rough k-omega SST (Compared to Moody, results are within 4% except for region 4 < Ks+ < 15 where error is about 10%. And I still have to validate for Re greater than 1e7).

But I still have a problem. I have two solutions to get the pressure gradient:
i. I compute a long pipe (enough long for boundary layer to stabilize)
ii. I use a RANS based modified version of channelOodles.
I would like to have a third solution with a cyclic velocity boundary condition between inlet and outlet and just a fixed pressure at outlet and of course an fixed mass flow. Is it possible to have such different boundary conditions for different fields??? I know it is possible in CFX using subdomains... Is there an equivalent in OpenFoam?

Thank you,


ngj March 4, 2008 11:48

Hi Jean-Luc First of all, I
Hi Jean-Luc

First of all, I would go for (ii). I seems to be the cheapest of the two.
I do not know how channelOodles is working, but the straight forward way would be to add an internal body force and then have cyclic boundaries on both p and U. Then adjust the body force until you have the desired mass flux. This body force will be identically balanced by your wall shear stress. The pressure gradient would in this be zero.
Is that in some way want you are suggesting for your third option?

Best regards, Niels

jlpelerin March 4, 2008 12:47

Hi Niels, You are right, ch
Hi Niels,

You are right, channelOodles adds a body force (a constant pressure gradient) to the momentum equation and tries to converge in terms of mass flow. I also thought it would be the fastest method. And it does in some cases. But with more complex geometries and higher Reynolds it becomes incredibly slow.

I may have found an alternative method today : I use directMappedPatch to couple inlet and oulet velocities. It also allows to specify a mean velocity. And the pressure is set up just as it would be in a simple pipe (this will probably have to be changed). It is still work in progress.

BTW : I also started to have a look at low reynolds turbulence models. Mainly because I have difficulties to live with coarse meshes at the wall :-)... I may give up k-omega and focus on these for roughness...

Best regards,


ngj March 5, 2008 08:12

Hi Jean-Luc I have had simi
Hi Jean-Luc

I have had similar problems with convergence, and I found that when using the correct tuning, something called PID-control actually yielded good results. It is a routine, which considers both the actual residual in the flux, the time derivative in the calculated flux and in integral of the flux over time. Using these informations, a correction to the pressure gradient is found.
There are 4 tuning parameters, and if they are set correctly, then you get a reasonably fast convergence to the correct pressure gradient.

Good luck


bboonacker May 22, 2008 05:31

Hello All, I'm new here, ju
Hello All,

I'm new here, just started working with OF. So forgive me if I ask some newbie questions, just let me know if it becomes to stupid

I am also trying to calculate the pressure losses in a trapezium shaped duct, and I get reasonably good results (-10%) for a "long" (7m) "small" (0.2m x 0.1m) smooth duct. Still searching for the difference (10% vs 5%).
My other problem is that I need to simulate ducts with a max length of 0.2m and I want to couple the inlet and outlets as well. So I have some questions,

Jean-Luc, do you have the directMappedPatch option working with good results?? At which dimensions?
Are you still using simpleFOAM with kOmegaSST?

Niels, what kind of lengths do you use ? And you are using simpleFOAM with a re-written Wilcox kOmega model to implement the boundary/roughness conditions?

Best regards,


ngj May 22, 2008 06:02

Hi Bart I am sorry to say,
Hi Bart

I am sorry to say, that I am not using any of the RANS-models in OpenFOAM. My knowledge is based on a study I did for my master thesis where I used an in-house numerical code and needed to decide upon either k-omega or k-epsilon.

Best regards,


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