1.8. Imposing Dirichlet boundary conditions by exact penalization

In this section, we present a simple and efficient numerical method to enforce the Dirichlet boundary conditions of a boundary-value problem. This method is actually the one used in most Finite Element libraries; in particular, it is the numerical recipe underlying the keyword on in \(\texttt{FreeFem}\).

To set ideas, let us consider the Laplace equation with homogeneous Dirichlet boundary conditions of Section 1.4. Reusing the notations of the latter, its variational formulation reads:

(1.31)\[\text{Search for } u \in H^1_0(\Omega) \text{ s.t. } \forall v \in H^1_0(\Omega), \:\: \int_{\Omega}{\nabla u \cdot \nabla v \:\d \x} = \int_{\Omega}{fv\:\d\x}.\]

The direct implementation of the Finite Element Method for the discretization and solution of this problem is somewhat tedious, even in the case of the relatively simple \(\P_1\) Lagrange Finite Element method described in Section 1.3. This task indeed requires to assemble the stiffness matrix \(K_h\) by retaining only those degrees of freedom lying in the interior of \(\Omega\), which raises cumbersome renumbering issues of the vertices of the mesh \(\calT_h\).

A much simpler approach consists in approximating \(u\) by the solution \(u_\e \in H^1(\Omega)\) to the following problem:

(1.32)\[\text{Search for } u _\e \in H^1(\Omega) \text{ s.t. } \forall v \in H^1(\Omega), \:\: \int_{\Omega}{\nabla u_\e \cdot \nabla v \:\d\x} + \frac{1}{\varepsilon}\int_{\partial \Omega}{u _\e v \:\d s} = \int_{\Omega}{fv\:\d\x},\]

where \(\varepsilon\) is a "very small" parameter (typically of the order of \(10^{-20}\)). Intuitively, \(u_\e\) does not exactly equal \(0\) on \(\partial \Omega\), but the second integral in the left-hand side of (1.32) is a large penalization of its values on \(\partial \Omega\).

The validity of this approach is assessed by the following theoretical exercise.

Exercise

This exercise uses the notions of compactness and weak convergence in Hilbert spaces, recalled in Section 6.2.4.

  1. Prove the following version of the Poincaré’s inequality: there exists a constant \(C >0\) such that:

    \[\forall u \in H^1(\Omega), \quad \int_\Omega u^2 \:\d \x \leq C \left( \int_\Omega \lvert \nabla u \lvert^2 \:\d\x + \int_{\partial \Omega} u^2 \:\d s \right). \]

  2. Prove that the solution \(u_\e\) to (1.32) is bounded in \(H^1(\Omega)\), independently of the value of \(\e\), i.e. that there exists a constant \(C >0\) such that, for \(\e >0\) small enough,

    \[\lvert\lvert u _\e \lvert\lvert_{H^1(\Omega)} \leq C \lvert\lvert f \lvert\lvert_{L^2(\Omega)}. \]

    Deduce that there exists a function \(u_* \in H^1(\Omega)\) such that:

    \[u_\e \xrightarrow{\e \to 0} u_* \text{ weakly in } H^1(\Omega).\]

  3. Prove that \(u_*\) is the unique solution \(u \in H^1_0(\Omega)\) to the exact variational problem (1.31).

  4. Prove that \(u_\e\) actually converges to \(u\) strongly in \(H^1(\Omega)\) when the penalization parameter \(\e\) vanishes, i.e.

    \[\lvert\lvert u _\e - u \lvert\lvert_{H^1(\Omega)} \xrightarrow{\e \to 0} 0.\]

The practical implementation of the penalization method for Dirichlet boundary conditions is relatively straightforward, and it is left as an exercise; the solution can be downloaded here.

Exercise

Let \(\Omega \subset \R^2\) be the L-shaped domain represented in Fig. 1.8 (left), and let \(f = 1\). Let \(u \in H^1_0(\Omega)\) and \(u_\e \in H^1(\Omega)\) be the unique solutions to (1.31) and (1.31), respectively.

  1. Solve the penalized problem for \(u_\e\) with \(\texttt{FreeFem}\); you may try out different values for the parameter \(\e\).

  2. Adapt the above penalization trick to the numerical resolution of the following version of the Laplace equation:

    \[\begin{split}\left\{\begin{array}{cl} - \Delta u = 0 & \text{in } \Omega, \\ u = 1 & \text{on }\partial \Omega, \end{array} \right.\end{split}\]