[Gmsh] Unit cell with periodic mesh

Christophe Geuzaine cgeuzaine at uliege.be
Sat May 18 13:43:04 CEST 2019



> On 17 May 2019, at 23:56, Sergej Tarasov <tarasov at pmi.lv> wrote:
> 
> Hi,
> I need to create cubic unit cell containing many particles crossing the walls
> with periodic mesh (the geometry itself is periodic). I do it like this:
> 
> SetFactory("OpenCASCADE");
> Mesh.MinimumCurvePoints = 2;
> Box(1) = { 0, 0, 0, 1, 1, 1 };
> Cylinder(2) = { 0.669103076524392, 0.926238630543764, 0.380445067549797, -0.00436647701608499, -0.00549592479612254, 0.0071224075356137, 0.25, 2*Pi };
> Cylinder(3) = { 0.669103076524392, -0.0737613694562362, 0.380445067549797, -0.00436647701608499, -0.00549592479612254, 0.0071224075356137, 0.25, 2*Pi };
> BooleanIntersection{ Volume{ 2:3 }; Delete; } { Volume{ 1 }; }
> BooleanDifference{ Volume{ 1 }; Delete; } { Volume{ 2:3 }; }
> 
> Periodic Surface{ 21 } = { 16 } Translate{ 1,0,0 };
> Periodic Surface{ 9, 19 } = { 14, 17 } Translate{ 0,1,0 };
> Periodic Surface{ 18 } = { 20 } Translate{ 0,0,1 };
> 
> 
> which works perfectly. But in case of many particles (50-100) I need
> to know the ID of each opposite surface. What is the best way to do it in Gmsh?
> Or there is better way to achieve this?

In this case I would use

e = 1e-6;
left_surface() = Surface In BoundingBox{-e,-e,-e, e,1+e,1+e};
right_surface() = Surface In BoundingBox{1-e,-e,-e, 1+e,1+e,1+e};
Periodic Surface{ right_surface() } = { left_surface() } Translate{ 1,0,0 };

etc.

If there are multiple sub-surfaces, you can compare their bounding boxes (b() = BoundingBox Surface{...};) to find the corresponding pairs.

Christophe


> 
> -- 
> Best regards,
> Sergej Tarasov                         mailto:tarasov at pmi.lv
> 
> 
> _______________________________________________
> 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






More information about the gmsh mailing list