# Pressure in OpenFOAM

 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 24, 2020, 11:28 #21 Super Moderator     Tobias Holzmann Join Date: Oct 2010 Location: Tussenhausen Posts: 2,708 Blog Entries: 6 Rep Power: 51 Thanks for getting back to me. To answer this question in general: Just go into one tutorial of the solver you want to use Check the units of the pressure field in 0/p or 0/p_rgh However, for interFoam we see the units of the field p_rgh to be equal to [1 -1 -2 0 0 0 0] which is Pa. Nevertheless, the values do not matter here. One can set a fixed value of 0 Pa somewhere or -1000 Pa (which is not physically possible). It is always a matter of interest if we need real pressure or only gradients. For the compressible solvers we solve a gas equation that requires the real pressure values; that is the most important reason behind that. So I agree, for interFoam we do have the pressure units to be Pa but the values donīt matter - similar to the single-phase incompressible solvers. We all know that we could include the density in all incompressible solvers of OpenFOAM but this would just be a multiplication with a constant during the calculation which would just be wasted computational power. Tobi __________________ Keep foaming, Tobias Holzmann

 April 24, 2020, 11:43 #22 Member   Gui Miotto Join Date: Feb 2020 Posts: 30 Rep Power: 6 Right. But one has just be careful to interpret you when you say that the values don't matter. For instance, it is true that for incompressible solvers (all of them) summing a constant to all pressure values won't make a difference. Nevertheless, multiplying all pressures by a constant (like dividing by some density) will alter the solution. Because it affects the gradients. Correct?

 October 29, 2020, 01:41 pressure bondary condition in sprayFoam #23 Member   Riddhideep Biswas Join Date: May 2020 Posts: 30 Rep Power: 5 Hello everyone. I am simulating a case in sprayFoam where I want to keep the atmospheric pressure boundary condition at my outlet. Which pressure value should I give? 0 Pa(i.e. the gauge pressure) or 1e5(i.e. the absolute pressure) ? It will be very helpful if any one guides me through this as I am new to sprayFoam and do not understanding this solver well.

October 29, 2020, 09:44
#24
Senior Member

Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 15
Quote:
 Originally Posted by miotto Nevertheless, multiplying all pressures by a constant (like dividing by some density) will alter the solution. Because it affects the gradients. Correct?
Why you say it affects the gradients? The gradient operator is Reynolds Operator: you can factor out the constant.

October 31, 2020, 16:14
#25
Senior Member

Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Quote:
 Originally Posted by miotto Nevertheless, multiplying all pressures by a constant (like dividing by some density) will alter the solution. Because it affects the gradients.
Perhaps you have misunderstood - what Tobi is saying is that in the incompressible solvers, where the equation of state is not a function of pressure, then the background pressure level does not matter, since the momentum equation only sees pressure gradients.

You are correct that a factor on the pressure gradient will change the solution. However, that's not the case for the incompressible solvers - for these, where density is constant, it is possible to divide through ALL of the terms in the momentum equation by density .. having done that you are left with kinematic terms throughout ... INCLUDING pressure which now has units of m2/s2. The incompressible solvers are therefore written in terms of the kinematic variables (eg nut not mut, p/rho not p etc.), and where code is shared with the compressible solvers rho=1.

April 5, 2021, 09:26
Pressure Driven flow with icoFoam (DNS)
#26
New Member

Nidal
Join Date: Nov 2018
Posts: 17
Rep Power: 7
Hi Tobi,

Thanks for this post. I have been trying to run a case similar to what you have described here but I always find my pressure diverging as my Pressure and velocity converge (As seen in the image attached).

As for my code it is as follows:

U
Code:
```/*--------------------------------*- C++ -*----------------------------------*\
=========                 |
\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
\\    /   O peration     | Website:  https://openfoam.org
\\  /    A nd           | Version:  7
\\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
version     2.0;
format      ascii;
class       volVectorField;
object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
ymin
{
type            cyclic;
}

ymax
{
type            cyclic;
}

xmin
{
type            pressureInletVelocity;
value           uniform (0 0 0);
}

xmax
{
}

zmin
{
type            cyclic;
}

zmax
{
type            cyclic;
}

ASCII
{
type            noSlip;
}

}

// ************************************************************************* //```
P
Code:
```/*--------------------------------*- C++ -*----------------------------------*\
=========                 |
\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
\\    /   O peration     | Website:  https://openfoam.org
\\  /    A nd           | Version:  7
\\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
version     2.0;
format      ascii;
class       volScalarField;
object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
ymin
{
type            cyclic;
}

ymax
{
type            cyclic;
}

xmin
{
type            totalPressure;
p0		uniform 2;
value		uniform 2;
}

xmax
{
type            totalPressure;
p0		uniform 0;
value		uniform 0;
}

zmin
{
type            cyclic;
}

zmax
{
type            cyclic;
}

ASCII
{
}

}

// ************************************************************************* //```
Im not sure where I went wrong here if you can spot a mistake that would be really helpful

Quote:
Attached Images
 Capture.jpg (72.5 KB, 50 views)

Last edited by Nidalsb; April 5, 2021 at 17:54.

March 18, 2024, 04:49
#27
Member

Pedro Gouveia
Join Date: Oct 2022
Location: Portugal
Posts: 59
Rep Power: 3
Quote:
 Originally Posted by Nidalsb Hi Tobi, Thanks for this post. I have been trying to run a case similar to what you have described here but I always find my pressure diverging as my Pressure and velocity converge (As seen in the image attached). As for my code it is as follows: U Code: ```/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 7 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { ymin { type cyclic; } ymax { type cyclic; } xmin { type pressureInletVelocity; value uniform (0 0 0); } xmax { type zeroGradient; } zmin { type cyclic; } zmax { type cyclic; } ASCII { type noSlip; } } // ************************************************************************* //``` P Code: ```/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 7 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField uniform 0; boundaryField { ymin { type cyclic; } ymax { type cyclic; } xmin { type totalPressure; p0 uniform 2; value uniform 2; } xmax { type totalPressure; p0 uniform 0; value uniform 0; } zmin { type cyclic; } zmax { type cyclic; } ASCII { type zeroGradient; } } // ************************************************************************* //``` Im not sure where I went wrong here if you can spot a mistake that would be really helpful
Hey,

Probably too late for you. But for anyone that comes read this thread. I believe you should not impose totalPressure BC at inlet and outlet. As already mentioned before, the best would be to implement a totalPressure boundary condition at the inlet, and a fixedValue or pressure BC at the outlet.

 March 18, 2024, 20:25 #28 Super Moderator     Tobias Holzmann Join Date: Oct 2010 Location: Tussenhausen Posts: 2,708 Blog Entries: 6 Rep Power: 51 Actually, it does not matter. The total pressure acts as fixed value for outflow and as total pressure fir inflow. Thus, for most cases it should not matter to use twice total pressure or total pressure at the inlet and fixed at the outlet. However, I would also prefer Totalpressure and fixedValue for readability and clearness. unilord likes this. __________________ Keep foaming, Tobias Holzmann