Applied Numerical 33 (2000) 393–405

A discontinuous Galerkin spectral/hp method on hybrid grids

R.M. Kirby, T.C. Warburton, I. Lomtev, G.E. Karniadakis ∗ Brown University, Center for Fluid Mechanics, Division of , 182 George Street, Box F, Providence, RI 02912, USA

Abstract We present a discontinuous Galerkin matrix-free formulation for the compressible Navier–Stokes equations and the viscous MHD equations based on spectral/hp hybrid element discretization. We first review the formulation and subsequently present convergence results for an Euler flow, as well as simulation results. The simulation results presented are flow past a NACA 0012 airfoil at Re = 10,000 including some preliminary 3D simulations, and a 2D MHD flow – the so-called Orszag–Tang vortex problem.  2000 IMACS. Published by Elsevier Science B.V. All rights reserved.

Keywords: Hybrid grids; Galerkin spectral/hp method; Discontinuous

1. Introduction

The successes of high-order methods, and specifically of spectral methods, in discretizing hyperbolic conservation laws are few. The main issues that need to be addressed are: monotonicity, conservativity, and complex-geometry domains. A new class of discontinuous Galerkin projections seem to be quite successful in this context as it provides a variational framework for a finite-volume-like algorithm, which in conjunction with a high-order has shown to be very promising [2–4,9,14]. Regarding the geometric complexity, there has been recently an interesting debate as to the relative advantages of structured and unstructured grids, with a renewed interest in Cartesian grids for complex- geometry aerodynamic flows [1]. The current confusion stems from the fact that most finite element and finite volume formulations in use today produce solutions which depend strongly on the quality of the grid. Specifically, for highly distorted grids convergence is questionable, and in most cases convergence rates are typically less than second-order. To this end, some—relatively few—efforts have addressed the development of hybrid grids, i.e., a mixture of structured and unstructured grids in order to combine the merits of both discretizations in the context of complex-geometry aerodynamic flows [10,12,15]. Such methods lead to more flexible geometric discretization and resolution placement, but they are still of low-order accuracy, i.e., at most second-order.

∗ Corresponding author. E-mail: [email protected], http://www.cfm.brown.edu/crunch

0168-9274/00/$20.00  2000 IMACS. Published by Elsevier Science B.V. All rights reserved. PII:S0168-9274(99)00106-3 394 R.M. Kirby et al. / Applied Numerical Mathematics 33 (2000) 393–405

In the current work we develop a new formulation for the compressible Navier–Stokes and the MHD equations employing high-order spectral/hp element discretization on hybrid grids consisting of triangular and quadrilateral elements in two dimensions, and tetrahedra, hexahedra, prisms, and pyramids in three dimensions. A discontinuous Galerkin formulation is developed for both the advection as well as the diffusion contributions that allows multidomain representation with a discontinuous (i.e., globally L2) trial basis. This discontinuous basis is orthogonal, hierarchical, and maintains a tensor- product property (even for non-orthogonal elements), a key property for the efficient implementation of high-order methods. Due to this basis the resulting mass matrix is diagonal, and thus the proposed method is matrix-free given that an explicit time-stepping is used. The conservativity property is maintained automatically by the discontinuous Galerkin formulation, and monotonicity is controlled by varying the order of the spectral expansion in the neighborhood of discontinuities.

2. Numerical formulation

We consider the nondimensionalized compressible Navier–Stokes or MHD equations, which we write in compact form as E −1 ν Ut +∇·F = Re∞ ∇·F , (1) where F and F ν correspond to inviscid and viscous flux contributions, respectively. For Navier–Stokes the vector UE =[ρ,ρu,ρv,ρw,E]T with (u,v,w)the local fluid velocity, ρ the fluid density, and E the total internal and for the MHD equations UE =[ρ,ρu,ρv,ρw,E,B]T containing in addition to previous quantities the magnetic field B. Splitting the Navier–Stokes/MHD operator in this form allows for a separate treatment of the inviscid and viscous contributions, which in general exhibit different mathematical properties. In the following, we review briefly the discontinuous Galerkin formulations employed in the proposed method; a rigorous analysis of the various operators was presented in [9], where a mixed formulation was used to treat the diffusion terms. The discontinuous Galerkin formulation has already been implemented in the context of unstructured grids in [8].

2.1. Discontinuous Galerkin for advection

To explain the formulation we consider the linear two-dimensional equation for advection of a conserved quantity u in a region Ω ∂u +∇·F (u) = 0, (2) ∂t where F (u) = (f (u), g(u)) is the flux vector which defines the transport of u(x,t). In the discontinuous Galerkin formulation we consider an approximation space X which may contain discontinuous functions. The discrete X δ contains polynomials within each “element”, but zero outside the element. Here the element mayS be a triangle or a quadrilateral; we denote this element by Ti . Thus the computational = domain Ω i Ti ,andTi,Tj overlap only on edges. Consequently, each element is treated separately, corresponding to the following variational statement: Z ∂   (u, v) + v f(u)e − F (u) · nb ds + ∇·F (u), v = 0. (3) ∂t e e ∂Te R.M. Kirby et al. / Applied Numerical Mathematics 33 (2000) 393–405 395

Computations on each element are performed separately, and the connection between elements is a result of the way boundary conditions are applied. Here, boundary conditions are enforced via the numerical flux f(u)e that appears in Eq. (3). Because this value is computed at the boundary between adjacent elements, it may be computed from the value of u given at either element. These two possible values are denoted here as u− (left) and u+ (right), and the boundary flux written f(ue −,u+). Upwinding considerations dictate how this flux is computed. In the more complicated case of a hyperbolic system of equations, an approximate would be used to compute a value of fe based on u− and u+.

2.2. Discontinuous Galerkin for diffusion

We consider as a model problem the parabolic equation with variable coefficient ν to demonstrate the treatment of the viscous contributions: 2 ut =∇·(ν∇u) + f, in Ω, u ∈ L (Ω), u = g(x,t), on ∂Ω. We then introduce the flux variable q =−ν∇u with q(x,t)∈ L2(Ω), and re-write the parabolic equation

ut =−∇·q + f, in Ω, 1 q =−∇u, in Ω, ν u = g(x,t), on ∂Ω. The weak formulation of the problem is then as follows: Find (q,u)∈ L2(Ω) × L2(Ω) such that = ∇ −h · i + ∀ ∈ 2 (ut ,w)e (q, w)e w,qb n e (f, w)e, w L (Ω), 1 (q, v) = (u, ∇·v) −hu , v· ni , ∀v ∈ L2(Ω), ν e b e u = g(x,t), on ∂Ω, where the parentheses denote standard inner product in an element (e) and the angle brackets denote boundary terms on each element, with n denoting the unit outwards normal. The surface terms contain weighted boundary values of vb,qb, which can be chosen as the arithmetic mean of values from the two sides of the boundary, i.e., vb = 0.5(v+ + v−),andqb = 0.5(q+ + q−). By integrating by parts once more, we obtain an equivalent formulation which is easier to implement and it is actually used in the computer code. The new variational problem is

= −∇· − − · + ∀ ∈ 2 (ut ,w)e ( q,w)e w,(qb qint) n e (f, w)e, w L (Ω), 1 (q, v) = (−∇u, v) −hu − u , v· ni , ∀v ∈ L2(Ω), ν e b int e u = g(x,t), on ∂Ω, where the subscript (int) denotes contributions evaluated at the interior side of the boundary. 396 R.M. Kirby et al. / Applied Numerical Mathematics 33 (2000) 393–405

2.3. Spectral/hp element discretization

2.3.1. Local coordinate systems We start by defining a convenient set of local coordinates upon which we can construct the expansions. Moving away from the use of barycentric coordinates, which are typically applied to unstructured domains, we define a set of collapsed Cartesian coordinates in non-rectangular domains. These coordinates will form the foundation of the polynomial expansions. The advantage of this system is that every domain can be bounded by constant limits of the new local coordinates; accordingly operations such as integration and differentiation can be performed using standard one-dimensional techniques. The new coordinate systems are based upon the transformation of a triangular region to a rectangular domain (and vice versa) as shown in Fig. 1. The main effect of the transformation is to map the vertical lines in the rectangular domain (i.e., lines of constant η1) onto lines radiating out of the point (ξ1 =−1, ξ2 = 1) in the triangular domain. The triangular region can now be described using the “ray” coordinate (η1) and the standard horizontal coordinate (ξ2 = η2). The triangular domain is therefore defined by (−1 6 η1, η2 6 1) rather than the Cartesian description (−1 6 ξ1,ξ2; ξ1 + ξ2 6 0) where the upper bound couples the two coordinates. The “ray” coordinate (η1) is multi-valued at (ξ1 =−1,ξ2 = 1). Nevertheless, we note that the use of singular coordinate systems is very common arising in both cylindrical and spherical coordinate systems. As illustrated in Fig. 2, the same transformation can be repeatedly applied to generate new coordinate systems in three dimensions. Here, we start from the bi-unit hexahedral domain and apply the triangle to rectangle transformation in the vertical plane to generate a prismatic region. The transformation is then used in the second vertical plane to generate the pyramidic region. Finally, the rectangle to triangle transformation is applied to every square cross section parallel to the base of the pyramidic region to arrive at the tetrahedral domain. By determining the hexahedral coordinates (η1,η2,η3) in terms of the Cartesian coordinates of the tetrahedral region (ξ1,ξ2,ξ3) we can generate a new coordinate system for the tetrahedron. This new

Fig. 1. Triangle to rectangle transformation.

Fig. 2. Hexahedron to tetrahedron transformation. R.M. Kirby et al. / Applied Numerical Mathematics 33 (2000) 393–405 397

Fig. 3. The local coordinate systems used in each of the hybrid elements and the planes described by fixing each local coordinate. system and the planes described by fixing the local coordinates are shown in Fig. 3. Also shown are the new systems for the intermediate domains which are generated in the same fashion. Here we have assumed that the local Cartesian coordinates for every domain are (ξ1,ξ2,ξ3).

2.3.2. Hierarchical expansions For each of the hybrid domains we can develop a polynomial expansion based upon the local coordinate system derived in Section 2.3.1. These expansions will be polynomials in terms of the local coordinates as well as the Cartesian coordinates (ξ1,ξ2,ξ3). This is a significant property as primary operations such as integration and differentiation can be performed with respect to the local coordinates but the expansion may still be considered as a polynomial expansion in terms of the Cartesian system. We shall initially consider expansions which are orthogonal in the Legendre inner product. We define a b c α,β three principle functions φi (z), φij (z) and φij k , in terms of the Jacobi polynomial Pp (z) as  i  i+j 1 − z + 1 − z + + φa(z) = P 0,0(z), φb (z) = P 2i 1,0(z), φc (z) = P 2i 2j 2,0(z). i i ij 2 j ij k 2 k Using these functions we can construct the orthogonal polynomial expansions:

hexahedral expansion: prismatic expansion: = a a a = a a b φpqr(ξ1,ξ2,ξ3) φp(ξ1)φq (ξ2)φr (ξ3), φpqr(ξ1,ξ2,ξ3) φp(ξ1)φq (η2)φqr(ξ3), pyramidic expansion: tetrahedral expansion: = a a c = a a c φpqr(ξ1,ξ2,ξ3) φp(η1)φq (η2)φpqr(η3), φpqr(ξ1,ξ2,ξ3) φp(η1)φpq(η2)φpqr(η3), where 2(1 + ξ1) 2(1 + ξ1) 2(1 + ξ2) η1 = − 1, η1 = − 1,η2 = − 1,η3 = ξ3 (−ξ2 − ξ3) (1 − ξ3) (1 − ξ3) are the local coordinates illustrated in Fig. 3. The hexahedral expansion is simply a standard tensor product of Legendre polynomials (since 0,0 = Pp (z) Lp(z)). In the other expansions the introduction of the degenerate local coordinate systems 398 R.M. Kirby et al. / Applied Numerical Mathematics 33 (2000) 393–405

b c is linked to the use of the more unusual functions φij (z) and φij k (z). These functions both contain factors of the form ((1 − z)/2)p which is necessary to keep the expansion as a polynomial of the Cartesian coordinates (ξ1,ξ2,ξ3). For example, the coordinate η2 in the prismatic expansion necessitates the use of b − q a the function φqr(ξ3) which introduces a factor of ((1 ξ3)/2) . The product of this factor with φq (η2) is a a polynomial function in ξ2 and ξ3. Since the remaining part of the prismatic expansion, φp(ξ1), is already in terms of a Cartesian coordinate, the whole expansion is a polynomial in terms of the Cartesian system. The polynomial space, in Cartesian coordinates, for each expansion is  P = p q r Span ξ1 ξ2 ξ3 , (4) where pqr for each domain is

Hexahedron: 0 6 p 6 P1, 0 6 q 6 P2, 0 6 r 6 P3,

Prism: 0 6 p 6 P1, 0 6 q 6 P2, 0 6 q + r 6 P3, (5) Pyramidic: 0 6 p 6 P1, 0 6 q 6 P2, 0 6 p + q + r 6 P3,

Tetrahedron: 0 6 p 6 P1, 0 6 p + q 6 P2, 0 6 p + q + r 6 P3. The range of the p,q and r indices indicate how the expansions should be expanded to generate a complete polynomial space. We note that if P1 = P2 = P3 then the tetrahedral and pyramidic expansions span the same space and are in a subspace of the prismatic expansion which is in turn a subspace of the hexahedral expansion. An important property of the hybrid spectral basis is that it is orthogonal in the new coordinate system that we introduce. This simplifies greatly the Galerkin formulation, which we will be using, since all mass matrices are diagonal and their inversion is trivial.

3. Convergence and simulations

3.1. Euler flow

We first consider the convergence rate of this formulation by solving for an isentropic flow problem in the geometry shown in Fig. 4(a). Low-order methods erroneously produce entropy from inlet to outlet for this problem. Here we show in Fig. 4(b) that the entropy error converges exponentially fast to zero with p-refinement.

3.2. Viscous compressible flow

To demonstrate the utility of hybrid elements, we examine viscous subsonic flow past a NACA 0012 airfoil. A combination of both structured and unstructured meshing techniques were used to produce the mesh presented in Fig. 5. A structured mesh was used both in the boundary layer region and wake region (center and right) to utilize the quadrilateral’s favorable computational characteristics while unstructured meshing (triangles) was used both for interfacing structured regions and for filling the remainder of the computational domain (left). A summary of the simulation parameters is given in Table 1. In Fig. 6 we show instantaneous iso-contours of density in the near wake of the airfoil. R.M. Kirby et al. / Applied Numerical Mathematics 33 (2000) 393–405 399

(a) (b)

Fig. 4. (a) Three-dimensional hybrid discretization of the geometry. (b) Exponential convergence of the error as the spectral order increases.

Table 1 Simulation parameters for compressible flow past a NACA 0012 Parameter Value Dimension 2D Re 10,000 based on total chord length Mach 0.5 1t 0.001–0.00001 P range 1–11

KTri 3307

KQuad 4180 Method Discontinuous Galerkin

Fig. 5. Hybrid discretization around a NACA 0012 airfoil. Only part of the domain is shown.

The three-dimensional problem we consider is flow past a NACA 0012 airfoil with plates attached to each end as a simple model of a wing between an engine and fuselage. We impose uniform upwind boundary conditions at inflow and outflow, and the domain is periodic from one end of the airfoil to the other. 400 R.M. Kirby et al. / Applied Numerical Mathematics 33 (2000) 393–405

Fig. 6. Iso-contours of density in the wake region (from x/L = 2tox/L = 5, where x originates at the front of the airfoil and L is the length of the airfoil) of flow past a NACA 0012 airfoil at Mach number 0.5.

Table 2 Simulation parameters for compressible flow past a NACA 0012 airfoil with endplates Parameter Value Dimension 3D Re 2000 base on chord length Mach 0.5 1t 10−4 P range 1– 4

KPrisms 1960

KHex 2095 Method Discontinuous Galerkin

A thin layer of hexahedra was used on the surface of the wing, and a combination of both hexahedra and prisms were used in the remainder of the computational domain. The simulation was run with up to 4th order expansion and Re = 2000 (based on chord length). A summary of the simulation parameters is giveninTable2.

3.3. MHD flow

We simulate MHD flow on a hybrid grid consisting of quadrilaterals and triangles as shown in Fig. 8. In addition to the normal constraints imposed for solving viscous compressible Navier–Stokes, the MHD equations require that the solution satisfies a divergence-free magnetic field constraint. We deal with this constraint by using the formulation of Powell [13]. The idea is to add a source term proportional to the divergence of the magnetic field to the right-hand side of the evolution equation. We have performed a series of detailed simulations in order to investigate the small-scale structure exhibited in MHD turbulence. In particular, we consider a problem first studied by Orszag and Tang (1979) [11] in the incompressible case and later extended by Dahlburg and Picone (1989) [6] to the compressible case. R.M. Kirby et al. / Applied Numerical Mathematics 33 (2000) 393–405 401

Fig. 7. Skeleton mesh for flow past a three-dimensional NACA 0012 airfoil with endplates (top and middle). Iso-contours for x-component of momentum for M = 0.5 flow past a three-dimensional NACA 0012 airfoil with endplates (bottom). 402 R.M. Kirby et al. / Applied Numerical Mathematics 33 (2000) 393–405

Table 3 Simulation parameters for the compressible Orszag–Tang vortex problem (hybrid mesh) Parameter Value Dimension 2D

Sv (Viscous Lundquist number) 100

Sr (Resistive Lundquist number) 100 A (Alfven number) 1.0 Mach 0.4 P 12

KQuad 176

KTri 64 Method Discontinuous Galerkin

Fig. 8. Hybrid mesh used for the Orszag–Tang vortex simulations.

The initial conditions are non-random, periodic fields with the velocity field being solenoidal. The total initial pressure consists of the superposition of appropriate incompressible pressure distribution upon a flat pressure field corresponding to an initial average Mach number below unity. It was found in [11] and [6] that the coupling of the two-dimensional flow with the magnetic field causes the formation of singularities, i.e., excited small-scale structure, which although not as strong as the singularities in three-dimensional turbulence, they are certainly much stronger than two-dimensional hydrodynamic turbulence. Moreover, it was found in [6] that compressibility causes the formation of additional small- scale structure such as massive jets and bifurcation of eddies. Our interest here is to investigate if we can capture these fine features on hybrid girds. The parameters of this simulation are listed in Table 3. Resolution studies for this problem are presented in [16]. In Fig. 9 we plot streamlines of the incompressible flow as well as the compressible flow at Mach number 0.4 and non-dimensional time t = 2.0. These results agree very well with the simulations of [6] R.M. Kirby et al. / Applied Numerical Mathematics 33 (2000) 393–405 403

Fig. 9. Compressible Orszag–Tang vortex (t = 2, instantaneous fields, Mach = 0.4). Top: incompressible flow; left: flow streamlines; right: magnetic streamlines. Bottom: compressible flow; left: flow streamlines; right: magnetic streamlines. at the same set of parameters. We note here that the compressible flow exhibits structures of finer features compared to the incompressible flow but the differences in the magnetic field are less obvious.

4. Summary

We have developed a new method for solving both the compressible Navier–Stokes equations and MHD equations on hybrid grids consisting of arbitrary triangles and quadrilaterals in two dimensions and tetrahedra, hexahedra, prisms, and pyramids in three dimensions. The new method is based on a discontinuous Galerkin treatment of the advective and diffusive component. This, in turn, allows the use of orthogonal tensor-product spectral basis in these non-orthogonal subdomains, which results in high d+1 computational efficiency. In particular, the computational cost is nelP (where d = 2or3in2Dand 3D, respectively) with nel the number of elements and P the polynomial order in an element. This cost 404 R.M. Kirby et al. / Applied Numerical Mathematics 33 (2000) 393–405 corresponds to differentiation and integration cost on the entire domain and is similar to the cost of such operations in standard global methods in simple separable domains. The only matrix inversion required is that of a local mass matrix, which is diagonal, and thus trivial to invert. High-order methods have not been popular in the past for simulations of compressible viscous flows or MHD flows, primarily due to problems associated with solution monotonicity in the presence of shocks. Typically, filtering, limiters or non-oscillatory reconstruction algorithms are involved, which have been shown to be neither efficient nor robust for most aerodynamic applications (see, for example, [5,7]). The method presented here borrows from features of finite volumes, finite-elements, and spectral methods, and is both robust and flexible as it is conservative, it does not rely on flux-limiters, and it works on flexible hybrid, i.e., a combination of structured and unstructured, grids.

Acknowledgements

We would like to thank both Dr. Spencer J. Sherwin and Dr. Joaquim Peiró of Imperial College for many helpful discussions, and Dr. Tim Barth of Nasa Ames who kindly provided his mesh generator code. This work was supported by AFOSR.

References

[1] M. Aftosmis, J. Melton, M. Berger, Adaptation and surface modeling of Cartesian mesh methods, in: AIAA- 95-1725, 1995. [2] C.E. Baumann, T.J. Oden, A discontinuous hp finite element method for the solution of the Euler equations of Gas Dynamics, in: Tenth International Conference on Finite Elements in Fluids, January 5–8, 1998. [3] C.E. Baumann, T.J. Oden, A discontinuous hp finite element method for the solution of the Navier–Stokes equations, in: Tenth International Conference on Finite Elements in Fluids, January 5–8, 1998. [4] C.E. Baumann, T.J. Oden, A discontinuous hp finite element method for the Euler and the Navier–Stokes equations, Internat. J. Numer. Methods Fluids (1998) (to appear). [5] W. Cai, D. Gottlieb, C.W. Shu, Non-oscillatory spectral Fourier methods for shock wave calculations, Math. Comp. 52 (1989) 389–410. [6] R.B. Dahlburg, J.M. Picone, Evolution of the Orszag–Tang vortex system in a compressible medium. I. Initial average subsonic flow, Phys. Fluids B 1 (11) (1989) 2153–2171. [7] J. Giannakouros, G.E. Karniadakis, A spectral element-FCT method for the compressible Euler equations, J. Comput. Phys. 115 (1994) 65. [8] I. Lomtev, G.E. Karniadakis, A discontinuous Galerkin method for the Navier–Stokes equations, Internat. J. Numer. Methods Fluids 29 (1999) 587–603. [9] I. Lomtev, C.B. Quillen, G.E. Karniadakis, Spectral/hp methods for viscous compressible flows on unstruc- tured 2d meshes, J. Comput. Phys. 144 (1998) 325–357. [10] D.J. Mavriplis, V. Venkatakrishnan, A unified multigrid solver for the Navier–Stokes equations on mixed element meshes, in: AIAA-95-1666, San Diego, CA, 1995. [11] S.A. Orszag, C. Tang, Small-scale structure of two-dimensional magnetohydrodynamic turbulence, J. Fluid Mech. 90 (1) (1979) 129–143. [12] V. Parthasarathy, Y. Kallinderis, K. Nakajima, Hybrid adaption method and directional viscous multigrid with prismatic-tetrahedral meshes, in: AIAA-95-0670, Reno, NV, 1995. [13] K.G. Powell, An approximate Riemann solver for magnetohydrodynamics (that works in more than one dimension), Technical Report, ICASE Report 94-24, ICASE, NASA Langley, 1994. R.M. Kirby et al. / Applied Numerical Mathematics 33 (2000) 393–405 405

[14] S. Sherwin, A high order Fourier/unstructured discontinuous Galerkin method for hyperbolic conservation laws, in: Seventh International Conference on Hyperbolic Problems, Zurich, 1998. [15] D. Tafli, M. Soetrisno, S. Imlay, A parallel algorithm for hybrid structured–unstructured grids, in: AIAA-96- 0287, Reno, NV, 1996. [16] T.C. Warburton, Spectral/hp methods on polymorphic multi-domains: Algorithms and applications, Ph.D. Thesis, Brown University, Division of Applied Mathematics, 1999.