OpenCurrent is an open source C++ library for solving Partial Differential Equations (PDEs) over regular grids using the CUDA platform from NVIDIA. It breaks down a PDE into 3 basic objects, “Grids”, “Solvers,” and “Equations.” “Grid” data structures efficiently implement regular 1D, 2D, and 3D arrays in both double and single precision. Grids support operations like computing linear combinations, managing host-device memory transfers, interpolating values at non-grid points, and performing array-wide reductions. “Solvers” use these data structures to calculate terms arising from discretizations of PDEs, such as finite-difference based advection and diffusion schemes, and a multigrid solver for Poisson equations. These computational building blocks can be assembled into complete “Equation” objects that solve time-dependent PDEs. One such Equation solver is an incompressible Navier-Stokes solver that uses a second-order Boussinesq model. This equation solver is fully validated, and has been used to study Rayleigh-Benard convection under a variety of different regimes. Benchmarks show it to perform about 8 times faster than an equivalent Fortran code running on an 8-core Xeon.
The OpenCurrent infrastructure includes support for profiling both the CPU or GPU, support for reading and writing NetCDF data files, and the ability to generate simple plots. It includes a complete validation and unit testing framework that allows for easy and automatic validation of numerical methods and solvers. OpenCurrent uses CMake for cross-platform development and has been tested on both Windows and Linux-based systems. Via a compile-time option, OpenCurrent can be configured to support older hardware (pre-GT200) that does not handle double precision, but on newer hardware all routines are available in both double and single precision.