1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Rocky Mountain Mathematics Consortium Summer School Conservation Laws & Applications Lecture V: Discontinuous Galerkin Methods James A. Rossmanith Department of Mathematics University of Wisconsin – Madison July 2st , 2010 J.A. Rossmanith | RMMC 2010 1/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Outline 1 1D DG-FEM 2 2D Cartesian DG-FEM 3 2D mesh generation 4 2D unstructured DG-FEM J.A. Rossmanith | RMMC 2010 2/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Outline 1 1D DG-FEM 2 2D Cartesian DG-FEM 3 2D mesh generation 4 2D unstructured DG-FEM J.A. Rossmanith | RMMC 2010 3/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Basic idea Spatial discretization [Cockburn & Shu, 1990’s] Map each element to [−1, 1]: x = xi + ξ ∆x 2 Basis functions: √ √ ff √ ´ ´ 5` 2 7` 3 φ(`) (ξ) = 1, 3 ξ, 3ξ − 1 , 5ξ − 3ξ , . . . 2 2 Orthogonality: 1 2 Z 1 φ(`) (ξ) φ(k) (ξ) dξ = δ`k −1 Galerkin expansion: n ˛ X ˛ q h (t, x)˛ = Q(`) (t) φ(`) (ξ(x)) T J.A. Rossmanith | RMMC 2010 `=1 4/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Basic idea Cofficients are computed via L2 -projection: #2 Z " n “ ” X 1 1 E Q(1) (t), . . . , Q(n) (t) = Q(`) (t) φ(`) (ξ) dξ q(t, ξ) − 2 −1 `=1 ∂E = ∂Q(k) 1 Z " q(t, ξ) − −1 ∴ J.A. Rossmanith | RMMC 2010 n X # Q(`) (t) φ(`) (ξ) φ(k) (ξ) dξ = 0 `=1 Q(k) (t) = 1 2 Z 1 q(t, ξ) φ(k) (ξ) dξ −1 5/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Basic idea Weak formulation: Z o 1 1 (`) n φ q,t + f (q),x dξ = 0 2 −1 Z 1 ff Z 1 d 1 1 φ(`) q dξ = − φ(`) f (q),ξ dξ dt 2 −1 ∆x −1 n X q(t, ξ) ∼ Q(k) (t) φ(k) (ξ) k=1 (k) Q̇i 1 = ∆x Z 1 „ » – ˛ « 1 ˛ (k) φ,ξ (ξ) dξ − f q h (t, ξ)˛ φ(k) (1) Fi+ 1 − φ(k) (−1) Fi− 1 2 2 ∆x Ti −1 Conservation: k=1 Time integrate J.A. Rossmanith | RMMC 2010 (1) =⇒ =⇒ Q̇i h (1) Qi » – 1 Fi+ 1 − Fi− 1 2 2 ∆x » – h in ∆t (1) = Qi − F̄i+ 1 − F̄i− 1 2 2 ∆x =− in+1 6/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Basic idea Weak formulation: Z o 1 1 (`) n φ q,t + f (q),x dξ = 0 2 −1 Z 1 ff Z 1 d 1 1 φ(`) q dξ = − φ(`) f (q),ξ dξ dt 2 −1 ∆x −1 n X q(t, ξ) ∼ Q(k) (t) φ(k) (ξ) k=1 (k) Q̇i 1 = ∆x Z 1 „ » – ˛ « 1 ˛ (k) φ,ξ (ξ) dξ − f q h (t, ξ)˛ φ(k) (1) Fi+ 1 − φ(k) (−1) Fi− 1 2 2 ∆x Ti −1 Conservation: k=1 Time integrate J.A. Rossmanith | RMMC 2010 (1) =⇒ =⇒ Q̇i h (1) Qi » – 1 Fi+ 1 − Fi− 1 2 2 ∆x » – h in ∆t (1) = Qi − F̄i+ 1 − F̄i− 1 2 2 ∆x =− in+1 6/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Basic idea Time-stepping: Space-time methods (implicit) Lax-Wendroff (Taylor-series + replace time by spatial derivatives) Total variation diminishing Runge-Kutta: U ? = U n + ∆t L(U n ) 3 1 1 U ?? = U n + U ? + ∆t L(U ? ) 4 4 4 1 n 2 ?? 2 n+1 U = U + U + ∆t L(U ?? ) 3 3 3 Numerical fluxes: Can use either exact or approximate Riemann solvers Unlike WP-FVM, order is not tied to Riemann solver Only need F (q̄, q̄) = f (q̄) Local Lax-Friedrichs: 1 1 F (Qr , Q` ) = (f (Q` ) + f (Qr )) − s (Qr − Q` ) , 2 2 J.A. Rossmanith | RMMC 2010 ˛ ˛ s = max˛λ(f,q )˛ 7/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Basic idea Time-stepping: Space-time methods (implicit) Lax-Wendroff (Taylor-series + replace time by spatial derivatives) Total variation diminishing Runge-Kutta: U ? = U n + ∆t L(U n ) 3 1 1 U ?? = U n + U ? + ∆t L(U ? ) 4 4 4 1 n 2 ?? 2 n+1 U = U + U + ∆t L(U ?? ) 3 3 3 Numerical fluxes: Can use either exact or approximate Riemann solvers Unlike WP-FVM, order is not tied to Riemann solver Only need F (q̄, q̄) = f (q̄) Local Lax-Friedrichs: 1 1 F (Qr , Q` ) = (f (Q` ) + f (Qr )) − s (Qr − Q` ) , 2 2 J.A. Rossmanith | RMMC 2010 ˛ ˛ s = max˛λ(f,q )˛ 7/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Gaussian quadrature Need to evaluate integrals of the form Z 1 I= f (ξ) dξ −1 Gaussian quadrature has maximum degree of precision: 2n − 1 Gaussian quadrature rules: I1 = 2f (0) X „ 1 « I2 = f ±√ 3 ± „ √ « 8 5 X 3 I3 = f (0) + f ±√ 9 9 ± 5 When integrating against φ(`) need rule with N points (`) When integrating against φ,ξ need rule with N − 1 points J.A. Rossmanith | RMMC 2010 8/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Moment limiters [Krivodonova, 2007] Moment representation: Q(1) , Q(2) , Q(3) , . . . Moment limiter: “ ” “ ”” “ (k) (k) (k−1) (k−1) (k−1) (k−1) Qi = minmod Qi , c(k) Qi − Qi−1 , c(k) Qi+1 − Qi .. . (2) Qi “ “ ” “ ”” (2) (1) (1) (1) (1) = minmod Qi , c(2) Qi − Qi−1 , c(2) Qi+1 − Qi J.A. Rossmanith | RMMC 2010 9/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Artificial viscosity [Persson & Peraire, 2006] q,t + f (q),x = (ε B(q) v),x v = q,x Cell-by-cell smoothness indicator: qh = N X Q(`) φ(`) , q̂ h = `=1 hq h − q̂ h , q h − q̂ h i , hq h , q h i ( 0 if S < TOL ε := ε0 if S ≥ TOL S := N −1 X Q(`) φ(`) `=1 S ∼ ∆x2N (smooth solutions) Local DG method for elliptic & parabolic PDEs: Multiply both equations by same test function, φ(`) , and 1 int-by-parts Difficulties: time-step restriction due to parabolic part, parameters J.A. Rossmanith | RMMC 2010 10/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Discontinuous Galerkin FEM Why? Comparison of properties: High-order Unstructured meshes Stability for conservation laws Explicit time-stepping Elliptic equations FVM 8 4 4 4 4 FDM 4 8 4 4 4 FEM 4 4 8 (4) 4 DG 4 4 4 4 (4) Difficulties with DG-FEM No universally accepted limiters Generally small time-restrictions due to sub-grid resolution Errors in replacing exact integrals by Gaussian quadrature Entropy stability and explicit time-stepping J.A. Rossmanith | RMMC 2010 11/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Discontinuous Galerkin FEM A brief history First introduced by [Reed & Hill, 1973] for neutron transport: σq + ∇ · (uq) = f First analysis by [Lesaint & Raviart, 1974] showing O(hN ) 1 Sharp analysis [Johnson, 1986] showing O(hN + 2 ) 1990’s: Extension to general conservation laws [Cockburn & Shu] Out of all this came RKDG (Runge-Kutta discontinuous Galerkin) Last 15 years: high-order, adaptivity, nodal/modal, . . .: Hesthaven, Warburton, Karniadakis, Kopriva, Shu, Persson, Munz, . . . Applications: Fluid dynamics Aero-acoustics Maxwell equations Plasma physics Shallow water waves J.A. Rossmanith | RMMC 2010 12/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Outline 1 1D DG-FEM 2 2D Cartesian DG-FEM 3 2D mesh generation 4 2D unstructured DG-FEM J.A. Rossmanith | RMMC 2010 13/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM DG-FEM on Cartesian grids Map each element to canonical element [−1, 1] × [−1, 1] x = xi + ξ ∆x 2 y = yj + η ∆y 2 Basis functions (up to third-order accuracy): √ √ n √ √ ´ ´o 5` 2 5` 2 3 ξ, 3 η, 3 ξη, 3ξ − 1 , 3η − 1 φ(`) = 1, 2 2 Orthonormality: D Z Z E 1 1 1 (m) φ(m) , φ(n) := φ (ξ, η) φ(n) (ξ, η) dξ dη = δmn 4 −1 −1 Galerkin approximation: 6 X ˛ (k) q h (t, ξ, η)˛T ≡ Qij (t) φ(k) (ξ, η) ij k=1 J.A. Rossmanith | RMMC 2010 14/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM DG-FEM on Cartesian grids Semi-discrete form: (`) (`) ∆Fij ∆Gij d (`) (`) Qij = Nij − − dt ∆x ∆y Internal and flux difference parts in the semi-discrete form: – Z Z » 1 1 1 1 (`) 1 (`) (`) Nij = φ,ξ f (q h ) + φ,η g(q h ) dξ dη, 2 −1 −1 ∆x ∆y » Z 1 –ξ=1 1 (`) ∆Fij = φ(`) f (q h ) dη 2 −1 ξ=−1 » Z 1 –η=1 1 (`) ∆Gij = φ(`) g(q h ) dξ 2 −1 η=−1 Integrals approximated via Gaussian quadrature rules Surface integrals: 1D GQ with N points Volume integrals: 2D tensor product GQ with (N − 1) × (N − 1) points J.A. Rossmanith | RMMC 2010 15/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Moment limiters [Krivodonova, 2007] In multi-D, moment limiters become more complicated For example, with a third-order scheme: Q(4) ξ 2 Q(5) ξη Q(2) ξ Q(6) η 2 Q(3) η Q(1) Limit highest-order first: (5) Qij “ ” (4) (4) (2) − (2) Qij = minmod Qij , ∆+ x Qij , ∆x Qij “ ” (5) (2) − (2) + (3) − (3) = minmod Qij , ∆+ y Qij , ∆y Qij , ∆x Qij , ∆x Qij “ ” (6) (6) (3) − (3) Qij = minmod Qij , ∆+ y Qij , ∆y Qij If anything happened, go to next order: “ ” (2) (2) (1) − (1) Qij = minmod Qij , ∆+ x Qij , ∆x Qij “ ” (3) (3) (1) − (1) Qij = minmod Qij , ∆+ y Qij , ∆y Qij J.A. Rossmanith | RMMC 2010 16/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Artificial viscosity [Persson & Peraire, 2006] q,t + ∇ · F(q) = ∇ · (ε B(q) v) v = ∇q Cell-by-cell smoothness indicator: K(N −1) K(N ) qh = X Q(`) φ(`) , q̂ h = `=1 hq h − q̂ h , q h − q̂ h i , hq h , q h i ( 0 if S < TOL ε := ε0 if S ≥ TOL S := X Q(`) φ(`) `=1 S ∼ h2N (smooth solutions) Local DG method for elliptic & parabolic PDEs: Multiply each equation by same test function, φ(`) , and 1 int-by-parts Difficulties: time-step restriction due to parabolic part, parameters J.A. Rossmanith | RMMC 2010 17/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Outline 1 1D DG-FEM 2 2D Cartesian DG-FEM 3 2D mesh generation 4 2D unstructured DG-FEM J.A. Rossmanith | RMMC 2010 18/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Triangular elements p(i,1:2) := x and y coordinates of ith node t(j,1:3) := list of 3 node indeces that make up element j All other info about nodes, elements, & edges can be derived from this Example: t(5,1) = 7, J.A. Rossmanith | RMMC 2010 t(5,2) = 25, t(5,3) = 18 19/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Mesh generation Given points, how do we form a triangulation? Mesh quality Minimum angle: „ θT := min p=1,2,3 Delaunay: θTp 60◦ « , τh := min θT , T 0 ≤ τh ≤ 1 for fixed point locations, this triangulation maximizes τh Delaunay triangulation Each point gets region of influence based on distance: Voronoi diagram Hpq := {x : kp − xk ≤ kq − xk} =⇒ regionp = ∩ Hpq This diagram is unique, area of overlap is zero, partitions R ∀q 2 Delaunay triangulation is dual to Voronoi: only connect if share edge Voronoi diagram is unique, Delaunay tri. is unique up to degeneracies Degeneracy: 4+ points are co-circular =⇒ resolve with coin flip J.A. Rossmanith | RMMC 2010 20/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Mesh generation Given points, how do we form a triangulation? Delaunay triangulation J.A. Rossmanith | RMMC 2010 21/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Mesh generation Given points, how do we form a triangulation? Delaunay triangulation J.A. Rossmanith | RMMC 2010 22/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Mesh generation Given points, how do we form a triangulation? Delaunay triangulation J.A. Rossmanith | RMMC 2010 23/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Mesh generation Given points, how do we form a triangulation? Delaunay triangulation J.A. Rossmanith | RMMC 2010 24/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Mesh generation Given ∂Ω, how do we form a triangulation? Mesh generator of [Persson & Strang, 2004] Define boundary via 8 > <− Φ(x) = + > : 0 signed distance function: if if if x∈Ω x∈ /Ω , x ∈ ∂Ω k∇Φ(x)k2 = 1 ∀ x ∈ R2 Start with equi-distributed points in Ω and triangulate J.A. Rossmanith | RMMC 2010 25/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Mesh generation Given ∂Ω, how do we form a triangulation? Mesh generator of [Persson & Strang, 2004] Spring dynamics: spring const. ∝ desired h, only allow repulsion Points that leave Ω are projected onto ∂Ω via x ← x − Φ(x) ∇Φ(x) Rinse and repeat, occasionally retriangulating J.A. Rossmanith | RMMC 2010 26/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Outline 1 1D DG-FEM 2 2D Cartesian DG-FEM 3 2D mesh generation 4 2D unstructured DG-FEM J.A. Rossmanith | RMMC 2010 27/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM DG-FEM on unstructured grids Map each element to canonical triangle „ « „ « „ « 1 1 2 1 1 2 ,− − ,− ↔ ↔ − , 3 3 3 3 3 3 1 x = (x1 + x2 + x3 ) + ξ (x2 − x1 ) + η (x3 − x1 ) 3 1 y = (y1 + y2 + y3 ) + ξ (y2 − y1 ) + η (y3 − y1 ) 3 Basis functions (before Gram-Schmidt orthonormalization): ˘ ¯ φ(`) = 1, ξ, η, ξ 2 , ξη, η 2 , ξ 3 , ξ 2 η, ξη 2 , η 3 , . . . J.A. Rossmanith | RMMC 2010 28/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM DG-FEM on unstructured grids Galerkin expansion: k(k+1)/2 q h (t, x) = X Q(`) (t) φ(`) (x) n=1 ∀T start with q,t + ∇ · F(q) = 0 and obtain semi-discrete weak-form: Z I d (`) 1 1 Q = ∇φ(`) · F(q) dx − φ(`) F(q) · ds dt |T | T |T | ∂T | {z } | {z } Interior Edge Interior: Gauss quad, Edge: approx Riemann soln, then quadrature J.A. Rossmanith | RMMC 2010 29/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Gaussian quadrature [D.A. Dunavant, 1985] J.A. Rossmanith | RMMC 2010 30/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Artificial viscosity [Persson & Peraire, 2006] q,t + ∇ · F(q) = ∇ · (ε B(q) v) v = ∇q Cell-by-cell smoothness indicator: K(N −1) K(N ) qh = X Q(`) φ(`) , q̂ h = `=1 hq h − q̂ h , q h − q̂ h i , hq h , q h i ( 0 if S < TOL ε := ε0 if S ≥ TOL S := X Q(`) φ(`) `=1 S ∼ h2N (smooth solutions) Local DG method for elliptic & parabolic PDEs: Multiply each equation by same test function, φ(`) , and 1 int-by-parts Difficulties: time-step restriction due to parabolic part, parameters J.A. Rossmanith | RMMC 2010 31/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Space/time methods Basic idea Take space-time Galerkin ansatz: N ˛ X ˛ q h (t, x)˛ = Q(k) φ(k) (t, x) T k=1 Weak formulation: 1 |T | Z tn+1 I Q(`), n+1 = ±Q(`), n + 1 − |T | J.A. Rossmanith | RMMC 2010 tn Z tn+1 tn Z h i (`) φ,t q + ∇φ(`) · F(q) dx dt T φ(`) F(q) · ds dt ∂T 32/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Space/time methods Entropy variables Space/time DG-FEM in entropy variables: Find vh ∈ V h such that BDG (vh , wh ) = 0 , ∀ wh ∈ V h with BDG (v, w) = N −1 X XZ Z n=0 + K∈T XZ Z K∈T + In In K −(q(v) · w,t + fi (v) · w,xi ) dx dt w(x− ) · h(v(x− ), v(x+ ); n) ds dt ∂K ! XZ ` n+1 n n ´ w(tn+1 ) · q(v(t )) − w(t ) · q(v(t )) dx + − − − K∈T K Entropy stability: Z Z U (q(vh (tN , x))) dx ≤ U (q(vh (t0− , x)) dx − Ω J.A. Rossmanith | RMMC 2010 Ω 33/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Lax-Wendroff time-stepping Basic idea Another alternative to RK is to do a Taylor series in time This turns out to be useful for local time-stepping Taylor series expansion: q,t + ∇ · F(q) = ψ(q) q(t + ∆t, x, y) = q + ∆t q,t + ˆ ˜ ∆t2 q,tt + O(∆t3 ) = q − ∆t ∇ · F − Ψ 2 ∆t F,q · {∇ · F − ψ} + O(∆t2 ) 2 ∆t Ψ := ψ − ψ,q · {∇ · F − ψ} + O(∆t2 ). 2 Weak formulation: ZZ n on+1 n on ∆t (`) (`) ∇φ(`) · F n dx Qi = Qi + |Ti | Ti I ZZ ∆t ∆t − φ(`) Fn · n ds + φ(`) Ψn dx |Ti | ∂Ti |Ti | Ti F := F − J.A. Rossmanith | RMMC 2010 34/35 1D DG-FEM 2D Cartesian DG-FEM 2D mesh generation 2D unstructured DG-FEM Lax-Wendroff time-stepping Asynchronous steps Each element has its own time-step: 1 Sort each element by their current time ti 2 Update the element that is lagging furthest behind 3 Apply flux corrections to maintain global conservation 4 Place the updated element in the correct location of the ordered list 5 Rinse and repeat J.A. Rossmanith | RMMC 2010 35/35