Skip to content

energy.c: Energy fluxes

Source under test: energy.c

Cases

Disabled transport mechanisms carry zero flux

Reference-pinned test: tests/test_energy.py::test_disabled_transport_mechanisms_carry_zero_flux

Reference: Analytical limit: a disabled transport mechanism carries zero flux, and with only conduction enabled the total flux equals the conductive flux at every node except the surface node, which carries the grey-body boundary flux.

Tolerance: abs 1e-20 W/m^2 on the disabled fluxes, at least 17 decades below the active fluxes (convection 9e8 to 2e9 W/m^2 with conduction off; conduction 1.9e-3 to 1.3e-2 W/m^2 in the conduction-only run); rel 1e-12 on the conduction-only identity, and the surface node differs by more than 1e3 W/m^2.

Command: make, then pytest -o addopts= tests/test_energy.py::test_disabled_transport_mechanisms_carry_zero_flux

Discrimination guards: Convection stays active when conduction is off (wrong-path guard); at the surface node the grey-body boundary flux differs from the conductive flux, so the identity holds at the interior nodes only; a scale bound on the full-physics flux. The sibling test in the same file asserts that the total flux is the sum of the components at the interior nodes.

The flux assembly is validated through its superposition structure: each transport term can be switched off through its runtime option, and the total must reproduce the remaining terms to output precision. This pins the dispatch wiring between the options, the individual flux routines, and the total used by the time integration.

Radiogenic heating pins two isotope decay

Reference-pinned test: tests/test_energy.py::test_radiogenic_heating_pins_two_isotope_decay

Reference: Analytical limit: radiogenic heating is the sum over isotopes of concentration times abundance times heat production, decaying as 2^(-(t - t0)/half_life). A two-isotope configuration with 100-year and 200-year half-lives pins the sum at t = 0 and the weighted decay factor 0.2506 after 200 years.

Tolerance: rel 1e-6 on the initial sum, rel 1e-4 on the decay factor.

Command: make, then pytest -o addopts= tests/test_energy.py::test_radiogenic_heating_pins_two_isotope_decay

Discrimination guards: A dropped isotope shifts the sum by 2.4e-3 relative; the two-isotope decay factor is resolved from the single-isotope values 0.25 and 0.5 and from the no-decay value 1.0.

Steady-state IC balances interior and surface

Reference-pinned test: tests/test_energy.py::test_steady_state_ic_balances_interior_and_surface

Reference: Analytical limit: the steady-state initial condition equalises the energy flow through every basic node and closes the surface radiation balance sigma (T_surf^4 - teqm^4) with the Stefan-Boltzmann constant of constants.c.

Tolerance: Relative energy-flow spread below 1e-8 (observed 2e-11); grey-body pin at rel 1e-5.

Command: make, then pytest -o addopts= tests/test_energy.py::test_steady_state_ic_balances_interior_and_surface

Discrimination guards: A T^3 exponent slip misses the flux by roughly a factor of the surface temperature (about 2000 here); sign and scale bounds on the flux.