[Gmsh] Selecting faces after boolean operation

Christophe Geuzaine cgeuzaine at uliege.be
Thu Feb 27 06:58:36 CET 2020



> On 27 Feb 2020, at 00:02, Francis Giraldeau <francis.giraldeau at gmail.com> wrote:
> 
> It is necessary to define physical groups for surfaces in order to apply boundary conditions. The Boundary function returns the surfaces for a given geometry, but after a boolean operation, the surface entities change and the surface is lost.

Yes indeed.

> Here is an example:
> 
> SetFactory("OpenCASCADE");
> 
> box1 = newreg;
> Box(box1) = {-2,-2,-2, 4,4,4};
> // The box1 will be deleted in the boolean operation and the boundary is invalid
> // box1_boundary() = Boundary{ Volume{box1}; };
> // Physical Surface("box1_surface") = { box1_boundary() };
> 
> box2 = newreg;
> Box(box2) = {-1,-1,-1, 2,2,2};
> 
> 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.

Christophe


> Physical Surface("case_surface") = { case_boundary() };
> 
> // Recover the surfaces using BoundingBox, but it's cumbersome and works only for specific simple geometries...
> tol = 1e-3;
> s1() = Surface In BoundingBox { -2-tol,-2-tol,-2-tol, 4+tol, 4+tol, -2+tol };
> Physical Surface("Back") = s1();
> 
> I would be curious if there is better way to obtain the outer surfaces of a volume after a boolean operation?
> 

> Thanks!
> 
> -- 
> 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