the Creative Commons Attribution 4.0 License.
the Creative Commons Attribution 4.0 License.

On stabilisation of compositional density jumps in compressible mantle convection simulations
Large density jumps in numerical simulations of solid Earth dynamics can cause numerical “drunken sailor” oscillations. An implicit method has previously been shown to be very effective in stabilising the density jump that occurs at a free surface against such instabilities (Kaus et al., 2010; Duretz et al., 2011). Here the use of this to prevent oscillations of compositional layers deeper in the mantle is examined. If the stabilisation algorithm uses the total density field including the steady increase of density with depth due to adiabatic compression and jumps due to phase transitions, then a severe artificial reduction in convective vigour occurs because the algorithm assumes that density is advected with the flow but these density gradients are not. This artificial vigour reduction increases with Rayleigh number but decreases with decreasing grid spacing. Thus, it is essential to use only composition-related density gradients in the stabilisation algorithm, and a simple method for isolating these is presented. Once this is done, the stabilisation method works effectively for internal compositional layers as well as a free surface.
- Article
(1459 KB) - Full-text XML
- BibTeX
- EndNote
Density jumps due to treatment of a free surface by the “sticky air” method (e.g. Crameri et al., 2012), in which the surface is represented as an abrupt interface between rock and low-density, low-viscosity “air”, can induce numerical “drunken sailor” instabilities, in which the free surface oscillates up and down on successive time steps, overshooting its equilibrium position. To cure this problem, an implicit free-surface stabilisation algorithm was introduced, initially for the finite-element discretisation (Kaus et al., 2010; Andrés-Martínez et al., 2015) and then for the staggered-grid finite-difference (equivalent to finite-volume) discretisation (Duretz et al., 2011). The basis of this scheme is that when calculating the flow field, the change in buoyancy due to advection of density during a time step is treated implicitly; while this is applied throughout the domain, by far the largest correction comes from advection of the free surface. It is very effective in stabilising the free surface, allowing a normal (e.g. Courant condition limited) time step to be used (Kaus et al., 2010; Duretz et al., 2011). A subsequent rigorous stability analysis led to an alternative approach using an explicit scheme based on nonstandard finite differences (Rose et al., 2017). Fully implicit time stepping in the entire domain is another alternative (Popov and Sobolev, 2008; Kramer et al., 2012).
In global mantle convection simulations, compositional density jumps can also arise inside in the mantle, typically due to a primordial layer of dense material above the core–mantle boundary (CMB) (e.g. Gurnis, 1986; Tackley, 1998; Davaille, 1999; Deschamps et al., 2011) or a layer of dense subducted basaltic crust above the CMB (e.g. Christensen and Hoffmann, 1994; Ogawa, 2000; Nakagawa and Tackley, 2015), and although the associated density difference is much smaller than that at a free surface, it can sometimes be enough to also induce numerical “drunken sailor” oscillations. Thus, it is tempting to apply the implicit density-jump stabilisation (DJS) algorithm throughout the domain. However, a key assumption of the algorithm is that density is advected with the flow, but this is not the case for the steady density increase with depth (pressure) due to adiabatic compression or density jumps due to solid–solid phase transitions, the most important of which cause the 410 and 660 km seismic discontinuities. According to the most commonly used Earth model PREM (Preliminary Reference Earth Model) (Dziewonski and Anderson, 1981), the density jump at 660 km is about 10 %, while the density increase due to combined compression and phase transitions from the surface to the CMB is about 65 %. If the DJS algorithm is applied to these density gradients, then a substantial artificial reduction in convective vigour results, as shown later. Thus, it is important to apply the DJS algorithm only to density gradients or jumps due to compositional gradients and not density gradients/jumps due to adiabatic compression or phase transitions.
In this paper, a test code written in the Julia programming language (Bezanson et al., 2017) is used first to again demonstrate the effectiveness of the DJS algorithm for stabilising a free surface, to additionally show its effectiveness in preventing oscillations of a dense layer above the CMB, and then to quantify the artificial reduction in convective vigour when applying it to total density in a setup that includes adiabatic compression and/or a phase transition. A way of separating composition-related density gradients from the total density gradient for arbitrary density functions is then presented.
2.1 Momentum equation with density-jump stabilisation
Here the basics of the algorithm are reviewed, following Duretz et al. (2011). The equation of motion (force balance) for highly viscous flow in Earth's mantle and crust is the Stokes equations, which neglect inertial terms in the Navier–Stokes equations.
where p is pressure, ρ is density, g is gravity and is the deviatoric stress tensor, given by
where η is the dynamic viscosity and n is the number of spatial dimensions (2 or 3). For incompressible flow, the last term is zero.
During a time step, advection of composition in the vicinity of a density gradient/jump can substantially change the density on the right-hand side of Eq. (1), approximately as
where Δt is the time step. These density changes can be treated implicitly by substituting ρnew for ρ in Eq. (1) and moving the velocity term to the left-hand side:
where θ is a factor between 0 (explicit) and 1 (implicit). The finite-difference stencil for velocity components is modified accordingly, based on ∇ρ calculated at the beginning of the time step. In practice, in the vicinity of a near-horizontal layer interface, it is vertical motions that change the density, so a simplified version considering only vertical (z) velocities and assuming that g is vertical has almost the same stabilisation effect:
2.2 Continuity equation
The full continuity (conservation of mass) equation can be written in Eulerian form as
or Lagrangian form as
These equations are commonly approximated bearing in mind that thermally induced density differences are of order 1 %, which is much smaller than density differences due to adiabatic compression + phase transitions over the depth of the mantle (∼65 %) or due to compositional differences such as a free surface (discussed above) or iron diapirs (e.g. Samuel and Tackley, 2008; Lin et al., 2011) (∼100 %). Furthermore, for whole-mantle studies, dynamic (i.e. related to the flow) pressure is much smaller than hydrostatic pressure, so its effect on density is typically ignored. Thus, Eq. (7) is often approximated as
This is valid when density is advected with the flow but invalid when there are significant non-advected density variations such as those due to pressure or phase transitions. In this study it is necessary to model flow with both large pressure-related density variations and large composition-related density variations, so a modified form of Eq. (7) is considered, decomposing the Lagrangian density time derivative into components related to temperature (T), pressure (P) and composition (C):
T-induced variations are assumed to be negligible, consistent with the Boussinesq or compressible anelastic approximations (additionally, T changes slowly in the Lagrangian frame). The compositional component is zero in the Lagrangian frame, and, ignoring dynamic pressure as in the Boussinesq or anelastic approximation, the pressure component is due only to vertical motion as
This can be satisfied using a z-dependent density that increases due only to hydrostatic compression:
where ρz is a depth-dependent reference density that depends only on hydrostatic compression, not composition. It would be possible to implement a more accurate version of the continuity equation that includes temperature and dynamic pressure effects (e.g. Gassmöller et al., 2020), but the current level of approximation suffices for the tests presented and is consistent with the commonly used anelastic approximation (King et al., 2010).
2.3 Energy equation
For the tests performed, here a simple form of energy conservation is assumed:
where T is temperature, t is time, Cp is specific heat capacity and k is thermal conductivity. Normally, when taking compressibility into account, terms for adiabatic heating/cooling and viscous dissipation would appear in this equation. This version corresponds to the limit of zero Grüneisen parameter () or, in nondimensional terms, having a zero dissipation number but finite compressibility number (Tackley, 1996). The concept is to make the test program as simple as possible to demonstrate what is discussed in this paper.
2.4 Test program
The associated test program CConv2dDJS.jl posted on Zenodo (Tackley and ETH Zurich, 2025) is written in the Julia programming language (Bezanson et al., 2017) and solves a nondimensional version of the equations above in two dimensions, x (horizontal) and z (vertical). The continuity equation is identical to Eq. (11) above, with ρz being 1.0 at the surface and increasing linearly to a specified value at the CMB. The two components of the momentum equation are
where Ra is the Rayleigh number; Cair and CDL are the fraction (0–1) of air and dense layer, respectively; and Bair and BDL are the compositional buoyancy ratios for air and dense layer, respectively (, where α is thermal expansivity and ΔT is the temperature drop across the layer). θ in Eq. (5) is assumed to be 1.0. For air, the buoyancy parameter is negative (air being less dense than rock) and has a value , whereas BDL is positive and has a much smaller magnitude. The mechanical boundary conditions are impermeable and free slip (zero shear stress) on all boundaries.
The nondimensional energy equation is
Thermal boundary conditions are insulating side boundaries and isothermal top and bottom boundaries (T=0 and 1, respectively). The equivalent equation for composition lacks the diffusion term.
Density is the sum of pressure-related, composition-related and phase transition-related components:
where ρz is 1.0 at the surface and increases linearly to a specified value at the CMB. The compositional component is given by
(noting that nondimensional and ) where ΔρPT is zero above the phase transition depth and the specified density increase below the phase transition depth, corresponding to a sharp phase transition with zero Clapeyron slope.
The continuity equation uses ρz as explained above, while the energy equation uses ρtot. The DJS algorithm can either correctly use ΔρC or incorrectly use ρtot in order to illustrate the bad artefacts that result.
The equations are discretised using a standard staggered-grid finite-volume discretisation (e.g. Harlow and Welch 1965; Patankar, 1980), as used by many codes in the geodynamical modelling community (e.g. Ogawa et al., 1991; Tackley, 1993, 2008; Trompert and Hansen, 1996; Gerya and Yuen, 2007; Kameyama et al., 2008; Kaus et al., 2016). The velocity–pressure solution is solved with a direct solver utilising the built-in “\” operator. Advection of temperature and composition is performed using an upwind donor-cell technique, which is very diffusive but suffices for the tests here. Temperature diffusion is calculated using explicit finite differences.
3.1 Surface or dense layer stabilisation
First, it is verified that the implementation of the DJS algorithm in the attached program eliminates “drunken sailor” oscillations. Figure 1 shows the effectiveness of the algorithm for preventing oscillations of a free surface with a sticky air layer. Detailed tests are not performed here because they have been already been reported elsewhere (Duretz et al., 2011). Figure 2 shows the effectiveness of the algorithm for stabilising a dense layer above the CMB. In both cases, oscillations occur with the algorithm switched off, but a smooth evolution is obtained with the algorithm switched on. When oscillations occur, the compositional interface (free surface or top of layer) becomes smeared out due to the numerical diffusion inherent in the upwind donor cell advection algorithm. In contrast, when the interface barely moves, there is negligible numerical diffusion, so the interface remains fairly sharp.
3.2 Convection with depth-dependent density
Steady-state convection solutions are calculated for various density increases with depth (), various Rayleigh numbers from 104 to 3×105 and two grid resolutions (32×32 and 64×64). The calculations are run until the top and bottom Nusselt numbers are identical and the rms velocity has stopped changing, which typically requires 1000 s of time steps. These tests do not have any compositional density variations, so the DJS algorithm is not needed; their purpose is to demonstrate the problems that occur when it is applied to non-compositional density variations.
The influence of compressibility is tested first, varying the density increase with depth () from factor 1.0 to 2.0, bearing in mind that on Earth this ratio is about 1.65 (including compressibility and phase transitions). Correct solutions (using only non-existent composition-dependent density gradients in the DJS algorithm) are compared to those using the full density field (Fig. 3 left column). Solutions indicate that the correct Nusselt number (top left) and Vrms (middle left) change slightly with , slightly increasing and decreasing, respectively. Resolution makes little difference to the correct values. With DJS using the full density field, however, the Nusselt number and Vrms decrease substantially as is increased. Ratios are plotted in the lower left. In the worst case (, 32×32 grid), the Nusselt number is decreased by 35 % and Vrms by about 65 %. This magnitude of reduction depends on grid resolution: with a 64×64 grid, the effect is about half as much as with a 32×32 grid. This is because the effect is proportional to the time step, which is about a factor of 2 smaller with the 64×64 grid.

Figure 3Influence of using DJS on full density for experiments with (a, d, g) varying density increase with depth, (b, e, h) varying Rayleigh number and (c, f, i) a phase transition with different density jumps.
Increasing Rayleigh number (Fig. 3 centre column) results in an increased Nusselt number and Vrms, as expected, but the increase is lower when DJS is applied to the full density field. The resolution is 64×64 cells. The ratio (stabilised / correct) (Fig. 3 bottom centre) indicates that the problem gets worse with increasing Rayleigh number. The values used here are still far below Earth's effective Rayleigh number of around 107–108 (Schubert et al., 2001), at which the flow reduction would be much worse. This is because with higher Ra the buoyant upwellings and downwellings become narrower, but the fake advected density correction still occurs everywhere. Higher Rayleigh number solutions are not plotted here because a steady state cannot be obtained when DJS is applied to the full density field: there are oscillating boundary-layer instabilities.
3.3 Convection with a phase transition
In the final set of experiments (Fig. 3 right column), a phase transition with zero Clapeyron slope is inserted at mid-depth, and its density jump is varied from 0 to 0.5, bearing in mind that the relevant jump for Earth is about 0.1. The resolution is 32×32 cells. The correct solution does not change, as the phase change density perturbation is applied in a Boussinesq-like manner, affecting the buoyancy term but nothing else. Solutions indicate that incorrectly applying DJS to the phase change density-jump results in a reduction in convective vigour of a slightly lower magnitude than that obtained with a gradual density increase but still large enough that the effect should be avoided.
3.4 Correct functioning of DJS with all density contributions
Figure 4 shows a convection result with all density variations switched on. The air layer and deep dense layer interfaces are stable with no oscillations, and convection is not inhibited. Two-layered convection is established due to the thick dense layer. The middle row contrasts the total density field (middle left) with the compositional-only density perturbation used in the DJS algorithm (middle right).
The results above demonstrate the importance of using only the composition-related density gradient, not the full density gradient, in the DJS algorithm. For a simple convection program like the one used here, the composition-related density gradient is straightforward to isolate. However, if the code has been written in such a manner that compositional, pressure, phase and temperature effects are combined in a single density () function, such as the StagYY code (Tackley, 2008), then this is more difficult. A practical solution is to perform twice as many density evaluations for each grid cell, as detailed below.
The composition-related density gradient may be calculated by subtracting the density gradient for a fixed composition from the total density gradient:
Using finite differences, the total density gradient is approximated as
where “u” denotes the upper cell, “l” denotes the lower cell and Δz is the grid spacing. As the upper and lower cells can have different compositions, when calculating the density gradient for fixed composition, it is best to calculate it for both compositions and average:
Subtracting Eq. (19) from Eq. (18) leads to
This expression has been found to work well in recent tests of the StagYY convection code (Tackley, 2008).
In these expressions, primes on temperatures denote that they are extrapolated adiabatically to the required locations; i.e. is Tu extrapolated adiabatically to zl. This is because, while the focus of Eq. (20) is on composition, it also works on temperature; i.e. it subtracts the density gradient at fixed temperature, leaving the density gradient that is due to a temperature gradient. This is appropriate, as density differences due to temperature differences are advected with the flow, but generally they are much smaller than the composition-based density gradients that are of concern here.
If one wishes to include horizontal density gradients in the DJS algorithm as in Eq. (4), the procedure is the same as that above (Eqs. 17–20) for each horizontal direction.
The density-jump stabilisation algorithm of Duretz et al. (2011) is an effective method of preventing numerical oscillations of internal compositional layers as well as of a free surface. However, it is essential that the density gradient used in the algorithm is that for compositional density variations only, otherwise severe artefacts result. If the density gradient used incorrectly includes the steady density increase with depth due to adiabatic compression and/or density jumps due to phase transitions, a severe reduction in convective vigour results. This reduction increases with Rayleigh number but decreases with increasing numerical resolution. Isolating the compositional component of the density gradient can be straightforwardly done using the approach presented in this paper.
The exact version of the Julia code used to produce the results and figures in this paper is archived on Zenodo under the MIT licence under https://doi.org/10.5281/zenodo.15115816 (Tackley and ETH Zurich, 2025). No input data or additional scripts are required. The Julia script used to produce the graphs in Fig. 3 is also archived there.
No data sets were used in this manuscript.
The author has declared that there are no competing interests.
Publisher's note: Copernicus Publications remains neutral with regard to jurisdictional claims made in the text, published maps, institutional affiliations, or any other geographical representation in this paper. While Copernicus Publications makes every effort to include appropriate place names, the final responsibility lies with the authors. Views expressed in the text are those of the authors and do not necessarily reflect the views of the publisher.
The process of identifying and fixing these problems at this point in time was motivated by dense layer oscillations identified by Elena Zaharia and Maxim Ballmer. Helpful reviews were provided by Mingming Li and Boris Kaus. Albert de Montserrat Navarro helped the author to improve the plotting in the final version.
This paper was edited by Ludovic Räss and reviewed by Mingming Li and Boris Kaus.
Andrés-Martínez, M., Morgan, J. P., Pérez-Gussinyé, M., and Rüpke, L.: A new free-surface stabilization algorithm for geodynamical modelling: Theory and numerical tests, Phys. Earth Planet. Int., 246, 41–51, https://doi.org/10.1016/j.pepi.2015.07.003, 2015.
Bezanson, J., Edelman, A., Karpinski, S., and Shah, V. B.: Julia: A fresh approach to numerical computing, SIAM Review, 59, 65–98, https://doi.org/10.1137/141000671, 2017.
Christensen, U. R., and Hofmann, A. W.: Segregation of subducted oceanic crust in the convecting mantle, J. Geophys. Res., 99, 19867–19884, https://doi.org/10.1029/93JB03403, 1994.
Crameri, F., Schmeling, H., Golabek, G. J., Duretz, T., Orendt, R., Buiter, S. J. H., May, D. A., Kaus, B. J. P., Gerya, T. V., and Tackley, P. J.: A comparison of numerical surface topography calculations in geodynamic modelling: an evaluation of the “sticky air” method, Geophysical Journal International, 189, 38–54, https://doi.org/10.1111/j.1365-246X.2012.05388.x, 2012.
Davaille, A.: Simultaneous generation of hotspots and superswells by convection in a heterogeneous planetary mantle, Nature, 402, 756–760, https://doi.org/10.1038/45461, 1999.
Deschamps, F., Kaminski, E., and Tackley, P. J.: A deep mantle origin for the primitive signature of ocean island basalt, Nature Geosci., 4, 879–882, https://doi.org/10.1038/ngeo1295, 2011.
Duretz, T., May, D. A., Gerya, T. V., and Tackley, P. J.: Discretisation errors and free surface stabilization in the finite difference and marker-in-cell method in geodynamic applications: A numerical study, Geochem. Geophys. Geosyst., 12, https://doi.org/10.1029/2011GC003567, 2011.
Dziewonski, A. M. and Anderson, D. L.: Preliminary reference Earth model, Phys. Earth Planet. Inter, 25, 297–356, https://doi.org/10.1016/0031-9201(81)90046-7, 1981.
Gassmöller, R., Dannberg, J., Bangerth, W., Heister, T., and Myhill, R.: On formulations of compressible mantle convection, Geophys. J. Int., 221, 1264–1280, https://doi.org/10.1093/gji/ggaa078, 2020.
Gerya, T. V. and Yuen, D. A.: Robust characteristics method for modelling multiphase visco-elasto-plastic thermo-mechanical problems, Physics of the Earth and Planetary Interiors, 163, 83–105, https://doi.org/10.1016/j.pepi.2007.04.015, 2007.
Gurnis, M.: The effects of chemical density differences on convective mixing in the Earth's mantle, J. Geophys. Res., 91, 1407–1419, https://doi.org/10.1029/JB091iB11p11407, 1986.
Harlow, F. H. and Welch, J. E.: Numerical calculation of time-dependent viscous incompressible flow of fluid with free surface, Phys. Fluids A, 8, 2182–2189, https://doi.org/10.1063/1.1761178, 1965.
Kameyama, M., Kageyama, A., and Sato, T.: Multigrid-based simulation code for mantle convection in spherical shell using yin-yang grid, Phys. Earth Planet. Int., 171, 19–32, https://doi.org/10.1016/j.pepi.2008.06.025, 2008.
Kaus, B. J. P., Mühlhaus, H., and May, D. A.: A stabilization algorithm for geodynamic numerical simulations with a free surface, Phys. Earth Planet. Int., 181, 12–20, https://doi.org/10.1016/j.pepi.2010.04.007, 2010.
Kaus, B. J. P., Popov, A. A., Baumann, T. S., Püsök, A. E., Bauville, A., Fernandez, N., and Collignon, M.: Forward and inverse modelling of lithospheric deformation on geological timescales, NIC Series, 48, 299, ISBN 978-3-95806-109-5, 2016.
King, S. D., Lee, C., van Keken, P. E., Leng, W., Zhong, S., Tan, E., Tosi, N., and Kameyama, M. C.: A community benchmark for 2-D Cartesian compressible convection in the Earth's mantle, Geophysical Journal International, 180, 73–87, https://doi.org/10.1111/j.1365-246X.2009.04413.x, 2010.
Kramer, S. C., Wilson, C. R., and Davies, D. R.: An implicit free surface algorithm for geodynamical simulations, Physics of the Earth and Planetary Interiors, 194–195, 25–37, https://doi.org/10.1016/j.pepi.2012.01.001, 2012.
Lin, J., Gerya, T. V., Tackley, P. J., Yuen, D. A., and Golabek, G. J.: Numerical modeling of protocore destabilization during planetary accretion: Feedbacks from non-Newtonian rheology and energy dissipation, Icarus, 213, 24–42, https://doi.org/10.1016/j.icarus.2009.06.035, 2011.
Nakagawa, T. and Tackley, P. J.: Influence of plate tectonic mode on the coupled thermochemical evolution of Earth's mantle and core, Geochem. Geophys. Geosys., 16, 3400–3413, https://doi.org/10.1002/2015gc005996, 2015.
Ogawa, M.: Numerical models of magmatism in convecting mantle with temperature-dependent viscosity and their implications for Venus and Earth, J. Geophys. Res., 105, 6997–7012, https://doi.org/10.1029/1999JE001162, 2000.
Ogawa, M., Schubert, G., and Zebib, A.: Numerical simulations of 3-dimensional thermal convection in a fluid with strongly temperature-dependent viscosity, J. Fluid Mech., 233, 299–328, https://doi.org/10.1017/S0022112091000496, 1991.
Patankar, S. V.: Numerical Heat Transfer and Fluid Flow, CRC Press, https://doi.org/10.1201/9781482234213, 1980.
Popov, A. A. and Sobolev, S. V.: SLIM3D: A tool for three-dimensional thermomechanical modeling of lithospheric deformation with elasto-visco-plastic rheology, Physics of the Earth and Planetary Interiors, 171, 55–75, https://doi.org/10.1016/j.pepi.2008.03.007, 2008.
Rose, I., Buffett, B., and Heister, T.: Stability and accuracy of free surface time integration in viscous flows, Physics of the Earth and Planetary Interiors, 262, 90–100, https://doi.org/10.1016/j.pepi.2016.11.007, 2017.
Samuel, H. and Tackley, P. J.: Dynamics of core formation and equilibrium by negative diapirism, Geochem. Geophys. Geosyst., 9, https://doi.org/10.1029/2007GC001896, 2008.
Schubert, G., Turcotte, D. L., and Olson, P.: Mantle Convection in the Earth and Planets, Cambridge University Press, https://doi.org/10.1017/CBO9780511612879, 2001.
Tackley, P. J.: Effects of strongly temperature-dependent viscosity on time-dependent, 3-dimensional models of mantle convection, Geophys. Res. Lett., 20, 2187–2190, https://doi.org/10.1029/93GL02317, 1993.
Tackley, P. J.: Effects of strongly variable viscosity on three-dimensional compressible convection in planetary mantles, J. Geophys. Res., 101, 3311–3332, https://doi.org/10.1029/95JB03211, 1996.
Tackley, P. J.: Three-dimensional simulations of mantle convection with a thermochemical CMB boundary layer: D”?, in: The Core-Mantle Boundary Region, edited by: Gurnis, M., Wysession, M. E., Knittle, E., and Buffett, B. A., American Geophysical Union, 231–253, https://doi.org/10.1029/GD028, 1998.
Tackley, P. J.: Modelling compressible mantle convection with large viscosity contrasts in a three-dimensional spherical shell using the yin-yang grid, Phys. Earth Planet. Int., https://doi.org/10.1016/j.pepi.2008.08.005, 2008.
Tackley, P. J. and ETH Zurich: Software for manuscript “On stabilisation of compositional density jumps in compressible mantle convection simulations” (1.1), Zenodo [code], https://doi.org/10.5281/zenodo.15115816, 2025.
Trompert, R. A. and Hansen, U.: The application of a finite-volume multigrid method to 3-dimensional flow problems in a highly viscous fluid with a variable viscosity, Geophys. Astrophys. Fluid Dyn., 83, 261–291, https://doi.org/10.1080/03091929608208968, 1996.