Journal of Scientific Computing

, Volume 71, Issue 3, pp 1062–1093 | Cite as

Well-Balanced Nodal Discontinuous Galerkin Method for Euler Equations with Gravity

Article

Abstract

We present a well-balanced nodal discontinuous Galerkin (DG) scheme for compressible Euler equations with gravity. The DG scheme makes use of discontinuous Lagrange basis functions supported at Gauss–Lobatto–Legendre (GLL) nodes together with GLL quadrature using the same nodes. The well-balanced property is achieved by a specific form of source term discretization that depends on the nature of the hydrostatic solution, together with the GLL nodes for quadrature of the source term. The scheme is able to preserve isothermal and polytropic stationary solutions upto machine precision on any mesh composed of quadrilateral cells and for any gravitational potential. It is applied on several examples to demonstrate its well-balanced property and the improved resolution of small perturbations around the stationary solution.

Keywords

Discontinuous Galerkin Euler equations Gravity Well-balanced 

1 Introduction

The Euler equations in the presence of a gravitational field are an important mathematical model arising in atmospheric flows and astrophysical applications. Due to the presence of gravitational force, these equations have non-trivial stationary solutions, usually refered to as hydrostatic solutions. These stationary solutions are of interest in themselves and particularly their stability to small perturbations. Many atmospheric phenoma are small perturbations around the hydrostatic solution. The accurate computation of these small perturbations about the hydrostatic solution is hence important in many applications. In general, there are many other mathematical models involving source terms which exhibit non-trivial stationary solutions. An important class of such models with source terms are the shallow water equations arising in river and ocean modeling. Any numerical scheme which preserves the hydrostatic solution on any mesh is said to be well-balanced.

Stationary solutions are obtained by the precise balance of fluxes and source terms. Schemes which are not well-balanced will not be able to achieve this precise balance and may give rise to large numerical errors close to the stationary solutions, especially on coarse meshes [4, 20]. In order to obtain reliable solutions, such schemes would require very fine meshes, which may be impractical in realistic simulations in three dimensions. Well-balanced schemes on the other hand yield accurate solutions even on coarse meshes and are capable of resolving small perturbations around the stationary solution.

In the finite difference and finite volume approach, there are many well-balanced schemes available in the literature for the Euler equations with gravity, see e.g. [4, 10, 12, 21]. However well-balanced DG schemes are not as well developed for the Euler equations. Xing and Shu [20] have proposed a well-balanced DG scheme for the shallow-water equations where the hydrostatic solution is characterized by a quadratic invariant, see also [6, 19]. In the case of Euler equations with gravity, the invariants are not simple polynomials which makes it difficult to preserve them in a DG scheme where numerical quadrature has to be used. The hydrostatic solution is determined by a non-linear ODE whose solutions cannot be written down explicitly except in some simple settings like ideal gas model, isothermal or polytropic gas, etc. To illustrate the difficulty, consider a scalar conservation law with source term \(q_t + f(q)_x = s(q)\) which has a stationary solution \(q_e\). The DG scheme has the form
$$\begin{aligned} \frac{\text {d}}{\text {d}t}\left( q_h, \phi _h \right) _h + a_h(q_h, \phi _h) = (s_{h}(q_h), \phi _h)_h, \quad \forall \phi _h \in V_h^k \end{aligned}$$
where \(\left( \cdot ,\cdot \right) _h\) is some approximation of the \(L^2\) inner product by quadratures, \(a_h\) is a bilinear form approximated by quadrature and \(s_h\) is an approximation of the source term. Let \(q_{e,h}\) be an approximation to the stationary solution, e.g., obtained by interpolation or projection of \(q_e\) on \(V_h^k\). For the above scheme to be well-balanced, we require that
$$\begin{aligned} a_h(q_{e,h}, \phi _h) = (s_{h}(q_{e,h}), \phi _h)_h, \quad \forall \phi _h \in V_h^k \end{aligned}$$
Depending on the degree k, this contains many equations that need to be satisfied at the same time. The non-linearity of the PDE means that the quadratures may not be exact and we cannot use integration by parts to prove well-balanced property.

Li and Xing [14] have proposed a well-balanced DG scheme using orthogonal basis functions for Euler equations with gravity for isothermal hydrostatic solutions. The well-balanced property is achieved by a re-writing of the source terms together with an integration by parts, and using a Lax–Friedrich type numerical flux with a modified viscosity. Since orthogonal basis functions are used, the initial condition is projected onto the finite element space.

In this work, we propose a well-balanced DG scheme for isothermal and polytropic hydrostatic solutions under the ideal gas assumption. The scheme is based on nodal Lagrange basis functions using Gauss–Lobatto–Legendre points on arbitrary quadrilateral cells in 2-D. The same GLL points are also used for quadrature in the weak formulation of the DG scheme. The source term is re-written based on whether we are near isothermal or polytropic hydrostatic solution and then discretized using the GLL points. For continuous isothermal and polytropic hydrostatic solutions, the scheme is well-balanced for any consistent numerical flux function. The scheme is also well-balanced for isothermal hydrostatic solutions in which density might be discontinuous provided we use a numerical flux function which is exact for stationary contact discontinuities, like the Roe or HLLC flux, and the initial discontinuity in density coincides with the cell boundaries. For discontinuous solutions, a non-linear TVD limiter is necessary to avoid unphysical oscillations. The limiter might destroy the well-balanced property but this is easily solved by preventing the application of the limiter in case the solution residual in any cell is zero (close to machine precision), which would be the case for a hydrostatic solution.

The rest of the paper is organized as follows. In Sect. 2 we introduce the 1-D Euler equations, explain the hydrostatic solutions, introduce the DG scheme and prove its well-balanced property. In Sect. 3 we perform the same steps for the 2-D Euler equations and explain the limiter in Sect. 4. Numerical results are shown in Sect. 5 to demonstrate the well-balanced property and the accurate resolution of perturbations around hydrostatic solutions. Finally we end the paper with a summary and conclusions.

2 1-D Euler Equations with Gravity

Consider the system of compressible Euler equations in one dimension which models conservation of mass, momentum and energy. These equations are given by
$$\begin{aligned} \frac{\partial \rho }{\partial t} + \frac{\partial }{\partial x}(\rho u)= & {} 0 \\ \frac{\partial }{\partial t}(\rho u) + \frac{\partial }{\partial x}(p+\rho u^2)= & {} -\rho \frac{\partial \Phi }{\partial x} \\ \frac{\partial E}{\partial t} + \frac{\partial }{\partial x}(E + p)u= & {} -\rho u \frac{\partial \Phi }{\partial x} \end{aligned}$$
Here \(\rho \) is the density, u is the velocity, p is the pressure, E is the energy per unit volume excluding the gravitational energy and \(\Phi \) is the gravitational potential. The pressure is given by
$$\begin{aligned} p = (\gamma -1) \left[ E - \frac{1}{2}\rho u^2 \right] , \quad \gamma = \frac{c_p}{c_v} > 1 \end{aligned}$$
where \(\gamma \) is the ratio of specific heats at constant pressure and volume, which is taken to be constant. We can write the above set of coupled equations in a compact notation as
$$\begin{aligned} \frac{\partial \varvec{q}}{\partial t} + \frac{\partial \varvec{f}}{\partial x} = -\begin{bmatrix} 0 \\ \rho \\ \rho u \end{bmatrix} \frac{\partial \Phi }{\partial x} \end{aligned}$$
where \(\varvec{q}\) is the set of conserved variables and \(\varvec{f}\) is the corresponding flux vector. In the case of a self-gravitating system, the gravitational potential \(\Phi \) is governed by a Poisson-type equation. In the present work, we will consider the case of a static gravitational potential, which is assumed to be given as a function of the spatial coordinates.

2.1 Hydrostatic States

Consider the hydrostatic stationary solution, i.e., the state with zero velocity, \(u_e = 0\). In this case, the mass and energy fluxes are identically zero and their conservation equations are automatically satisfied. The momentum equation becomes an ordinary differential equation given by
$$\begin{aligned} \frac{\text {d}p_e}{\text {d}x} = -\rho _e \frac{\text {d}\Phi }{\text {d}x} \end{aligned}$$
(2.1)
We will assume the ideal gas equation of state
$$\begin{aligned} p = \rho R T \end{aligned}$$
(2.2)
where R is the gas constant.

2.1.1 Isothermal Solution

If the temperature is constant, \(T= T_e = \hbox {const}\), we can integrate the stationary momentum Eq. (2.1) together with (2.2) to obtain
$$\begin{aligned} p_e(x) \exp \left( \frac{\Phi (x)}{RT_e}\right) = \hbox {const} \end{aligned}$$
(2.3)
Since the potential is obtained as the solution of a Poisson equation, it is reasonable to assume that it is a continuous function of the spatial variable, which implies that the pressure in the hydrostatic state is a continuous function. In general, we can consider a hydrostatic solution where the density is discontinuous, e.g., two regions of different but constant temperature. Even in this case, the hydrostatic pressure would be continuous.

2.1.2 Polytropic Solution

For a gas in a polytropic equilibrium, the condition is characterized by
$$\begin{aligned} p \rho ^{-\nu } = \alpha = \hbox {const} \end{aligned}$$
(2.4)
for some constant \(\nu > 1\). Using this in the hydrostatic Eq. (2.1) we obtain
$$\begin{aligned} \frac{\alpha \nu }{\nu -1} \rho _e^{\nu -1}(x) + \Phi (x) = \beta = \hbox {const}\end{aligned}$$

2.2 Mesh and Basis Functions

Consider a partition of the domain into disjoint cells \(C_i = (x_{i - \frac{1}{2}},x_{i + \frac{1}{2}})\) with the cell size being \(\Delta x_i = x_{i + \frac{1}{2}}- x_{i - \frac{1}{2}}\). We will approximate the solution inside each cell by a polynomial of degree N and we will refer to this as a \(Q_N\) polynomial. To construct the basis functions inside each cell \(C_i\) we map it to a reference cell, say \(\hat{C}=[0,1]\), the mapping being given by
$$\begin{aligned} x = \xi \Delta x_i + x_{i - \frac{1}{2}}, \quad \xi \in [0,1] \end{aligned}$$
(2.5)
On this reference cell, let \(\xi _j\), \(0 \le j \le N\) be the Gauss–Lobatto–Legendre nodes. The nodal Lagrange basis functions using these GLL points are denoted by \(\ell _j(\xi )\) with the interpolation property
$$\begin{aligned} \ell _j(\xi _k) = \delta _{jk}, \quad 0 \le j,k \le N \end{aligned}$$
The basis functions are then taken as
$$\begin{aligned} \phi _j(x) = \ell _j(\xi ), \quad 0 \le j \le N \end{aligned}$$
where x and \(\xi \) are related by (2.5). To compute the derivatives of the shape functions \(\phi _j\) we apply the chain rule of differentiation
$$\begin{aligned} \frac{\text {d}}{\text {d}x}\phi _j(x) = \ell _j'(\xi ) \frac{\text {d}\xi }{\text {d}x} = \frac{1}{\Delta x_i} \ell _j'(\xi ) \end{aligned}$$
Moreover, let \(x_j \in C_i\) denote the physical locations of the GLL points, i.e., \(x_j = \xi _j \Delta x_i + x_{i - \frac{1}{2}}\), \(0 \le j \le N\).

2.3 Semi-discrete DG Scheme in 1-D

In order to explain the DG scheme, we will let q denote one of the components of \(\varvec{q}\), and consider the single conservation law with source term
$$\begin{aligned} \frac{\partial q}{\partial t} + \frac{\partial f}{\partial x} = s \end{aligned}$$
We will approximate the solution inside cell \(C_i\) by the polynomial of degree N which can be written as
$$\begin{aligned} q_h(x,t) = \sum _{j=0}^N q_j(t) \phi _j(x) \end{aligned}$$
The coefficients \(q_j\) in the above expansion are the degrees of freedom which determine the solution. In actual computations the above function is evaluated on the reference cell. Similarly we will approximate the flux inside the cell by a polynomial of degree N given by
$$\begin{aligned} f_h(x,t) = \sum _{j=0}^N f\left( q_h\left( x_j,t\right) \right) \phi _j(x) = \sum _{j=0}^N f_j(t) \phi _j(x) \end{aligned}$$
In the weak formulation of the DG scheme, we need to perform some quadrature to approximate the integrals. We will use Gauss–Lobatto–Legendre quadrature which uses the same nodes as used in the solution representation, i.e.,
$$\begin{aligned} \int _{C_i} \phi (x) \psi (x) \text {d}x \approx \left( \phi , \psi \right) _h = \left( \phi , \psi \right) _{N,C_i} = \Delta x_i \sum _{q=0}^N \omega _q \phi (x_q) \psi (x_q) \end{aligned}$$
where the GLL weights \(\omega _q\) correspond to the reference interval [0, 1]. The semi-discrete DG scheme is given by
$$\begin{aligned} \begin{aligned}&\frac{\text {d}}{\text {d}t}\left( q_h,\phi _j \right) _h + \left( \partial _x f_h, \phi _j \right) _h + \left[ \hat{f}_{i + \frac{1}{2}}- f_h\left( x_{i + \frac{1}{2}}^-\right) \right] \phi _j \left( x_{i + \frac{1}{2}}^-\right) \\&\qquad - \left[ \hat{f}_{i - \frac{1}{2}}- f_h\left( x_{i - \frac{1}{2}}^+\right) \right] \phi _j\left( x_{i - \frac{1}{2}}^+\right) = \left( s_h, \phi _j \right) _h, \quad 0 \le j \le N \end{aligned} \end{aligned}$$
(2.6)
where \(\hat{f}_{i + \frac{1}{2}}= \hat{f}(q_{i + \frac{1}{2}}^-, q_{i + \frac{1}{2}}^+)\) is a numerical flux function. This equation will be solved using a Runge–Kutta scheme. The mass matrix in the above scheme is diagonal which can be inverted explicitly. The above type of DG scheme is also refered to as a quadrature-free scheme, see [1], and sometimes as a spectral element method. Note that we have performed an additional integration by parts to obtain the flux divergence term \(\partial _x f_h\) leading to what is known as the strong form of the DG scheme [9]. For a detailed discussion on different forms of the nodal DG method, we refer the reader to [11].

Remark 1

In fact, the quadrature in the DG scheme is trivial and the scheme (2.6) can be written in simplified form as
$$\begin{aligned} \begin{aligned}&\omega _j \Delta x_i \frac{\text {d}q_j}{\text {d}t} + \partial _x f_h(x_j,y_j) \omega _j \Delta x_i + \left[ \hat{f}_{i + \frac{1}{2}}- f_h\left( x_{i + \frac{1}{2}}^-\right) \right] \phi _j \left( x_{i + \frac{1}{2}}^-\right) \\&\qquad - \left[ \hat{f}_{i - \frac{1}{2}}- f_h\left( x_{i - \frac{1}{2}}^+\right) \right] \phi _j \left( x_{i - \frac{1}{2}}^+\right) = s_h(x_j) \omega _j \Delta x_i, \quad 0 \le j \le N \end{aligned} \end{aligned}$$
In the actual code, the above simplified form is used, however in the proofs, we will still write the scheme in the general form (2.6) since it has a compact notation.

2.4 Numerical Flux Function

The numerical flux function \(\hat{\varvec{f}}(\varvec{q}^-,\varvec{q}^+)\) must be consistent in the sense that \(\hat{\varvec{f}}(\varvec{q},\varvec{q}) = \varvec{f}(\varvec{q})\). There are many different choices for these fluxes for the Euler equations based on exact or approximate Riemann solvers [8, 17]. Some flux functions also satisfy the property of exactly resolving a stationary contact discontinuity. For the two stationary states \(\varvec{q}^- = [\rho ^-, \ 0, \ E]^\top \) and \(\varvec{q}^+ = [\rho ^+, \ 0, \ E]^\top \) with \(E=p/(\gamma -1)\), the numerical flux satisfies
$$\begin{aligned} \hat{\varvec{f}}(\varvec{q}^-, \varvec{q}^+) = [0, \ p, \ 0]^\top \end{aligned}$$
(2.7)
We will refer to this as the contact property. Some examples of numerical fluxes having the contact property are the Roe scheme [15] and the HLLC scheme [18]. This property is necessary to prove the well-balanced property of the scheme for hydrostatic solutions containing a discontinuity in the density. If the hydrostatic solution is continuous then any consistent numerical flux function is sufficient to obtain well-balanced property, as proved in the theorem below.

2.5 Approximation of Source Term

If the potential is known to us as an explicit function of the spatial coordinate, we can compute the source term exactly by taking its derivative, but this does not lead to a well balanced scheme. In order to achieve the well-balanced property we will find it useful to approximate the spatial derivative of the potential in a form similar to the flux derivative in the above DG scheme.

2.5.1 Isothermal Case

Let \(\bar{T}_i\) be the temperature corresponding to the cell average value in cell \(C_i\). We can write the source term in the momentum equation as [21]
$$\begin{aligned} s(x) = -\rho \frac{\partial \Phi }{\partial x} = \rho R \bar{T}_i \exp \left( \frac{\Phi }{R\bar{T}_i}\right) \frac{\partial }{\partial x} \exp \left( -\frac{\Phi }{R\bar{T}_i}\right) \end{aligned}$$
Using the above form, the source term is approximated as follows
$$\begin{aligned} s_h(x) = \rho _h(x) R \bar{T}_i \exp \left( \frac{\Phi (x)}{R\bar{T}_i}\right) \frac{\partial }{\partial x} \sum _{j=0}^N \exp \left( -\frac{\Phi (x_j)}{R\bar{T}_i}\right) \phi _j(x), \quad x \in C_i \end{aligned}$$
(2.8)
Note that we use the same approximation for the source term as for the fluxes which is key to the well-balanced property. The source term in the energy equation will be approximated as \((\rho u)_h s_h/\rho _h\).

2.5.2 Polytropic Case

Define the function H(x) inside each cell \(C_i\) as
$$\begin{aligned} H(x) = \frac{\nu }{\nu -1} \ln \left( \frac{\nu -1}{\nu \alpha _i} \left( \beta _i - \Phi (x)\right) \right) , \quad x \in C_i \end{aligned}$$
where \(\alpha _i\), \(\beta _i\) are constants to be chosen. The source term in the momentum equation can be written as
$$\begin{aligned} s(x) = -\rho \frac{\partial \Phi }{\partial x} = \frac{\nu -1}{\nu } \rho \left( \beta _i - \Phi (x)\right) \exp \left( -H(x)\right) \frac{\partial }{\partial x} \exp \left( H(x)\right) , \quad x \in C_i \end{aligned}$$
Using the above form, the source term is approximated as
$$\begin{aligned} s_h(x) = \frac{\nu -1}{\nu } \rho _h(x) \left( \beta _i - \Phi (x)\right) \exp \left( -H(x)\right) \frac{\partial }{\partial x} \sum _{j=0}^N \exp \left( H(x_j)\right) \phi _j(x), \quad x \in C_i \end{aligned}$$
(2.9)
The parameter \(\beta _i\) is chosen as
$$\begin{aligned} \beta _i = \max _{0 \le j \le N} \left[ \frac{\nu }{\nu -1} \frac{p_j}{\rho _j} + \Phi (x_j) \right] , \quad \alpha _i = p_{j^*} \rho _{j^*}^{-\nu } \end{aligned}$$
where \(j^*\) is the index of the GLL point where the maximum is attained. With this choice the function H(x) is well defined at all the GLL nodes.

Theorem 2.1

Let the initial condition be obtained by interpolating the hydrostatic solution corresponding to a continuous gravitational potential \(\Phi \). Then the DG scheme (2.6) together with the source term approximation given by (2.8) or (2.9) preserves the initial condition under any time integration scheme.

Proof

Since the hydrostatic solution is interpolated at the GLL points, the initial condition is exactly equal to the hydrostatic solution at the GLL points. We will first show that the boundary flux terms in (2.6) vanish in the hydrostatic case. Firstly, assume that the hydrostatic solution (isothermal or polytropic) is continuous. Since we interpolate the hydrostatic solution at the GLL points and we have GLL points located at the element boundaries, the finite element approximation of the initial condition is also continuous across the element boundaries. Hence by consistency of the numerical flux, we have
$$\begin{aligned} \hat{f}_{i + \frac{1}{2}}- f_h\left( x_{i + \frac{1}{2}}^-\right) = 0, \quad \hat{f}_{i - \frac{1}{2}}- f_h\left( x_{i - \frac{1}{2}}^+\right) = 0 \end{aligned}$$
If the isothermal hydrostatic solution has discontinuous density, we will assume that the discontinuity exactly coincides with some cell boundary. If we use a numerical flux with the contact property then the above conditions are again satisfied. Thus the boundary terms vanish from the DG scheme.
The velocity being zero for the hydrostatic solution, the flux \(f_h(x)=0\) in the density and energy equation, so that density and energy remain constant with time. It remains to check the momentum equation. The flux \(f_h\) has the form
$$\begin{aligned} f_h(x,t) = \sum _{j=0}^N p_j(t) \phi _j(x) \end{aligned}$$
where \(p_j\) is the pressure at the GLL point \(x_j\). If the initial condition is isothermal, then \(\bar{T}_i = T_e = \hbox {const}\). Now the source term evaluated at any GLL node \(x_k\) is given by
$$\begin{aligned} s_h(x_k)= & {} \rho _h(x_k) R T_e \exp \left( \frac{\Phi (x_k)}{RT_e}\right) \sum _{j=0}^N \exp \left( -\frac{\Phi (x_j)}{RT_e}\right) \frac{\partial }{\partial x} \phi _j(x_k) \\= & {} p_k \exp \left( \frac{\Phi (x_k)}{RT_e}\right) \sum _{j=0}^N \exp \left( -\frac{\Phi (x_j)}{RT_e}\right) \frac{\partial }{\partial x} \phi _j(x_k) \\= & {} \sum _{j=0}^N p_k \exp \left( \frac{\Phi (x_k)}{RT_e}\right) \exp \left( -\frac{\Phi (x_j)}{RT_e}\right) \frac{\partial }{\partial x} \phi _j(x_k) \\= & {} \sum _{j=0}^N p_j \exp \left( \frac{\Phi (x_j)}{RT_e}\right) \exp \left( -\frac{\Phi (x_j)}{RT_e}\right) \frac{\partial }{\partial x} \phi _j(x_k) \\= & {} \sum _{j=0}^N p_j \frac{\partial }{\partial x} \phi _j(x_k) \\= & {} \frac{\partial }{\partial x} f_h(x_k) \end{aligned}$$
Since \(\partial _x f_h = s_h\) at all the GLL nodes, we can conclude that \(\left( \partial _x f_h, \phi _j \right) _h = \left( s_h, \phi _j \right) _h\) and hence the scheme is well-balanced for the momentum equation also.
If the initial condition is polytropic with exponent \(\nu \) then \(\alpha _i = \alpha \) and \(\beta _i = \beta \) are constants. At any GLL node \(x_k\), we have \(H(x_k) = \ln \rho _k^\nu \). The source term at any GLL node \(x_k\) can be written as
$$\begin{aligned} s_h(x_k)= & {} \frac{\nu -1}{\nu } \rho _h(x_k) \left( \beta - \Phi (x_k)\right) \exp \left( -H(x_k)\right) \sum _{j=0}^N \exp \left( H(x_j)\right) \frac{\partial }{\partial x} \phi _j(x_k) \\= & {} \frac{\nu -1}{\nu } \rho _k \left( \beta - \Phi (x_k)\right) \rho _k^{-\nu } \sum _{j=0}^N \rho _j^\nu \frac{\partial }{\partial x} \phi _j(x_k) \\= & {} \alpha \sum _{j=0}^N \rho _j^\nu \frac{\partial }{\partial x} \phi _j(x_k) = \sum _{j=0}^N p_j \frac{\partial }{\partial x} \phi _j(x_k) \\= & {} \partial _x f_h(x_k) \end{aligned}$$
Hence in this case also, the DG scheme is well-balanced. \(\square \)

Remark The use of GLL nodes was important in the above proof. The boundary flux terms vanish since the GLL nodes ensure that the interpolation of the hydrostatic solution on the mesh is continuous across the elements. The entire scheme makes use of only the solution at the GLL nodes which is exact in the hydrostatic case and helps us to satisfy the well-balanced property.

3 2-D Euler Equations with Gravity

The Euler equations in 2-D are given by the following set of four coupled conservation laws for mass, momentum and energy
$$\begin{aligned} \frac{\partial \varvec{q}}{\partial t} + \frac{\partial \varvec{f}}{\partial x} + \frac{\partial \varvec{g}}{\partial y} = \varvec{s}\end{aligned}$$
where \(\varvec{q}\) is the vector of conserved variables, \((\varvec{f},\varvec{g})\) is the flux vector and \(\varvec{s}\) is the source term, given by
$$\begin{aligned} \varvec{q}= \begin{bmatrix} \rho \\ \rho u \\ \rho v \\ E \end{bmatrix}, \quad \varvec{f}= \begin{bmatrix} \rho u \\ p + \rho u^2 \\ \rho u v \\ (E+p)u \end{bmatrix}, \quad \varvec{g}= \begin{bmatrix} \rho v \\ \rho u v \\ p + \rho v^2 \\ (E+p)v \end{bmatrix}, \quad \varvec{s}= \begin{bmatrix} 0 \\ -\rho \frac{\partial \Phi }{\partial x} \\ -\rho \frac{\partial \Phi }{\partial y} \\ -\left( \rho u \frac{\partial \Phi }{\partial x} + \rho v \frac{\partial \Phi }{\partial y} \right) \end{bmatrix} \end{aligned}$$

3.1 Hydrostatic Solution

In the hydrostatic state we have \(u_e = v_e = 0\) so that the mass and energy equations are identically satisfied. The momentum equation can be written as
$$\begin{aligned} \nabla p_e = - \rho _e \nabla \Phi \end{aligned}$$
Assuming the ideal gas equation of state (2.2) and a constant temperature \(T = T_e = \hbox {const}\), we get \(\text {d}p_e = - \rho _e \text {d}\Phi = -\frac{p_e}{RT_e} \text {d}\Phi \). Integrating this equations gives the condition
$$\begin{aligned} p_e(x,y) \exp \left( \frac{\Phi (x,y)}{RT_e} \right) = \hbox {const} \end{aligned}$$
(3.1)
In the case of a polytropic solution satisfying (2.4) we obtain
$$\begin{aligned} \frac{\alpha \nu }{\nu -1} \rho _e^{\nu -1}(x,y) + \Phi (x,y) = \beta = \hbox {const}\end{aligned}$$
We will exploit the above properties of the hydrostatic state to construct the well-balanced schemes.

3.2 Mesh and Basis Functions

Consider a partition of the domain into a mesh \(\mathcal {T}_h\) of disjoint quadrilateral cells K and let \(\hat{K}= [0,1] \times [0,1]\) be the reference cell. We assume that the mesh is conforming, i.e., there are no hanging nodes. Let \(T_K : \hat{K}\rightarrow K\) be the mapping from the reference cell \(\hat{K}\) to the physical cell K, see Fig. 1. If \(\xi _r \in [0,1]\), \(0 \le r \le N\) are the GLL points, then consider their tensor product \((\xi _r, \xi _s)\), \(0 \le r,s \le N\). This is illustrated in Fig. 2 for \(N=1,2,3\). Assume that there is a one dimensional indexing of these points as \(i=1,2,\ldots ,M\) where \(M=(N+1)^2\). The basis functions in cell K for the space \(Q_N\) of tensor product polynomials of degree N are of the form
$$\begin{aligned} \varphi _i^K(x,y) = \ell _r(\xi ) \ell _s(\eta ), \quad (x,y) = T_K(\xi ,\eta ), \quad i=1,2,\ldots ,M \end{aligned}$$
The computation of flux derivatives like \(\partial _x f_h\) requires derivatives of the basis functions which are evaluated by applying the chain rule, e.g.,
$$\begin{aligned} \frac{\partial }{\partial x}\phi _i^K(x,y) = \ell _r'(\xi ) \ell _s(\eta ) \frac{\partial \xi }{\partial x} + \ell _r(\xi ) \ell _s'(\eta ) \frac{\partial \eta }{\partial x} \end{aligned}$$
The derivatives \(\frac{\partial \xi }{\partial x}\) etc. are computed from the mapping \(T_K\) between the reference cell \(\hat{K}\) and the actual cell K. This map is affine only if K is a parallelogram and is non-affine for more general cell shapes.
Fig. 1

A quadrilateral cell K and reference cell \(\hat{K}\)

Fig. 2

GLL points for degree \(N=1,2,3\)

3.3 Semi-discrete DG Scheme

To explain the DG scheme in two dimensions, we will consider a single conservation law with source term of the form
$$\begin{aligned} \frac{\partial q}{\partial t} + \frac{\partial f}{\partial x} + \frac{\partial g}{\partial x} = s \end{aligned}$$
The solution inside cell K is represented as
$$\begin{aligned} q_h(x,y,t) = \sum _{i=1}^M q_i^K(t) \varphi _i^K(x,y) \end{aligned}$$
In actual computations, the above expression would be evaluated on the reference element. Similarly, we approximate the fluxes inside the cell by the following interpolation at the same GLL nodes
$$\begin{aligned} f_h(x,y) = \sum _{i=1}^M f(q_h(x_i, y_i)) \phi _i^K(x,y) = \sum _{i=1}^M f_i \phi _i^K(x,y) \end{aligned}$$
and
$$\begin{aligned} g_h(x,y) = \sum _{i=1}^M g(q_h(x_i, y_i)) \phi _i^K(x,y) = \sum _{i=1}^M g_i \phi _i^K(x,y) \end{aligned}$$
Define the quadrature on element K using GLL points
$$\begin{aligned} \left( \phi , \psi \right) _K = \sum _{r=0}^N \sum _{s=0}^N \phi (\xi _r, \xi _s) \psi (\xi _r, \xi _s) \omega _r \omega _s |J_K(\xi _r,\xi _s)| \end{aligned}$$
where \(\omega _r\) are the GLL quadrature weights and \(J_K\) is the Jacobian of the map \(T_K\). We also need the quadrature on the faces of the cell K. This is approximated as
$$\begin{aligned} \left( \phi , \psi \right) _{\partial K} = \sum _{e \in \partial K} \left( \phi , \psi \right) _e \end{aligned}$$
where \((\cdot ,\cdot )_e\) are one dimensional quadrature rules using the subset of GLL nodes located on the boundary of the cell. The semi-discrete DG scheme is given by
$$\begin{aligned} \begin{aligned}&\frac{\text {d}}{\text {d}t}\left( q_h, \phi _i^K \right) _K + \left( \partial _x f_h, \phi _i^K \right) _K + \left( \partial _y g_h, \phi _i^K \right) _K \\&\qquad + \left( \hat{F}_h - F_h^-, \phi _i^K \right) _{\partial K} = \left( s_h, \phi _i^K \right) , \quad 1 \le i \le M \end{aligned} \end{aligned}$$
(3.2)
where \(\hat{F}_h = \hat{F}(q^-_h, q^+_h, n)\) is a numerical flux function in the direction of the unit outward normal vector \(n=(n_x,n_y)\) to the boundary of the cell \(\partial K\), and \(F_h^-\) is the flux in the direction of n given by \(F_h^- = f_h^- n_x + g_h^- n_y\) which is evaluated using the solution inside the element K. As discussed in the 1-D case, the above scheme can also be written in a simplified form.

3.4 Approximation of Source Term

We rewrite the source term as in the 1-D problem starting with the case of an isothermal solution. Let \(\bar{T}_K\) be the temperature corresponding to the cell average value in cell K. The source term in the x-momentum equation can be re-written as
$$\begin{aligned} s = -\rho \frac{\partial \Phi }{\partial x} = \rho R \bar{T}_K \exp \left( \frac{\Phi }{R\bar{T}_K}\right) \frac{\partial }{\partial x} \exp \left( -\frac{\Phi }{R\bar{T}_K}\right) \end{aligned}$$
To be consistent with the discretization of the flux derivative term in the hydrostatic situation we discretize the above form of the source term by
$$\begin{aligned} s_h(x,y) = \rho _h(x,y) R \bar{T}_K \exp \left( \frac{\Phi (x,y)}{R\bar{T}_K}\right) \frac{\partial }{\partial x} \sum _{j=1}^M \exp \left( -\frac{\Phi (x_j,y_j)}{R\bar{T}_K}\right) \phi _j^K(x,y) \end{aligned}$$
(3.3)
A similar expression is used for the source term in the y-momentum equation.
In the case of polytropic solution, define the function H(xy) inside each cell K as
$$\begin{aligned} H(x,y) = \frac{\nu }{\nu -1} \ln \left( \frac{\nu -1}{\nu \alpha _K} \left( \beta _K - \Phi (x,y)\right) \right) , \quad (x,y) \in K \end{aligned}$$
where \(\alpha _K\), \(\beta _K\) are constants to be chosen. The source term in the x-momentum equation can be written as
$$\begin{aligned} s(x,y) = -\rho \frac{\partial \Phi }{\partial x} = \frac{\nu -1}{\nu } \rho \left( \beta _K - \Phi (x,y)\right) \exp \left( -H(x,y)\right) \frac{\partial }{\partial x} \exp \left( H(x,y)\right) , \quad (x,y) \in K \end{aligned}$$
Using the above form, the source term for \((x,y) \in K\) is approximated as
$$\begin{aligned} s_h(x,y) = \frac{\nu -1}{\nu } \rho _h(x,y) \left( \beta _K - \Phi (x,y)\right) \exp \left( -H(x,y)\right) \frac{\partial }{\partial x} \sum _{j=1}^M \exp \left( H(x_j,y_j)\right) \phi _j(x,y) \end{aligned}$$
(3.4)
The parameter \(\beta _K\) is chosen as
$$\begin{aligned} \beta _K = \max _{1 \le j \le M} \left[ \frac{\nu }{\nu -1} \frac{p_j}{\rho _j} + \Phi (x_j,y_j) \right] , \quad \alpha _K = p_{j^*} \rho _{j^*}^{-\nu } \end{aligned}$$
where \(j^*\) is the index of the GLL point where the maximum is attained. With this choice the function H(xy) is well defined at all the GLL nodes in the cell K.

If we denote the source terms in the momentum equation as \((s_h^x, s_h^y)\), then the source term in the energy equation is given by \( \frac{1}{\rho _h}[ (\rho u)_h s_h^x + (\rho v)_h s_h^y]\). This completes the specification of the DG scheme.

Theorem 3.1

Let the initial condition be obtained by interpolating the hydrostatic solution corresponding to a continuous gravitational potential \(\Phi \). Then the DG scheme (3.2) together with the source term approximation given by (3.3) or (3.4) preserves the initial condition under any time integration scheme.

Proof

The interpolation of the hydrostatic solution ensures that the solution \(q_h\) and the fluxes \(f_h\), \(g_h\) are equal to the hydrostatic solution at all the GLL points. Firstly, assuming that the hydrostatic solution is continuous, the finite element approximation \(q_h\) of the initial condition is continuous on the element boundaries. Due to consistency of the numerical flux, we get
$$\begin{aligned} \hat{F}_h = F_h \quad \text {at all GLL points on } \partial K \end{aligned}$$
If the hydrostatic density is discontinuous, then assuming that the discontinuity surface coincides with the cell boundaries, the above condition is satisfied if the numerical flux has the contact property. Thus in both cases, the boundary terms are zero.
In the hydrostatic solution, the velocity is zero and hence the mass and energy equations are well-balanced since \(f_h = g_h = 0\) in these equations. Now consider the x-momentum equation. The fluxes at the GLL points have the form
$$\begin{aligned} f_j = p_j, \quad g_j = 0, \quad 1 \le j \le M \end{aligned}$$
and hence
$$\begin{aligned} \partial _x f_h(x,y) = \sum _{j=1}^M p_j \partial _x \phi _j^K(x,y), \quad \partial _x g_h(x,y) = 0 \end{aligned}$$
For the initial condition which is isothermal and hydrostatic, the source term at any GLL point can be written as
$$\begin{aligned} s_h(x_i,y_i)= & {} \rho _h(x_i,y_i) R T_e \exp \left( \frac{\Phi (x_i,y_i)}{RT_e}\right) \frac{\partial }{\partial x} \sum _{j=1}^M \exp \left( -\frac{\Phi (x_j,y_j)}{RT_e}\right) \phi _j^K(x_i,y_i) \\= & {} p_i \exp \left( \frac{\Phi (x_i,y_i)}{RT_e}\right) \sum _{j=1}^M \exp \left( -\frac{\Phi (x_j,y_j)}{RT_e}\right) \frac{\partial }{\partial x} \phi _j^K(x_i,y_i) \\= & {} \sum _{j=1}^M p_i \exp \left( \frac{\Phi (x_i,y_i)}{RT_e}\right) \exp \left( -\frac{\Phi (x_j,y_j)}{RT_e}\right) \frac{\partial }{\partial x} \phi _j^K(x_i,y_i) \\= & {} \sum _{j=1}^M p_j \exp \left( \frac{\Phi (x_j,y_j)}{RT_e}\right) \exp \left( -\frac{\Phi (x_j,y_j)}{RT_e}\right) \frac{\partial }{\partial x} \phi _j^K(x_i,y_i) \\= & {} \sum _{j=1}^M p_j \frac{\partial }{\partial x} \phi _j^K(x_i,y_i) \\= & {} \partial _x f_h(x_i,y_i) \end{aligned}$$
where we have made use of (3.1). Hence at all the GLL points we have \(\partial _x f_h = s_h\) which is enough to conclude that
$$\begin{aligned} \left( \partial _x f_h, \phi _i^K \right) _K = \left( s_h, \phi _i^K \right) _K \end{aligned}$$
This proves that the x-momentum equation is well-balanced. A similar proof shows that the y-momentum equation is also well-balanced. The case of polytropic hydrostatic solution can also be proved along similar lines. Thus the DG scheme is well-balanced for isothermal and polytropic hydrostatic solutions. \(\square \)

4 Limiter

The computation of discontinuous solutions by a high order accurate scheme leads to unphysical oscillations which can spoil the accuracy of the scheme and may even lead to a break-down of the computations. In order to control the oscillations, we can use a non-linear TVD limiter [5] which is applied as a post processing step. The limiter reduces the degree of the polynomial solution if it detects the presence of oscillations in the linear part of the solution. The standard TVD limiter is given for the case of complete polynomial solutions belonging to \(\mathbb {P}_k\) [5] but in our work we use tensor product polynomials \(\mathbb {Q}_k\). For such solutions, we construct a limiter for Cartesian meshes as follows. In each cell the average gradient is computed
$$\begin{aligned} \overline{\nabla q}_h = \frac{1}{|K|} \int _K \nabla q_h \text {d}x \end{aligned}$$
This gradient is compared with forward and backward differences of the cell average quantities
$$\begin{aligned} \partial _x q_h^{(m)}= & {} \text{ minmod }\left( \overline{\partial _x q}_h, \beta \frac{\Delta ^-_x \bar{q}_h}{\Delta x}, \beta \frac{\Delta ^+_x \bar{q}_h}{\Delta x} \right) , \\ \partial _y q_h^{(m)}= & {} \text{ minmod }\left( \overline{\partial _y q}_h, \beta \frac{\Delta ^-_y \bar{q}_h}{\Delta y}, \beta \frac{\Delta ^+_y \bar{q}_h}{\Delta y} \right) \end{aligned}$$
where \(\Delta _x^\pm \), \(\Delta _y^\pm \) are backward and forward difference operators in the x and y directions, while \(\beta \in [1,2]\). In all the computations, we use \(\beta =2\) which corresponds to MC limiter of Van Leer and leads to more accurate solutions. On unstructured meshes, we cannot define backward and forward differences. Hence we adopt the minmax limiter as developed for finite volume methods [3]. The average gradient is computed in each cell as described above. This is used to define an affine function in the cell, which is evaluated at the centers of each face. We then check that these values are bounded between the minimum and maximum of the neighbouring cell average values. If any of these face values falls outside the range, then the gradient is scaled to ensure that values do not exceed the local minimum and maximum values.

As described above, the limiter is applied component-wise to the conserved variables. However it is beneficial to apply the limiter to characteristic variables [5]. The average gradient is transformed by multiplying with the matrix of left eigenvectors. The limiter is applied as above and transformed back to the original variables by multiplying with the matrix of right eigenvectors.

The application of limiter can change the solution in a cell even if the solution is hydrostatic and smooth, especially at extrema. In order to preserve the well-balanced property of the scheme, we apply the limiter in a cell only if the \(L^2\) norm of the cell residual is greater than a small number and in the computations we use a tolerance of \(10^{-12}\). In all the numerical tests, we find that this is sufficient to prevent the application of limiter when the solution is in hydrostatic state.

5 Numerical Results

The DG code is written in C++ using the deal.II finite element library [2] and all computations are performed in double precision. All the grids used in the computations are generated using the open source grid generator Gmsh [7]. The time integration is performed using a strong stability preserving Runge–Kutta scheme, see [16]. For the ODE \(\frac{\text {d}q}{\text {d}t} = R(t,q)\), the second order scheme is given by
$$\begin{aligned} q^{(1)}= & {} q^n + \Delta t \cdot R\left( t_n, q^n\right) \\ q^{(2)}= & {} \frac{1}{2} q^n + \frac{1}{2}\left[ q^{(1)} + \Delta t \cdot R\left( t_n+\Delta t,q^{(1)}\right) \right] \\ q^{n+1}= & {} q^{(2)} \end{aligned}$$
and the third order scheme is
$$\begin{aligned} q^{(1)}= & {} q^n + \Delta t R\left( t_n, q^n\right) \\ q^{(2)}= & {} \frac{3}{4} q^n + \frac{1}{4}\left[ q^{(1)} + \Delta t \cdot R\left( t_n+\Delta t,q^{(1)}\right) \right] \\ q^{(3)}= & {} \frac{1}{3} q^n + \frac{2}{3}\left[ q^{(2)} + \Delta t \cdot R\left( t_n+\Delta t/2,q^{(2)}\right) \right] \\ q^{n+1}= & {} q^{(3)} \end{aligned}$$
In all the computations we take the gas constant \(R=1\) and \(\gamma =1.4\).

5.1 1-D Hydrostatic Solution

5.1.1 Isothermal Case

We first perform numerical test of well-balanced property for one dimensional solutions. The potential is taken to be either \(\Phi = x\) or \(\Phi = \sin (2\pi x)\). The corresponding states for density and pressure are given by \(\rho = p = \exp \left( -\Phi (x)\right) \). Starting with the hydrostatic solution as the initial condition, the solution is updated upto a time of \(t=0.1\) and the \(L^2\) norm of the difference in final solution and the initial condition is computed on different mesh sizes. The computations are performed on the unit square with a Cartesian mesh of different cell sizes. This is shown in Tables 1 and 2 for the second and third order schemes for the potential \(\Phi = x\), and in Tables 3 and 4 for the potential \(\Phi = \sin (2\pi x)\). In all cases we see that the difference is small and of the order of machine precision.
Table 1

Well-balanced test for isothermal case on Cartesian mesh using \(Q_1\) polynomials and potential \(\Phi = x\)

Mesh

\(\rho u\)

\(\rho v\)

\(\rho \)

E

\(25\times 25\)

1.03822e–13

6.68114e–15

2.72604e–14

9.53913e–14

\(50\times 50\)

1.04783e–13

5.92391e–15

2.67559e–14

9.36725e–14

\(100\times 100\)

1.05019e–13

5.6383e–15

2.66323e–14

9.34503e–14

\(200\times 200\)

1.05088e–13

5.54862e–15

2.66601e–14

9.33861e–14

Table 2

Well-balanced test for isothermal case on Cartesian mesh using \(Q_2\) polynomials and potential \(\Phi =x\)

Mesh

\(\rho u\)

\(\rho v\)

\(\rho \)

E

\(25\times 25\)

1.04518e–13

7.29936e–15

2.7548e–14

9.64205e–14

\(50\times 50\)

1.04983e–13

6.03994e–15

2.69317e–14

9.43158e–14

\(100\times 100\)

1.05069e–13

5.68612e–15

2.69998e–14

9.39126e–14

\(200\times 200\)

1.05089e–13

5.69125e–15

2.68828e–14

9.462e–14

Table 3

Well-balanced test for isothermal case on Cartesian mesh using \(Q_1\) polynomials and \(\Phi = \sin (2\pi x)\)

Mesh

\(\rho u\)

\(\rho v\)

\(\rho \)

E

\(25\times 25\)

9.23424e–13

1.16432e–13

2.31405e–13

8.16645e–13

\(50\times 50\)

9.36459e–13

1.04921e–13

2.28315e–13

8.04602e–13

\(100\times 100\)

9.39613e–13

1.00384e–13

2.28001e–13

8.03005e–13

\(200\times 200\)

9.40422e–13

9.89098e–14

2.2792e–13

8.02653e–13

Table 4

Well-balanced test for isothermal case on Cartesian mesh using \(Q_2\) polynomials and \(\Phi = \sin (2\pi x)\)

Mesh

\(\rho u\)

\(\rho v\)

\(\rho \)

E

\(25\times 25\)

9.34536e–13

1.32134e–13

2.35173e–13

8.30316e–13

\(50\times 50\)

9.39556e–13

1.08172e–13

2.29908e–13

8.10055e–13

\(100\times 100\)

9.40442e–13

1.00923e–13

2.28538e–13

8.04638e–13

\(200\times 200\)

9.40668e–13

9.90613e–14

2.28051e–13

8.0357e–13

We next add a perturbation to the initial hydrostatic solution. The perturbation is added to the pressure as follows
$$\begin{aligned} p = \exp (-x) + \eta \exp \left( -100(x-1/2)^2\right) \end{aligned}$$
where the perturbation amplitude \(\eta =10^{-2}\) or \(\eta =10^{-4}\). The initial perturbation breaks into two waves which propagate in the negative and positive directions. The solution at time \(t=0.25\) is shown in Figs. 3 and 4 for the two amplitudes and different mesh sizes and polynomial degree. We observe that in all cases, the well-balanced scheme is able to predict the perturbation solution without any spurious oscillations. Even the coarse grid solutions show good accuracy as compared with the fine grid solutions.
Fig. 3

Evolution of small perturbations in the isothermal case for \(\eta = 10^{-2}\): a\(Q_1\), b\(Q_2\)

Fig. 4

Evolution of small perturbations in the isothermal case for \(\eta = 10^{-4}\): a\(Q_1\), b\(Q_2\)

To show the advantage of well-balanced scheme, we compute the above solutions using a scheme that is not well balanced. The source terms in the non well-balanced scheme are computed using the exact value of the gravitational force \(\nabla \Phi \). The resulting perturbation pressures are shown in Figs. 5 and 6. The non well-balanced scheme has much larger error in the perturbation pressure compared to the well-balanced scheme. Figure 5 shows that using a higher order scheme (\(Q_2\)) reduces the error in the non-well-balanced scheme. However if the perturbation level is smaller, as in Fig. 6, then the error in non well-balanced scheme is still too high compared to well-balanced scheme.
Fig. 5

Comparison of well-balanced (WB) and non well-balanced (non-WB) schemes for evolution of small perturbations in the isothermal case for \(\eta = 10^{-2}\): a\(Q_1\), 100 cells, b\(Q_2\), 50 cells

Fig. 6

Comparison of well-balanced (WB) and non well-balanced (non-WB) schemes for evolution of small perturbations in the isothermal case for \(\eta = 10^{-4}\): a\(Q_1\), 100 cells, b\(Q_2\), 50 cells

5.1.2 Polytropic Case

We next consider a polytropic hydrostatic solution with potential \(\Phi = x\) and state given by
$$\begin{aligned} \rho = \left( \rho _0^{\nu -1} - \alpha \frac{\nu -1}{\nu } x \right) ^{1/(\nu -1)}, \quad p = \alpha \rho ^{\nu } \end{aligned}$$
where \(\rho _0=1\), \(\alpha =1\) and \(\nu =1.2\). We compute the solution upto a final time of \(t=0.1\) units and show the error in solution in Tables 5 and 6 for second and third order schemes respectively. We see that the scheme preserves the initial condition close to machine precision.
To study the evolution of small perturbations, we consider an initial condition given by
$$\begin{aligned} \rho = \left( \rho _0^{\nu -1} - \alpha \frac{\nu -1}{\nu } x \right) ^{1/(\nu -1)}, \quad p = \alpha \rho ^{\nu } + \eta \exp \left( -100(x-1/2)^2\right) \end{aligned}$$
This is advanced upto a time of \(t=0.25\) and the perturbation pressure is shown in Figs. 7 and 8 for \(\eta =10^{-2}\) and \(\eta = 10^{-4}\) respectively. The perturbations are resolved without any spurious oscillations and even the coarse mesh gives solutions comparable to those on the finer mesh.

5.2 Order of Accuracy Study When Scheme is Not Well-Balanced

In this test, we start with the polytropic hydrostatic solution from Sect. 5.1.2 as initial condition in two dimensions with gravity acting vertically, and solve it with the isothermal well-balanced scheme. This scheme will not be able to exactly preserve the polytropic solution. Since the exact solution is the polytropic hydrostatic solution, we can compute the \(L^2\) norm of the error. The error is computed on different grid sizes and polynomials degrees, and the results are shown in Tables 7 and 8. The horizontal momentum error is close to machine zero since gravity acts on in the vertical direction. The other quantities are not exactly preserved but their errors converge at the expected rate, i.e., we get second order accuracy with \(Q_1\) polynomials and third order accuracy with \(Q_2\) polynomials.

5.3 2-D Hydrostatic Solution: I

This test case is taken from [21]. For the potential \(\Phi = x+y\), the hydrostatic solution is given by
$$\begin{aligned} \rho = \rho _0 \exp \left( - \frac{\rho _0 g}{p_0}(x+y) \right) , \quad p = p_0 \exp \left( - \frac{\rho _0 g}{p_0}(x+y) \right) , \quad u=v= 0 \end{aligned}$$
For the parameters appearing in the above equations, we take the values \(\rho _0=1\), \(p_0=1\) and \(g=1\). With the above initial conditions, the DG scheme maintains the solution at the same values upto machine precision as shown in Table 9. Next we add a small perturbation to the pressure so that the initial pressure is given by
$$\begin{aligned} p = p_0 \exp \left( - \frac{\rho _0 g}{p_0}(x+y) \right) + \eta \exp \left( -100\frac{\rho _0 g}{p_0}[ (x-0.3)^2 + (y-0.3)^2] \right) \end{aligned}$$
while the remaining quantities are as before. In this case, the initial condition is not in equilibrium and it evolves with time. Due to the gravitational force, the pressure perturbation is advected towards the lower left corner. We see in Figs. 9 and 10 that the well-balanced scheme is able to predict the evolution of the perturbation without any spurious disturbances. The \(Q_1\) solutions become more accurate as the mesh becomes finer while the \(Q_2\) solutions are visually quite accurate even on the coarse mesh.
Table 5

Well-balanced test for polytropic case on Cartesian mesh using \(Q_1\) polynomials and potential \(\Phi = x\)

Mesh

\(\rho u\)

\(\rho v\)

\(\rho \)

E

\(25\times 25\)

1.07749e–13

6.67302e–15

2.89086e–14

9.38882e–14

\(50\times 50\)

1.08760e–13

5.87560e–15

2.82644e–14

9.17933e–14

\(100\times 100\)

1.07487e–13

5.29355e–15

4.91244e–14

9.62769e–14

\(200\times 200\)

1.09086e–13

5.70042e–15

2.81423e–14

9.14467e–14

Table 6

Well-balanced test for polytropic case on Cartesian mesh using \(Q_2\) polynomials and potential \(\Phi = x\)

Mesh

\(\rho u\)

\(\rho v\)

\(\rho \)

E

\(25\times 25\)

1.08483e–13

7.35525e–15

2.92146e–14

9.48770e–14

\(50\times 50\)

1.08977e–13

6.03037e–15

2.85168e–14

9.25119e–14

\(100\times 100\)

1.09071e–13

5.75922e–15

2.86190e–14

9.23044e–14

\(200\times 200\)

1.09107e–13

6.11341e–15

2.91511e–14

9.39398e–14

Fig. 7

Evolution of small perturbations in the polytropic case for \(\eta = 10^{-2}\): a\(Q_1\), b\(Q_2\)

Fig. 8

Evolution of small perturbations in the polytropic case for \(\eta = 10^{-4}\): a\(Q_1\), b\(Q_2\)

5.4 2-D Hydrostatic Solution: II

We consider an initial condition with two constant temperatures
$$\begin{aligned} T = {\left\{ \begin{array}{ll} T_l &{} y < 0 \\ T_u &{} y > 0 \end{array}\right. } \end{aligned}$$
Taking the potential to be \(\Phi = y\), the hydrostatic pressure and density are given by
$$\begin{aligned} p = {\left\{ \begin{array}{ll} p_0 \text {e}^{-y/RT_l}, &{} y \le 0 \\ p_0 \text {e}^{-y/RT_u}, &{} y> 0 \end{array}\right. }, \quad \rho = {\left\{ \begin{array}{ll} p/RT_l, &{} y < 0 \\ p/RT_u, &{} y > 0 \end{array}\right. } \end{aligned}$$
While the pressure is continuous at \(y=0\), the density experiences a jump due to the jump in temperature. The computational domain is taken to be \([-0.25, +0.25] \times [-1,1]\) which is covered with a Cartesian mesh and we use the Roe numerical flux. We consider two configurations based on the temperature distribution and compute the solution until time \(t=0.1\) units.

Case 1 Here we choose \(T_l = 1\), \(T_u = 2\). This corresponds to lighter fluid on top of heavier fluid which is a stable configuration. The DG scheme preserves the initial condition upto machine precision as seen in Table 10.

Case 2 Here we choose \(T_l = 2\), \(T_u = 1\). This corresponds to heavier fluid on top of lighter fluid which is an unstable configuration. The DG scheme preserves the initial condition upto machine precision as seen in Table 11.
Table 7

Polytropic hydrostatic solution solved with isothermal well-balanced scheme on Cartesian mesh using \(Q_1\) polynomials and potential \(\Phi = x\)

Mesh size

\(\rho u\)

\(\rho v\)

\(\rho \)

E

Error

Error

Rate

Error

Rate

Error

Rate

\(25\times 25\)

6.22039e–14

1.39945e–05

5.03134e–07

1.50727e–06

\(50\times 50\)

6.27891e–14

3.51615e–06

1.99

1.71697e–07

1.55

4.03669e–07

1.90

\(100\times 100\)

6.29344e–14

8.79605e–07

1.99

4.91080e–08

1.80

1.08737e–07

1.89

\(200\times 200\)

6.29710e–14

2.19966e–07

1.99

1.30477e–08

1.91

2.83352e–08

1.94

Table 8

Polytropic hydrostatic solution solved with isothermal well-balanced scheme on Cartesian mesh using \(Q_2\) polynomials and potential \(\Phi = x\)

Mesh size

\(\rho u\)

\(\rho v\)

\(\rho \)

E

Error

Error

Rate

Error

Rate

Error

Rate

\(25\times 25\)

6.26353e–14

1.03474e–07

1.17234e–07

3.80288e–07

\(50\times 50\)

6.24467e–14

1.29041e–08

3.00

1.46356e–08

3.00

4.74617e–08

3.00

\(100\times 100\)

6.29693e–14

1.61142e–09

3.00

1.82873e–09

3.00

5.92946e–09

3.00

\(200\times 200\)

6.29792e–14

2.01344e–10

3.00

2.28559e–10

3.00

7.41017e–10

3.00

Table 9

Well-balanced test for 2-D isothermal hydrostatic solution on Cartesian meshes

 

\(\rho u\)

\(\rho v\)

\(\rho \)

E

\(Q_1\), \(25\times 25\)

9.85926e–14

9.85855e–14

5.32357e–14

1.55361e–13

\(Q_1\), \(50\times 50\)

9.94493e–14

9.94451e–14

5.37084e–14

1.56669e–13

\(Q_1\), \(100\times 100\)

9.96481e–14

9.96474e–14

5.38404e–14

1.57062e–13

\(Q_2\), \(25\times 25\)

9.9256e–14

9.92682e–14

5.39863e–14

1.57435e–13

\(Q_2\), \(50\times 50\)

9.961e–14

9.96538e–14

5.41091e–14

1.57521e–13

\(Q_2\), \(100\times 100\)

9.95889e–14

9.97907e–14

5.43145e–14

1.57728e–13

Fig. 9

Pressure perturbation on \(50 \times 50\) mesh at time \(t=0.15\)a\(Q_1\), b\(Q_2\). Showing 20 contours lines between \(-0.0002\) and \(+0.0002\)

Fig. 10

Pressure perturbation on \(200 \times 200\) mesh at time \(t=0.15\)a\(Q_1\), b\(Q_2\). Showing 20 contours lines between \(-0.0002\) and \(+0.0002\)

Table 10

Well-balanced test for Rayleigh–Taylor problem in Case 1, \(T_l=1\), \(T_u=2\)

 

\(\rho u\)

\(\rho v\)

\(\rho \)

E

\(Q_1, 25\times 100\)

5.13108e–13

1.10971e–13

2.56836e–13

8.91784e–13

\(Q_1, 50\times 200\)

5.15744e–13

1.12234e–13

2.84309e–13

8.97389e–13

\(Q_2, 25\times 100\)

5.15726e–13

1.1341e–13

3.22713e–13

9.01183e–13

\(Q_2, 50\times 200\)

5.16397e–13

1.13707e–13

3.93623e–13

9.02503e–13

Table 11

Well-balanced test for Rayleigh–Taylor problem in Case 2, \(T_l=2\), \(T_u=1\)

 

\(\rho u\)

\(\rho v\)

\(\rho \)

E

\(Q_1, 25\times 100\)

3.487e–13

1.0989e–13

1.98949e–13

7.42265e–13

\(Q_1, 50\times 200\)

3.50153e–13

1.1121e–13

2.34991e–13

7.4747e–13

\(Q_2, 25\times 100\)

3.50149e–13

1.12159e–13

2.80645e–13

7.5104e–13

\(Q_2, 50\times 200\)

3.50548e–13

1.12533e–13

3.63806e–13

7.52151e–13

The configuration in Case 2 is however physically unstable since the heavier fluid is on top. The small round-off errors will eventually grow with time and lead to the Rayleigh–Taylor instability. In Fig. 11, we show the density at large times and observe that the solution does not change for Case 1 which is a stable configuration. At sufficiently large times, the configuration in Case 2 develops instabilities near the density jump but it remains well-balanced away from the interface.
Fig. 11

Rayleigh–Taylor problem. ad Case 1, ef Case 2

5.5 Order of Accuracy Study

This test case is taken from [21]. An exact solution of the Euler equations with gravity given by
$$\begin{aligned} \rho= & {} 1 + 0.2 \sin (\pi (x+y-t(u_0+v_0))), \quad u = u_0, \quad v = v_0\\ p= & {} p_0 + t(u_0 + v_0) -x - y + 0.2 \cos (\pi (x+y -t(u_0 + v_0)))/\pi \end{aligned}$$
is used to study the order of accuracy. The gravitational potential in this case is given by \(\Phi (x,y) =x+y\). For the parameters, we take \(u_0 = v_0 = 1\), \(p_0 = 4.5\) as in [21]. The above initial condition is evolved in time using the well-balanced DG scheme upto a final time of \(t=0.1\) units. On all parts of the boundary the numerical flux (HLLC) is used to calculate the flux by making use of the exact solution. Tables 12 and 13 show the error measured in \(L^2\) norm for different mesh sizes and polynomial degrees on a Cartesian mesh. We observe that the error converges at the rate of \(N+1\) for the polynomial degree N in all the variables.
Table 12

Convergence of error for degree \(N=1\)

1 / h

\(\rho u\)

\(\rho v\)

\(\rho \)

E

Error

Rate

Error

Rate

Error

Rate

Error

Rate

50

0.00134154

0.00134154

0.0012837

0.00161287

100

0.000335446

1.99

0.000335446

1.99

0.00032044

2.00

0.000411141

1.97

200

8.35627e–05

2.00

8.35627e–05

2.00

7.97842e–05

2.00

0.00010335

1.99

400

2.08348e–05

2.00

2.08348e–05

2.00

1.98754e–05

2.00

2.58109e–05

2.00

Table 13

Convergence of error for degree \(N=2\)

1 / h

\(\rho u\)

\(\rho v\)

\(\rho \)

E

Error

Rate

Error

Rate

Error

Rate

Error

Rate

25

7.7019e–05

7.7019e–05

7.80868e–05

9.32865e–05

50

9.68863e–06

2.99

9.68863e–06

2.99

9.76471e–06

2.99

1.16849e–05

2.99

100

1.21506e–06

2.99

1.21506e–06

2.99

1.22031e–06

3.00

1.46256e–06

2.99

200

1.52134e–07

2.99

1.52134e–07

2.99

1.52503e–07

3.00

1.8247e–07

3.00

5.6 Radial Rayleigh–Taylor Instability

Consider a radial potential given by \(\Phi = r\). The isothermal hydrostatic solution is given by
$$\begin{aligned} \rho = p = \exp (-r) \end{aligned}$$
We compute the solution with above initial condition on Cartesian and unstructured meshes. The domain and mesh used are shown in Fig. 12 in case of the coarsest mesh used. Tables 14 and 15 show the error in solution at time \(t=1\) on Cartesian and unstructured meshes, which shows the well-balanced property is satisfied close to machine precision.
Fig. 12

Sample grids used for radial Rayleigh–Taylor problem: a\(30\times 30\) Cartesian cells, b unstructured mesh of 956 cells

We next compute the above hydrostatic solution with a scheme which is not well balanced. The source terms in the non well-balanced scheme are computed using the exact value of the gravitational force \(\nabla \Phi \). On the outer boundary, which is an artificial boundary, the flux is computed from the interior solution. We compute the solution until time \(t=1.5\) on a mesh of \(50 \times 50\) using our well-balanced scheme and the non well-balanced scheme. The density contours plotted in Fig. 13 show that the well-balanced scheme retains the initial condition, while the non well-balanced scheme generates large errors. If we continue the computation for longer times, then the non well-balanced scheme fails at some point since the artificial boundary conditions cannot be made stable and accurate when the solution does not remain stationary near the outer boundary.
Table 14

Well balanced test for radial Rayleigh–Taylor problem on Cartesian mesh

 

\(\rho u\)

\(\rho v\)

\(\rho \)

E

\(Q_1, 30\times 30\)

6.08113e–13

6.06081e–13

2.11611e–14

4.13127e–14

\(Q_1, 50\times 50\)

5.45634e–13

5.44973e–13

1.29319e–14

2.66376e–14

\(Q_1, 100\times 100\)

5.4918e–13

5.49012e–13

9.63433e–15

2.11463e–14

\(Q_2, 30\times 30\)

6.29776e–13

6.27278e–13

1.9777e–14

5.08689e–14

\(Q_2, 50\times 50\)

5.5376e–13

5.52903e–13

1.5635e–14

3.85134e–14

\(Q_2, 100\times 100\)

5.51645e–13

5.5142e–13

2.173e–14

5.25578e–14

Table 15

Well balanced test for radial Rayleigh–Taylor problem on unstructured mesh

 

\(\rho u\)

\(\rho v\)

\(\rho \)

E

\(Q_1\), 956

3.03033e–16

3.23738e–16

6.66245e–16

2.11449e–16

\(Q_1\), 2037

5.20653e–16

5.10865e–16

9.82565e–16

4.06402e–16

\(Q_1\), 10,710

2.00037e–15

1.57078e–15

2.21284e–15

4.66515e–15

\(Q_2\), 956

2.69429e–14

3.31591e–14

4.50499e–14

1.61455e–13

\(Q_2\), 2037

7.68549e–14

1.1834e–13

1.01632e–13

3.84886e–13

\(Q_2\), 10,710

2.92633e–13

2.44323e–13

2.9449e–13

4.10069e–13

Fig. 13

Well balanced test for radial Rayleigh–Taylor problem on \(50 \times 50\) mesh. a Initial density, b well-balanced scheme, density at \(t=1.5\), c non well-balanced scheme, density at \(t=1.5\)

Fig. 14

Radial Rayleigh–Taylor problem on Cartesian mesh of \(240 \times 240\) and \(Q_1\) polynomials, showing density at different times

Fig. 15

Shock tube problem under gravitational field

In the next test, we put a perturbation in density over the isothermal radial solution. The initial pressure and density are given by
$$\begin{aligned} p = {\left\{ \begin{array}{ll} \text {e}^{-r} &{} r \le r_0 \\ \text {e}^{-\frac{r}{\alpha } + r_0\frac{(1-\alpha )}{\alpha }} &{} r> r_0 \end{array}\right. }, \quad \rho = {\left\{ \begin{array}{ll} \text {e}^{-r} &{} r \le r_i(\theta ) \\ \frac{1}{\alpha } \text {e}^{-\frac{r}{\alpha } + r_0\frac{(1-\alpha )}{\alpha }} &{} r > r_i(\theta ) \end{array}\right. } \end{aligned}$$
where \(r_i(\theta ) = r_0(1 + \eta \cos (k\theta ))\) and \(\alpha = \exp (-r_0)/(\exp (-r_0)+ \Delta _\rho )\). Hence the density jumps by an amount \(\Delta _\rho > 0\) at the interface defined by \(r=r_i(\theta )\) whereas the pressure is continuous. Following [13], we take \(\Delta _\rho = 0.1\), \(\eta =0.02\), \(k=20\) and use a mesh of \(240 \times 240\) cells on the domain \([-1,+1] \times [-1,+ 1]\). In the regions \(r < r_0(1-\eta )\) and \(r > r_0(1+\eta )\) the initial condition is in stable equilibrium but due to the discontinuous density, a Rayleigh–Taylor instability develops at the interface defined by \(r=r_i(\theta )\). The evolution of the density interface with time is shown in Fig. 14. The disturbance is seen to be localized around the initial interface and the solution remains unchanged in other regions. The characteristic plume like structures are clearly visible in the pictures. This level of accuracy is not possible with a scheme that is not well-balanced and such schemes can even be unstable, as discussed above, due to the inability to maintain the hydrostatic solution near the boundaries of the domain, which is an artificial boundary arising due to truncation of the computational domain.

5.7 Shock Tube Problem

We consider the standard Sod test case together with a gravitational field \(\Phi (x) = x\) as in [21]. The domain is [0, 1] and the initial conditions are given by
$$\begin{aligned} (\rho ,u,p) = {\left\{ \begin{array}{ll} (1, 0, 1) &{}\quad x < \frac{1}{2}\\ (0.125, 0, 0.1) &{}\quad x > \frac{1}{2}\end{array}\right. } \end{aligned}$$
together with solid wall boundary conditions. The solutions are obtained on 100 and 200 cells until a time of \(t=0.2\) using the HLLC flux and are shown in Fig. 15. We see that the density increases near \(x=0\) due to the gravitational force which is directed to the left. The coarse mesh of 100 cells is already able to resolve all the features in the solution and there are no spurious oscillations. This test indicates that the modifications in reconstruction scheme and source term are not destroying the non-oscillatory nature of the scheme.

6 Summary

We have proposed a DG scheme for Euler equations with gravitational source terms which is well-balanced for isothermal and polytropic hydrostatic solutions. The scheme is based on nodal Lagrange basis functions using Gauss–Lobatto–Legendre points. The well-balanced property holds for arbitrary gravitational potentials and even on unstructured grids. Standard numerical flux functions can be used in this approach. The scheme is able to compute perturbations around the hydrostatic solution accurately even on coarse meshes.

Notes

Acknowledgements

Praveen Chandrashekar thanks the Airbus Foundation Chair for Mathematics of Complex Systems at TIFR-CAM, Bangalore, for support in carrying out this work. Markus Zenk thanks the DAAD Passage to India program which supported his visit to Bangalore during which time part of this work was conducted.

References

  1. 1.
    Atkins, H.L., Shu, C.-W.: Quadrature-free implementation of discontinuous galerkin method for hyperbolic equations. AIAA J. 36, 775–782 (1998)CrossRefGoogle Scholar
  2. 2.
    Bangerth, W., Hartmann, R., Kanschat, G.: deal.II—a general purpose object oriented finite element library. ACM Trans. Math. Softw. 33, 24/1–24/27 (2007)MathSciNetCrossRefGoogle Scholar
  3. 3.
    Barth, T.J., Jespersen, D.C.: The design and application of upwind schemes on unstructured meshes AIAA PAPER 89-0366. 27th AIAA Aerospace Sciences Meeting, Reno, NV, 9–12 Jan 1989, p. 13. https://ntrs.nasa.gov/search.jsp?R=19890037939
  4. 4.
    Chandrashekar, P., Klingenberg, C.: A second order well-balanced finite volume scheme for Euler equations with gravity. SIAM J. Sci. Comput. 37, B382–B402 (2015)MathSciNetCrossRefMATHGoogle Scholar
  5. 5.
    Cockburn, B., Shu, C.-W.: The Runge–Kutta discontinuous Galerkin method for conservation laws V: multidimensional systems. J. Comput. Phys. 141, 199–224 (1998)MathSciNetCrossRefMATHGoogle Scholar
  6. 6.
    Ern, A., Piperno, S., Djadel, K.: A well-balanced Runge–Kutta discontinuous Galerkin method for the shallow-water equations with flooding and drying. Int. J. Numer. Methods Fluids 58, 1–25 (2008)MathSciNetCrossRefMATHGoogle Scholar
  7. 7.
    Geuzaine, C., Remacle, J.-F.: GMSH: a 3-D finite element mesh generator with built-in pre- and post-processing facilities. Int. J. Numer. Methods Eng. 79, 1309–1331 (2009)MathSciNetCrossRefMATHGoogle Scholar
  8. 8.
    Godlewski, E., Raviart, P.-A.: Numerical Approximation of Hyperbolic Systems of Conservation Laws. Springer, Berlin (1996)CrossRefMATHGoogle Scholar
  9. 9.
    Hesthaven, J.S., Warburton, T.: Nodal Discontinuous Galerkin Methods: Algorithms, Analysis, and Applications. Texts in Applied Mathematics. Springer, Berlin (2008)CrossRefMATHGoogle Scholar
  10. 10.
    Käppeli, R., Mishra, S.: Well-balanced schemes for the Euler equations with gravitation. J. Comput. Phys. 259, 199–219 (2014)MathSciNetCrossRefMATHGoogle Scholar
  11. 11.
    Kopriva, D.A., Gassner, G.: On the quadrature and weak form choices in collocation type discontinuous Galerkin spectral element methods. J. Sci. Comput. 44, 136–155 (2010)MathSciNetCrossRefMATHGoogle Scholar
  12. 12.
    Leveque, R.J.: A well-balanced path-integral f-wave method for hyperbolic problems with source terms. J. Sci. Comput. 48, 209–226 (2011)MathSciNetCrossRefMATHGoogle Scholar
  13. 13.
    LeVeque, R.J., Bale, D.S.: Wave propagation methods for conservation laws with source terms. In: Jeltsch, R., Fey, M. (eds.) Hyperbolic Problems: Theory, Numerics, Applications, International Series of Numerical Mathematics, vol. 130, pp. 609–618. Birkhäuser, Basel (1999)CrossRefGoogle Scholar
  14. 14.
    Li, G., Xing, Y.: Well-balanced discontinuous Galerkin methods for Euler equations under gravitational fields. J. Sci. Comput. 67(2), 493–513 (2016). doi:10.1007/s10915-015-0093-5
  15. 15.
    Roe, P.L.: Approximate Riemann solvers, parameter vectors, and difference schemes. J. Comput. Phys. 43, 357–372 (1981)MathSciNetCrossRefMATHGoogle Scholar
  16. 16.
    Shu, C.-W., Osher, S.: Efficient implementation of essentially non-oscillatory shock-capturing schemes. J. Comput. Phys. 77, 439–471 (1988)MathSciNetCrossRefMATHGoogle Scholar
  17. 17.
    Toro, E.F.: Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction. Springer, Berlin (1999)CrossRefMATHGoogle Scholar
  18. 18.
    Toro, E.F., Spruce, M., Speares, W.: Restoration of the contact surface in the HLL-Riemann solver. Shock Waves 4, 25–34 (1994)CrossRefMATHGoogle Scholar
  19. 19.
    Xing, Y.: Exactly well-balanced discontinuous Galerkin methods for the shallow water equations with moving water equilibrium. J. Comput. Phys. 257, 536–553 (2014). Part AMathSciNetCrossRefMATHGoogle Scholar
  20. 20.
    Xing, Y., Shu, C.-W.: High order well-balanced finite volume WENO schemes and discontinuous Galerkin methods for a class of hyperbolic systems with source terms. J. Comput. Phys. 214, 567–598 (2006)MathSciNetCrossRefMATHGoogle Scholar
  21. 21.
    Xing, Y., Shu, C.-W.: High order well-balanced WENO scheme for the gas dynamics equations under gravitational fields. J. Sci. Comput. 54, 645–662 (2013)MathSciNetCrossRefMATHGoogle Scholar

Copyright information

© Springer Science+Business Media New York 2017

Authors and Affiliations

  1. 1.TIFR Center for Applicable MathematicsBangaloreIndia
  2. 2.Department of MathematicsUniversity of WürzburgWürzburgGermany

Personalised recommendations