Tutorial/Laplace equation with Neumann boundary condition

Revision as of 11:06, 1 September 2011 by 139.165.160.63 (talk)

Revision as of 11:06, 1 September 2011 by 139.165.160.63 (talk)

The problem

We propose here to solve a first very simple academic example with GMSH and GetDP. The problem is the following: \begin{equation} \begin{cases}\label{eq:problemU} \Delta u + u = f & \text{in } \Omega\\ \displaystyle{\frac{\partial u}{\partial \mathbf{n}} = 0} & \text{on }\partial\Omega, \end{cases} \end{equation} where $\Omega$ is the unit square, $\partial\Omega$ its boundary and $f$ the two-variables function defined by $$ \forall x,y\in [0,1]^2,\qquad f(x,y) = (1+2\pi^2)\cos(\pi x)\cos(\pi y) $$ Then, the unique solution of problem \eqref{eq:problemU} is $$ \forall x,y\in[0,1]^2, \qquad u(x,y) = \cos(\pi x)\cos(\pi y). $$ If $H^1(\Omega)$ denotes the usual Sobolev space, then the variationnal formulation of problem \eqref{eq:problemU} reads \begin{equation}\label{eq:WeakFormulation} \left\{\begin{array}{l} \text{Find } u\in H^1(\Omega) \text{ such that, }\\ \displaystyle{\forall v\in H^1(\Omega), \qquad \int_{\Omega} \nabla u\cdot\nabla v \;{\rm d}\Omega + \int_{\Omega}uv \;{\rm d}\Omega - \int_{\Omega}fv\;{\rm d}\Omega = 0}. \end{array}\right. \end{equation}

Outline of the program

We give here a (very) detailled solution. We proposed to construct 4 different files, the two principles are : - LaplacianSquare.geo : GMSH file, used to build the domain (the square). The extension ".geo" is mainly used to design a GMSH file - LaplacianSquare.pro : GetDP file, contains the weak formulation \eqref{eq:WeakFormulation} of the problem \eqref{eq:problemU}. The extension ".pro" is associated with GetDP files.


Et deux fichiers annexes : - param.geo : GetDP et GMSH indice chaque région du domaine par un nombre. Afin de faire correspondre la notation GMSH et celle de GetDP, ces indices sont contenus dans un fichier auxiliaire param.geo, qui sera appelé par GMSH dans carre.geo et par GetDP dans carre.pro. - JacobInt.pro : il contient la méthode d'intégration numérique (nombre de points) ainsi que le jacobien. Il peut être inclut directement dans carre.pro. Cependant, comme nous ne modifions que rarement les valeurs contenues dedans, il est commode de procéder ainsi pour pouvoir le réutiliser dans d'autres programmes.