jlchan / StartUpDG.jl

Initializes and sets up reference elements and physical meshes for DG.
MIT License
27 stars 9 forks source link

StartUpDG

Docs-stable Docs-dev Build status Codecov

This package contains routines to initialize reference element operators, physical mesh arrays, and connectivity arrays for nodal discontinuous Galerkin (DG) methods. The codes are roughly based on Nodal Discontinuous Galerkin Methods by Hesthaven and Warburton (2007). The original port from Matlab to Julia was by Yimin Lin, with subsequent modifications by Jesse Chan and other contributors.

This package is registered and can be installed via ] add StartUpDG or using Pkg; Pkg.add("StartUpDG").

Usage overview

Variables are contained within structs rd::RefElemData and md::MeshData, which contain quantities from Globals1D, Globals2D, Globals3D in the Nodal DG book codes. These can be used to compute DG derivatives, and are useful for matrix-free implementations of DG methods using explicit time-stepping.

using StartUpDG

# polynomial degree and mesh size
N = 3
K1D = 8

# init ref element and mesh
rd = RefElemData(Tri(), N)
VXY, EToV = uniform_mesh(Tri(), K1D)
md = MeshData(VXY, EToV, rd)

# Define a function by interpolation
(; x, y) = md
u = @. 2 + 0.5 * exp(-100 * (x^2 + y^2))

# Compute derivatives using geometric mapping + chain rule
(; Dr, Ds) = rd
(; rxJ, sxJ, J) = md
dudx = (rxJ .* (Dr * u) + sxJ .* (Ds * u)) ./ J

Contributors