If a fluid element is at rest, we can do a simple force balance on the element (recognizing that the sum of forces equals zero for a non-accelerating "body"):

$0 = (P_1-P_2A)+ \rho gV$

dividing through by area leaves:

$(P_2-P_1) = \rho gh$

If we let the distance, h, get small so that the change in pressure ($P_1-P_2$) also gets small, we get:

$dP = \rho g dz$

which we can rearrange to give:

$\displaystyle{\frac{dP}{dz} = \rho g}$

In three dimensions this gives us the Pressure Field Equation for a static fluid as:

$\nabla P = \rho \vec{g}$

Here gravity is a vector pointing in the z direction.

A more general form of this equation is possible if we relax the assumption that the fluid is not accelerating. In this case, we simply have the sum of the pressure and gravity forces equal to the mass of the fluid times acceleration:

$\rho Va = (P_1-P_2)A + \rho gV$

again dividing through by area leaves:

$\rho ha = (P_1-P_2) + \rho gh$

which for small h and P difference (in three dimensions) gives the general Pressure Field Equation:

$\nabla P = \rho (\vec{g} - \vec{a})$

Derive the pressure field equation