Abstract:We assess two domain-specific languages included in the GridTools ecosystem as tools for implementing a high-order Discontinuous Galerkin discretization of the shallow water equations. Equations in spherical geometry are considered, thus providing a blueprint for the application of domain-specific languages to the development of global atmospheric models. The results demonstrate that domain-specific languages designed for finite difference/volume methods can be successfully extended to implement a Discontinuous Galerkin solver.
Numerical Analysis,Distributed, Parallel, and Cluster Computing,Programming Languages
What problem does this paper attempt to address?
### What problems does this paper attempt to solve?
This paper aims to evaluate the applications of two Domain - Specific Languages (DSLs) in implementing high - order Discontinuous Galerkin (DG) methods, especially in the discretization of the shallow - water equations in spherical geometry. Specifically, the paper explores the following points:
1. **Improving code performance and portability**: With the development of new computing architectures (such as GPUs and FPGAs), scientists need to write code that can run efficiently on these new platforms. DSLs can help separate the concerns of domain scientists from the complexity of underlying computer science, thus simplifying code writing and optimization.
2. **Expanding the application range of DSLs**: Traditional DSLs are mainly used for finite - difference/volume methods, and this paper attempts to verify whether these DSLs can be successfully extended to implement DG solvers, especially for atmospheric models in spherical geometry.
3. **Verifying the feasibility of DSLs in atmospheric modeling**: By implementing the DG method in spherical geometry, the paper shows that DSLs can be used to develop prototype code for global atmospheric models and verify its effectiveness and performance in practical applications.
4. **Solving numerical problems in spherical geometry**: There are some numerical difficulties in the shallow - water equations in spherical geometry, such as the grid deformation problem near the poles. The paper reduces these numerical problems by introducing techniques such as degree - adaptive techniques.
### Main content of the paper
- **Mathematical models and numerical discretization methods**: The paper describes in detail the form of the shallow - water equations in spherical geometry and introduces how to use the DG method to discretize them.
- **Implementation of DSLs**: The paper uses two DSL tools - C++ - based Galerkin - for - GridTools (G4GT) and Python - based GridTools - for - Python (GT4Py) respectively to implement DG solvers. Among them, GT4Py is the main implementation tool and supports multiple backend compilation options to adapt to different hardware architectures.
- **Verification and benchmark tests**: Through common benchmark tests such as linear advection and shallow - water equations, the numerical results and performance of the DG method implemented by DSLs are verified.
### Key formulas
The form of the shallow - water equations in spherical geometry is:
\[
\frac{\partial h}{\partial t}+\nabla\cdot(h\mathbf{v}) = 0
\]
\[
\frac{\partial(h\mathbf{v})}{\partial t}+\nabla\cdot(h\mathbf{v}\otimes\mathbf{v})=-f\hat{k}\times h\mathbf{v}-\nabla\left(\frac{gh^{2}}{2}\right)
\]
where:
- \(h\) is the fluid thickness,
- \(\mathbf{v} = u\hat{i}+v\hat{j}\) is the velocity field,
- \(f = 2\Omega\sin\theta\) is the Coriolis parameter,
- \(g = 9.81\,\text{m/s}^2\) is the gravity acceleration,
- \(\Omega = 7.292\times 10^{-5}\,\text{s}^{-1}\) is the angular velocity of the earth's rotation.
Through these formulas, the paper shows how to implement and verify the DG method in spherical geometry.