[Gmsh] How to select Pre/Post processing entity by location?

andrew armitatz at gmail.com
Wed Dec 13 19:31:24 CET 2017


the IDs are not generated randomly. They do have a logic in that when a
surface is created it elements are increasing. The problem is that you
don't know the order that gmsh does its calculation.
But it is difficult. I found that a geometrical type of filtering can give
good results.


2017-12-13 20:20 GMT+02:00 Shamsul Arefin <mail.shanto at gmail.com>:

> Hi Andrew,
>
> Thanks for the link ...
>
> I want to do the 'naming task' in the batch. Problem is, after the
> generation of the volume, the surface IDs are created randomly. In GUI this
> is not a problem,  but since I am in batch mode, i need a rather stable
> solution to do this generation and naming repeatedly.
>
>
>
>> Regards,
> Shamsul Arefin
> ph: 017655441319
>
> On Wed 13 Dec 6:53:50 pm, andrew <armitatz at gmail.com> wrote:
> I am glad it helped a bit.
>
> For extrusion hints you can see the tutorial of openfoam and gmsh
> https://openfoamwiki.net/index.php/2D_Mesh_Tutorial_using_GMSH
> It gives some info for the extrusion vectors.
>
> If you change the function in my files you can create functions for a few
> elementary geometrical entities. Unfortunately selecting elements according
> to geometry is a bit tricky in gmsh.
> You can get the elements in an array and sweep in the array. This way you
> can select the elements according to their coordinates with any criteria
> you like.
>
> For example in my file it goes
>
> For PlaneFilter_jj In {0:#PlaneFilter_Surfaces[]-1}          <-------
> SWEEP SURFACES
>   PlaneFilter_n[]=PointsOf{Surface{PlaneFilter_Surfaces[PlaneFilter_jj]};};
>     <----------- GET ALL POINTS OF SURFACE
>   PlaneFilter_nn=#PlaneFilter_n[];
>   PlaneFilter_cc=0;
>   For PlaneFilter_kk In {0:#PlaneFilter_n[]-1}      <--------- SWEEP
> POINTS IN SURFACE
>     PlaneFilter_pn[]=Point{PlaneFilter_n[PlaneFilter_kk]};
>  PlaneFilter_px=PlaneFilter_pn[0];          <------- COORDINATES
>  PlaneFilter_py=PlaneFilter_pn[1];
>  PlaneFilter_pz=PlaneFilter_pn[2];
> .......
>
> the two nested loops are for getting the points and their coordinates.
> After that you can filter them any way you like...
>
>
>
>
> 2017-12-13 16:40 GMT+02:00 Shamsul Arefin <mail.shanto at gmail.com>:
>
>> This is a nice trick. Thanks Andrew.
>>
>> However, this is only for selecting plane surfaces. I may have to tweak
>> the code for Cylindrical Surfaces and also for more control over the shape
>> of the geometry.
>>
>> # It would have been better if I could know how entities are stored in an
>> array. Say I extrude a surface to create a block. If this extrusion command
>> is saved in an array, what would be the sequence of IDs in the array, of
>> generated surfaces of the block.
>>
>>>> Regards,
>> Shamsul Arefin
>> ph: 017655441319
>>
>> On Tue 12 Dec 3:46:59 pm, andrew <armitatz at gmail.com> wrote:
>> I thought it was together with the other files !
>>
>>
>>
>> 2017-12-12 11:43 GMT+02:00 Shamsul Arefin <mail.shanto at gmail.com>:
>>
>>> Is there no other selection by location option? Say I want to select the
>>> areas at 'z=0', or volumes between -10<x<+10 and -10<y<+10.
>>>
>>> The purpose is to select nodes from a particular geometric entity and
>>> define name for those nodes i.e. a nodal set.
>>>
>>> Usually when I know the ID of a surface (for example), i can define a
>>> "physical surface" and get the nodes and elements in the output-file
>>> grouped together. Problem is, I would not know surface ID's while working
>>> in the batch.
>>>
>>> Or anyone has a better idea for doing this with gmsh?
>>>
>>>>>> Regards,
>>> Shamsul Arefin
>>> ph: 017655441319
>>>
>>> On Mon 11 Dec 8:26:36 pm, andrew <armitatz at gmail.com> wrote:
>>> ​perhaps this could help you. It selects a face that belongs to a plane
>>>
>>>>>>
>>>
>>> 2017-12-11 18:28 GMT+02:00 Shamsul Arefin <mail.shanto at gmail.com>:
>>>
>>>> Hello,
>>>>
>>>> Lets say I have a box modeled in gmsh. I want to select different faces
>>>> of the box just by - selection through location coordinate. So far have not
>>>> find anything in the documentation! Can anyone help?
>>>>
>>>>>>>> Regards,
>>>> Shamsul Arefin
>>>> ph: 017655441319
>>>>
>>>> _______________________________________________
>>>> gmsh mailing list
>>>> gmsh at onelab.info
>>>> http://onelab.info/mailman/listinfo/gmsh
>>>>
>>>>
>>>
>>> _______________________________________________
>>> 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/20171213/fa058291/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 70121 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20171213/fa058291/attachment-0001.png>


More information about the gmsh mailing list