EGU General Assembly 2022
© Author(s) 2023. This work is distributed under
the Creative Commons Attribution 4.0 License.

How composable software tools in Julia help developing multi-physics codes in geodynamics

Boris Kaus1, Nicolas Berlie1, Valentin Churavy2, Matias Cosarinsky3, Thibault Duretz4, Daniel Kiss1, Jeremy Kozdon5, Albert de Montserrat6, Lucas Moser1, Nils Medinger1, Samuel Omlin7, Ludovic Räss8, Patrick Sanan6, Arne Spang1, Marcel Thielmann9, and Ivan Utkin8
Boris Kaus et al.
  • 1Institute of Geosciences, Johannes-Gutenberg University Mainz, Germany
  • 2Massachusets Institute of Technology, Boston, USA
  • 3University of Buenos Aires, Argentina
  • 4Faculty of Earth Science, University of Frankfurt, Germany
  • 5Department of Applied Mathematics, Naval Postgraduate School, Monterey, USA
  • 6Institute of Geophysics, ETH Zürich, Switzerland
  • 7CSCS, Swiss National Computing Center, Lugano, Switzerland
  • 8Laboratory of Hydraulics, Hydrology and Glaciology (VAW), ETH Zürich, Switzerland
  • 9Bayerisches GeoInstitut, University of Bayreuth, Germany

Julia( recently emerged as a very powerful high-level computer language for (parallel) scientific computing, which allows you to “write codes like in MATLAB”, while “achieving the speed of Fortran/C”. A particular strength of Julia is that it is easy to write composable software packages that talk to each other. Here we will discuss our efforts in making Julia a development platform for geodynamic applications that significantly simplifies the process of going from a working solver to a production code which runs on massively parallel (GPU) machines.  We are working on a number of open-source packages that simplify certain steps that many geodynamics codes have in common:

  • GeoParams.jl ( is a package in which you can specify constitutive relationships (e.g., creeplaws). It automatically handles the (non-)dimensionalization of all input parameters, includes pre-defined creep laws (e.g., dislocation and diffusion creep laws), plotting routine and includes computational routines that can be directly integrated in your code.
  • PETSc.jl ( is the main interface from Julia to PETSc, including MPI support and automatic installations of PETSc (one of the main hurdles that existing users faced). We have recently extended the package to include an interface to DMSTAG, such that you create a staggered finite difference grid and assemble the stiffness matrix in a straightforward manner. You can use automatic differentiation tools in Julia to create the Jacobians for nonlinear equations, which again minimizes the required lines of code (compared to their C counterparts). At the same time, the full range of (nonlinear multigrid) PETSc solvers is available. This is thus very well suited to write implicit solvers.
  • ParallelStencil.jl ( and ImplicitGlobalGrid.jl ( are packages that are devoted to solving stencils in a very efficient manner on (parallel) GPU or CPU machines, which scales to very large GPU-based computers. It is particularly efficient in combination with pseudo-transient iterative solvers and allow running codes on modern architectures.
  • GeophysicalModelGenerator.jl ( is a package that gives you a simple way to collect geophysical/geological data of a certain region and combine that to construct a 3D geodynamic input model setup.

Ongoing efforts include the development of a grid generation and a marker and cell advection package that work, seamlessly with both ParallelStencil and PETSc. This will allow developers to apply both direct-iterative and pseudo-transient implicit solvers to the same problem, while only having to make minimal changes to the model setup. Combined, these packages will make the step from developing a new (nonlinear) solver to having an efficient (3D) production code much easier.

How to cite: Kaus, B., Berlie, N., Churavy, V., Cosarinsky, M., Duretz, T., Kiss, D., Kozdon, J., de Montserrat, A., Moser, L., Medinger, N., Omlin, S., Räss, L., Sanan, P., Spang, A., Thielmann, M., and Utkin, I.: How composable software tools in Julia help developing multi-physics codes in geodynamics, EGU General Assembly 2022, Vienna, Austria, 23–27 May 2022, EGU22-5704,, 2022.