BOUT++ is a 3D plasma fluid simulation code which has been developed at York in collaboration with the MFE group at LLNL and the MCS division at ANL. Key features are

  • Finite difference in non-orthogonal coordinate systems. Can handle complicated topologies such as the x-point region in tokamaks
  • Written in C++ in a modular way. One section of the code (e.g. differencing methods, or output format) can be changed with minimal alterations to the rest of the code
  • Can solve an arbitrary number of scalar and vector fluid equations
  • Range of time integration schemes available, including fully implicit (BDF, backwards Euler, Crank-Nicholson,...) and explicit schemes (Euler, RK4, Karniadakis, Adams ...), which can be chosen at run-time based on input options
  • High-order differencing schemes are implemented, including a 3rd-order WENO scheme for advection and MUSCL schemes. These result in lower numerical dissipation and better handling of shocks. These can also be changed at run-time
  • The portion of the code which specifies the equations to be solved is (relatively) small, typically 50-500 lines of code compared to ~30,000 lines for the whole code. This makes the equations being solved very clear and easy to change
  • Scales well using to several thousand processors for typical problems. Work ongoing to improve scalability to tens of thousands and beyond

A common problem with large simulation codes is that it can be very difficult to understand what equations they are solving, making peer review of simulation results difficult. BOUT++ tries to make this easier, so that the inputs to a simulation can be verified without having to grok thousands of lines of code. As an example, the important lines in an MHD example are:

ddt(rho) = -V_dot_Grad(v, rho) - rho*Div(v);
ddt(p) = -V_dot_Grad(v, p) - gamma*p*Div(v);
ddt(v) = -V_dot_Grad(v, v) + ((Curl(B)^B) - Grad(p))/rho;
ddt(B) = Curl(v^B);

Of course obtaining good performance or numerical stability occasionally requires access to the underlying algorithms, and this is still possible. You can start with a simple set of equations and then tweak the code later to optimise it.

Getting BOUT++

BOUT++ is open source under the Lesser General Public License (LGPL), and is available on github here. To get a copy, you can download a zip file from the github website, but the recommended way is to use Git to download the latest version and keep up to date. Assuming Git is installed, run the command:

$ git clone git://

Instructions on installing BOUT++ are on the wiki page, including the basics of using Git for version control. To do anything useful, you will also need to install the following libraries:

  • FFTW (version 3) is used for Fast Fourier Transforms (FFTs)
  • NetCDF (version 4) for file input/output
Optionally, BOUT++ can also make use of the following libraries
  • SUNDIALS solvers for implicit time integration. For most simulations, the CVODE solver is used, but if constraints are needed then the IDA Differential Algebraic Equation (DAE) solver can also be used.
  • PETSc for high-performance parallel libraries
  • PACT for backwards compatibility with BOUT and UEDGE

Recent papers

Some recent papers using BOUT++