
[Sponsors] 
December 16, 2019, 18:11 
About the totalPressure BC

#1 
Senior Member
Join Date: Dec 2019
Posts: 215
Rep Power: 7 
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. 

December 17, 2019, 06:22 

#2 
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 
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) 

December 17, 2019, 07:44 

#3 
Member
Join Date: Jun 2017
Posts: 73
Rep Power: 9 
You should calculate the totalPressure first. There are some possibilities for it.


December 17, 2019, 07:57 

#4  
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 
Quote:
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: 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 bugfixes etc. you also can go through the release history from 4.1 up to the latest version 7. Tobi
__________________
Keep foaming, Tobias Holzmann 

December 17, 2019, 12:01 

#5 
Senior Member
Join Date: Dec 2019
Posts: 215
Rep Power: 7 
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 = (gamma1)/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. 

December 17, 2019, 13:44 

#6 
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 
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... 

December 17, 2019, 14:27 

#7 
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 
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 p for the flow, should lead to the same behavior, shouldn't it?
__________________
Keep foaming, Tobias Holzmann 

December 17, 2019, 14:41 

#8 
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 
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 steadystate 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". 

December 18, 2019, 04:37 

#9 
Senior Member
Join Date: Dec 2019
Posts: 215
Rep Power: 7 
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 1e9; relTol 0; } e { $U; tolerance 1e9; 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 

December 18, 2019, 04:44 

#10 
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 
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. 

December 18, 2019, 05:03 

#11 
Senior Member
Join Date: Dec 2019
Posts: 215
Rep Power: 7 
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 

December 18, 2019, 07:26 

#12 
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 
Can you share your case? Or a simplified version if there are some data what you can't share.


December 20, 2019, 06:36 

#13 
Senior Member
Join Date: Dec 2019
Posts: 215
Rep Power: 7 
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? 

December 20, 2019, 09:49 

#14  
Senior Member
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 220
Rep Power: 19 
Quote:
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. 

December 21, 2019, 09:55 

#15 
Senior Member
Join Date: Dec 2019
Posts: 215
Rep Power: 7 
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 

December 21, 2019, 20:34 

#16 
Senior Member
Join Date: Dec 2019
Posts: 215
Rep Power: 7 
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? 

December 22, 2019, 09:49 

#17 
Senior Member
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 220
Rep Power: 19 
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... where the compressibility is 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? 

December 22, 2019, 10:31 

#18 
Senior Member
Join Date: Dec 2019
Posts: 215
Rep Power: 7 
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 Machnumber increases further. It is a supersnic injection like in here: https://www.researchgate.net/profile...rossflowa.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. 

December 22, 2019, 10:52 

#19 
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 
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 reset somehow the BC. Nevertheless, this is a different topic. Good luck.
__________________
Keep foaming, Tobias Holzmann 

December 22, 2019, 13:51 

#20 
Senior Member
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 220
Rep Power: 19 
shock77,
Given all the nonreflective downstream bcs, does the nonphysical shock persist if the flow is changed from pressuredriven to a prescribed velocity at the inflow? Prescribed massflow at the inlet and outflow pressure is usually the "most wellbehaved". 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. 

Tags 
rhocentralfoam, totalpressure 
Thread Tools  Search this Thread 
Display Modes  


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 