# Bernoulli's principle for a liquid with non uniform density

Consider a cylindrical container (section $$S$$, height $$H$$) which contains a liquid with non uniform density.

Let $$z$$ be the axis along the height of the container ($$z = 0$$ indicates the top of liquid while $$z = H$$ indicates the floor).

Suppose that the liquid stratifies in the container, i.e. the density is a function $$\rho(z) > 0$$, which is strictly increasing with $$z$$ ($$\rho'(z) > 0$$).

Suppose that atmospheric pressure is $$p_0$$. Then, according to the Stevin's law, the hydrostatic pressure is:

$$p'(z) = g\rho(z) \Rightarrow p(z) = p_0 + g\int_0^z \rho(s)ds.$$

Then, is it correct to write the Bernoulli's principle as follows

$$p(z) + \frac{1}{2}\rho(z)v^2(z) + \rho(z)g(H-z) = \text{constant} \Rightarrow\\ p_0 + g\int_0^z \rho(s)ds + \frac{1}{2}\rho(z)v^2(z) + \rho(z)g(H-z) = \text{constant}?$$

The liquid is steady, that is $$v(z) = 0 ~\forall z \in [0, H]$$. Then, the Bernoulli's principle reduces to:

$$p_0 + g\int_0^z \rho(s)ds + \rho(z)g(H-z) = \text{constant}.$$

Taking the derivative, I get:

$$g\rho(z) + \rho'(z)g(H-Z) - g\rho(z) = 0 \Rightarrow g(H-z)\rho'(z) = 0.$$

The last equation suggests me that

$$\rho'(z) = 0,$$

i.e. $$\rho(z) = \rho ~\forall z$$, which means that the fluid is uniform!!!

This results is really strange...

Does the Bernoulli's principle work for non uniform liquids? Is there any formulation of the Bernoulli's principle that takes into account a non uniform density?