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

About the totalPressure BC

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

Like Tree4Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 16, 2019, 18:11
Default About the totalPressure BC
  #1
Senior Member
 
Join Date: Dec 2019
Posts: 188
Rep Power: 3
shock77 is on a distinguished road
Hello dear community,

I have noticed some strange behaviour of the totalPressure BC.

I have set the totalPressure BC at my nozzel inlet for the pressure BC. The velocity is calculated at the inlet and the BC is zeroGradient. The outlet has a fixed static pressure and for the outlet I use inletOutlet.

I have noticed two strange things:

1. You can define "p0" and "value" for some reason. If I define "value" p0 is ignored. I dont know wheter value is a total pressure or a static pressure.

2. If I dont define a "value" and just define p0 e. g. as 1 MPa, at time 0 the total pressure at the inlet is 1 MPa, but decrease with time. I dont know why.


I use OpenFOAM 4.1 and the solver rhoCentralFoam.

I hope that someone can help me to resolve those questions.

Thank you in advance.
shock77 is offline   Reply With Quote

Old   December 17, 2019, 06:22
Default
  #2
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 417
Rep Power: 11
simrego is on a distinguished road
Hi!


p0 is always used.
value is usually used for initialization, but some BCs can be fine without it, like this BC.
You see the static pressure that's why it is decreasing. I think you initialize with 0 velocity, thus the static pressure will be the same as the total pressure. Then as your velocity is increasing, the static pressure will decrease.
Check this:
https://openfoam.com/documentation/g...d.html#details
(OF 4.1 is pretty old, but i think it was the same in it)
Tobi and granzer like this.
simrego is offline   Reply With Quote

Old   December 17, 2019, 07:44
Default
  #3
Member
 
Join Date: Jun 2017
Posts: 72
Rep Power: 6
Friendly is on a distinguished road
You should calculate the totalPressure first. There are some possibilities for it.
Friendly is offline   Reply With Quote

Old   December 17, 2019, 07:57
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Augsburg
Posts: 2,595
Blog Entries: 6
Rep Power: 47
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
Quote:
I know that p is the static pressure in openFOAM.
Not 100 % correct. If you are using an incompressible solver, the pressure is not a real pressure as we only need a pressure gradient within the momentum equation. That is the reason why we also can achieve pressure values with a negative sign (not possible).


The totalPressure BC works fine if you want to have a pressure defined flow. If you would set both (inlet and outlet) to fixed values, your fluid will accelerate and accelerate and accelerate (based on your dp) till your solver crashes. The totalPressure BC reduces the pressure on the faces regarding the kinematic pressure:
p_{face} = p_0 - \frac{1}{2}\rho\textbf{U}^2


Commonly I use totalPressure with a pressureInletOutletVelocity.
The object function you are using is not included within the latest Foundation version. However, I would expect that it is similar to the "pressure" object function in version 7. Here some description:

Code:
Description                                                                     
    Includes tools to manipulate the pressure into different forms.             
                                                                                
    These currently include:                                                    
    - static pressure                                                           
        \f[                                                                     
            p = \rho p_k                                                        
        \f]                                                                     
    - total pressure                                                            
        \f[                                                                     
            p_0 = p_{ref} + p + 0.5 \rho |U|^2                                  
        \f]                                                                     
    - static pressure coefficient                                               
        \f[                                                                     
            Cp = \frac{p - p_{\inf}}{0.5 \rho_{\inf} |U_{\inf}|^2}              
        \f]                                                                     
    - total pressure coefficient                                                
        \f[                                                                     
            Cp_0 = \frac{p_0 - p_{\inf}}{0.5 \rho_{\inf} |U_{\inf}|^2}          
        \f]

In order to be sure that your are fine with bug-fixes etc. you also can go through the release history from 4.1 up to the latest version 7.


Tobi
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   December 17, 2019, 12:01
Default
  #5
Senior Member
 
Join Date: Dec 2019
Posts: 188
Rep Power: 3
shock77 is on a distinguished road
The formula you have written is for incompressible fluids. I am using rhoCentralFoam for supersonic flows. So the static pressure is actually calculated by:


p = p0/(1+0.5*z*G*U)^(1/G)


with G = (gamma-1)/gamma


and z = 1/(Rs*T)


I have calculated the the totalpressure with:


rhoCentralFoam -func -postProcess totalPressureCompressible


but it changes overtime.






Anyway I have strange phenomena at the inlet. (see Image)


I have defined a total pressure at the inlet (1MPa), the walls are zeroGradient, and the outlet is wavetransmissive (0.1 MPa).


U is calculated by pressureInletOutletVelocity (as you do), walls are slip and the outlet is inletOutlet.


For T I have a fixedValue for the Temperature (300k), and the walls and outlet are zeroGradient.




I still have no clue why I have such problems with this boundary conditions.
Attached Images
File Type: png strange.png (35.3 KB, 119 views)
febriyan91 likes this.
shock77 is offline   Reply With Quote

Old   December 17, 2019, 13:44
Default
  #6
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 417
Rep Power: 11
simrego is on a distinguished road
It is like a weird pressure shock, for no reason (based on your description about the case).
Try with a smaller pressure difference, or even try with an incompressible solver just to make sure you are able to set up a much simpler case (simpler on the modelling level), then go for more complicated models. This is my advice in OpenFOAM all the time because usually people go for a hell complicated stuff what they never did and then they can't find the problem.
And check your schemes. Maybe you are using pure first order? Or just copy from the forwardStep for example. These tutorials are usually using pretty stable schemes, then you can play with it if it is working


And the mainstream advice which is usually useless: decrease the time step, increase the mesh resolution...
simrego is offline   Reply With Quote

Old   December 17, 2019, 14:27
Default
  #7
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Augsburg
Posts: 2,595
Blog Entries: 6
Rep Power: 47
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,


I commonly see such pressure waves in my simulations, if I am using a density based solver while the initial velocity and pressure field is 0. While starting the calculation, the first time step is somehow like a "shock" as the fluid starts immediately entering to the domain with a fixed velocity and so on.



Using a \Deltap for the flow, should lead to the same behavior, shouldn't it?
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   December 17, 2019, 14:41
Default
  #8
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 417
Rep Power: 11
simrego is on a distinguished road
Yes, that should be okay. But he had 0.1 MPa on the outlet, and 1 MPa inlet. With these BCs i think that 155 MPa shock is a bit unphysical.


With that dP you mean the smaller pressure difference? I sometimes use this trick to use BCs such a way that the initial field (zero velocity, etc) is much closer to the steady-state solution, so you start solving really close from the solution (really stable). This way you can check if there is a huge problem in the case. For example horrible schemes, some really bad BC, etc... Also in a transient simulation you shouldn't have a huge change this way, so your deltaT should be fine. I think he had a giant courrant no after this "detonation".
simrego is offline   Reply With Quote

Old   December 18, 2019, 04:37
Default
  #9
Senior Member
 
Join Date: Dec 2019
Posts: 188
Rep Power: 3
shock77 is on a distinguished road
Thank you for you help!


@simrego


I have tried reducing the totalPressure at the inlet, but there is still this shock. My Co is 0.2 and the mesh is still coarse. This shock is also weird, because it is not a supersonic shock. I think the inlet boundary condition has troubles to adjust the static pressure at the inlet with the static pressure in the field, since it has to adjust the staticPressure and Velocity at the same time, what might lead to some kind of oscillations, which result in this weird phenomena.



I am using the following schemes and solvers:


Code:
fluxScheme      Kurganov;

ddtSchemes
{
    default         Euler;
}

gradSchemes
{
    default         Gauss linear;
}

divSchemes
{
    default         none;
    div(tauMC)      Gauss linear;
}

laplacianSchemes
{
    default         Gauss linear corrected;
}

interpolationSchemes
{
    default         linear;
    reconstruct(rho) upwind;
    reconstruct(U)   upwind;
    reconstruct(T)   upwind;
}

snGradSchemes
{
    default         corrected;
}

Code:
solvers
{
    "rho.*"
    {
        solver          diagonal;
    }

    "U.*"
    {
        solver          smoothSolver;
        smoother        GaussSeidel;
        nSweeps         2;
        tolerance       1e-9;
        relTol          0;
    }

    e
    {
        $U;
        tolerance       1e-9;
        relTol          0;
    }
}

@tobi


Did your pressure shocks level out at the end of the simulations? My result is still not converged, but I have doubts that they will.




Many regards,
shock77
shock77 is offline   Reply With Quote

Old   December 18, 2019, 04:44
Default
  #10
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 417
Rep Power: 11
simrego is on a distinguished road
Hi!
Try to get rid of that first order interpolation scheme (upwind). You should never use first order interpolation. Maybe if you have a supersonic flow it can be acceptable but not in your case. Try with this:
interpolationSchemes
{
default linear;
reconstruct(rho) vanLeer;
reconstruct(U) vanLeerV;
reconstruct(T) vanLeer;
}


If it is really coarse you could try to refine a bit, but I don't think if it will help.
simrego is offline   Reply With Quote

Old   December 18, 2019, 05:03
Default
  #11
Senior Member
 
Join Date: Dec 2019
Posts: 188
Rep Power: 3
shock77 is on a distinguished road
Hi Simrego,


I have tried vanLeer, Gamma, minmod and vanAlbada. They are all leading to this.


This phenomena induces instability, so that everything besides upwind results in the termination of the simulation.


Maybe I can recalculate the fields with vanLeer. I will try that!






Many regards,

shock77
shock77 is offline   Reply With Quote

Old   December 18, 2019, 07:26
Default
  #12
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 417
Rep Power: 11
simrego is on a distinguished road
Can you share your case? Or a simplified version if there are some data what you can't share.
simrego is offline   Reply With Quote

Old   December 20, 2019, 06:36
Default
  #13
Senior Member
 
Join Date: Dec 2019
Posts: 188
Rep Power: 3
shock77 is on a distinguished road
Hi Simrego,


I could only share everything besides the mesh. So I dont know wether this can help or not.


Do you think initiiating the field with a low velocity could help? Maybe the reason is, that the field stands still and thats why the solver has some issues?
shock77 is offline   Reply With Quote

Old   December 20, 2019, 09:49
Default
  #14
Senior Member
 
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 207
Rep Power: 16
tas38 is on a distinguished road
Quote:
Originally Posted by shock77 View Post
Hi Simrego,


I could only share everything besides the mesh. So I dont know wether this can help or not.


Do you think initiiating the field with a low velocity could help? Maybe the reason is, that the field stands still and thats why the solver has some issues?



Can you please share the specific boundary conditions for p, T, and U at the inflow and outflow boundaries? Note for example, that the manner in which the static pressure is evaluated at the total pressure boundary changes depending on how/what combinations of rho, phi, and psi are prescribed.
tas38 is offline   Reply With Quote

Old   December 21, 2019, 09:55
Default
  #15
Senior Member
 
Join Date: Dec 2019
Posts: 188
Rep Power: 3
shock77 is on a distinguished road
Hi tas38,

thank you for your help! I can share the BCs tomorrow, I have no access to my computer today.

I have seen that you can specify u, rho and psi... but I am quite sure that I have dont that. So just the default options should be active.

My BC type are (I will share the specific BC options tomorrow):

Inlet:

p: totalPressure
T: totalTemperature (tried also fixedValue)
u: pressureInletOutletVelocity

Outlet:

p: waveTransmissive
T: zeroGradient
u: inletOutlet

walls:

p: zeroGradient
T: zeroGradient
u: slip


Kind regards,
shock77
shock77 is offline   Reply With Quote

Old   December 21, 2019, 20:34
Default
  #16
Senior Member
 
Join Date: Dec 2019
Posts: 188
Rep Power: 3
shock77 is on a distinguished road
Here are the BCs:


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

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

internalField  uniform 1e5;

boundaryField
{
    inlet
    {
    type            totalPressure;
    gamma           1.4;
    p0              uniform 10e5;
 }

   outlet
    {
        type            zeroGradient;
    }
    
    top
    {
        type            waveTransmissive;
        field           p;
        psi             thermo:psi;
        gamma           1.667;
        fieldInf        1e5;
        lInf            1;
        value           uniform 1e5;
    }
    bottom
    {
        type            waveTransmissive;
        field           p;
        psi             thermo:psi;
        gamma           1.667;
        fieldInf        1e5;
        lInf            1;
        value           uniform 1e5;
    }
    front
    {
        type            waveTransmissive;
        field           p;
        psi             thermo:psi;
        gamma           1.667;
        fieldInf        1e5;
        lInf            1;
        value           uniform 1e5;
    }
    back
    {
        type            waveTransmissive;
        field           p;
        psi             thermo:psi;
        gamma           1.667;
        fieldInf        1e5;
        lInf            1;
        value           uniform 1e5;
    }
    walls
    {
        type            zeroGradient;
    }
  
}

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

dimensions      [0 0 0 1 0 0 0];

internalField   uniform 293;



boundaryField
{
    inlet
    {
        type            fixedValue;
    value        uniform 293;
    }

    outlet
    {
        type            zeroGradient;
    }
    top
    {
        type            zeroGradient;
    }
    bottom
    {
        type            zeroGradient;
    }
    front
    {
        type            zeroGradient;
    }
    back
    {
        type            zeroGradient;
    }
    walls
    {
        type            zeroGradient;
    }

  
}

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

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

internalField  uniform (0 0 0);

boundaryField
{
    inlet
    {
        type                        pressureInletOutletVelocity;
                value                    uniform (0 0 0);
    }

    outlet
    {
        type            inletOutlet;
        value           $internalField;
        inletValue      uniform (0 0 0);
    }
    top
    {
        type            inletOutlet;
        value           $internalField;
        inletValue      uniform (0 0 0);
    }
    bottom
    {
        type            inletOutlet;
        value           $internalField;
        inletValue      uniform (0 0 0);
    }
    front
    {
        type            inletOutlet;
        value           $internalField;
        inletValue      uniform (0 0 0);
    }
    back
    {
        type            inletOutlet;
        value           $internalField;
        inletValue      uniform (0 0 0);
    }
    walls
    {
        type            slip;
    }

  
}

// ************************************************************************* //

The case is a supersonic injection into a free enviroment. Could a problem be, that all outer walls of my domain are handeld as outlet basicly?
shock77 is offline   Reply With Quote

Old   December 22, 2019, 09:49
Default
  #17
Senior Member
 
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 207
Rep Power: 16
tas38 is on a distinguished road
shock77,


Looking into the code, it appears in OF ver.4.x that the totalPressure boundary condition you set at the inlet computes the static pressure as you said previously, namely...


P_s = \frac{P_T}{\left( 1 + \psi \left( \frac{\gamma -1}{2 \gamma} \right) |\vec{u}|^2 \right)^{\gamma / (\gamma -1)}}


where the compressibility is


\psi = \frac{1}{RT}


However, this pressure boundary condition should be used in conjunction with the totalTemperature bc (for T) at the inlet. I believe you stated that you used both totalTemperature and fixedValue bcs for the inlet temperature and saw no change/improvement. Is this indeed the case?


Also, you state in your most recent post that the bcs were (or should be) setup for supersonic injection into the atmosphere. What makes you state that it is supersonic injection, rather than say subsonic compressible injection?
tas38 is offline   Reply With Quote

Old   December 22, 2019, 10:31
Default
  #18
Senior Member
 
Join Date: Dec 2019
Posts: 188
Rep Power: 3
shock77 is on a distinguished road
Hello tas38,


Yes I have also tried totalTemperature. It was actually my first try, but fixedValue seems to be more stable.


The inlet is subsonic, thats true. But the inlet is not the throat, the velocity reaches Ma=1 in the throat and because of the expansion the Mach-number increases further.


It is a supersnic injection like in here:




https://www.researchgate.net/profile...rossflow-a.png




I have realized that for lower pressure ratios (p0/p_atm = 5/1) this phenomon does not show. Maybe I need more stable schemes...


I also tried using fixedValue at the Inlet for pressure, velocity and temperature (like in the ladenburg jet tutorial). That leads to the same phenomenon.
shock77 is offline   Reply With Quote

Old   December 22, 2019, 10:52
Default
  #19
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Augsburg
Posts: 2,595
Blog Entries: 6
Rep Power: 47
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 shock77,


I am not really familiar with sonic flows and with the rhoCentralFoam. However, is there any reason why you are not using rhoPimpleFoam? I am asking, because in that solver, we do can calculate the pressure differently based on transonic flows. I just checked the rhoCentralFoam right now but out of the box, I cannot estimate the calculation idea (it is also related due to the fact that I commonly use the *Pimple* solvers).

It is just a hint, but maybe not a qualified one. Right now, I am dealing with reactingFoam and a methane injection into a exhaust pipe system. Here, I get acoustic pressure waves moving from inlet to outlet (here it is reflected) and then back to the inlet. The reflecting of the pressure at the outlet boundary is not real however and maybe I should re-set somehow the BC.

Nevertheless, this is a different topic. Good luck.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   December 22, 2019, 13:51
Default
  #20
Senior Member
 
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 207
Rep Power: 16
tas38 is on a distinguished road
shock77,


Given all the non-reflective downstream bcs, does the non-physical shock persist if the flow is changed from pressure-driven to a prescribed velocity at the inflow? Prescribed massflow at the inlet and outflow pressure is usually the "most well-behaved". If so, this may point to an issues with the schemes and/or grid. If not, you know there is likely some issue with the bc setup.



You may want to try running this type of bc first, then switch to purely pressure driven bcs later.
tas38 is offline   Reply With Quote

Reply

Tags
rhocentralfoam, totalpressure

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
totalPressure (why flux direction dependend) Tobi OpenFOAM Running, Solving & CFD 3 October 17, 2019 23:27
Need info about totalPressure boundary condition sahmed OpenFOAM Running, Solving & CFD 4 December 4, 2018 22:23
About the totalPressure BC fmerk OpenFOAM Running, Solving & CFD 1 September 25, 2017 18:53
totalPressure boundary :Performance Curve (constant RPM) nash OpenFOAM Running, Solving & CFD 0 September 6, 2013 12:34
Totalpressure Ansys Leuchte CFX 2 April 9, 2013 19:56


All times are GMT -4. The time now is 12:49.