Skip to content

Initializes and sets up reference elements and physical meshes for DG.

License

Notifications You must be signed in to change notification settings

jlchan/StartUpDG.jl

Repository files navigation

StartUpDG

Docs-stable Docs-dev Build status Codecov

Routines to initialize reference element operators, physical mesh arrays, and connectivity for nodal discontinuous Galerkin (DG) methods. Codes roughly based on Nodal Discontinuous Galerkin Methods by Hesthaven and Warburton (2007). Original port from Matlab to Julia by Yimin Lin.

This package is registered, so you can install it via ] add StartUpDG.

Usage overview

Variables are contained within structs rd::RefElemData and md::MeshData. These structs contain variables from Globals1D, Globals2D, Globals3D in the Nodal DG book codes. Variables can be unpacked using @unpack.

using StartUpDG

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

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

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

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

About

Initializes and sets up reference elements and physical meshes for DG.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages