# How to get a pressure boundary condition as triangle distribution by FlowEngine

Hello all,

As we know, water pressure increases with depth. (Pressure=denstiy*g*depth)
I want to use FlowEngine to get a pressure boundary that the pressure is increasing with depth. However, I find that by setting "bndCondValue"[1] can only get a uniform pressure at the boundary, which doesn't change with depth. I've read through the FlowEngine class reference [2] to get some ideas. I think I can search for the cells which are outermost and use "setCellPressure" [3] to get a boundary that the pressure increases with depth. But this is too complicated. Is there any better idea?

Thank you for any suggestions.

## Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
Robert Caulk
Solved:
Last query:
 Revision history for this message Robert Caulk (rcaulk) said on 2021-03-24: #1

Hello,

>> I think I can search for the cells which are outermost and use "setCellPressure" [3] to get a boundary that the pressure increases with depth. But this is too complicated. Is there any better idea?

That would be the solution, or use imposePressureFromId if you know the IDs of the cells you want to impose. So assuming the cells you want to set are already the boundaries:

for i in range(0,flow.nCells()):
coords = flow.getCellCenter(i)
pressure_imposed = flow.getCellPImposed(i)
if not pressure_imposed: continue
zcoord = coords[0]
pressure = density*g*zcoord
flow.imposePressureFromId(i,pressure)

Cheers,

Robert

 Revision history for this message Huang peilun (hpl16) said on 2021-03-24: #2

Thanks Robert Caulk, that solved my question.

 Revision history for this message Bruno Chareyre (bruno-chareyre) said on 2021-03-24: #3

> As we know, water pressure increases with depth. (Pressure=denstiy*g*depth)

True, but the pressure in PFV implementation is not the absolute pressure, it is the piezometric pressure (water "head" given in Pa).
And as we know water head is constant with depth in equilibrium states. So you don't have to worry about a linear boundary condition, it should be just constant - much easier.

The downside is that Archimede buoyancy is not included automatically. PFV only cares about drag due to relative phases motion. So you need to add buoyancy as additional external forces if your problem is gravitational.

Regards

Bruno