Fluids
Fluid column
Layered columns and the U-tube between them
A well is rarely full of one fluid. This handles the stack: brine over mud over cement, a gas cap, a spacer in the middle, and works out what the column exerts at any depth and where the two sides of a U-tube come to rest. The answer to "will it flow back when I open it" is a column balance, not a single hydrostatic.