Multiple holes in solid

Hi,
What is the best practise if I am to create a solid with many holes in it? The solid is a G4Box. The holes are G4Tubes which will reach from one side to halfway through the box, all being placed in rows and columns with equal distance between each other. The holes will all be of the same dimension but their rotation will be different depending on their placement.

Without the rotation I’ve successfully placed the tubes as a daughter in the mother volume of the box. With the rotation, this is problematic, since some parts of the holes then will protrude through the side of the mother volume while other parts of the holes leave the side mother volume “undrilled”. My solution has therefore been to “drill” the holes using a G4SubtractionSolid in a double for-loop. As the number of rows grow, the time to visualise the geometry seems to increase at least as a quadratic polynomial (not rigorously tested). For the number of holes that I require the creation time was too long for me to wait (beyond half an hour before I finally closed it down). Is there another solution to this that makes the time to start the simulation feasible?

Cheers

You can create a G4MultiUnion solid, where you collect all of the “hole volumes” into a single entity (instead of a very, very deep nesting of booleans), then do a single G4SubtractionSolid(myBox, myMultiUnion).

You should make your ‘drill’ slightly longer than a mother volume. Otherwise it will leave a thin wall.
For example, if you want to drill a hole to x=y=z=10 cm box, your tubes height should be 10.1 cm(or 0.51*z_of_box) to make a clear hole.

1 Like

Thanks a lot!

I remember trying to use G4MultiUnion some months ago when the geometry construction was without the now neeeded rotation, but I couldn’t successfully include the G4MutliUnion.hh-file. And since the mother-daugher solution worked out, I decided to not look into it further. Seems like the MultiUnion is included from version 10.4, so good to finally have the incentive to upgrade from 10.3!

Yeah I’ve noticed that this is necessary at least for the sake of visualisation. Does the “thin wall” affect the simulation or is it purely a matter of visualistation?

The “thin wall” does affect tracking, because that’s real material left behind. When “drilling holes” via G4SubtractionSolid, you should always make sure that the “drill” extends beyond the boundary of the volume of interest. I usually use a a millimeter on flat surfaces; if I’m punching a hole through a curved surface, I code up the sagitta and extend the hole at least a millimeter beyond that.

1 Like

Alright, thanks for the information! Regarding this, if I were to place a daughter which ends up just at the border of the mother volume, does the “thin wall” also appear there?

Yes, it can. If your two volumes have relatively simple surfaces, in particular if the surfaces are along Cartesian planes, then you can place them adjacent and things should be fine.

But if the surfaces are “shaped”, or not on a simple X, Y, or Z plane, then floating point rounding can lead to them not being perfectly coincident. Normally, such differences should be small, and the geometry “tolerance” will take care of it.

Thanks for sharing that information!

Even in the case where tubes are rotated you can define the geometry without boolean subtraction. Just use G4CutTubs for daughter volumes.

2 Likes