CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   pressure distribution in water flow, differences in icoFoam and COMSOL (

deniggo September 23, 2010 09:09

pressure distribution in water flow, differences in icoFoam and COMSOL
3 Attachment(s)

I simulate flow in an open stream over repeating streambed geometries (sinusoidal geometry of ripples).

I used COMSOL some weeks ago and tried to do the same job in OpenFOAM. Now, I'm a bit confused about the different results, even I use similar (boundary) conditions.

The general model setup:
Water is entering the domain in an parabolic velocity profile at the left boundary and leaves it at the right. Top bc is symmetryPlane and bottom is no-slip bc. In OF I use icoFoam, COMSOL is also laminar flow.

The results:
The velocity fields are looking quite similar, whereas pressure (p) distributions show differences:
In flow experiments and literature the highest pressure occurs at the stoss side of the ripple (plane against flow direction), and low pressure on the lee side (plane in flow direction).
COMSOL shows exactly this behavior, but OF does not.
In OF, lowest pressure values are exactly at the crest of the ripple. Highest values are in the "valleys".
Also the pressure magnitude differs: In COMSOL it accounts for 200 Pa, in OF it is only 2e-3 Pa and pressure
is negative (!?) at left inlet.
The relative pressure distribution does not depend on velocity.

Maybe (and hopefully) the differences are related to calculations concerning Bernoullis eq: p = p_dynamic + p_hydrostatic ?
Btw: sigmayy = wallGradU(y) * nu (=1e-6) shows a distribution similar to COMSOL and as expected, but with a magnitude of 5e-3 Pa.

Please look at my attached files:
The first one shows the velocity and pressure distribution in COMSOL, red is high, blue is low value. The other two pictures show U and p in OF, blue is low, green is high value.

Can somebody explain these differences?



ngj September 23, 2010 09:51

Hi Nico

icoFoam has the switch momentumPrediction. Is this turned on? It seems like seperation is not occuring in one of the cases hence the shift in pressure distribution.

/ Niels

deniggo September 23, 2010 09:58

hi Niels,

never heard of this, where can I switch it "on"?



ngj September 23, 2010 10:03

Take a look in the fvSolution file in the system folder.

/ Niels

deniggo September 23, 2010 10:10

Thats my fvsolution file:


    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      fvSolution;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
        solver          PCG;
        preconditioner  DIC;
        tolerance      1e-06;
        relTol          0;

        solver          PBiCG;
        preconditioner  DILU;
        tolerance      1e-05;
        relTol          0;

    nCorrectors    2;
    nNonOrthogonalCorrectors 0;
    //pRefCell        0;
    //pRefValue      0;

maybe pRefCell or pRefValue is the switch?

ngj September 23, 2010 10:16

Sorry, the switch has been removed from 1.6, so it is probably not in 1.7 either.

Could you post more detailed vector plots of the velocity field on the lee side from both models?

- Niels

deniggo September 23, 2010 11:14

2 Attachment(s)
I hope this is ok. For more comsol-details I have to switch to windows...

Thanks for your help, Niels.


ngj September 23, 2010 11:30

Hi Nico

Based on the pictures the ripples in COMSOL and OF are not identical, having a trough-to-crest over length ratio of 0.88 and 0.67 respectively, hence you are comparing apples and pears. This also explains the difference in pressure distribution.

/ Niels

deniggo September 23, 2010 14:03

Hi Niels,

yes that's true, but geometry of the ripples does not influence the location of the highest pressure on the stoss side. I changed geometry often, and tried it also with more "realistic" round ripples.

It seems like the p-field in OF is rather a pure hydostatic pressure than the addition of dynamic and hydrostatic pressure.

I'm also wondering about the sigmayy values, that show at least the right distribution, apart from a reliable magnitute (approx. 50 - 100 Pa).


alberto September 24, 2010 02:20

To solve the momentum predictor add

momentumPredictor on;

to the PISO subdictionary in fvSolution. The switch is still in the code, just not in the tutorial.

alberto September 24, 2010 02:27

Sorry... icoFoam, and I was thinking to pisoFoam. Please, ignore my previous post :)

icoFoam always solves the momentum predictor in 1.7.x

deniggo September 26, 2010 07:38

Maybe the unconsidered gravitiy force in icoFoam could be a reason for my different results?

ngj September 27, 2010 05:35


Have you tried switching off gravity in COMSOL then? If you are comparing total pressure with excess pressure, then there most be significant differences.

/ Niels

deniggo September 28, 2010 11:20


in most of the cases, including posted pic above, gravity was switched off in COMSOL.
But in general, for me it's not completely clear, when and then why gravity force should be considered in CFD (Sorry for this beginners question).


deniggo September 30, 2010 03:48

3 Attachment(s)
Hello again,

I played a bit with the pressure data of my results. By calculating p = p_dynamic + p_hydrostatic I obtain pressure data as I expect it.

In the first picture the pressure output p calculated by OF is shown: Lowest pressure at the highest point and highest pressure at the lowest point.
In graph1 the dark blue line indicates the pressure distribution (p) of the bottom plane and shows same distribution as the picture. The green line is the linear interpolation between maxima and minima of the pressure data. This should describe p_hydrostatic.

In the next step I subtract p_hydrostatic from p (blue minus green line). The result is shown in graph2 by the light blue line. In respect to p = p_dynamic + p_hydrostatic this indicates p_dynamic.
But on the lee side dynamic pressure should be negative, due to the downstream velocity. Considering this, the highest pressure is located on the stoss side, while the lowest is on the lee side (red dashed line).

With this result the values and the distribution of p_dynamic are in the magnitude of the COMSOL model and the literature. A more or less sinusoidal pressure distribution occurs.

So far so good. For my further simulations mainly the dynamic pressure is of importance.
My question: How can I modify icoFoam / pisoFoam to obtain only dynamic pressure?

Any comment on my post is welcome.

Thank you.


All times are GMT -4. The time now is 19:06.