CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Correct boundary conditions for p_rgh (special for vertical patches)

Register Blogs Community New Posts Updated Threads Search

Like Tree22Likes
  • 11 Post By Tobi
  • 3 Post By clapointe
  • 3 Post By clapointe
  • 1 Post By kcjarvis56
  • 1 Post By kcjarvis56
  • 2 Post By Tobi
  • 1 Post By Tobi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 20, 2018, 15:41
Default Correct boundary conditions for p_rgh (special for vertical patches)
  #1
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
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
Hi all,

as I made already a lot of tests regarding the correct boundary condition for the p_rgh field that is used in density based solvers, I want to know your experience and set-up of common problems. Let us consider the following example, cf. figure below (10 s). The conditions are as follows:
  • 2D case
  • Two inlets (left)
  • Two outlets (right)
  • gravity is acting against the y-axis
  • All other walls are considered to be walls
  • Size is 10 m long and 2 m high
  • Initial temperature 300 K
  • Inlet velocity 0.1 m/s
  • Top inlet 305 K
  • Bottom Inlet 300 K
The generated picture (below) has the gravity deactivated. Thus, no buoyancy force acts in the case. I want to discuss the boundary conditions for the outlets mainly for the p_rgh field. Without gravity, the simulation runs fine with a prghPressure boundary type which is calculating the face values based on:


p_{rgh} = p - \rho g (h- h_{ref})


The boundary condition includes the height difference and density (temperature depended). The field h_{ref} is a default field with the value of 0. However, changing the field can be done by adding the hRef file into the constant/ folder.

Code:
    Info<< "\nReading hRef" << endl;                                            
    uniformDimensionedScalarField hRef                                          
    (                                                                           
        IOobject                                                                
        (                                                                       
            "hRef",                                                             
            runTime.constant(),                                                 
            mesh,                                                               
            IOobject::READ_IF_PRESENT,                                          
            IOobject::NO_WRITE                                                  
        ),                                                                      
        dimensionedScalar("hRef", dimLength, 0)                                 
    );
The velocity boundary condition at the outlet is inletOutlet. However, the zeroGradientcondition can be used too; it is identical in this case.









The problem starts after activating the gravity because the p_rgh field is not identical to p anymore (before g was zero, thus the second term on the RHS of the equation was zero too). What happens:


  • High backflow at the upper outlet to the upper inlet
    This should be related to the p_rgh field. However, it is not physical here. The acceleration of the fluid will change the solution of the simulation completely.
What can be the problem?
  • isbehavior can be related to the 2D case (I am aware of pressure problems in 2D); however, I have to check it.
  • The initial p_rgh field is uniform which should be non-uniform based on the height - are there some tools in OpenFOAM for setting up the p_rgh field? Such as setFields including mathematical functions?
  • The boundary conditions are somehow not reliable
  • Maybe I should define two separate BC for the upper and lower outlet






As far as I know, there are a lot of people out doing heat transfer and similar problems, this problem should be a common one. Therefore, I am interested in your set-up.
If someone wants to test the case, you can download it here: https://Holzmann-cfd.de/forums/buoyancyCase.tar.gz


Applying two different boundary conditions for the outlet seems to work better. E.g., upper outlet fixedFluxPressure and lower outlet fixedValue. However, this should not be physical based on the missing information regarding \rho g \Delta h.



Thanks for taking your time.
__________________
Keep foaming,
Tobias Holzmann

Last edited by Tobi; October 20, 2018 at 19:30. Reason: Missing brackets inside the equation
Tobi is offline   Reply With Quote

Old   October 21, 2018, 19:24
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
I've faced similar boundary condition problems before, related to simulation of buoyant jets in 2 and 3d. Although these problems are not as confined as the one you describe, getting fluid to exit the domain as it should is still a matter of concern. Through many iterations of various conditions and openfoam versions, we've found a few things. Using the pressureInletOutletVelocity condition instead of the regular inletOutlet condition for velocity usually helps. That said, I tried it and still saw the backflow problem. Another nice tool is using a hydrostatic total pressure boundary condition for p_rgh. These boundary condition choices are most closely tied to the latest additions to fireFoam -- especially the hydrostatic total pressure. A hydrostatic background is precomputed and used in conjunction with the p_rgh bc to set the total pressure at the outlet. So, I converted your case to a fireFoam case and ran it successfully removing the backflow at the outlet. The case is attached. There are a few minor changes from your case : thermo is now hePsiThermo, the working fluid is (inert) N2. A link to the case is here : https://www.dropbox.com/s/0kg8tqj2b0..._C.tar.gz?dl=0. Let me know if it doesn't work. Thoughts?

Caelan
jherb, Tobi and Mahmoud Abbaszadeh like this.
clapointe is offline   Reply With Quote

Old   November 6, 2018, 05:07
Default
  #3
New Member
 
Salar Tavakkol
Join Date: Jun 2018
Posts: 1
Rep Power: 0
salart is on a distinguished road
Hi Tobias and Caelan


I have the same problem regarding unphysical gas velocity at outlet patch specially occurring when the gravity is along (parallel to) the patch and not perpendicular). here are some of the conditions:

  • model is 3D and I use coalChemistryFoam as the solver (transient solver with compressible gas via PIMPLE)
  • the cross-section of the tube is inlet patch and along the z-direction the same for outlet patch (pictures are from outlet patch). diameter is 0.08 m and length is 1 m
  • gravity is acting against the y-axis
  • gas velocity at the inlet is fixedValue 0.005 m/s

I have tried to minimize the effect by trying different outlet pressure and velocity boundary conditions (B.C.s).

best one (the image is taken from) has pressureInletOutletVelocity for outlet velocity and outletInlet for outlet pressure B.C. but the effect is still there and visible. At least the simulation is stable and runs without divergence.



The same problem in DPM/MPPIC solvers (incompressible) with the same geometry exists but there the options for choosing the B.C. are limited so I could not manage to have a stable simulation at all (it starts diverging from the very beginning and crashes eventually), until I turn off the gravity for the gas phase.
Attached Images
File Type: jpg B.C.problem.JPG (27.2 KB, 486 views)
File Type: jpg B.C.problem2.JPG (25.8 KB, 371 views)
salart is offline   Reply With Quote

Old   November 6, 2018, 11:36
Default
  #4
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
Fair warning -- I've never used those solvers. However, your outlet boundary conditions are immediately suspect. pressureInletOutletVelocity is generally fine for velocity. For pressure, you'll probably get better results with something else. I've previously mentioned success with prghTotalHydrostaticPressure. Additionally, I've recently had success with a waveTransmissive condition for pressure at the outlet (horzontal and vertcial patches).

Caelan
Tobi, rajibroy and WaterHammer1985 like this.
clapointe is offline   Reply With Quote

Old   October 3, 2019, 11:58
Default p and p_rgh for high pressure, high temperature cases with flow and heat transfer
  #5
New Member
 
Join Date: Sep 2019
Posts: 5
Rep Power: 7
ASurendran is on a distinguished road
Hi,


I know this is an old thread. But, could anyone suggest me the possible boundary conditions for p and p_rgh that one can use when there is flow and heat transfer in a high pressure (~10bar) environment?



I am currently trying to simulate the heat transfer in a cold circular cylinder (~300K) in a very hot flow (~1500K). I am using buoyantSimpleFoam as I am only looking at a steady case. But my simulation crashes with the following error (please see below).


Code:
Time = 5

DILUPBiCGStab:  Solving for h, Initial residual = 0.999811, Final residual = 0.00895307, No Iterations 94
#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::GAMGSolver::scale(Foam::Field<double>&, Foam::Field<double>&, Foam::lduMatrix const&, Foam::FieldField<Foam::Field, double> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, Foam::Field<double> const&, unsigned char) const at ??:?
#4  Foam::GAMGSolver::Vcycle(Foam::PtrList<Foam::lduMatrix::smoother> const&, Foam::Field<double>&, Foam::Field<double> const&, Foam::Field<double>&, Foam::Field<double>&, Foam::Field<double>&, Foam::Field<double>&, Foam::Field<double>&, Foam::PtrList<Foam::Field<double> >&, Foam::PtrList<Foam::Field<double> >&, unsigned char) const at ??:?
#5  Foam::GAMGSolver::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const at ??:?
#6  Foam::fvMatrix<double>::solveSegregated(Foam::dictionary const&) at ??:?
#7  Foam::fvMatrix<double>::solve(Foam::dictionary const&) in "/opt/openfoam6/platforms/linux64GccDPInt32Opt/bin/buoyantSimpleFoam"
#8  Foam::fvMatrix<double>::solve() in "/opt/openfoam6/platforms/linux64GccDPInt32Opt/bin/buoyantSimpleFoam"
#9  ? in "/opt/openfoam6/platforms/linux64GccDPInt32Opt/bin/buoyantSimpleFoam"
#10  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#11  ? in "/opt/openfoam6/platforms/linux64GccDPInt32Opt/bin/buoyantSimpleFoam"
Floating point exception (core dumped)

I am very new to OpenFOAM and any suggestions are deeply appreciated. If anyone is interested, I can post my codes here.


Thanks
ASurendran is offline   Reply With Quote

Old   October 6, 2019, 09:40
Default
  #6
Member
 
Kirk Jarvis
Join Date: Mar 2009
Posts: 31
Rep Power: 17
kcjarvis56 is on a distinguished road
I ran Tobias' case and reduced the size (in half) of the outlets with gravity on and fixedValue for p_rgh work fine along with calculated for p and pressureInletOutletVelocity for U. Tobias' case with gravity on the volume leaving the lower outlet is so high that the inlet flow was not high enough to keep the pressure up in the domain so it has to have inflow to satisfy the pressure condition on the top outlet. What are you using for your transportProperties?

I have attached the v1806 case similar to Tobias with smaller outlets.
Attached Files
File Type: gz buoyancyForumKJ.tar.gz (54.0 KB, 184 views)
Tobi likes this.
kcjarvis56 is offline   Reply With Quote

Old   October 6, 2019, 10:13
Default
  #7
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
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
Hi,


reducing the area of the outlets may help but if your physical domain does not allow to reduce the outlet in that case, what would you do? Okay, we could extend the geometry while reducing the extension but if this is always physical correct? Hmmm...
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 7, 2019, 00:05
Default
  #8
Member
 
Kirk Jarvis
Join Date: Mar 2009
Posts: 31
Rep Power: 17
kcjarvis56 is on a distinguished road
Tobi,
You make a good point. I looked at it again with the outlets and inlets the same size and slowed the velocity to 0.1 m/s and the back flow in the upper outlet was much smaller and only lasted a couple early time steps, using following bc for the outlets:

p_rgh - FixedValue
p - calculated
U - pressureInletOutletVelocity

other changes from your case:

in thermalphysicalProperities
dpdt off;

in fvSolution in PIMPLE added:
pRefCell 1810; top cell of the outletBottom bc
pRefValue 1e5;

I can share the case if you would like to take a look.

Thanks,

Kirk
saidc. likes this.
kcjarvis56 is offline   Reply With Quote

Old   November 26, 2019, 22:16
Default Backflow
  #9
Senior Member
 
Join Date: Jul 2019
Posts: 148
Rep Power: 7
Bodo1993 is on a distinguished road
Hi,

I am working with twoLiquidMixingFoam solver and I am facing a problem of back flow at the outlets.

I have a single inlet and two outlets. I am setting the outlets to Prgh to zero (i.e. reference pressure value) and using the pressureInletOutletVelocity for velocity.

I have tried also to use totalPressure = 0 instead of Prgh = 0 and it did not work. I have also used the inletOutlet for the outlet velocity but with no success.

I would appreciate your assistance. Please let me know if further information is needed.

Thanks
Bodo1993 is offline   Reply With Quote

Old   June 13, 2020, 10:14
Default
  #10
Member
 
Himanshu
Join Date: Jan 2017
Posts: 34
Rep Power: 9
Himanshu_Shrivastava is on a distinguished road
Quote:
Originally Posted by Tobi View Post
Hi all,

as I made already a lot of tests regarding the correct boundary condition for the p_rgh field that is used in density based solvers, I want to know your experience and set-up of common problems. Let us consider the following example, cf. figure below (10 s). The conditions are as follows:
  • 2D case
  • Two inlets (left)
  • Two outlets (right)
  • gravity is acting against the y-axis
  • All other walls are considered to be walls
  • Size is 10 m long and 2 m high
  • Initial temperature 300 K
  • Inlet velocity 0.1 m/s
  • Top inlet 305 K
  • Bottom Inlet 300 K
The generated picture (below) has the gravity deactivated. Thus, no buoyancy force acts in the case. I want to discuss the boundary conditions for the outlets mainly for the p_rgh field. Without gravity, the simulation runs fine with a prghPressure boundary type which is calculating the face values based on:


p_{rgh} = p - \rho g (h- h_{ref})


The boundary condition includes the height difference and density (temperature depended). The field h_{ref} is a default field with the value of 0. However, changing the field can be done by adding the hRef file into the constant/ folder.

Code:
    Info<< "\nReading hRef" << endl;                                            
    uniformDimensionedScalarField hRef                                          
    (                                                                           
        IOobject                                                                
        (                                                                       
            "hRef",                                                             
            runTime.constant(),                                                 
            mesh,                                                               
            IOobject::READ_IF_PRESENT,                                          
            IOobject::NO_WRITE                                                  
        ),                                                                      
        dimensionedScalar("hRef", dimLength, 0)                                 
    );
The velocity boundary condition at the outlet is inletOutlet. However, the zeroGradientcondition can be used too; it is identical in this case.









The problem starts after activating the gravity because the p_rgh field is not identical to p anymore (before g was zero, thus the second term on the RHS of the equation was zero too). What happens:


  • High backflow at the upper outlet to the upper inlet
    This should be related to the p_rgh field. However, it is not physical here. The acceleration of the fluid will change the solution of the simulation completely.
What can be the problem?
  • isbehavior can be related to the 2D case (I am aware of pressure problems in 2D); however, I have to check it.
  • The initial p_rgh field is uniform which should be non-uniform based on the height - are there some tools in OpenFOAM for setting up the p_rgh field? Such as setFields including mathematical functions?
  • The boundary conditions are somehow not reliable
  • Maybe I should define two separate BC for the upper and lower outlet






As far as I know, there are a lot of people out doing heat transfer and similar problems, this problem should be a common one. Therefore, I am interested in your set-up.
If someone wants to test the case, you can download it here: https://Holzmann-cfd.de/forums/buoyancyCase.tar.gz


Applying two different boundary conditions for the outlet seems to work better. E.g., upper outlet fixedFluxPressure and lower outlet fixedValue. However, this should not be physical based on the missing information regarding \rho g \Delta h.



Thanks for taking your time.
Hello Tobi,

The code you mentioned to change the h_ref. Do we have to paste the exact same code with changed H-ref value in trasportProperties file or do we have to change it in createFilelds.H file?
Himanshu_Shrivastava is offline   Reply With Quote

Old   June 13, 2020, 10:43
Default hRef file
  #11
New Member
 
Jagan Mohan
Join Date: Dec 2019
Location: New York
Posts: 27
Rep Power: 7
jagan1mohan is on a distinguished road
You have to create a file with the name hRef in the constant folder and also add the reading module given by Tobi to createFields.H of the solver you are using. Inside hRef file, contents should be like.


FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object hRef;
}


hRef hRef [0 1 0 0 0 0 0] (Whatever value you want to impose);




Could you try and see? Post the error message if it fails.


Thank you,
Jagan Mohan.
jagan1mohan is offline   Reply With Quote

Old   June 13, 2020, 10:55
Default
  #12
Member
 
Himanshu
Join Date: Jan 2017
Posts: 34
Rep Power: 9
Himanshu_Shrivastava is on a distinguished road
Thank You for the quick reply.
I will try and let you know.
Himanshu_Shrivastava is offline   Reply With Quote

Old   August 7, 2020, 23:55
Default prghPressure
  #13
wwj
New Member
 
wangwenjun
Join Date: Oct 2019
Posts: 1
Rep Power: 0
wwj is on a distinguished road
Hello, I'm new to OpenFOAM and I met the same problem as you.I‘m using the interFoam solver to model a phenomenon of gas jet in liquid cross-flow. The outlet boundary condition is prghPressure. The problem is that the pressure on the surface of outlet gradually decreases along the direction of gravity and it is not correct. Do you know how to solve it ? thank you very much!
wwj is offline   Reply With Quote

Old   April 2, 2021, 13:06
Default problems with pressure
  #14
New Member
 
David
Join Date: Jan 2021
Posts: 13
Rep Power: 5
dalschouten is on a distinguished road
Hi there,

I am stuck with my pressure BC. The flow at the outlet increases, because of this pressure difference. I am dealing with multiphase flow and density differences and have modelled a flume with an in- and outlet.

boundaries U:
inlet: fixedValue (0.1 0 0)
outlet zeroGradient


boundaries p : what should I use?
dalschouten is offline   Reply With Quote

Old   April 2, 2021, 15:45
Default
  #15
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
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
p Inlet -> totalPressure
p Outlet -> fixedValue (or meanFixed or fixedMean - dont know how it is called right now).

However, for multiphase you might use prghTotalPressure or anything related to the hydrostatic part.
Ship Designer and dalschouten like this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   April 3, 2021, 11:02
Default
  #16
New Member
 
David
Join Date: Jan 2021
Posts: 13
Rep Power: 5
dalschouten is on a distinguished road
Thank you for the very quick reply. I have tried this and when I use this I get a fatal error. The file you send in the original post does not work anymore.

I tried adding a hRef file to the constant folder, but it does not seem to find it. I have a p_rgh pressure file.

This is the error I receive:

--> FOAM FATAL ERROR:

request for uniformDimensionedScalarField hRef from objectRegistry region0 failed
available objects of type uniformDimensionedScalarField are
1(cumulativeContErr)

From const Type& Foam:bjectRegistry::lookupObject(const Foam::word&, bool) const [with Type = Foam::UniformDimensionedField<double>]
in file /home/pawan/OpenFOAM/OpenFOAM-v2006/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 463.

FOAM aborting
dalschouten is offline   Reply With Quote

Old   April 6, 2021, 08:10
Default
  #17
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
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
Check out the *header* of your hRef file. It should look like that

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.x                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       uniformDimensionedScalarField;
    location    "constant";
    object      hRef;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 0 0 0 0 0];
value           0.244;

// ************************************************************************* //
dalschouten likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   June 18, 2021, 06:12
Default
  #18
New Member
 
pierre
Join Date: May 2021
Posts: 4
Rep Power: 5
pierrechot is on a distinguished road
Quote:
Originally Posted by Tobi View Post
Check out the *header* of your hRef file. It should look like that

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.x                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       uniformDimensionedScalarField;
    location    "constant";
    object      hRef;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 0 0 0 0 0];
value           0.244;

// ************************************************************************* //
Hello Tobi,

For compression by air-liquid injection at 3 bar without outlet into air at 0.64 bar.
What do you suggest for the boundary conditions of:
- P_inlet
- P_wall

- U_inlet
- U_wall

- P_rgh_inlet
- P_rgh_walls

Thanking you,
Pierre
pierrechot is offline   Reply With Quote

Old   October 14, 2023, 09:54
Default
  #19
New Member
 
Join Date: Sep 2021
Posts: 3
Rep Power: 5
EzgiCFD is on a distinguished road
Hello everyone,

This thread is old but my domain seems like the model of Tobi's. In my domain, at the bottom, the flow is from left to right while at the top, the flow is from right to left. Can you help me about boundary conditions especially for pressure boundary condition? The details of the model is explained in this thread:

Correct boundary conditions for two inlets and two outlets


I will be grateful if you help me. Thanks a lot.
EzgiCFD 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
Radiation in semi-transparent media with surface-to-surface model? mpeppels CFX 11 August 22, 2019 08:30
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 02:27
Implementation of boundary conditions for FVM Tom Main CFD Forum 7 August 26, 2014 06:58
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32


All times are GMT -4. The time now is 09:28.