|
A grid-operator framework for efficient implementation of explicit finite difference schemes
M. M. Krasnov, V. A. Balashov, E. B. Savenkov Keldysh Institute of Applied Mathematics of RAS
Abstract:
Current paper is devoted to the description of the mesh-operator programming technique.
The approach allows for short implementation of mathematical formulas in source code
using programming language operators similar to mathematical ones and, at the same
moment, provides portable implementation suitable for both CPU and CPU/GPGPU
hardware.
Mesh-operator programming is based on expression templates metaprogramming
technique to construct C++ expression to implement mesh operators. In turn, mesh
operators can be applied to mesh data structures to construct more complex mesh
operators. Such an approach allows to perform an arbitrarily complex computations with
the mesh functions. In fact, computations are performed in the delayed fashion, i.e., the
actual numerical values are computed only when the mesh expression is assigned to the
mesh function.
In this paper we show how such an approach can be applied to the efficient
implementation of the relatively complex algorithm which utilizes mesh functions
defined on different elements of the mesh, i.e., cells, faces, etc. Using mesh-operator
technique, the implementation is kept simple and formulas in the code looks practically
as simple as in mathematical notation.
Keywords:
C++, template metaprogramming, finite difference schemes, operator library, stencil computations.
Received: 17.09.2020 Revised: 17.09.2020 Accepted: 30.11.2020
Citation:
M. M. Krasnov, V. A. Balashov, E. B. Savenkov, “A grid-operator framework for efficient implementation of explicit finite difference schemes”, Matem. Mod., 33:2 (2021), 20–40; Math. Models Comput. Simul., 13:5 (2021), 831–843
Linking options:
https://www.mathnet.ru/eng/mm4259 https://www.mathnet.ru/eng/mm/v33/i2/p20
|
|