CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Pressure in OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Like Tree61Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 24, 2020, 11:28
Default
  #21
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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
Tobi is offline   Reply With Quote

Old   April 24, 2020, 11:43
Default
  #22
Member
 
Gui Miotto
Join Date: Feb 2020
Posts: 30
Rep Power: 6
miotto is on a distinguished road
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?
miotto is offline   Reply With Quote

Old   October 29, 2020, 01:41
Default pressure bondary condition in sprayFoam
  #23
Member
 
Riddhideep Biswas
Join Date: May 2020
Posts: 30
Rep Power: 6
Rid@foam is on a distinguished road
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.
Rid@foam is offline   Reply With Quote

Old   October 29, 2020, 09:44
Default
  #24
Senior Member
 
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 15
Santiago is on a distinguished road
Quote:
Originally Posted by miotto View Post
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.
Santiago is offline   Reply With Quote

Old   October 31, 2020, 16:14
Default
  #25
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 696
Rep Power: 14
Tobermory will become famous soon enough
Quote:
Originally Posted by miotto View Post
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.
Tobermory is offline   Reply With Quote

Old   April 5, 2021, 09:26
Default Pressure Driven flow with icoFoam (DNS)
  #26
New Member
 
Nidal
Join Date: Nov 2018
Posts: 17
Rep Power: 7
Nidalsb is on a distinguished road
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

Quote:
Originally Posted by Tobi View Post
Hi all,

I just want to include a bit more of information here. First of all I agree with the statements given by Santiago especially for turbulent flows (back flow - how are the eddies coming back etc. - by the way does FOAM provide an Orlansky BC? - I don't make LES / DNS simulations and I am not so familiar).
In addition everything that is mentioned about the pressure is correct. If you derive the Navier-Stokes-Equation for incompressible fluids, you will find that the pressure p does not have any physical meaning. Only the gradient of p has a meaning. As it was already said, it is the driving force for your flow. Therefore, if you set a fixed value of pressure at the outlet to 0 or 1e5 does not influence your system because only the gradient is of physical meaning.

Case 1 p = 0 at outlet
  • In that case you specify p at the outlet with an value of 0. Setting an inflow using U, you might see negative pressure values at the inlet or in the whole domain.
Case 2 p = 1e5 at outlet
  • In that case you will not see negative pressure values but actually if you would make the gradient of p_outlet - p_Inlet, it would be the same values as in Case 1
Case 3 pressure driven flows
  • The reason to specify totalPressure with (pressureInletVelocity) and fixedValue at the inlet and outlet is obvious.
  • If one would specify fixedValue at the inlet and outlet, you will have a pressure gradient which will never vanish. If you go on in time, the gradient will accelerate your flow till infty.
  • The totalPressure reduces the pressure at each face based on the flux that is coming in. E.g. the pressure at the inlet face is equal to the pressure you set minus the kinematic pressure.
  • You can see that the increase of velocity will decrease the values of the pressure at the inlet and thus the total pressure gradient and therefore the acceleration of the flud.
  • At the end you will have an established flow that is in equilibrium.
  • By the way you simply can make that test with a normal pipe flow.


Pressure values

As already mentioned you can set p to any value because only the gradients matter here (still talking about incompressible cases). Therefore, if you would like to know the absolute pressure value, you can do it as follow:

  • You know that the pressure at the outlet is 1.5e5 Pa (atmospheric + 0.5 bar)
  • Incompressible means divide by density
  • Then set this values of 1.5e5 Pa / density at the outlet
  • After the calculation you have to multiply the pressure by the density again (to get the values in Pascal)
  • Then you would have the absolute pressure values
I hope I did not make any mistake here but it should be fine. As you can see, the dividing and multiplying step could be removed but this is the logical way. Again, as Santiago already stated, the pressure here has no physical meaning. The solver would also run if you set p at the outlet to a value of -141235.

By the way Philippo was talking about that here too: Outflow boundary condition for LES/DNS
Attached Images
File Type: jpg Capture.jpg (72.5 KB, 51 views)

Last edited by Nidalsb; April 5, 2021 at 17:54.
Nidalsb is offline   Reply With Quote

Old   March 18, 2024, 04:49
Default
  #27
Member
 
Pedro Gouveia
Join Date: Oct 2022
Location: Portugal
Posts: 64
Rep Power: 3
unilord is on a distinguished road
Quote:
Originally Posted by Nidalsb View Post
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.
unilord is offline   Reply With Quote

Old   March 18, 2024, 20:25
Default
  #28
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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
Tobi is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Map of the OpenFOAM Forum - Understanding where to post your questions! wyldckat OpenFOAM 10 September 2, 2021 05:29
question regarding LES of pipe flow - pimpleFoam Dan1788 OpenFOAM Running, Solving & CFD 37 December 26, 2017 14:42
interFoam (HELYX-OS) pressure boundary conditions SFr OpenFOAM Running, Solving & CFD 8 June 23, 2016 16:36
CFX Solver stopped with error when requested for backup during solver running Mfaizan CFX 40 May 13, 2016 06:50
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 cfd.direct OpenFOAM Announcements from Other Sources 2 August 31, 2015 13:36


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