RUS  ENG
Full version
JOURNALS // Matematicheskoe modelirovanie // Archive

Matem. Mod., 2021 Volume 33, Number 2, Pages 20–40 (Mi mm4259)

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

DOI: 10.20948/mm-2021-02-02


 English version:
Mathematical Models and Computer Simulations, 2021, 13:5, 831–843


© Steklov Math. Inst. of RAS, 2024