# [Gmsh] Unexpected behavior (bug?)

Christophe Geuzaine cgeuzaine at ulg.ac.be
Thu Feb 11 13:36:18 CET 2016

```> On 09 Feb 2016, at 21:21, Kópházi József <j.kophazi at imperial.ac.uk> wrote:
>
> Dear list members,
>
> I have encountered some unusual behavior while trying to generate a very simple structured tetrahedral mesh for two boxes. The attached images show the surface (triangle) and volumetric (tetrahedron) elements of the same mesh. However, some of the triangles do not "sit" properly on the face of the corresponding tetrahedron but they are "laid across" on two tetrahedra. This is marked with red arrows on the images. I have also attached the script resulting this mesh.
>

Yes : the "Transfinite Volume" algorithm in automatic mode (when the corner vertices are not explicitly specified) will not try to match the surface mesh (because in some cases it's impossible, depending on the surface mesh). Without "Recombine" you should thus specify the orientions by hand:

lc = 0.3;

// example of a purely hexahedral mesh using only transfinite
// mesh constraints

Point(1) = {-2,0,0,lc};
Point(2) = {-1,0,0,lc};
Point(3) = {-1,1,0,lc};
Point(4) = {-2,1,0,lc};
Point(5) = {-2,0,1,lc};
Point(6) = {-1,0,1,lc};
Point(7) = {-1,1,1,lc};
Point(8) = {-2,1,1,lc};
Line(1) = {4,3};
Line(2) = {3,2};
Line(3) = {2,1};
Line(4) = {1,4};
Line(6) = {5,6};
Line(7) = {6,7};
Line(8) = {7,8};
Line(9) = {8,5};
Line(10) = {1,5};
Line(11) = {4,8};
Line(12) = {2,6};
Line(13) = {3,7};
Line Loop(14) = {3,4,1,2};
Plane Surface(15) = {14};
Line Loop(16) = {6,7,8,9};
Plane Surface(17) = {16};
Line Loop(18) = {10,-9,-11,-4};
Plane Surface(19) = {18};
Line Loop(20) = {8,-11,1,13};
Plane Surface(21) = {20};
Line Loop(22) = {12,7,-13,2};
Plane Surface(23) = {22};
Line Loop(24) = {6,-12,3,10};
Plane Surface(25) = {24};
Surface Loop(1) = {17,-25,-23,-21,19,15};
Volume(1) = {1};
Transfinite Line{1:4,6:13} = 5;

// need to specify orientation (through vertex list) by hand to have correctly
// matching volume/surface edges
Transfinite Surface {15} = {1,2,3,4};
Transfinite Surface {17} = {5,6,7,8};
Transfinite Surface {19} = {1,5,8,4};
Transfinite Surface {21} = {4,8,7,3};
Transfinite Surface {23} = {2,6,7,3};
Transfinite Surface {25} = {1,5,6,2};
Transfinite Volume{1} = {1,2,3,4,5,6,7,8};

Note that it's often less tedious to use "Extrude" with "Layers" instead of Transfinite.

Christophe

> I generated these pictures using gmsh version 2.9.1 but some other versions also produce the same problem.
>
> Thank you for your help,
>
> Jozsef Kophazi
>
>
> <surfaces marked.png><twobox.geo><volumes marked.png>_______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

--
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine

Tetrahedron V, July 4-5 2016: http://tetrahedron.montefiore.ulg.ac.be
Free software: http://gmsh.info | http://getdp.info | http://onelab.info

```