# PlanetPhysics/Continuity Equation

Much like the mechanics of solid bodies, the concept of mass conservation plays an important role in the study of fluids. In conceptual terms, mass conservation for a fluid states that for a given volume in fixed space, the rate of change of fluid mass contained within that volume is equivalent to the difference between the rate of change of mass into and out of that volume. A typical way to conceptualise this is to consider the flow of fluid in a pipe. At one end of the pipe, water is flowing in at some constant rate, and at the other end, water pours out at the same rate. What does this mean if the pipe is of variable width? It means that water must flow at a greater rate through the narrow sections of pipe than through the broader sections. For a given unit of velocity, a greater amount of mass will flow through the wide section than through the narrow section. Thus, to conserve mass, the velocity of the water must increase as the radius of the pipe decreases.
The mass of a fluid can be written mathematically in terms of the fluid density and volume. Suppose that the containing volume is a sphere of radius $r$, and the fluid is of constant density. Then, the mass of fluid, $M$, is density of fluid $\times$volume of fluid . In the case presented in this example, $M=\rho \times (4\pi r^{3}/3)$, where $\rho$ is used to denote density. In general, we cannot assume constant density, nor can we assume ideal geometric forms for the containing volume. Thus, we write mass as
   $M=\int _{V}\rho dV,$
with $V$ the volume. Mass conservation then takes the form
   ${\frac {\partial }{\partial t}}\int _{V}\rho dV=-\int _{S}\rho \mathbf {u} \cdot d\mathbf {S} .$
The left hand side is simply a mathematical representation of the statement the rate of change of mass in volume $V$ . The term $\rho \mathbf {u}$ is the mass flux across some area on the surface of the volume, $V$, where $\mathbf {u}$ is the velocity vector. Thus, the surface integral of the right hand side gives the total mass exiting the volume $V$ in a unit time. To bring this equation into its common state, we must apply the divergence theorem. This allows us to convert the flux through a surface term on the right hand side into a divergence within a volume. In particular,
   $\int _{S}\rho \mathbf {u} \cdot d\mathbf {S} =\int _{V}\nabla \cdot (\rho \mathbf {u} )dV.$
Substituting this result into the original statement of mass conservation, and moving all terms to the left hand side, we have
   ${\frac {\partial }{\partial t}}\int _{V}\rho dV+\int _{V}\nabla \cdot (\rho \mathbf {u} )dV=\int _{V}\left({\frac {\partial \rho }{\partial t}}+\nabla \cdot (\rho \mathbf {u} )\right)dV=0.$
The time derivative was taken inside the integral because the setting here is an Eularian one i.e. the volume is fixed in space. This equation abstracts directly to the familiar form of mass conservation for a fluid. Since we initially placed no restrictions or constraints on the form the volume $V$ takes, it must be true that the integral holds over all volumes $V$. Thus, it follows that
   $(1){\frac {\partial \rho }{\partial t}}+\nabla \cdot (\rho \mathbf {u} )=0.$
This is the expression of mass conservation in the Eularian setting. The equation can be equivalently formulated in the Lagrangian setting, and is written as
   $(2){\frac {D\rho }{Dt}}+\rho \nabla \cdot \mathbf {u} =0.$
These expressions for the conservation of mass are typically referred to as continuity equations. The continuity equation finds application in nearly all areas of fluid mechanics. For instance, in physical oceanography, upwelling is an area of great interest. Upwelling is the upward motion of deep water through the water column. Upwelling will, for instance, bring cooler bottom water to the surface, or circulate nutrient rich and nutrient poor waters. One mechanism through which upwelling can occur is mass conservation. Suppose that the horizontal flow of water converges at some point along the ocean floor. At that point, the water must move upward, in order to conserve mass, thus giving a region of upwelling.
As a final point, it is important that we remark upon the form of the continuity equation for an incompressible fluid. A fluid is considered incompressible when changes in pressure do not result in changes in density. For many practical applications, water is considered incompressible, for example. By enforcing the incompressibility restriction, it follows that the rate of change of density following the motion (the Lagrangian setting) must be zero i.e the density following the motion of the fluid parcel is constant. Thus, Equation 44 reduces to
   $\nabla \cdot \mathbf {u} =0.$
This states that for mass to be conserved in an incompressible fluid, the velocity field must be divergence free.