[Gmsh] gmsh Digest, Vol 196, Issue 22

Ziad Boutanios ziad at binkz.ca
Wed May 22 00:18:19 CEST 2019


Hi Felix,

All the following result in syntax errors:

BoundaryLayer Field = 1 2;

BoundaryLayer Field = 1,2;

BoundaryLayer Field = {1,2};

Adding the following 3 lines you suggested removed all BLs:

Field[3] = Min;
Field[3].FieldsList = {1, 2};
Background Field = 3;

The mesh I got with identical BLs is good enough to run some 
simulations. I'll check out the different BL issue again later this week.

Thanks,

Ziad

On 2019-05-21 3:03 p.m., gmsh-request at ace20.montefiore.ulg.ac.be wrote:
> Send gmsh mailing list submissions to
> 	gmsh at onelab.info
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://onelab.info/mailman/listinfo/gmsh
> or, via email, send a message with subject or body 'help' to
> 	gmsh-request at onelab.info
>
> You can reach the person managing the list at
> 	gmsh-owner at onelab.info
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of gmsh digest..."
>
>
> Today's Topics:
>
>     1. Re: separate boundary layer settings (Felix Salazar)
>     2. Re: Unit cell with periodic mesh (Christophe Geuzaine)
>     3. Re: Refining a 4th order mesh to a 2nd order mesh
>        (Christophe Geuzaine)
>     4. Re: Unit cell with periodic mesh (Sergej Tarasov)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 21 May 2019 14:50:03 -0400
> From: Felix Salazar <felix.salazar at polymtl.ca>
> To: gmsh at onelab.info
> Subject: Re: [Gmsh] separate boundary layer settings
> Message-ID:
> 	<CACsb-XkyfyfQDAPikdNfipV=s-eOx00ikmVKhk1nZcK89364ow at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Just rereading your latest message,
>
> According to gmsh documentation, there are several ways to specify mesh size
> <http://gmsh.info/doc/texinfo/gmsh.html#Specifying-mesh-element-sizes>.
> Global mesh, mesh size at a point/vertex/ curvature meshing (gives you more
> nodes in curves than in straight lines), and background mesh.
>
> The boundary layer field you are using can only be properly implemented as
> a mesh size indicator if used as background mesh. My guess is that in your
> case is partially working, because gmsh creates and evaluates the field and
> use it as background due to the command "BoundaryLayer Field = 1". But if
> other field is evaluated, the previous is overwritten. That's why you can't
> get the combination of your boundary layers. You can only see the cylinder
> BL when you comment lines 53-61, which is where you create the 2nd BL.
>
> I'm not sure if using a BoundaryLayer Field = {1,2} would work. In any
> case, you can create the 2 fields (BL1, BL2), and then create a 3rd field
> that takes the minimum of those other 2. And set the background mesh as
> these 3rd field. It will only take 3 extra lines on your .geo file. Check
> the example 10 to see some examples of fields and combinations
> <http://gmsh.info/doc/texinfo/gmsh.html#t10_002egeo>.
>
> Comment lines 48, 61, and add this after line 62.
>
> Field[3] = Min;
> Field[3].FieldsList = {1, 2};
> Background Field = 3;
>
> Post the results if satisfied
>
>
>
> ------------------------------------
>
> *F?lix Salazar**felix.salazar at polymtl.ca <felix.salazar at polymtl.ca>*
> ------------------------------------
>
>
> On Mon, May 20, 2019 at 8:58 PM Ziad Boutanios <ziad at binkz.ca> wrote:
>
>> Don't worry about it. I'll take a look at background fields, but off the
>> bat it seems like a substantial detour for additional boundary layers,
>> assuming it works.
>>
>> Maybe one of the developers can comment whether separate instances of
>> BoundaryLayer can be implemented in a mesh at all?
>> On 2019-05-20 3:29 p.m., Felix Salazar wrote:
>>
>> Sorry for not replying sooner. I'm using my phone to read your messages
>> and couldn't open gmsh. But you're right, the extrusion lines were
>> commented. My bad.
>>
>> You need to specify a background field. That field needs to somehow
>> integrate the effect of your 3 boundary layers. Take a look at this example
>> http://gmsh.info/doc/texinfo/gmsh.html#t10_002egeo
>>
>> Several fields are computed, and the background field used for meshing is
>> the minimum of all of them
>>
>> Not sure if it will work on your version of gmsh
>>
>> Hope that helps
>>
>> On Mon, May 20, 2019, 1:16 PM Ziad Boutanios <ziad at binkz.ca> wrote:
>>
>>> On 2019-05-20 11:59 a.m., Ziad Boutanios wrote:
>>>
>>>
>>> On 2019-05-20 11:26 a.m., Felix Salazar wrote:
>>>
>>> Based on the .geo file, what you're seeing on the top and bottom surfaces
>>> is due to the extrusions. The combination of these plus the BL fields
>>> creates more layers than the 5 specified in the extrusions.
>>>
>>> Try disabling (commenting) either the extrude or the BL field and remesh.
>>>
>>>
>>> The Extrude sections in the bottom of the provided geo file are already
>>> commented.
>>>
>>>
>>> Around the cylinder, there's a BL. You have smaller quads there. If you
>>> want finer control, try using an O-grid mesh
>>> <https://www.researchgate.net/figure/O-grid-around-the-circular-cylinder_fig11_280028215>,
>>> similar to the one on the previous link.
>>>
>>> Thanks for the suggestion but it doesn't help me. I'm looking for a way
>>> to implement different instances of BoundaryLayer, each with its own
>>> settings. Any idea how this can be done?
>>>
>>> BTW, I have to use gmsh 3.0.6 for compatibility reasons.
>>>
>>> Forgot to mention that what you see in the original snapshot around the
>>> cylinder is not a BoundaryLayer. That's just the unstructured quad result
>>> of Recombine. If you comment lines 53-61 you can see what the cylinder BL
>>> looks like. I attached a snapshot of it.
>>>
>>> The problem is that when I use successive instances of BoundaryLayer,
>>> only the last one in the geo file is produced. I need to have them all work
>>> so I can customize each with its own settings.
>>>
>>>
>>> ------------------------------------
>>>
>>> * F?lix Salazar **felix.salazar at polymtl.ca <felix.salazar at polymtl.ca>*
>>> ------------------------------------
>>>
>>>
>>> On Sun, May 19, 2019 at 11:11 AM Ziad Boutanios <ziad at binkz.ca> wrote:
>>>
>>>> Hi,
>>>>
>>>> The geometry I'm meshing is that of a cylinder in a straight rectangular
>>>> channel in 2D. The geo file is attached, as well as a screenshot of the
>>>> result. I would like to use separate settings for the boundary layer
>>>> around the cylinder and at the top and bottom surfaces. To do this I
>>>> implemented two BoundaryLayer Field sections (lines 40-48 and 53-61).
>>>> Unfortunately only the boundary layer corresponding to the last section
>>>> is produced. Can that be fixed using BoundaryLayer?
>>>>
>>>> Thanks,
>>>>
>>>> Ziad
>>>>
>>>>
>>>> _______________________________________________
>>>> gmsh mailing list
>>>> gmsh at onelab.info
>>>> http://onelab.info/mailman/listinfo/gmsh
>>>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://onelab.info/pipermail/gmsh/attachments/20190521/b630a06c/attachment-0001.html>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 21 May 2019 21:00:13 +0200
> From: Christophe Geuzaine <cgeuzaine at uliege.be>
> To: Sergej Tarasov <tarasov at pmi.lv>
> Cc: gmsh at onelab.info
> Subject: Re: [Gmsh] Unit cell with periodic mesh
> Message-ID: <1B44B8D4-DAB2-4167-985D-12AB52820063 at uliege.be>
> Content-Type: text/plain;	charset=utf-8
>
>
>
>> 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
>
>
>
>
>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 21 May 2019 21:00:54 +0200
> From: Christophe Geuzaine <cgeuzaine at uliege.be>
> To: Aman Saxena <amansaxena.iitg at gmail.com>
> Cc: gmsh at onelab.info
> Subject: Re: [Gmsh] Refining a 4th order mesh to a 2nd order mesh
> Message-ID: <520F29C5-556B-40D1-9925-0B9DB0FD764D at uliege.be>
> Content-Type: text/plain;	charset=utf-8
>
>
>
>> On 21 May 2019, at 09:23, Aman Saxena <amansaxena.iitg at gmail.com> wrote:
>>
>> I have a 4th order mesh(with 5 points defining the lines) and I want to refine it twice. As I refine it once, I get a linear mesh and all other points except for the nodes forming the elements are lost.
>> So when I refine it for the second time it splits and gives me points on the linear mesh which are not on the actual boundary. If I can get a 2nd order mesh after refining the 4th order mesh, further refinement could have given me points on the actual boundary.
>>
>> Thus how to get a 2nd order mesh from the fourth order mesh?
>>
> There's no built-in function for this. But you could code it yourself quite easily with the Gmsh api.
>
> Christophe
>
>> I have attached a file to demonstrate this, figure 1 shows the boundary element of fourth order mesh while second figure shows the boundary element(linear) I get after one refinement and the last figure shows the kind of element(quadratic -- degree 2) I want to have after one refinement.
>>
>> I have also attached the mesh file.
>>
>> Thanks.
>>
>>   btc0-NLR-L3.v2.m4.msh.gz
>>
>> <boundaryElement.pdf>_______________________________________________
>> 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
>
>
>
>
>
>
> ------------------------------
>
> Message: 4
> Date: Tue, 21 May 2019 21:19:23 +0300
> From: Sergej Tarasov <tarasov at pmi.lv>
> To: Christophe Geuzaine <cgeuzaine at uliege.be>, gmsh at onelab.info
> Subject: Re: [Gmsh] Unit cell with periodic mesh
> Message-ID: <21885659.20190521211923 at pmi.lv>
> Content-Type: text/plain; charset=us-ascii
>
> 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!
>
>



More information about the gmsh mailing list