Poisson equation with core modules¶
This chapter builds a full finite-element Poisson solver with DUNE core modules. It stays intentionally low-level so each implementation step is explicit.
Learning goals
After this chapter, you should be able to:
- set up grid, DoF numbering, sparse matrix, and rhs vector,
- assemble the system using
dune-localfunctionslocal basis interfaces, - solve with
dune-istland export a.vtufile for ParaView.
Model problem¶
We will solve the Poisson equation in the unit square domain with homogeneous Dirichlet boundary conditions,
\[
-\Delta u = 1 \quad\text{in }\Omega=(0,1)^2,
\qquad
u = 0 \quad\text{on }\partial\Omega,
\]
using the finite element method. Therefore, we transform the PDE into it's weak form:
find \(u\in H_0^1(\Omega)\) such that
\[
a(u,v)=\ell(v) \quad \forall v\in H_0^1(\Omega),
\]
with
\[
a(u,v)=\int_\Omega \nabla u\cdot\nabla v\,dx,
\qquad
\ell(v)=\int_\Omega v\,dx.
\]
We use first-order conforming Lagrange elements (Q1 on a structured square grid, one DoF per vertex) for the discretization of the function space \(H^1\) and incorporate the Dirichlet boundary condition by a modification of the algebraic system.