The formulation is valid for an arbitrary number n of horizontal layers. Layer properties are piecewise constant, depth is positive downward, and heat flow is expressed as an upward-positive magnitude.
1. Layer notation and governing equation
Interfaces0 = z0 < z1 < ··· < zn = L
Layer thicknesshi = zi − zi−1
Layer propertiesAi, ki; i = 1, …, n
Numerical cellsM cells; Δz = L/M
(1)
(2)
The boundary conditions are T(0) = Ts and q(L) = qb. Temperature and heat flow remain continuous at every interface.
2. Exact piecewise solution for n layers
The heat flow at the top of layer i includes the basal contribution and the heat produced in layer i and all deeper layers:
(3)
Within layer i, define local depth ξ = z − zi−1, where 0 ≤ ξ ≤ hi. The exact solution is
(4)
The next layer starts from the values obtained at ξ = hi:
(5)
3. Cell-centered finite-volume discretization
The interval 0 ≤ z ≤ L is divided into M cells. Each cell center receives the A and k values of its containing geological layer. Conductivity at an internal cell face is the harmonic mean:
(6)
For an interior cell p = 1, …, M−2, flux balance gives
(7)
The surface half-cell conductance is Gs = 2k0/Δz. The first and last rows of the matrix are
(8)
4. Calculation procedure
- Validate and order the n layer interfaces, then convert km, µW m⁻³, and mW m⁻² to SI units.
- Evaluate the exact piecewise solution by starting with qb and propagating heat flow and temperature through all layers.
- Assign A and k to M finite-volume cells, construct the tridiagonal system from Equations (6)–(8), and solve it with the Thomas algorithm.
- Interpolate the analytical solution at numerical cell depths and report max |TFV − Tanalytical|. Increase M to assess grid convergence.
Computational cost: the tridiagonal solve requires O(M) operations and O(M) storage. The analytical calculation requires O(n + P) operations, where P is the number of plotted sample points.