JOVANA
Explore Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Finite Volumes and Conservation

Finite elements minimize an error in an averaged sense; the finite volume method does something different and, for fluids, more precious — it keeps the books exactly, so that not one gram of mass leaks out of the numerical world. This guide builds the method from a single accounting idea, then meets the numerical flux and the upwinding that make it work.

A different virtue: keep the books exactly

The first four guides of this rung built one machine: restate a PDE in its weak form, span the solution with mesh shape functions, apply Galerkin projection, and solve the resulting stiffness-matrix system. That machine is superb at elliptic problems like elasticity and steady heat — places where the right thing to ask of an approximation is that it be close, in an averaged, energy sense, to the true solution. But there is a whole world of physics where 'close' is not the property you most need to protect. When you simulate air rushing over a wing or a flood moving down a river, the quantity you must never quietly violate is conservation: the mass, momentum, and energy in the system can only change by flowing across its boundary, never by leaking into thin air through a rounding slip in your scheme.

Why does conservation deserve to be the master principle? Because the governing equations of fluids are themselves conservation laws in disguise — statements that the rate of change of stuff inside any region equals the net flow of stuff across that region's boundary. A scheme that respects this exactly will get shock positions, total mass, and long-time behaviour right even when it is coarse; a scheme that violates it can look smooth and plausible and still drift to a physically impossible answer, manufacturing or destroying mass a sliver at a time until, after a million steps, the river holds the wrong amount of water. The finite volume method (FVM) is built from the ground up to make that kind of leak structurally impossible. It is the workhorse of computational fluid dynamics for exactly this reason.

From a conservation law to a control volume

Start with the simplest conservation law in one dimension: u_t + f(u)_x = 0. Read it physically. The quantity u is a density — say mass per unit length — and f(u) is its flux, the rate at which that quantity streams past a point. The equation says the density changes in time only because more flux comes in one side than leaves the other. For pure transport at speed a, the flux is f(u) = a*u; for traffic or shallow water it is nonlinear, but the form is the same. The finite element method would now multiply by a test function. The finite volume method does something more literal and more physical: it picks up the equation and integrates it over a small chunk of space, a control volume, asking not 'does this hold pointwise?' but 'is the budget balanced for this cell?'.

Chop the line into cells; call cell i the interval from x_{i-1/2} to x_{i+1/2}, of width h. Integrate u_t + f(u)_x = 0 over that cell. The first term becomes the rate of change of the total amount in the cell; the second term, by the fundamental theorem of calculus, collapses to a difference of fluxes at the two faces: the flux entering the left face minus the flux leaving the right face. Define U_i(t) as the cell average, the integral of u over cell i divided by h — not a value at a point, but the average density in the whole cell. The exact, no-approximation-yet budget for cell i is h * dU_i/dt = f(u at x_{i-1/2}) - f(u at x_{i+1/2}). This is just bookkeeping made precise: the stock in a bin changes at exactly the rate stuff flows in minus the rate it flows out.

conservation law:    u_t + f(u)_x = 0        u = density,  f(u) = flux

integrate over cell i = [x_{i-1/2}, x_{i+1/2}],  width h,  U_i = cell average

   d/dt ( integral of u over cell i )  +  [ f at right face - f at left face ]  =  0

   h * dU_i/dt  =  f(x_{i-1/2})  -  f(x_{i+1/2})        <- EXACT so far

   replace true face fluxes by NUMERICAL fluxes F:

   dU_i/dt  =  -( F_{i+1/2} - F_{i-1/2} ) / h

   note: F_{i+1/2} leaves cell i and ENTERS cell i+1 with the SAME value
         -> whatever cell i loses, cell i+1 gains  -> nothing is created
The finite volume idea in one column. Integrating the conservation law over a cell turns it into an exact flux balance; the only approximation is the choice of numerical flux F at each shared face. Because neighbouring cells use the identical F, conservation is built into the data structure, not hoped for.

The numerical flux is where conservation becomes automatic

The budget above is exact, but it asks for the true flux at each cell face, and we do not have the true solution there — we only know cell averages, one number per cell. So we must guess each face flux from the cell averages on its two sides. That guess is the numerical flux, written F_{i+1/2}, a function of the left and right neighbours: F_{i+1/2} = F(U_i, U_{i+1}). Replacing the exact face flux by F turns the exact budget into a computable update, dU_i/dt = -(F_{i+1/2} - F_{i-1/2}) / h. Everything now hinges on choosing F well — and here lies the single most important structural fact of the whole method.

Notice that the face between cell i and cell i+1 is shared: it is the right face of i and the left face of i+1. If both cells compute their flux there from the same formula F(U_i, U_{i+1}), they use the literally identical number. So whatever amount the update subtracts from cell i across that face is exactly the amount it adds to cell i+1. Sum the update over all cells and the interior fluxes cancel in pairs — a telescoping sum — leaving only the fluxes at the two far ends of the domain. The total amount of u in the whole grid therefore changes only through the outer boundary, which is precisely conservation, and it holds to machine precision regardless of how coarse the mesh is or how crude F is. This is the deep reason FVM is trusted: conservation is not an accuracy property you tune toward, it is an algebraic identity of the bookkeeping.

Upwinding: respecting which way the wind blows

What should F(U_i, U_{i+1}) be? The naive choice is the average, F = a * (U_i + U_{i+1}) / 2 for the linear flux f(u) = a*u. Substitute it and you discover, to your dismay, that you have rebuilt a centred scheme — and as you saw two guides back, a centred space discretization of pure advection has imaginary semi-discrete eigenvalues and is unstable under forward Euler, blowing up no matter how small the step. The fix is one of the most physical ideas in all of numerical PDEs: upwinding. Information in u_t + a*u_x = 0 travels in one direction, at speed a. If a > 0 the wind blows left to right, so the value arriving at a face comes from the cell on its left — the upwind side. Take the flux from there: F_{i+1/2} = a*U_i when a > 0, and F_{i+1/2} = a*U_{i+1} when a < 0. Do not average across the wind; look into the wind.

This is exactly the upwind scheme you met under finite differences, now arising organically from the flux picture, and it is stable — but only conditionally. Marching it in time with forward Euler is stable only when the CFL condition holds: the dimensionless number |a|*h_t/h, called the Courant number, must be at most 1. Physically the CFL number is the fraction of a cell the wind crosses in one time step, and the condition says you may not let information skip over a cell in a single step — the numerical domain of dependence must contain the true one. Upwinding makes the scheme stable; the CFL number tells you how large a step that stability permits. Implicit time-stepping lifts the CFL cap at the cost of solving a linear system each step, the same trade you weighed in the finite-difference rung.

Upwinding buys stability, but it is only first-order accurate, O(h), and that low order shows up as heavy numerical dissipation — a sharp step in u is smeared into a gentle ramp, as if the scheme had quietly added a dose of artificial viscosity. Sharpen it by reconstructing a sloped line inside each cell instead of a flat average (a higher-order reconstruction), and accuracy jumps to O(h^2) on smooth parts. But raw high-order reconstruction overshoots near a shock, inventing spurious wiggles — the same dispersion ringing that haunts high-order schemes. The cure is a slope limiter: it watches the data and flattens the reconstructed slope back toward first order wherever the solution is steepening into a shock, keeping the crisp resolution of a high-order method on smooth flow while refusing to manufacture new maxima or minima at discontinuities.

Where finite volumes sit, and the honest fine print

Step back and see the family. Finite differences ask the PDE to hold at points; finite elements ask it to hold weakly, against test functions, minimizing an error in an averaged energy sense; finite volumes ask each cell's budget to balance, enforcing conservation as an identity. These are three answers to the same question — how do I turn a continuous PDE into finitely many equations? — and each has a domain where it shines: finite elements for structures and elliptic problems on complex geometry, finite volumes for conservation laws and fluids, finite differences for simple regular domains. They even blend: the discontinuous Galerkin method fuses finite elements' high-order shape functions inside each cell with finite volumes' flux exchange across cell faces, getting both high accuracy and exact conservation at once.

The honest caveats are the usual disciplines of this whole ladder, sharpened by the fluids setting. Every numerical answer is approximate: the face fluxes are guessed from neighbours, the cell integrals are themselves evaluated by cell averaging, and all of it runs in floating point. Accuracy is still conditioning times stability, so a beautifully conservative scheme on a badly distorted mesh, or near a near-singular shock, can still lose digits; conservation protects the global budget, not the local conditioning. Nonlinear fluxes like the shallow-water or Euler equations make even the right flux a research topic — exact and approximate Riemann solvers exist precisely because choosing F(U_i, U_{i+1}) correctly across a shock is genuinely hard, and a careless flux can converge briskly to a confidently wrong, non-physical solution.