1%%%%%%%%%%%%%%%%%%% 2% XLiFE++ is an extended library of finite elements written in C++ 3% Copyright (C) 2014 Lunéville, Eric; Kielbasiewicz, Nicolas; Lafranche, Yvon; Nguyen, Manh-Ha; Chambeyron, Colin 4% 5% This program is free software: you can redistribute it and/or modify 6% it under the terms of the GNU General Public License as published by 7% the Free Software Foundation, either version 3 of the License, or 8% (at your option) any later version. 9% This program is distributed in the hope that it will be useful, 10% but WITHOUT ANY WARRANTY; without even the implied warranty of 11% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12% GNU General Public License for more details. 13% You should have received a copy of the GNU General Public License 14% along with this program. If not, see <http://www.gnu.org/licenses/>. 15%%%%%%%%%%%%%%%%%%% 16 17 Consider the Laplace problem with homogeneous Dirichlet condition: 18 \[ 19\begin{cases} 20 -\Delta u = f & \text{ in }\Omega \\ 21 u=0 & \text{ on }\partial \Omega 22 \end{cases} 23 \] 24 Introducing $p=\nabla u$, it is rewritten as a mixed problem in $(u,p)$: 25 \[ 26 \begin{cases} 27 -\mathrm{div}\,p = f & \text{ in }\Omega \\ 28 p=\nabla u & \text{ in }\Omega \\ 29 u=0 & \text{ on } \partial \Omega 30 \end{cases} 31 \] 32 with the following variational formulation: 33 \[ 34 \left| 35 \begin{array}{c} 36\text{find }(u,p)\in L^2(\Omega)\times H(div,\Omega) \text{ such that } \\ 37\begin{aligned} 38& \displaystyle -\int_\Omega\mathrm{div}\,p\, v = \int_\Omega f\,v & & \forall v\in L^2(\Omega)\\ 39& \displaystyle \int_\Omega u\,\mathrm{div}\,q + \int_\Omega p.q = 0 & & \forall q\in H(div,\Omega). 40 \end{aligned} 41 \end{array} 42 \right. 43 \] 44 Note that the Dirichlet boundary condition is a natural condition in this formulation. \\ 45 46 The \xlifepp implementation of this problem using P0 approximation for $L^2(\Omega)$ and an approximation of $H(div,\Omega)$ using Raviart-Thomas elements of order 1 is the following:\\ 47 48 \inputXlifeppExample[deletekeywords={[3] x,y}]{laplace2dP0_RT1.cpp} 49 \vspace{3mm} 50 Using Paraview with the \textit{Cell data to point data} filter that moves P0 data to P1 data and the \textit{Warp by scalar} filter that produces elevation, the approximated field $u$ looks like: 51\begin{figure}[H] 52\begin{center} 53\includePict[width=8cm]{ex_laplace2d_P0_RT1.png} 54\end{center} 55\caption{Solution of the Laplace 2D problem with mixed formulation P0-RT1 on the unit square $[0,1]^2$} 56\end{figure} 57