SimpleDiscontinuousGalerkin.jl API

SimpleDiscontinuousGalerkin.SimpleDiscontinuousGalerkinModule
SimpleDiscontinuousGalerkin

SimpleDiscontinuousGalerkin.jl is a Julia package that implements some basic discontinuous Galerkin (DG) methods for the solution of hyperbolic partial differential equations (PDEs). The package is designed to be simple and easy to use and understand. It is intended for educational purposes and to provide a starting point for more complex DG methods. For a more comprehensive and advanced implementation of DG methods, we recommend using the package Trixi.jl. This package can be understood as a minimalistic version of Trixi.jl, which is designed to be easy to understand and modify. Many design concepts are inspired by Trixi.jl, but the implementation is much simpler and more straightforward.

SimpleDiscontinuousGalerkin.jl builds on the foundations of the package SummationByPartsOperators.jl.

See also: SimpleDiscontinuousGalerkin.jl

source

Equations

SimpleDiscontinuousGalerkin.AbstractEquationsType
AbstractEquations{NDIMS, NVARS}

An abstract supertype of specific equations such as the linear advection equation. The type parameters encode the number of spatial dimensions (NDIMS) and the number of primary variables (NVARS) of the physics model.

source
SimpleDiscontinuousGalerkin.cons2entropyMethod
cons2entropy(u, equations)

Return the entropy variables from the conservative variables u for the given system of equations. The entropy variables are defined as the derivative of the entropy with respect to the conservative variables.

source
SimpleDiscontinuousGalerkin.eachvariableMethod
eachvariable(equations::AbstractEquations)

Return an iterator over the indices that specify the location in relevant data structures for the variables in equations. In particular, not the variables themselves are returned.

source
SimpleDiscontinuousGalerkin.get_nameMethod
get_name(equations::AbstractEquations)

Return the canonical, human-readable name for the given system of equations.

Examples

julia> SimpleDiscontinuousGalerkin.get_name(LinearAdvectionEquation1D(1.0))
"LinearAdvectionEquation1D"
source
SimpleDiscontinuousGalerkin.flux_godunovMethod
flux_godunov(u_ll, u_rr, equations::LinearAdvectionEquation1D)

Godunov (upwind) flux for the 1D linear scalar advection equation. Essentially first order upwind, see e.g. https://math.stackexchange.com/a/4355076/805029 .

source
SimpleDiscontinuousGalerkin.flux_centralMethod
flux_central(u_ll, u_rr, orientation_or_normal_direction, equations::AbstractEquations)

The classical central numerical flux f((u_ll) + f(u_rr)) / 2. When this flux is used as volume flux, the discretization is equivalent to the classical weak form DG method (except floating point errors).

source

Mesh

SimpleDiscontinuousGalerkin.OversetGridMeshType
OversetGridMesh{NDIMS, RealT, MeshLeft, MeshRight}
OversetGridMesh(mesh_left, mesh_right)

Create an overset grid (Chimera) mesh that combines two meshes, mesh_left and mesh_right, which have an overlap region.

source

Boundary conditions

SimpleDiscontinuousGalerkin.BoundaryConditionDirichletType
BoundaryConditionDirichlet(boundary_value_function)

Create a Dirichlet boundary condition that uses the function boundary_value_function to specify the values at the boundary. This can be used to create a boundary condition that specifies exact boundary values by passing the exact solution of the equation. The passed boundary value function will be called with the same arguments as an initial condition function is called, i.e., as

boundary_value_function(x, t, equations)

where x specifies the coordinates, t is the current time, and equation is the corresponding system of equations.

Examples

julia> BoundaryConditionDirichlet(initial_condition_convergence_test)
source

Solver

SimpleDiscontinuousGalerkin.eachnodeMethod
eachnode(solver::DG, element)

Return an iterator over the indices that specify the location in relevant data structures for the nodes in a specific element in solver. In particular, not the nodes themselves are returned.

source
SimpleDiscontinuousGalerkin.DGSEMType
DGSEM(; RealT=Float64, polydeg::Integer,
        surface_flux=flux_central,
        surface_integral=SurfaceIntegralWeakForm(surface_flux),
        volume_integral=VolumeIntegralWeakForm())

Create a discontinuous Galerkin spectral element method (DGSEM) using a LegendreDerivativeOperator with polynomials of degree polydeg.

source
SimpleDiscontinuousGalerkin.FDSBPType
FDSBP(D; RealT=Float64,
         surface_flux=flux_central,
         surface_integral=SurfaceIntegralWeakForm(surface_flux),
         volume_integral=VolumeIntegralWeakForm())

Create a discontinuous Galerkin method using a summation-by-parts operator D from SummationByPartsOperators.jl. This is similar to the DGSEM, but uses a general derivative operator instead of a Legendre derivative operator.

source
SimpleDiscontinuousGalerkin.PerElementFDSBPType
PerElementFDSBP(bases::Vector{BasisType};
                surface_flux = flux_central,
                surface_integral = SurfaceIntegralWeakForm(surface_flux),
                volume_integral = VolumeIntegralWeakForm()) where BasisType

Create a discontinuous Galerkin method using different bases for each element. This is like FDSBP, but allows for a different SBP operator on each element. See also: PerElementBasis.

source
SimpleDiscontinuousGalerkin.SurfaceIntegralWeakFormType
SurfaceIntegralWeakForm(surface_flux=flux_central, surface_flux_boundary=surface_flux)

The classical weak form surface integral type for DG methods as explained in standard textbooks. It uses surface_flux for the interior fluxes and surface_flux_boundary for the boundary fluxes.

See also VolumeIntegralWeakForm.

References

source

Semidiscretization

SimpleDiscontinuousGalerkin.flat_gridMethod
flat_grid(semi)

Return a vector of the coordinates of all nodes in semi, flattened across all elements. This is useful for plotting or other operations that require a single vector of coordinates.

source

Callbacks

SimpleDiscontinuousGalerkin.AnalysisCallbackType
AnalysisCallback(semi; interval=0,
                       extra_analysis_errors=Symbol[],
                       extra_analysis_integrals=(),
                       io=stdout)

Analyze a numerical solution every interval time steps. The L2- and the L∞-norm for each component are computed by default. Additional errors can be computed, e.g. by passing extra_analysis_errors = (:conservation_error,).

Further scalar functions func in extra_analysis_integrals are applied to the numerical solution and integrated over the computational domain. Some examples for this are mass, and entropy. You can also write your own function with the same signature as the examples listed above and pass it via extra_analysis_integrals. The computed errors and intergrals are saved for each timestep and can be obtained by calling errors and integrals.

During the Simulation, the AnalysisCallback will print information to io.

source