# [Getdp] 3D Laplace equation with Neumann and Dirichlet boundary conditions

michael.asam at infineon.com michael.asam at infineon.com
Fri Oct 17 16:49:05 CEST 2014

Hi Gilles,

implementing natural boundary conditions in GetDP is actually quite easy. If you just want to set the derivative of u
with respect to the normal direction (a scalar value) you can just write:
Galerkin{ [ -du_dn[], {u}]; In GammaInner; Jacobian JSur; Integration I1;}

I’ve modified your example accordingly. Please find the attached files and screenshots 1 and 2.

If you have a vector and just want to get it’s normal part, you can multiply it with the build-in function Normal[], which gives you
a unit vector normal to the surface. The direction of the normal vector is defined in Gmsh, where you can also invert the direction. You should check if they are
pointing in the right direction (usually outwards, i.e. away from the computation domain). See screenshot 3.

In you .pro files there are two additional points I had to change:

-          Function space must cover the complete computation-domain, i.e. Omega AND GammaInner AND GammaOuter (Therefore I definied group “TotalDomain”)

-          In PostProcessing the value of u should be evaluated also in TotalDomain. Otherwise you cannot plot u OnElementsOf GammaInner, as GammaInner does not belong to group Omega

Have a nice weekend!
Michael

From: getdp [mailto:getdp-bounces at ace20.montefiore.ulg.ac.be] On Behalf Of gilles quemener
Sent: Friday, October 17, 2014 11:43 AM
To: getdp at geuz.org
Subject: [Getdp] 3D Laplace equation with Neumann and Dirichlet boundary conditions

Hello,

Currently I am trying to solve Laplace equation in 3D with both some Neumann and Dirichlet boundary conditions
on different parts of the problem domain. This domain consists in an outer cube with a cubic hole at centre
(see attached file Laplace3D.geo).
The problem to be solved is the following :

- div(grad(u) = 0  in Omega

with both the following BC:
1) Dirichlet BC:
u = 0 on GammaOuter

2) Neumann BC:
\partial u / \partial normal =  grad(u).normal = (gbx, gby, gbz).(normalX, normalY, normalZ) on GammaInner

where:
GammaOuter = Outer cube surface
GammaInner = Inner cube surface
Omega = volume limited by these two surfaces

I tried to modify Onelab examples for 2D Laplace equations as shown at http://onelab.info/wiki/Category:GetDP.
I have some known functions of space coordinates X[], Y[] and Z[] and of an order norder (=3 e.g.) for gbx[], gby[]
and gbz[].
As I do not know how to access the normal components (normalX, normalY and normalZ) within GetDP and as
my geometry is quite simple, I divided both GammerOuter and GammaInner into 6 individual Physical Surfaces:
top, bottom, left, right, front and back faces for each cube. There the normal vectors are known and I can therefore
write the Neumann boundary conditions on each face see the (Weak) Formulation space in the attached file
Laplace3D.pro. Note: how to proceed for more complicated surfaces is still a mystery to me but this is not my current
problem !

Gmsh (command: gmsh Laplace3D.geo -3) does its works and provides me with a 3D mesh of the domain of interest.
GetDP (command:  getdp Laplace3D.pro -solve -pos) runs and outputs files, but solved potentials are null everywhere !

Does anyone have some clue on what I am doing wrong in this formulation ? I tried to solve the same problem
using FreeFem++ (see atached files Laplace-cube-cube.edp and MeshSurface.idp) and got results making some sense.
But I would prefer much more to solve it in Gmsh/GetDP as Gmsh is so powerful for postprocessing data.

Thanks a lot for any help,

Gilles

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/getdp/attachments/20141017/f158fd0f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot_3.PNG
Type: image/png
Size: 670442 bytes
Desc: Screenshot_3.PNG
URL: <http://www.geuz.org/pipermail/getdp/attachments/20141017/f158fd0f/attachment.PNG>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot_1.PNG
Type: image/png
Size: 363784 bytes
Desc: Screenshot_1.PNG
URL: <http://www.geuz.org/pipermail/getdp/attachments/20141017/f158fd0f/attachment-0001.PNG>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot_2.PNG
Type: image/png
Size: 793310 bytes
Desc: Screenshot_2.PNG
URL: <http://www.geuz.org/pipermail/getdp/attachments/20141017/f158fd0f/attachment-0002.PNG>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: param.geo
Type: application/octet-stream
Size: 870 bytes
Desc: param.geo
URL: <http://www.geuz.org/pipermail/getdp/attachments/20141017/f158fd0f/attachment.geo>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Laplace3D.geo
Type: application/octet-stream
Size: 5201 bytes
Desc: Laplace3D.geo
URL: <http://www.geuz.org/pipermail/getdp/attachments/20141017/f158fd0f/attachment-0001.geo>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Laplace3D.pro
Type: application/octet-stream
Size: 3803 bytes
Desc: Laplace3D.pro
URL: <http://www.geuz.org/pipermail/getdp/attachments/20141017/f158fd0f/attachment.pro>