# [Gmsh] periodic mesh

Josefin Ahlkrona josefin.ahlkrona at it.uu.se
Thu Feb 4 10:41:02 CET 2016

```Thank you, that's exactly what i needed!

Best Regards,

Josefin

On 02/03/2016 09:20 PM, Christophe Geuzaine wrote:
>> On 03 Feb 2016, at 18:06, Josefin Ahlkrona <josefin.ahlkrona at it.uu.se> wrote:
>>
>> Hi,
>>
>> Thank you for the answer. Is there a way to make structured meshes periodic? Since it's structured of course the nodes match, but I would like the edges to match eachother too!
>>
> It's possible, albeit tedious: you need to use the "Transfinite" algorithm for that, and specify the orientions by hand (the automatic mode will not ensure edge matching). Here's an example:
>
> 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};
>
>
>
>
>> Best Regards,
>>
>> Josefin
>>
>> On 02/03/2016 06:02 PM, Christophe Geuzaine wrote:
>>>> On 02 Feb 2016, at 20:59, Josefin Ahlkrona <josefin.ahlkrona at it.uu.se> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I have a cuboid (x,y,z) domain for which i have created tetrahedral, structured mesh.  Now, I want to apply periodic boundary conditions in x, and y direction and in order to do that I need the mesh to be identical for the x=0 and x=xmax surfaces, as well as for the y=0 and y=ymax surfaces. It is not sufficient for only the nodes to match but I also want the edges to match!
>>>>
>>>> I have tried to use the "Periodic Surface" command without success. I have seen several posts on using the "Periodic Surface" commands without finding a solution for my problem.
>>>>
>>> The Periodic meshing command only apply to unstructured grids. In your case the grid is set structured (meshed by extrusion with the "Layers" option).
>>>
>>>
>>>> Could anyone help me?
>>>>
>>>> My geofile looks like this:
>>>>
>>>> cl=1.0;
>>>> //cuboid which is 8000,8000,1000 big
>>>>
>>>> Point(1) = {0,0,0,cl};
>>>> Extrude {8000,0,0} {
>>>>   Point{1}; Layers{10};
>>>> }
>>>> Extrude {0,8000,0} {
>>>>   Line{1}; Layers{10};
>>>> }
>>>> Extrude {0,0,1000} {
>>>>   Surface{5}; Layers{5};
>>>> }
>>>>
>>>>
>>>> boundMaster[] = Boundary{26};
>>>> boundSlave[] = Boundary{-8}; //tried plus and minus sign here..
>>>> boundMaster2[] = Boundary{22};
>>>> boundSlave2[] = Boundary{-14};  //tried plus and minus sign here..
>>>>
>>>> Periodic Surface 18 {boundSlave[]} = 26 {boundMaster[]};
>>>> Periodic Surface 14 {boundSlave2[]} = 22 {boundMaster2[]};
>>>>
>>>> Physical Surface(28) = {14};   //y=y0
>>>> Physical Surface(29) = {18};   //x=xmax
>>>> Physical Surface(30) = {22};   //y=ymax
>>>> Physical Surface(31) = {26};   //x=x0
>>>> Physical Surface(32) = {5};    //top
>>>> Physical Surface(33) = {27};   //bottom
>>>>
>>>> Physical Volume(34) = {1};
>>>>
>>>> Best,
>>>>
>>>> Josefin
>>>>
>>>>
>>>> _______________________________________________
>>>> gmsh mailing list
>>>> gmsh at onelab.info
>>>> http://onelab.info/mailman/listinfo/gmsh
>> --
>> Josefin Ahlkrona
>> PhD Student
>> Division of Scientific Computing
>> Department of Information Technology
>> Uppsala University
>> Box 337
>> SE-751 05 Uppsala
>> Sweden
>>
>> Email: josefin.ahlkrona at it.uu.se
>> Webpage: http://www.it.uu.se/katalog/josah992
>> Ph: +46-18-4712980
>> Fax: +46 18 523049, +46 18 511925

--

Josefin Ahlkrona
PhD Student
Division of Scientific Computing
Department of Information Technology
Uppsala University
Box 337
SE-751 05 Uppsala
Sweden

Email: josefin.ahlkrona at it.uu.se
Webpage: http://www.it.uu.se/katalog/josah992
Ph: +46-18-4712980
Fax: +46 18 523049, +46 18 511925

```