Conservation Laws

Mass, momentum, and energy - the fundamental equations of fluid motion

Introduction

The motion of fluids is governed by conservation laws - mass, momentum, and energy cannot be created or destroyed, only transported and converted. These fundamental principles, combined with constitutive relations, give us the complete equations of fluid dynamics.

We present both integral forms (useful for control volume analysis) and differential forms (useful for detailed flow field solutions).

Conservation of Mass (Continuity)

Integral Form

The rate of change of mass in a control volume equals the net mass flux through the surface:

$$\frac{\partial}{\partial t}\int_{CV} \rho \, dV + \oint_{CS} \rho (\vec{v} \cdot \hat{n}) \, dA = 0$$

For steady flow: ∮ρ(v·n)dA = 0 → Mass in = Mass out

Differential Form

Using the divergence theorem:

$$\frac{\partial \rho}{\partial t} + \nabla \cdot (\rho \vec{v}) = 0$$

Or equivalently, using the material derivative:

$$\frac{D\rho}{Dt} + \rho (\nabla \cdot \vec{v}) = 0$$

Incompressible Flow

When Dρ/Dt = 0 (density of a fluid particle doesn't change), continuity simplifies to:

$$\nabla \cdot \vec{v} = 0$$

Valid for liquids and low-speed (Ma < 0.3) gas flows.

Conservation of Momentum

Integral Form (Control Volume)

Newton's second law applied to a control volume:

$$\sum \vec{F} = \frac{\partial}{\partial t}\int_{CV} \vec{v}\rho \, dV + \oint_{CS} \vec{v}\rho (\vec{v} \cdot \hat{n}) \, dA$$

Forces include pressure, gravity, viscous stresses, and external forces.

Cauchy Momentum Equation

General differential form (valid for any continuous medium):

$$\rho \frac{D\vec{v}}{Dt} = -\nabla p + \nabla \cdot \boldsymbol{\tau} + \rho \vec{g}$$

where τ is the deviatoric stress tensor (viscous stresses for Newtonian fluids).

Navier-Stokes Equations

For incompressible Newtonian fluids with constant viscosity:

$$\rho\left(\frac{\partial \vec{v}}{\partial t} + (\vec{v} \cdot \nabla)\vec{v}\right) = -\nabla p + \mu \nabla^2 \vec{v} + \rho \vec{g}$$

∂v/∂t

Unsteady

(v·∇)v

Convection

μ∇²v

Diffusion

-∇p + ρg

Pressure + Gravity

Euler Equations (Inviscid)

When viscous effects are negligible (high Re, away from boundaries):

$$\rho \frac{D\vec{v}}{Dt} = -\nabla p + \rho \vec{g}$$

Conservation of Energy

First Law for a Control Volume

Energy balance including work and heat transfer:

$$\dot{Q} - \dot{W}_s = \frac{\partial}{\partial t}\int_{CV} e\rho \, dV + \oint_{CS} \left(e + \frac{p}{\rho}\right)\rho (\vec{v} \cdot \hat{n}) \, dA$$

where e = u + v²/2 + gz is specific energy (internal + kinetic + potential)

Differential Energy Equation

For a compressible fluid:

$$\rho \frac{De}{Dt} = -\nabla \cdot \vec{q} - p(\nabla \cdot \vec{v}) + \boldsymbol{\tau}:\nabla\vec{v}$$

Terms: heat conduction, pressure work, viscous dissipation

For Incompressible Flow

Often temperature can be treated separately from mechanics (weak coupling), and the energy equation simplifies to tracking temperature evolution via heat conduction and advection.

Bernoulli Equation

A special case of energy/momentum conservation for steady, inviscid, incompressible flow along a streamline:

$$p + \frac{1}{2}\rho v^2 + \rho g z = \text{constant along streamline}$$

p

Static pressure

½ρv²

Dynamic pressure

ρgz

Hydrostatic pressure

Extended Forms

Unsteady Bernoulli

$$\frac{p}{\rho} + \frac{v^2}{2} + gz + \int \frac{\partial v}{\partial t} ds = \text{constant}$$

With Head Loss (Engineering)

$$\frac{p_1}{\rho g} + \frac{v_1^2}{2g} + z_1 = \frac{p_2}{\rho g} + \frac{v_2^2}{2g} + z_2 + h_L$$

hL accounts for viscous losses (friction, minor losses)

Applications

Pitot Tube

Velocity from Bernoulli: v = √(2(p₀-p)/ρ) where p₀ is stagnation pressure

Venturi Meter

Flow rate from pressure difference using continuity + Bernoulli

Siphon

Flow driven by elevation difference - must stay above vapor pressure

Jet Propulsion

Momentum flux from nozzle provides thrust: F = ṁ(vexit - vinlet)

Interactive Simulations

Bernoulli Equation: Flow Through a Converging Nozzle

Python
script.py44 lines

Click Run to execute the Python code

Code will be executed with Python 3 on the server

Mass and Momentum Conservation in a Pipe Junction

Fortran
program.f9061 lines

Click Run to execute the Fortran code

Code will be compiled with gfortran and executed on the server

Detailed Derivations

Derivation: Continuity Equation from Mass Conservation

1

Consider a fixed, infinitesimal control volume dx dy dz in a flow field. Mass is conserved: the rate of mass increase inside equals the net mass flux inward through the surfaces.

2

Rate of mass increase inside the element:

$$\frac{\partial \rho}{\partial t}\,dx\,dy\,dz$$
3

Net mass flux through x-faces: mass in at x minus mass out at x+dx:

$$[\rho u]_x\,dy\,dz - [\rho u]_{x+dx}\,dy\,dz = -\frac{\partial(\rho u)}{\partial x}\,dx\,dy\,dz$$

Similarly for y-faces and z-faces.

4

Set rate of accumulation equal to net influx, cancel the volume element:

$$\boxed{\frac{\partial \rho}{\partial t} + \frac{\partial(\rho u)}{\partial x} + \frac{\partial(\rho v)}{\partial y} + \frac{\partial(\rho w)}{\partial z} = 0}$$
5

In vector notation:

$$\frac{\partial \rho}{\partial t} + \nabla\cdot(\rho\vec{v}) = 0$$

For incompressible flow (ρ = const): ∇·v = 0.

Derivation: Navier-Stokes Equations from Newton's Second Law

1

Apply Newton's second law to an infinitesimal fluid element of mass dm = ρ dx dy dz:

$$dm\,\frac{D\vec{v}}{Dt} = d\vec{F}_{\text{body}} + d\vec{F}_{\text{surface}}$$
2

Body forces (gravity): dFbody = ρg dV.

Surface forces (pressure + viscous stress): the net force in the x-direction from the stress tensor σij:

$$dF_x = \left(\frac{\partial \sigma_{xx}}{\partial x} + \frac{\partial \sigma_{yx}}{\partial y} + \frac{\partial \sigma_{zx}}{\partial z}\right)dx\,dy\,dz$$
3

Decompose the stress tensor into pressure and deviatoric (viscous) parts: σij = −pδij + τij. For a Newtonian fluid:

$$\tau_{ij} = \mu\left(\frac{\partial v_i}{\partial x_j} + \frac{\partial v_j}{\partial x_i}\right) + \lambda(\nabla\cdot\vec{v})\delta_{ij}$$

where λ = −2μ/3 (Stokes hypothesis).

4

Combining and dividing by dV, for incompressible flow (∇·v = 0):

$$\boxed{\rho\frac{D\vec{v}}{Dt} = -\nabla p + \mu\nabla^2\vec{v} + \rho\vec{g}}$$
5

The x-component written fully:

$$\rho\!\left(\frac{\partial u}{\partial t} + u\frac{\partial u}{\partial x} + v\frac{\partial u}{\partial y} + w\frac{\partial u}{\partial z}\right) = -\frac{\partial p}{\partial x} + \mu\!\left(\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} + \frac{\partial^2 u}{\partial z^2}\right) + \rho g_x$$

Three coupled, nonlinear, second-order PDEs plus the continuity constraint — together they are four equations for four unknowns (u, v, w, p).

Derivation: Bernoulli Equation Along a Streamline

1

Start with the Euler equation (inviscid, μ = 0) for steady flow (∂/∂t = 0):

$$(\vec{v}\cdot\nabla)\vec{v} = -\frac{1}{\rho}\nabla p + \vec{g}$$
2

Project along a streamline direction ds (where ds is tangent to v). Let v = |v| and note that (v·∇)v · ds = v dv:

$$v\,dv = -\frac{1}{\rho}\,dp - g\,dz$$
3

For incompressible flow (ρ = const), integrate along the streamline:

$$\int v\,dv = -\frac{1}{\rho}\int dp - g\int dz$$
4

Carrying out the integration:

$$\boxed{p + \frac{1}{2}\rho v^2 + \rho g z = \text{constant along a streamline}}$$
5

Assumptions: (i) Steady flow, (ii) Inviscid (frictionless), (iii) Incompressible (ρ = const), (iv) Along a single streamline, (v) No shaft work or heat transfer. Violations of any assumption require corrections (head loss, unsteady term, etc.).

Derivation: Energy Equation from the First Law of Thermodynamics

1

The first law for a fluid element (specific internal energy e, specific enthalpy h = e + p/ρ):

$$\rho\frac{De}{Dt} = \text{(heat added)} + \text{(work done on element)}$$
2

Heat flux by conduction (Fourier's law): q = −k∇T. Net heat added to the element per unit volume:

$$-\nabla\cdot\vec{q} = \nabla\cdot(k\nabla T)$$
3

Work by surface stresses on the element: −p(∇·v) (compression work) + Φ (viscous dissipation):

$$\Phi = \tau_{ij}\frac{\partial v_i}{\partial x_j} = \mu\left(\frac{\partial v_i}{\partial x_j} + \frac{\partial v_j}{\partial x_i}\right)\frac{\partial v_i}{\partial x_j} \geq 0$$

Viscous dissipation is always non-negative — it converts kinetic energy to heat.

4

Combining all terms:

$$\boxed{\rho\frac{De}{Dt} = -p(\nabla\cdot\vec{v}) + \Phi + \nabla\cdot(k\nabla T)}$$

For incompressible flow, ∇·v = 0 and the compression work term vanishes.

Derivation: Darcy-Weisbach Equation from Momentum Integral

1

Consider fully developed, steady flow in a horizontal pipe of diameter D and length L. The flow is driven by a pressure difference ΔP = P₁ − P₂.

2

Apply the momentum equation to a cylindrical control volume. For fully developed flow, momentum flux in equals momentum flux out. The balance is between pressure forces and wall shear:

$$\Delta P \cdot \frac{\pi D^2}{4} = \tau_w \cdot \pi D L$$
3

Solve for the pressure drop:

$$\Delta P = \frac{4\tau_w L}{D}$$
4

Define the Darcy friction factor f via the non-dimensionalisation τw = (f/8)ρV²:

$$\boxed{\Delta P = f\,\frac{L}{D}\,\frac{\rho V^2}{2}}$$
5

For laminar flow, comparison with the Hagen-Poiseuille solution gives f = 64/Re. For turbulent flow, f depends on Re and relative roughness ε/D — determined from the Colebrook equation or the Moody diagram.

Control Volume Diagram

Mass flux, pressure forces, and body forces acting on a fixed control volume in a flow field.

Control Volume(CV)ṁ₁ = ρ₁A₁v₁ṁ₂ = ρ₂A₂v₂P₁A₁P₂A₂ρgVCS = Control Surface (dashed boundary)Mass fluxPressureBody forceOutward normal

Advanced Simulations

Bernoulli Applications: Venturi Meter & Pitot Tube

Python
script.py51 lines

Click Run to execute the Python code

Code will be executed with Python 3 on the server

Pipe Flow Pressure Drop & Moody Diagram Data

Python
script.py76 lines

Click Run to execute the Python code

Code will be executed with Python 3 on the server