We produce one test case for a 2d problem and another one for 3d:
-- In 2d, let's choose as domain a half circle. On this domain, we choose the
- function $u(\mathbf x)=-2x_1x_2$ as the solution.
+<ul>
+<li>
+ In 2d, let's choose as domain a half circle. On this domain, we choose the
+ function $u(\mathbf x)=-2x_1x_2$ as the solution. To compute the right hand
+ side, we have to compute the second <i>tangential</i> derivatives of the
+ solution function. There are (at least) two ways to do that. The first one
+ is to project away the normal derivative, i.e. to compute
+ @f[
+ -\Delta_\Gamma u
+ =
+ -
+ \left[\nabla - \mathbf n (\mathbf n \cdot \nabla)\right]
+ \cdot
+ \left[\nabla - \mathbf n (\mathbf n \cdot \nabla)\right]
+ u.
+ @f]
+ Since we are on the unit circle, $\mathbf n=\mathbf x$. Furthermore, $\nabla
+ u = \left(\begin{array}{c}-2x_2 \\ -2x_1\end{array}\right)$.
+ Consequently, we have the following identities:
+ @f{align*}
+ \left[\nabla - \mathbf n (\mathbf n \cdot \nabla)\right] u
+ &=
+ \left(\begin{array}{c}-2x_2 \\ -2x_1\end{array}\right)
+ +
+ 4x_1x_2
+ \left(\begin{array}{c}x_1 \\ x_2\end{array}\right)
+ =
+ \left(\begin{array}{c}-2x_2(1-2x_1^2) \\ -2x_1(1-2x_2^2)\end{array}\right)
+ \\
+ \nabla \cdot \left[\nabla - \mathbf n (\mathbf n \cdot \nabla)\right] u
+ &=
+ 16x_1x_2
+ \\
+ (\mathbf n \cdot \nabla)
+ \left[\nabla - \mathbf n (\mathbf n \cdot \nabla)\right] u
+ &=
+ \left(\begin{array}{c}
+ 12x_1^2x_2 -2x_2\\
+ 12x_1x_2^2 -2x_1
+ \end{array}\right)
+ \\
+ \left[\mathbf n (\mathbf n \cdot \nabla)\right] \cdot
+ \left[\nabla - \mathbf n (\mathbf n \cdot \nabla)\right] u
+ &=
+ 12x_1^3x_2 -4x_1x_2 + 12x_1x_2^3
+ \\
+ \Delta_\Gamma u
+ &=
+ 16x_1x_2 - (12x_1^3x_2 -4x_1x_2 + 12x_1x_2^3)
+ =
+ 20x_1x_2 - 12 x_1x_2 (x_1^2+x_2^2).
+ @f}
+ In the last equation, we can note that since we only ever evaluate this
+ right hand side on the unit circle, $x_1^2+x_2^2=1$, yielding the final
+ value $-\Delta_\Gamma u = -8 x_1x_2$.
-- In 3d, the domain is again half of the surface of the unit sphere but this
- time without the disk that closes it. We choose $u(\mathbf x)=-2\sin(\pi
- x_1)\cos(\pi x_2)e^z$ as the solution.
-
+ A somewhat simpler version, at least for the current case of a curve in
+ two-dimensional space, is to note that we can map the interval $t \in
+ [0,\pi]$ onto the domain $\Omega$ using the transformation
+ $\mathbf x(t)= \left(\begin{array}{c} \cos t \\ \sin t \end{array}\right)$.
+ At position $\mathbf x=\mathbf x(t)$, the value of the solution is then
+ $u(\mathbf x(t)) = -2\cos t \sin t$.
+ Taking into account that the transformation is length preserving, i.e. a
+ segment of length $dt$ is mapped onto a piece of curve of exactly the same
+ length, the tangential Laplacian then satisfies
+ @f{align*}
+ \Delta_\Gamma u
+ &= \frac{d^2}{dt^2}(-2\cos t \sin t)
+ = -2 \frac{d}{dt}(-sin^2 t + \cos^2 t)
+ = -2 (-2 \sin t \cos t - 2 \cos t \sin t)
+ \\
+ &= 8 \sin t \cos t,
+ @f}
+ which is of course the same result as we had above.
+
+<li>
+ In 3d, the domain is again half of the surface of the unit ball, i.e. a half
+ sphere or dome. We choose $u(\mathbf x)=-2\sin(\pi x_1)\cos(\pi x_2)e^z$ as
+ the solution. We can compute the right hand side of the
+ equation, $f=-\Delta_\Gamma u$, in the same way as above, yielding an
+ awkward and lengthy expression. You can find the full expression in the
+ source code, where we use the fact that
+ @f{align*}
+ \Delta_\Gamma
+ &=
+ \left[\nabla - \mathbf n (\mathbf n \cdot \nabla)\right]
+ \cdot
+ \left[\nabla - \mathbf n (\mathbf n \cdot \nabla)\right]
+ \\
+ &=
+ \left[\mathbf I - \mathbf n \otimes \mathbf n\right]\nabla
+ \cdot
+ \left[\mathbf I - \mathbf n \otimes \mathbf n\right]\nabla
+ \\
+ &=
+ \text{trace}\;
+ \left\{
+ (\left[\mathbf I - \mathbf n \otimes \mathbf n\right]\nabla)
+ \otimes
+ (\left[\mathbf I - \mathbf n \otimes \mathbf n\right]\nabla)
+ \right\}
+ \\
+ &=
+ \text{trace}\;
+ \left\{
+ \nabla^2
+ +
+ (\left[\mathbf n \otimes \mathbf n\right]\nabla)
+ \otimes
+ (\left[\mathbf n \otimes \mathbf n\right]\nabla)
+ -
+ \nabla \otimes (\left[\mathbf n \otimes \mathbf n\right]\nabla)
+ -
+ \left[\mathbf n \otimes \mathbf n\right]\nabla^2
+ \right\}.
+ @f}
+ Applied to the solution, we then get using the abbreviation $H=\nabla^2 u$
+ for the Hessian with derivatives in all three spatial directions:
+ @f{align*}
+ \Delta_\Gamma u
+ &=
+ \text{trace}\;
+ \left\{
+ H
+ +
+ (\left[\mathbf n \otimes \mathbf n\right]\nabla)
+ \otimes
+ (\left[\mathbf n \otimes \mathbf n\right]\nabla) u
+ -
+ \nabla \otimes (\left[\mathbf n \otimes \mathbf n\right]\nabla) u
+ -
+ \left[\mathbf n \otimes \mathbf n\right] H
+ \right\}
+ \\
+ &=
+ \text{trace}\; H
+ +
+ \text{trace}\;
+ \left\{
+ (\left[\mathbf n \otimes \mathbf n\right]\nabla)
+ \otimes
+ (\left[\mathbf n \otimes \mathbf n\right]\nabla) u
+ -
+ \nabla \otimes (\left[\mathbf n \otimes \mathbf n\right]\nabla) u
+ \right\}
+ -
+ \mathbf n^T H \mathbf n.
+ @f}
+ A lengthier computation shows that if we take into account that $\mathbf n =
+ \mathbf x$, then the middle term can be simplified in
+ such a way that we obtain
+ @f{align*}
+ \Delta_\Gamma u
+ &=
+ \text{trace}\; H
+ +
+ (2-\text{spacedim}-1) \mathbf n \cdot \nabla u
+ -
+ \mathbf n^T H \mathbf n.
+ @f}
+</ul>
+
+In the program, we will also compute the $H^1$ seminorm error of the
+solution. Since the solution function and its numerical approximation are only
+defined on the manifold, the obvious definition of this error functional is
+$| e |_{H^1} = \left( \int_\Omega | \left[\mathbf n \otimes \mathbf
+n\right]\nabla (u-u_h) |^2 \right)^{1/2}$. This requires us to provide the
+<i>tangential</i> gradient $\left[\mathbf n \otimes \mathbf
+n\right]\nabla u$ to the function VectorTools::integrate_difference, which we
+will do by implementing the function <code>Solution::gradient</code> in the
+program below.
<h3>Implementation</h3>