[Gmsh] Periodic Surface

Mikhail Artemiev artemiev.mikhail at ngs.ru
Wed Dec 28 05:40:29 CET 2011


Hi all!
I try to mesh a cube in such a manner that the opposite
faces have identical mesh.
For this purpose I try to use 'Periodic Surface'.
This is my script:

// --- the cube ---
cl = 0.2;
Point(1) = {0, 0, 0, cl};
Point(2) = {1, 0, 0, cl};
Line(1) = {1, 2};
outSurf[] = Extrude{0, 1, 0}{Line{1};};
outVol[] = Extrude{0, 0, 1}{Surface{outSurf[1]};};

// --- the periodicity ---
// only x = 0 and x = 1 faces for example
surfMaster = outVol[5]; // x = 0
surfSlave = outVol[3]; // x = 1
boundMaster[] = Boundary{Surface{surfMaster};};
boundSlave[] = Boundary{Surface{surfSlave};};
Periodic Surface surfSlave { boundSlave[] } = surfMaster { boundMaster[] };

If one will look at (x=1)face in +X view and at (x=0)face in -X view, the 
meshes will identical.
But I think that it is incorrect.
Because one should look at one, say +X, view.
To look the mesh on the (x=0)face in +X view, I used a clipping (A=-1, 
B=C=0).
In this case the meshes was not identical, but they was not really different 
too.
It seemed that (x=1)face was a mirror reflection of the (x=0)face.
Then I printed boundMaster and boundSlave arrays, and I realized that in +X 
view
boundMaster had the edges in clockwise, boundSlave - in counterclockwise.
After that I changed these arrays by hand:

boundMaster[] = {3, 21, 10, -12}; // counterclockwise
boundSlave[] = {4, 17, -8, -13}; // counterclockwise

After that Gmsh built an ugly mesh.
I tried with 2.5.0 and 2.5.1 (from nightly sources) versions with the same 
result.
OS - Windows.

Is still 'Periodic Surface' an experimental feature?
Or I use it incorrectly?

Thanks in advance.
Mikhail Artemiev