Algorithms for solving the Navier-Stokes equations on a three-dimensional tetrahedral grid by the discontinuous Galerkin method were realized. Under the code development a new approach to programming problems of mathematical physics was used which allows one compactly write and effectively implement mathematical expressions in particular due to introduction of the concept of «grid operator» similar to mathematical one and uniformly realize algorithms for various grid types and computing architectures. The efficiency of this numerical code is investigated.Keywords: Navier-Stokes equations, discontinuous Galerkin method, parallel programming, templated meta-programming Introduction. At present, numerical methods of high accuracy must be used to solve a number of applied problems of mathematical physics. This is especially true for solving complex, multiscale problems, in which it is not enough to obtain a solution by grinding the mesh and methods of the first order of accuracy. An example of a method providing high accuracy is the Discontinuous Galerkin Method (DGM) [1], which has proved itself to solve a wide class of problems in mathematical physics. This method has a number of advantages inherent in both finite-element and finite-difference approximations. In particular, it provides a given order of accuracy, can be used for grids of arbitrary structure and is theoretically justified [1][2][3][4][5]. Discontinuous Galerkin Method, with all its merits, has a significant computational complexity, so the question of maximizing the use of all the possibilities of modern computer technology is very acute. The dynamics of the development of high-performance computing technology dictates the creation of software complexes that are relatively easily adaptable for work on various hybrid parallel architectures. For this purpose, when creating calculation modules, it is necessary to use new approaches to programming. When creating programs based on numerical methods of high accuracy, such as RMG, it is necessary to use the new capabilities of modern programming languages. Thus, with the advent of templates in new versions of the C ++ language, it became possible to reduce the amount of computation by transferring some of the computation to the compilation stage and, as a consequence, accelerating the computations. In addition, template metaprogramming makes it possible to simplify the algorithm due to its generalization [6].