[Gmsh] Sphere in a sphere mesh

Silvia Ceccacci (HDR) silvia.ceccacci at hdr.mq.edu.au
Wed Mar 4 09:25:59 CET 2020


Dear all,

I would like to generate a geometry where I have a bigger sphere (radius=3) and a smaller one inside it (radius=1). Then I want to generate a 3D mesh without the sphere inside (so there is a hole in the middle of the bigger sphere).

I am trying two different approaches, but none of them seem to work:

1) BooleanDifference - I want to take away the smaller sphere from the bigger one. This is the code:

Sphere(1) = {0, 0, 0, 1, -Pi/2, Pi/2, 2*Pi};
Sphere(2) = {0, 0, 0, 3, -Pi/2, Pi/2, 2*Pi};
BooleanDifference{ Volume{2}; Delete; }{ Volume{1}; Delete; }

but it does not do it. Could you explain why, please?

2) Extrude - I generate a half annulus (with the first Extrude), then I want to extrude it in rotation (2*Pi) to generate the same geometry, sphere in a sphere. This is the code:

Point(1) = {1, 0, 0, 1.0};
Point(2) = {2, 0, 0, 1.0};
Line(1) = {1, 2};
//+
Extrude {{0, 0, 1}, {0, 0, 0}, Pi} {
Line{1};Layers{8};Recombine;
}
//+
Extrude {{1, 0, 0}, {0, 0, 0}, Pi} {
Surface{5};Layers{8};Recombine;
}

but again, the second Extrude does not do it. Could you explain why, please?

Could you tell me how to do it, please?

Thank you.

Kind regards,
Silvia


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20200304/f0c851a6/attachment.html>


More information about the gmsh mailing list