Solver for a simple ODE using discontinuous Galerkin Finite Elements. This is based on https://dealii.org/current/doxygen/deal.II/step_3.html which solves a simple PDE.
Here we solve the ODE
with
Next we split the closure of our interval into M intervals
By multiplying with suitable discontinuous Galerkin test functions $\varphi\in dG(r)$of order
Find
Compared to solving Poisson's equation there are a few key differences
- We need to add the jump term entries to our sparsity pattern. This is done in setup_system()
- We have no rhs, but instead have
$u(t)\varphi(t)$ to assemble - The first argument of the previous Laplace term now has only one derivative/shape_grad
- The jump term also have to be assembled.
- As the problem is nonsymmertric so the CG solver does not work anymore and was changed to the direct solver UMFPACK
The function output_results() is written in a way that enables us to also visualize discontinuous solutions of higher order (r>1).
For this reason an iterated quadrature rule is used to obtain the solution behavior on a single element.
The resulting time points and solution values are printed as matrices in Matlab Syntax.
This way the plots will be properly graphed as discontinuous.
You need to install deal.II in your system.
Then clone or download this code and change to it's directory. Then call
cmake -DDEAL_II_DIR=<path_to_your_deal_install> .
make run
to run the program.