# [Gmsh] Selecting faces after boolean operation

Francis Giraldeau francis.giraldeau at gmail.com
Thu Feb 27 00:02:21 CET 2020

```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. Here is an example:

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}; };
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20200226/e5b0bc1b/attachment.html>
```