6. Exercises#

6.1. Get started with Netgen-Opencascade geometric modeling#

6.2. Experiment with CoefficientFunctions#

6.3. Work with GridFunctions#

  • Define an \(H^1\) finite element space of some order on \(\Omega = (0,1)^2\)

  • Define a GridFunction in this space, and interpolate \(u(x,y) = \exp(-x^2 - y^2)\)

  • Compute the \(L_2\)-norm of the interpolation error \(u - I_h u\).

  • Study convergence of the interpolation error depending on the mesh-size and the polynomial order of the space (generate plots).

  • Study convergence in the \(H^1\)-norm

  • Find a way to compute \(\int_{\partial \Omega} | \partial_n u- \partial_n I_h u) |^2\).

6.4. Linear Algebra#

6.5. Experiments with BilienarForms and LinearForms#

  • Create a GridFunction gfu and interpolate \(xy\) to it

  • Define LinearForm \(f : V \rightarrow {\mathbb R} : v \mapsto \int_\Omega 1 v \, dx\)

  • Compute \(f(gfu)\) using InnerProduct of the vectors. Explain what you observe.

  • Define a BilinearForm \(A : V \times V \rightarrow {\mathbb R} : (u,v) \mapsto \int_\Omega u v + \nabla u \nabla v \, dx\)

  • Compute \(\|u \|_{H^1}^2 = \| u \|_{L_2}^2 + \| \nabla u \|_{L_2}^2\) in two kinds: Once using Integrate, and then using the bilinear-form.

6.6. Computing dual norms#

  • Define the LinearForm \(f : V \rightarrow {\mathbb R} : v \mapsto \int_{\partial \Omega} v \, ds\)

  • The canonical norm for the linear-form is the dual norm

    \[ \| f \|_{V^\ast} := \sup_{v \in V} \frac{f(v)}{\|v \|_V}. \]

    Proof that the supremum is attained for \(w\) satisfying \((w,v)_V = f(v) \; \forall \, v \in V\), i.e. the solution of a variational problem.

  • Compute the dual norm by replacing the space \(V\) by a sequence of finite element spaces (refinement in \(h\) and/or \(p\)). Try with norms \(\| \cdot \|_{L_2}\) and \(\| \cdot \|_{H^1}\).