# How to set pressure bc?

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

 May 12, 2023, 09:50 How to set pressure bc? #1 New Member   riccardo Join Date: Mar 2023 Posts: 7 Rep Power: 2 Hi, I am modeling a vertical pipe, with inlet at the top and outlet at the bottom. I set the velocity at the top. I would like to fix pressure at the top and, in a sense, see the pressure changes at the bottom, is it possible? I have both a file for p and for p_rgh. The problem is that the pressure at the bottom remains fixed to the initial value, while it changes at the inlet. For the moment I have set: p_rgh: inlet { type fixedFluxPressure; value \$internalField; } outlet { type prghPressure; p \$internalField; value \$internalField; } p: inlet { type zeroGradient; } outlet { type zeroGradient; } However using different condition (for example zerogradient for p_rgh at outlet) ends up in an error.

 May 14, 2023, 06:29 #2 Senior Member   Yann Join Date: Apr 2012 Location: France Posts: 809 Rep Power: 24 Hello Riccardo, Knowing what solver you are using could be helpful here. Usually on solvers using p_rgh, we set the BC on p_rgh and p only uses calculated BCs (basically p is computed based on p_rgh, and you need to focus on setting proper BCs on p_rgh) On the setup you posted, you are fixing the pressure at the outlet using prghPressure, and you let it "free" at the inlet with fixedFluxPressure. So you get the expected behavior: the pressure is fixed at the outlet and it changes at the inlet (fixedFluxPressure basically adjusts pressure gradient to satisfy the velocity fixed on the patch) You will not be able to fix both pressure and velocity at the inlet as it will lead to numerical issues. You cannot use fixedFluxPressure + zeroGradient either since both are setting gradients and you need to fix a pressure value somewhere. If you want to fix an inlet pressure you will probably have to define an outlet velocity rather than an inlet one, and it might be more unstable. More about BCs general principles here: https://doc.cfd.direct/notes/cfd-gen...ary-conditions Hope this helps, Yann

May 15, 2023, 03:43
#3
New Member

riccardo
Join Date: Mar 2023
Posts: 7
Rep Power: 2
Quote:
 Originally Posted by Yann Hello Riccardo, Knowing what solver you are using could be helpful here. Usually on solvers using p_rgh, we set the BC on p_rgh and p only uses calculated BCs (basically p is computed based on p_rgh, and you need to focus on setting proper BCs on p_rgh) On the setup you posted, you are fixing the pressure at the outlet using prghPressure, and you let it "free" at the inlet with fixedFluxPressure. So you get the expected behavior: the pressure is fixed at the outlet and it changes at the inlet (fixedFluxPressure basically adjusts pressure gradient to satisfy the velocity fixed on the patch) You will not be able to fix both pressure and velocity at the inlet as it will lead to numerical issues. You cannot use fixedFluxPressure + zeroGradient either since both are setting gradients and you need to fix a pressure value somewhere. If you want to fix an inlet pressure you will probably have to define an outlet velocity rather than an inlet one, and it might be more unstable. More about BCs general principles here: https://doc.cfd.direct/notes/cfd-gen...ary-conditions Hope this helps, Yann
Thanks a lot for your answer, I have a further doubt: defining the bc like this:
p_rgh:
inlet
{
type prghPressure;
p \$internalField;
value \$internalField;
}
outlet
{
type fixedFluxPressure;
value \$internalField;
}

gives some results that for my modeling are better because at outlet I see pressure changes. However I was wondering if this makes sense

May 15, 2023, 05:14
#4
Senior Member

Yann
Join Date: Apr 2012
Location: France
Posts: 809
Rep Power: 24
Quote:
 Originally Posted by ricx However I was wondering if this makes sense
It depends on what you set for U on those patches. Pressure and velocity are coupled, so their BCs must work together.

More generally speaking, it's not possible to tell if your setup makes sense without knowing what kind of physics you are trying to simulate and which solver you are using.

Yann

 Tags bc's, openfoam, pressure, vertical pipe, zerogradient