Note: This codebase will not be maintained further. All facilities that were made available here for implementing DPG methods are now available directly in recent versions of NGSolve. Users wanting to try out DPG methods should proceed to use the python or c++ interfaces of NGSolve.
This repository provides facilities to experiment with Discontinuous Petrov Galerkin (DPG) methods. The C++ codes here can be compiled to make a shared library that can be added onto the NGSolve package. Python codes that interface with the C++ objects are also provided. Large parts of the code in this repository can be understood independently of the DPG method.
CONTRIBUTORS: Dow Drake, Jay Gopalakrishnan, Lukas Kogler, Nicole Olivares, Joachim Schoberl.
SEND comments or bug reports to Jay Gopalakrishnan [email protected].
- Do make sure you have the dependencies installed before proceeding: A working installation of NGSolve and Netgen is required. Please follow the instructions online for installing the development version of these packages. (Please ensure that the compile script
ngscxx
is in your path after a successful install of NGSolve.) - Clone this repository:
git clone https:/jayggg/DPG
- Navigate to the cloned folder
DPG
and typemake
. This should compile the C++ files on Linux or Mac systems (where GNU or othermake
is already installed) and should create the shared library calledlibDPG
.
Starting version 6.1, NGsolve provides a Python3 interface (called NGSpy
) to many of its facilities, including symbolic forms. DPG methods can be implemented directly using these new symbolic facilities, or by loading the precompiled DPG library from python using CDLL. (The latter is at times faster for complex forms.) If you want to explore implementing DPG methods using NGSPy, start with these examples:
-
laplaceadaptive.py: In a terminal where PYTHONPATH is set to find the NGsolve libs, navigate to
python
folder and typenetgen laplaceadaptive.py
to see a demo of automatic adaptivity using DPG methods for the Laplace equation. This example uses pure NGSpy, and there is no need to compile or loadlibDPG
. -
periodicmaxwell.py: Solve a 3D Maxwell problem, with x and y periodicity, using
libDPG
(which includes an implementation of periodic H(curl) spaces).
NGSolve uses PDE files (with extension .pde
) to specify inputs detailing boundary value problems. The DPG library can be utilized using this interface.
Please see comments in individual .pde
file examples within folder pde
. You may want to explore these pde-file examples:
- primallaplace.pde - Simplest DPG method for Laplace eq.
- laplaceadaptive.pde - See how to use adaptivity in the DPG context. Load the file and press Solve button repeatedly to proceed to next adaptive iteration.
- helmholtz.pde - Solve the Helmholtz equation with impedance bc.
- scatteradaptive.pde - Adaptively compute a scattered wave.
- planewave3d.pde - Compute a 3D wave using DPG method
- periodicmaxwell.pde - A 3D Maxwell problem with periodic boundary conditions in the x and y-directions.
- Adaptivity: Python example, Pde file example
- Finite Elements: Enriched quadrilateral element, Trace element of DG
- Finite Element Spaces: Periodic spaces, DG trace space, Enriched quad space
- Hexahedral mesh elements
- Periodic finite element spaces
- Periodic meshes
- Prismatic mesh elements
- Quotient norm approximation by polynomial extension
- Schwarz preconditioner on vertex patches
- Traces of DG spaces
- Thin layers
Check out other DPG implementations by our friends: