
This demo illustrates how to:

* Solve a linear partial differential equation
* Use a discontinuous Galerkin method
* Solve a fourth-order differential equation

The solution for :math:`u` in this demo will look as follows:

.. image:: ../biharmonic_u.png
    :scale: 75 %

Equation and problem definition
-------------------------------

The biharmonic equation is a fourth-order elliptic equation. On the domain
:math:`\Omega \subset \mathbb{R}^{d}`, :math:`1 \le d \le 3`, it reads

.. math::
   \nabla^{4} u = f \quad {\rm in} \ \Omega,

where :math:`\nabla^{4} \equiv \nabla^{2} \nabla^{2}` is the biharmonic
operator and :math:`f` is a prescribed source term. To formulate a complete
boundary value problem, the biharmonic equation must be complemented by
suitable boundary conditions.

Multiplying the biharmonic equation by a test function and integrating
by parts twice leads to a problem second-order derivatives, which
would requires :math:`H^{2}` conforming (roughly :math:`C^{0}`
continuous) basis functions.  To solve the biharmonic equation using
Lagrange finite element basis functions, the biharmonic equation can
be split into two second-order equations (see the Mixed Poisson demo
for a mixed method for the Poisson equation), or a variational
formulation can be constructed that imposes weak continuity of normal
derivatives between finite element cells.  The demo uses a
discontinuous Galerkin approach to impose continuity of the normal
derivative weakly.

Consider a triangulation :math:`\mathcal{T}` of the domain :math:`\Omega`,
where the union of interior facets is denoted by :math:`\Gamma`.
Functions evaluated on opposite sides of a facet are indicated by the
subscripts ':math:`+`' and ':math:`-`'.
Using the standard continuous Lagrange finite element space

.. math::
    V_ = \left\{v \in H^{1}_{0}(\Omega): \ v \in P_{k}(K) \ \forall \ K \in \mathcal{T} \right\}

and considering the boundary conditions

.. math::
   u            &= 0 \quad {\rm on} \ \partial\Omega \\
   \nabla^{2} u &= 0 \quad {\rm on} \ \partial\Omega

a weak formulation of the biharmonic reads: find :math:`u \in V` such that

.. math::
   \sum_{K \in \mathcal{T}} \int_{K} \nabla^{2} u \nabla^{2} v \, dx \
  - \int_{\Gamma} \left<\nabla^{2} u \right>  [\!\![ \nabla v ]\!\!] \, ds
  - \int_{\Gamma}[\!\![  \nabla u ]\!\!]  \left<\nabla^{2} v \right>  \, ds
  + \int_{\Gamma} \frac{\alpha}{h}[\!\![ \nabla u ]\!\!]  [\!\![ \nabla v ]\!\!]  \, ds
  = \int_{\Omega} vf \, dx \quad \forall \ v \in V

where :math:`\left< u \right> = (1/2) (u_{+} + u_{-})`, :math:`[\!\![  w
]\!\!]  = w_{+} \cdot n_{+} + w_{-} \cdot n_{-}`, :math:`\alpha \ge 0`
is a penalty term and :math:`h` is a measure of the cell size.  For the
implementation, it is useful to identify the bilinear form

.. math::
   a(u, v) = \sum_{K \in \mathcal{T}} \int_{K} \nabla^{2} u \nabla^{2} v \, dx \
  - \int_{\Gamma} \left<\nabla^{2} u \right>[\!\![ \nabla v ]\!\!]  \, ds
  - \int_{\Gamma} [\!\![ \nabla u ]\!\!]  \left<\nabla^{2} v \right>  \, ds
  + \int_{\Gamma} \frac{\alpha}{h} [\!\![ \nabla u ]\!\!] [\!\![ \nabla v ]\!\!] \, ds

and the linear form

.. math::
  L(v) = \int_{\Omega} vf \, dx

The input parameters for this demos are defined as follows:

* :math:`\Omega = [0,1] \times [0,1]` (a unit square)
* :math:`\alpha = 8.0` (penalty parameter)
* :math:`f = 4.0 \pi^4\sin(\pi x)\sin(\pi y)` (source term)
