[Gmsh] Selecting faces after boolean operation

Christophe Geuzaine cgeuzaine at uliege.be
Sat Feb 29 09:30:27 CET 2020



> On 27 Feb 2020, at 17:02, Francis Giraldeau <francis.giraldeau at gmail.com> wrote:
> 
> Le jeu. 27 févr. 2020 à 00:58, Christophe Geuzaine <cgeuzaine at uliege.be> a écrit :
> > On 27 Feb 2020, at 00:02, Francis Giraldeau <francis.giraldeau at gmail.com> wrote:
> > case = newreg;
> > BooleanDifference(case) = { Volume{box1}; Delete; }{ Volume{box2}; };
> > 
> > Physical Volume("case") = {case};
> > Physical Volume("box2") = {box2};
> > 
> > // The boundary return also the internal surface
> > case_boundary() = Boundary{ Volume{case}; };
> 
> Use CombinedBoundary to remove all internal faces.
> 
> Interesting. I tried that and it seems it doesn't work using BooleanDifference. CombinedBoundary also return the internal surfaces in the case above.
> 

Boolean operations create new entities. Since you don't delete box2, you end up with two (disjoint volumes): box2 and the result of the difference, "case". The boundary operator works as expected.

> However, replacing BooleanDifference by BooleanFragments causes CombinedBoundary to return only the external faces:

Yes: the fragment operation results in two volumes that are "glued", i.e. they share the internal surfaces. Hence CombinedBoundary behaves as expected.

> 
> frag() = BooleanFragments { Volume{box1,box2}; Delete; }{ };
> cb() = CombinedBoundary{Volume{frag()};};
> Physical Surface("cb") = {cb()};
> 
> But when using BooleanFragments, box2 is deleted and cannot be used anymore to create the corresponding physical volume.
> 
> Either way, it seems that BoundingBox is necessary to retrieve the volumes or surfaces in order to create the physical groups.
> 

Gmsh tries to reuse the same tag for top level (highest dimensional) entities that are not modified. Here box2 will keep its tag, that you can use for the physical.

Note that the API returns additional information on the parent/child relationships: see https://gitlab.onelab.info/gmsh/gmsh/-/blob/master/tutorial/python/t16.py

Christophe

> Cheers!
> 
> Francis
> _______________________________________________
> 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