# [Gmsh] how to make a periodic cubic mesh

Aleksejs Fomins aleksejs.fomins at lspr.swiss
Wed Dec 14 16:11:43 CET 2016

```Hi Dave,

Here's my actual use case: two (or more) cuboids stacked up to form a big layered cuboid. The big cuboid should be periodic. Each intermediate surface will have a different characteristic lengthscale, and the characteristic lengthscale of the connecting surfaces should change smoothly. Can this be achieved?

Cheers,
Aleksejs

On 14.12.2016 15:29, David Colignon wrote:
>
> On 14/12/16 14:22, Aleksejs Fomins wrote:
>
>> Dear Gmsh,
>>
>> I would like to create a cubic domain with a few complicated 3D shapes inside, and produce a corresponding tetrahedral mesh. The domain boundaries of the cube should be periodically conformal, e.g. each triangle on the surface with normal -x should be equivalent to a triangle on the surface with normal +x under translation along the x-axis.
>>
>> Using google I have found a solution proposed earlier on this list:
>>
>> http://onelab.info/pipermail/gmsh/2016/010305.html
>>
>> The .geo code suggested in the above link produces a conformal tetrahedral mesh of a cube using Transfinite surfaces and edges. It seems to work, but has a few problems:
>> 1) It completely ignores the value of the characteristic lengthscale variable "lc", always splitting each edge in exactly 4 parts
>> 2) The characteristic lengthscale changes depending on when index number of the Transfinite Line. Currently it is 5. If one would set it to 14, each edge would be split into exactly 25 segments. Why is that?
>
> Hi,
>
> see http://gmsh.info/doc/texinfo/gmsh.html#Structured-grids
>
> Transfinite Line { expression-list } | "*" = expression < Using Progression | Bump expression >;
>
>     Selects the lines in expression-list to be meshed with the 1D transfinite algorithm. The expression on the right hand side gives the number of nodes that will be created on the line (this overrides any other mesh element size prescription—see Specifying mesh element sizes).
>
>
> 5 nodes -> four segments
>
> Regards,
>
> Dave
>

```