[Gmsh] Unit cell with periodic mesh
Christophe Geuzaine
cgeuzaine at uliege.be
Tue May 21 21:00:13 CEST 2019
> On 21 May 2019, at 20:19, Sergej Tarasov <tarasov at pmi.lv> wrote:
>
> Hello Christophe,
>
> Saturday, May 18, 2019, 2:43:04 PM, you wrote:
>
>
>
>>> 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?
>
> CG> In this case I would use
>
> CG> e = 1e-6;
> CG> left_surface() = Surface In BoundingBox{-e,-e,-e, e,1+e,1+e};
> CG> right_surface() = Surface In BoundingBox{1-e,-e,-e, 1+e,1+e,1+e};
> CG> Periodic Surface{ right_surface() } = { left_surface() } Translate{ 1,0,0 };
>
> CG> etc.
>
> CG> If there are multiple sub-surfaces, you can compare their
> CG> bounding boxes (b() = BoundingBox Surface{...};) to find the
> CG> corresponding pairs.
>
> CG> Christophe
>
>
> Thank you very much. The first method you suggested doesn't work with complex shapes,
> so I tried to compare bounding boxes, which works perfectly, but unfortunately
> not always. It fails in one specific situation, which occurs quite often in my case.
> Below is sample code that fails to generate periodic mesh.
>
> -------------------------------------------------------------------
> SetFactory("OpenCASCADE");
> Box(1) = { 0, 0, 0, 1, 1, 1 };
>
> Cylinder(2) = { 0.58, 0.917, 0.689, -0.004387, 0.006, 0.00668, 0.1, 2*Pi };
> Cylinder(3) = { 0.58, -0.083, 0.689, -0.004387, 0.006, 0.00668, 0.1, 2*Pi };
> BooleanIntersection{ Volume{ 2:3 }; Delete; } { Volume{ 1 }; }
> BooleanDifference{ Volume{ 1 }; Delete; } { Volume{ 2:3 }; }
>
> Periodic Surface{ 17 } = { 15 } Translate{ 0,1,0 };
> Mesh 3;
> -------------------------------------------------------------------
>
>
> Is there any way to avoid this? Thanks!
>
Indeed, it's a known limitation of the current periodic implementation: matching curves are identified using their bounding points - and in this case the two periodic curves have the same bounding points.
The routine to generalize is GFace::setMeshMaster(). Can you open an issue in the gitlab so we don't forget about it?
Thanks,
Christophe
>
> --
> Best regards,
> Sergej Tarasov mailto:tarasov at pmi.lv
—
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