# [Gmsh] [GMSH] Surface mesh for 3D solids

Christophe Geuzaine geuzaine at gmail.com
Thu May 17 17:34:59 CEST 2018

```
> On 17 May 2018, at 15:07, Anderson Gabriel Santiago <agasantiago.usp at gmail.com> wrote:
>
> Thank you for your response. But that is quite unexpected, since the normal vectors define the volume.

No: each surface can be connected to two volumes - the "natural" orientation with respect to the first volume will be the opposite one for the other.

> So my question is, how can I make all the normal vectors point outward the volume? I am working with boundary element method and the normal vector orientation is really important to the method.

You can use the "Reverse Surface" to get the mesh oriented the way you want. For your example:

Point(1) = {0, 0, 0, 1.0};
Point(2) = {1, 0, 0, 1.0};
Point(3) = {1, 1, 0, 1.0};
Point(4) = {0, 1, 0, 1.0};
Point(5) = {0, 0, 1, 1.0};
Point(6) = {1, 0, 1, 1.0};
Point(7) = {1, 1, 1, 1.0};
Point(8) = {0, 1, 1, 1.0};
Line(1) = {1, 2};
Line(2) = {2, 6};
Line(3) = {6, 5};
Line(4) = {5, 1};
Line(5) = {5, 8};
Line(6) = {8, 4};
Line(7) = {4, 1};
Line(8) = {8, 7};
Line(9) = {7, 3};
Line(10) = {3, 4};
Line(11) = {6, 7};
Line(12) = {3, 2};
Line Loop(1) = {4, -7, -6, -5};
Plane Surface(1) = {1};
Line Loop(2) = {2, 11, 9, 12};
Plane Surface(2) = {2};
Line Loop(3) = {3, 5, 8, -11};
Plane Surface(3) = {3};
Line Loop(4) = {10, 7, 1, -12};
Plane Surface(4) = {4};
Line Loop(5) = {9, 10, -6, 8};
Plane Surface(5) = {5};
Line Loop(6) = {3, 4, 1, 2};
Plane Surface(6) = {6};
Surface Loop(1) = {4, 5, 2, 6, 3, 1};
Volume(1) = {1};
Reverse Surface{1:4};
Physical Surface(1) = {6};
Physical Surface(2) = {4, 2, 3, 1};
Physical Surface(3) = {5};
Physical Volume(4) = {1};

There is currently no interface to reorient surfaces automatically. We will probably add this in the future, as we already use such a feature internally for some 3D mesh algorithms.

Christophe

>
>
> On Thu, May 17, 2018 at 3:54 AM, Christophe Geuzaine <geuzaine at gmail.com <mailto:geuzaine at gmail.com>> wrote:
>
>
> > On 16 May 2018, at 00:28, Anderson Gabriel Santiago <agasantiago.usp at gmail.com <mailto:agasantiago.usp at gmail.com>> wrote:
> >
> > Dear all,
> >
> > I am using GMSH to create a 3D surface mesh. For some unknown reason, some normal vectors points inwards, not outwards,
>
> The mesh is oriented according to the orientation of the geometrical surface - everything is correct in your file. You can check by visualizing both the geometry and the mesh normals (in Tools->Options->Geometry or Mesh->Visibility->Normals)
>
> Christophe
>
>
> > as I would expect, since I defined a solid limited by plane surfaces.
> >
> > Here is the GEO file I created using the GMSH GUI.
> >
> >
> > // Gmsh project created on Tue May 15 19:19:43 2018
> > //+
> > Point(1) = {0, 0, 0, 1.0};
> > //+
> > Point(2) = {1, 0, 0, 1.0};
> > //+
> > Point(3) = {1, 1, 0, 1.0};
> > //+
> > Point(4) = {0, 1, 0, 1.0};
> > //+
> > Point(5) = {0, 0, 1, 1.0};
> > //+
> > Point(6) = {1, 0, 1, 1.0};
> > //+
> > Point(7) = {1, 1, 1, 1.0};
> > //+
> > Point(8) = {0, 1, 1, 1.0};
> > //+
> > Line(1) = {1, 2};
> > //+
> > Line(2) = {2, 6};
> > //+
> > Line(3) = {6, 5};
> > //+
> > Line(4) = {5, 1};
> > //+
> > Line(5) = {5, 8};
> > //+
> > Line(6) = {8, 4};
> > //+
> > Line(7) = {4, 1};
> > //+
> > Line(8) = {8, 7};
> > //+
> > Line(9) = {7, 3};
> > //+
> > Line(10) = {3, 4};
> > //+
> > Line(11) = {6, 7};
> > //+
> > Line(12) = {3, 2};
> > //+
> > Line Loop(1) = {4, -7, -6, -5};
> > //+
> > Plane Surface(1) = {1};
> > //+
> > Line Loop(2) = {2, 11, 9, 12};
> > //+
> > Plane Surface(2) = {2};
> > //+
> > Line Loop(3) = {3, 5, 8, -11};
> > //+
> > Plane Surface(3) = {3};
> > //+
> > Line Loop(4) = {10, 7, 1, -12};
> > //+
> > Plane Surface(4) = {4};
> > //+
> > Line Loop(5) = {9, 10, -6, 8};
> > //+
> > Plane Surface(5) = {5};
> > //+
> > Line Loop(6) = {3, 4, 1, 2};
> > //+
> > Plane Surface(6) = {6};
> > //+
> > Surface Loop(1) = {4, 5, 2, 6, 3, 1};
> > //+
> > Volume(1) = {1};
> > //+
> > Physical Surface(1) = {6};
> > //+
> > Physical Surface(2) = {4, 2, 3, 1};
> > //+
> > Physical Surface(3) = {5};
> > //+
> > Physical Volume(4) = {1};
> >
> > Any help is appreciated.
> >
> > --
> > Anderson Gabriel Santiago
> >
> >
> > ~"If you are depressed,
> >    you are living in the past.
> >    If you are anxious,
> >    you are living in the future.
> >    If you are at peace,
> >    you are living in the present."~   - Lao Tzu
> > _______________________________________________
> > gmsh mailing list
> > gmsh at onelab.info <mailto:gmsh at onelab.info>
> > http://onelab.info/mailman/listinfo/gmsh <http://onelab.info/mailman/listinfo/gmsh>
>
>
>
>
> --
> Anderson Gabriel Santiago, Ph.D., E.E.
> Adjunct Professor, Biomedical Engineering - UFABC
> agasantiago.usp at gmail.com <mailto:santiago.eletrica at gmail.com>
> Cel.: +55 11 99801-0881 <tel:%2811%29%2099801-0881>
>
> ~"If you are depressed,
>    you are living in the past.
>    If you are anxious,
>    you are living in the future.
>    If you are at peace,
>    you are living in the present."~   - Lao Tzu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20180517/37c6eafe/attachment.html>
```