Skip to content

Examples ​

The examples/ folder holds runnable drivers that set up a complete model, call the solver and write ParaView output. They are meant to be read as well as run: each file states its physics, its parameters and its run-length knobs in the header, and each sets every optional physics flag explicitly rather than inheriting a default.

ExampleDimensionDriverPage
Onset of convection: growth rates and the critical Rayleigh number2-D spherical annulusexamples/annulus_onset_2d.jlOnset of convection
Isoviscous convection at Ra = 10⁴, 10⁵, 10⁶2-D spherical annulusexamples/annulus_convection_2d.jlIsoviscous convection
A plume rising from the core-mantle boundary2-D spherical annulusexamples/annulus_plume_2d.jlPlume from the CMB
Boussinesq, TALA and ALA at three dissipation numbers2-D spherical annulusexamples/annulus_compressible_2d.jlBoussinesq, TALA and ALA
Purely internal heating with an insulating core at Ra = 10⁴, 10⁵, 10⁶2-D spherical annulusexamples/annulus_internal_heating_2d.jlInternal heating
Stagnant lid that fails: Arrhenius viscosity and a yield stress2-D spherical annulusexamples/annulus_stagnant_lid_2d.jlStagnant lid
Whole-mantle or layered convection with an endothermic phase change2-D spherical annulusexamples/annulus_phase_layering_2d.jlPhase-change layering
Planform of convection with a stiff lower mantle, four viscosity profiles2-D spherical annulusexamples/annulus_bunge_2d.jlStiff lower mantle
Mobile to stagnant lid: the same shell at viscosity contrasts 1 to 10⁶2-D spherical annulusexamples/annulus_stagnant_lid_2d.jlMobile to stagnant lid
Earth's mantle with a Perple_X reference state and the Steinberger & Calderwood viscosity2-D spherical annulusexamples/annulus_earth_steinberger_2d.jlEarth's mantle
Primordial and recycled material in the lower mantle over 4.5 Gyr2-D spherical annulusexamples/annulus_primordial_recycled_2d.jlPrimordial material
Mobile, episodic, plutonic-squishy and stagnant lids with magmatism over 4.5 Gyr2-D spherical annulusexamples/annulus_lid_regimes_2d.jlTectonic regimes
Mars and Mercury over 4.5 Gyr, with and without a crust (runs in progress)2-D spherical annulusexamples/annulus_fleury_thermal_evolution_2d.jlMars and Mercury
Three continental rafts and three slabs over 1 Gyr2-D spherical annulusexamples/annulus_continents_2d.jlContinents
Plume planforms at Ra = 10⁴, 10⁵, 10⁶3-D Yin-Yang shell, 2 MPI ranksexamples/yinyang_convection_3d.jl3-D plume planforms

Batch scripts for all of them are in hpc/, described in Running on HPC.

Every example at a glance, in the order of the menu: short preview runs of the 2-D drivers (temperature from cold blue to hot red, except composition for primordial material; grids and run lengths on each page) and the hot-temperature isosurface of the 3-D shell at Ra = 10⁶.

Common conventions ​

Geometry. Every 2-D example runs in the spherical annulus, cfg.geometry = "spherical_annulus", whose radial measure is r2dr, so the core-mantle boundary carries the area ratio of a sphere. All examples use the same shell: ri/ro=1.22/2.22=0.5495, scaled to a mantle D=1000 km thick (Rin=1220 km, Rout=2220 km). The 3-D example uses the same radii on the Yin-Yang grid. The shared 2-D set-up lives in examples/common_2d.jl:

helperwhat it does
ht_shell!(cfg, mat; Nr)the shell above, uniform radial grid, Nt = 8 Nr
boussinesq_only!(cfg, temp)clears every optional physics flag, selects Boussinesq, an isothermal CMB, net-rotation removal and MUMPS
eta_for_Ra(Ra, cfg, ΔT)viscosity for which ρ0gαΔTD3/(κη)=Ra
set_uniform_eta!(cfg, mat, η)a constant viscosity on the simple viscosity path
apply_env_overrides!(cfg)reads MILEVA_MAXSTEPS, MILEVA_MAXTIME_MYR, MILEVA_OUTDIR, MILEVA_VTKEVERY
window_mean, csv_window_meantime averages over the last third of a run

Rayleigh number. All examples are dimensional runs of a nondimensional problem. With ρ0=3300 kg m⁻³, g=9.81 m s⁻², α=3×10−5 K⁻¹, κ=10−6 m² s⁻¹ and D=1000 km, the viscosity

η=ρ0gαΔTD3κRa

is 9.7×1022, 9.7×1021 and 9.7×1020 Pa s at Ra=104,105,106 for ΔT=1000 K. The drivers' end-of-run summaries and the 3-D diagnostics_3d.csv give Vrms nondimensionally as VD/κ; the 2-D diagnostics.csv and log line give cm/yr (Vrms_cmyr, Vsurf_rms_cmyr); Vrms=100 in units of κ/D is 0.32 cm/yr. Time is given in thermal diffusion times D2/κ=31700 Myr.

Resolution. Science runs start at Nr = 64. Coarser grids appear on these pages only as quick smoke tests.

Output. 2-D runs write diagnostics.csv (one row per cfg.logEvery steps, columns defined in utils/diagnostics_csv.jl), VTK frames under vtk/, six-panel figures under figures/ and checkpoints under checkpoints/, all below output/examples/<case>/ unless MILEVA_OUTDIR is set. The 3-D driver writes its own diagnostics_3d.csv, per-patch .vts files with a .vtm per step, and a .pvd collection.

Headless rendering

The 2-D drivers load Plots before include/mileva.jl, as Getting started requires. On a machine without a display, set GKSwstype=nul so the GR backend renders figures off screen.

Cost on a laptop ​

Measured on the development laptop (Apple M4, 16 GB, 2 Julia threads, 40 steps, VTK and figures included), October 2026:

drivergrids/steppeak memory
annulus_convection_2d.jl 1e5 64 664 × 5120.412.3 GB
annulus_plume_2d.jl 1e6 6464 × 5120.562.4 GB
annulus_stagnant_lid_2d.jl 1e6 64 1e4 1e-11 864 × 5120.702.7 GB

The number of steps a run needs is set by the CFL condition and the model-time cap, so it differs between examples by orders of magnitude; each page gives the cap. The 3-D example is meant for a cluster; its cost is discussed on its page.