heat1d implements four numerical methods for the 1-D heat equation: three
finite-difference time-stepping schemes following Hayne et al. (2017), Appendix
A2 (Eqs. A13--A20), and a frequency-domain Fourier-matrix solver that eliminates
time-stepping entirely.
The heat equation on a non-uniform grid is discretized using the flux-conservative
form. For interior node
where the geometric coefficients
The explicit scheme (Eq. A17) updates temperatures using only values from the current time step:
where
Stability: The explicit scheme is conditionally stable, requiring the CFL condition:
where F ≤ 0.5 is the Fourier mesh number. For typical Moon parameters, this limits the time step to ~3000 s (~830 steps per lunar day).
The fully implicit scheme evaluates spatial derivatives at the new time level
where:
This forms a tridiagonal system that is solved using the Thomas algorithm (see below).
Stability: The implicit scheme is unconditionally stable for the interior
nodes, which see fixed Dirichlet boundary values from the Newton-converged
surface temperature. The unconditional stability of implicit methods applies
strictly to linear problems; the nonlinear
Accuracy: First-order in time (O(Δt)), same as explicit.
The Crank-Nicolson scheme averages the explicit and implicit contributions, achieving second-order accuracy in time:
The left-hand side forms a tridiagonal system with half-coefficients, while the right-hand side uses the old temperature values.
Stability: Unconditionally stable for the interior tridiagonal system, like the fully implicit scheme. See Boundary Conditions for how the nonlinear surface BC is handled.
Accuracy: Second-order in time (O(Δt²)), the most accurate of the three schemes for a given time step.
Boundary values: The Crank-Nicolson scheme requires both old and new boundary values. The old values (before the BC update) contribute to the explicit half of the RHS, while the new values contribute to the implicit half of the LHS.
Both the implicit and Crank-Nicolson schemes produce tridiagonal linear systems of the form:
where
The Thomas algorithm (Tri-Diagonal Matrix Algorithm) solves this in O(n) time using forward elimination and back-substitution:
Forward sweep:
Back-substitution:
The algorithm is numerically stable for the heat equation because the coefficient matrix is always diagonally dominant:
The Fourier-matrix solver takes a fundamentally different approach: instead of marching forward in time, it solves for the periodic steady-state temperature directly in the frequency domain. This eliminates time-stepping and equilibration entirely, providing ~100--1000× speedup over the finite-difference methods.
For a periodic surface forcing with period
where
For a single frequency
where
accumulated from the deepest layer to the surface, gives the global transfer from the bottom boundary to the surface. The surface thermal impedance is:
where
giving
The surface energy balance
is nonlinear in
where
The Newton update at each iteration is:
where
The nonlinear temperature dependence of thermal conductivity (K ∝ 1 + χT³/350³) produces a net downward heat transport known as thermal pumping or the solid-state greenhouse effect. Because conductivity is higher when the near-surface is hot (daytime), more heat flows downward during the day than upward at night. This elevates subsurface temperatures above what a linear model would predict.
The solver captures this through an outer iteration loop:
-
Freeze properties at the current equilibrium profile
$\bar{T}(z)$ -
Solve the linearized frequency-domain problem (inner Newton loop)
-
Compute rectification flux
$J_{\text{pump}}(z) = \langle K(T) \partial \tilde{T}/\partial z \rangle$ from the time-domain reconstruction of$T(z,t)$ and the exact nonlinear$K(T)$ , where$\tilde{T}(z,t) = T(z,t) - \bar{T}(z)$ is the AC (oscillatory) component and$\langle \cdot \rangle$ denotes the time average over one period -
Update the equilibrium profile by integrating
$$ d\bar{T}/dz = (Q_b - J_{\text{pump}}(z)) / K_{\text{eff}}(z) $$
downward from the surface using 4th-order Runge-Kutta, where
$K_{\text{eff}}(z) = \langle K(T(z,t)) \rangle$ is the exact time-averaged conductivity computed from the full reconstructed$T(z,t)$ -
Repeat until the mean surface temperature converges (typically 3--5 outer iterations)
Once the surface temperature is converged, the full
The DC component uses the equilibrium profile
The Fourier-matrix solver is ~1000× faster than time-stepping for a single diurnal cycle because:
- No equilibration orbits are required (the solution is already periodic)
- All frequencies are solved simultaneously via matrix operations
- The Newton iteration converges in O(10) iterations rather than O(10³) time steps
- A complete lunar diurnal cycle is solved in ~100 ms
- Assumes periodic forcing (cannot model transient events like eclipses)
- Linearizes subsurface conduction around the equilibrium profile (corrected by outer iteration, but may be less accurate for extreme temperature swings)
- Does not support PSR (bowl-shaped crater) geometry
| Scheme | Method | Accuracy | Stability | Steps/lunar day | Relative Speed |
|---|---|---|---|---|---|
| Explicit | Forward Euler | O(Δt) | Conditional | ~830 | 1× |
| Implicit | Backward Euler + TDMA | O(Δt) | Unconditional | ~24 | ~35× |
| Crank-Nicolson | Semi-implicit + TDMA | O(Δt²) | Unconditional | ~24 | ~35× |
| Fourier-matrix | Frequency domain | Spectral* | N/A (periodic) | N/A | ~1000× |
*Fourier-matrix accuracy is controlled by the number of harmonics N, not by a time-step size. Truncation errors decay exponentially with N for smooth forcing (spectral convergence). In practice, N ~ 100–500 harmonics suffice for sub-mK accuracy on the lunar diurnal cycle.
For time-stepping applications, the Crank-Nicolson scheme is recommended: it offers second-order accuracy with the same unconditional stability as the fully implicit scheme.
For periodic steady-state problems (the most common use case), the Fourier-matrix
solver is strongly preferred. It is the default equilibration solver
(equil_solver = "fourier-matrix" in Configurator), and when used as the
primary solver (solver = "fourier-matrix"), it bypasses equilibration entirely.
Even when the output phase uses a time-stepping solver (e.g., for eclipse
modeling or external flux series), the Fourier-matrix solver is used by default
for the equilibration phase. It computes the periodic steady-state temperature
profile directly, then initializes the time-stepping solver from
Biele, J., Grott, M., Kührt, E., & Kossacki, K. J. (2022). Specific heat capacity measurements of meteorites and their constituents. International Journal of Thermophysics, 43, 144. doi:10.1007/s10765-022-03067-y
Carslaw, H. S., & Jaeger, J. C. (1959). Conduction of Heat in Solids (2nd ed.). Oxford University Press.
Hayne, P. O., et al. (2017). Global regolith thermophysical properties of the Moon from the Diviner Lunar Radiometer Experiment. J. Geophys. Res. Planets, 122, 2371--2400. doi:10.1002/2017JE005387
Kundert, K. S., & Sangiovanni-Vincentelli, A. (1986). Simulation of nonlinear circuits in the frequency domain. IEEE Trans. Computer-Aided Design, 5(4), 521--535. doi:10.1109/TCAD.1986.1270223
Linsky, J. L. (1966). Models of the lunar surface including temperature-dependent thermal properties. Icarus, 5, 606--634. doi:10.1016/0019-1035(66)90075-3
Maillet, D., André, S., Batsale, J.-C., Degiovanni, A., & Moyne, C. (2000). Thermal Quadrupoles: Solving the Heat Equation through Integral Transforms. Wiley. doi:10.1002/9780470694374
Pipes, L. A. (1957). Matrix analysis of heat transfer problems. Journal of the Franklin Institute, 263(3), 195--206. doi:10.1016/0016-0032(57)90927-6
Schorghofer, N., & Khatiwala, S. (2024). Semi-implicit numerical schemes for surface energy balance and subsurface heat conduction with phase change. The Planetary Science Journal, 5, 120. doi:10.3847/PSJ/ad4351
Williams, G. P., & Curry, A. R. (1977). A note on the numerical solution of the heat equation with radiation boundary condition. International Journal for Numerical Methods in Engineering, 11, 1605--1611. doi:10.1002/nme.1620111012