Tensor calculus in spherical coordinates using Jacobi polynomials. Part-II: Implementation and examples

Daniel Lecoanet*, Geoffrey M. Vasil, Keaton J. Burns, Benjamin P. Brown, Jeffrey S. Oishi

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review

3 Scopus citations


We present a simulation code which can solve a broad range of partial differential equations in a full sphere. The code expands tensorial variables in a spectral series of spin-weighted spherical harmonics in the angular directions and a scaled Jacobi polynomial basis in the radial direction, as described in Vasil et al. (2018; hereafter, Part-I). Nonlinear terms are calculated by transforming from the coefficients of the spectral series to the value of each quantity on the physical grid, where it is easy to calculate products and perform other local operations. The expansion makes it straightforward to solve equations in tensor form (i.e., without decomposition into scalars). We propose and study several unit tests which demonstrate the code can accurately solve linear problems, implement boundary conditions, and transform between spectral and physical space. We then run a series of benchmark problems proposed in Marti et al. (2014), implementing the hydrodynamic and magnetohydrodynamic equations. We are able to calculate more accurate solutions than reported in Marti et al. (2014) by running at higher spatial resolution and using a higher-order timestepping scheme. We find the rotating convection and convective dynamo benchmark problems depend sensitively on details of timestepping and data analysis. We also demonstrate that in low resolution simulations of the dynamo problem, small changes in a numerical scheme can lead to large changes in the solution. To aid future comparison to these benchmarks, we include the source code used to generate the data, as well as the data and analysis scripts used to generate the figures.

Original languageEnglish (US)
Article number100012
JournalJournal of Computational Physics: X
StatePublished - Jun 2019
Externally publishedYes


  • Benchmark
  • Code comparison
  • Spectral methods
  • Spherical geometry

ASJC Scopus subject areas

  • Physics and Astronomy (miscellaneous)
  • Computer Science Applications

Fingerprint Dive into the research topics of 'Tensor calculus in spherical coordinates using Jacobi polynomials. Part-II: Implementation and examples'. Together they form a unique fingerprint.

Cite this