Skip to content
Get started

4. Finite-volume balance

Can every cell account for what crosses its boundary?

Section titled “Can every cell account for what crosses its boundary?”

A finite volume is a small accounting region. Its source must be balanced by what leaves its faces. If two neighboring cells disagree about their shared face flux, adding their balances creates or destroys a quantity inside the domain.

We use the same dimensionless Poisson problem as the finite-element lesson: u=π2sin(πξ)-u''=\pi^2\sin(\pi\xi) on [0,1][0,1], with zero endpoint values. You can start here knowing only that its exact solution is u=sin(πξ)u=\sin(\pi\xi).

Define the rightward diffusive flux q=uq=-u'. Then q=fq'=f. For cell KiK_i, bounded by ξi1/2\xi_{i-1/2} and ξi+1/2\xi_{i+1/2},

qi+1/2qi1/2=Kifdξ.q_{i+1/2}-q_{i-1/2}=\int_{K_i} f\,d\xi.

The minus sign at the left face represents its leftward outward normal. The unknown UiU_i now lives at the cell center rather than at a mesh vertex.

text
cell K_i cell K_(i+1)
|----------●----------|----------●----------|
U_i → U_(i+1)
shared face
<--------- h -------->
center-to-center distance

Conceptual sketch of two equal cells. The arrow fixes one positive flux direction at the shared face. The same flux leaves the left cell and enters the right cell; the two outward contributions have opposite signs.

For an orthogonal uniform mesh, approximate the shared flux by

qi+1/2=Ui+1Uih.q_{i+1/2}=-\frac{U_{i+1}-U_i}{h}.

Substituting both faces gives

Ui1+2UiUi+1h=Kifdξ.\frac{-U_{i-1}+2U_i-U_{i+1}}h=\int_{K_i}f\,d\xi.

Its resemblance to the finite-element interior equation does not make the methods identical. The unknown locations, load construction, boundary treatment, and reconstruction differ.

At the left boundary, the first center is distance h/2h/2 from the prescribed value uD=0u_D=0. The rightward boundary flux is

q1/2=U1uDh/2.q_{1/2}=-\frac{U_1-u_D}{h/2}.

The cell’s outward flux there is q1/2-q_{1/2}. Using a full-cell distance would halve this boundary conductance. A plot could remain smooth while solving a different boundary approximation.

With one cell covering the entire interval, the center value is UU. Each outward endpoint flux is 2U2U, so

4U=01π2sin(πξ)dξ=2π,U=π/2.4U=\int_0^1\pi^2\sin(\pi\xi)\,d\xi=2\pi, \qquad U=\pi/2.

The exact center value is 1. This deliberately coarse, hand-derived solution shows that conservation alone does not guarantee a small field error.

Summing every cell equation cancels each interior face contribution once with a positive sign and once with a negative sign:

q(1)q(0)=01fdξ=2π.q(1)-q(0)=\int_0^1 f\,d\xi=2\pi.

The exact solution gives q(0)=πq(0)=-\pi and q(1)=πq(1)=\pi, consistent with that prediction. In several dimensions, replace endpoint fluxes by integrals over faces and use each face’s outward normal. The two-point approximation relies on the geometry connecting cell centers appropriately to faces; an arbitrary skew mesh needs more than the formula above. Eymard, Gallouët, and Herbin study this method and its error on admissible meshes in their TPFA analysis.

Compare the same equation through both methods

Section titled “Compare the same equation through both methods”

Reuse the .eqi model in the finite-element lesson. From the source checkout:

Terminal windowbash
cargo run -p eqiora-numerics --example poisson_convergence

Inspect fvm_l2, fvm_order, and fvm_relative_balance. The program supplies one mathematical model to both methods; it does not rewrite the source for FVM. Its run source shows that common input explicitly.

The FVM error column uses a continuous, piecewise linear reconstruction through cell centers and boundary values. It is not the error of the raw piecewise constant cell field. The distinction becomes important in the next lesson.

In a Python application, eqiora.fvm.CellCenteredTpfa() selects the scalar two-point-flux policy. The method is a numerical choice; the source and boundary relations remain properties of the model. After deriving the flux, this policy is the reusable implementation you select.

Consider two cells with an interior rightward flux of 3. Their shared-face outward contributions must be +3+3 and 3-3. If you write +3+3 in both balances, the domain sum acquires a false source of 6. This is a paper experiment: it isolates the orientation error without changing Eqiora’s implementation.

The same accounting matters in fluid mechanics and heat transport. A detailed velocity or temperature picture cannot substitute for the integrated balance.

  1. Derive the first-cell equation for a uniform mesh, including its boundary flux. Explain why its diagonal differs from an interior diagonal.
  2. In the one-cell example, intentionally use distance 1 at each boundary. Compute the resulting UU and explain what became inconsistent.
  3. Use three symbolic cell balances to demonstrate interior cancellation.
  4. Why is an accurate total boundary flux compatible with an inaccurate center value on the one-cell mesh?
  5. Describe which geometrical assumption makes the two-point face gradient reasonable, and why a strongly skew line between centers can violate it.

Previous: Weak forms and finite elements · Book map · Next: Refinement and reproducibility