Boundary crossing in assemblies

Dear all,

I am describing complicated geometries by means of volume assemblies, i.e. I have a list of tetrahedrons
which I put in the right place in an assembly. The problem is that due to numerical precision sometimes
a thin layer is of the surrounding material is created between the different tetrahedrons. This causes an
unphysical boundary crossing within the assembly. Currently, I am doing a findnextboundaryandStep and then I propagate the tracker by a small step in the actual direction to see if there is a tetrahedron very close to the boundary.
Is there a more efficient (elegant) way to get rid of these unphysical crossings within assemblies ? I do not want
to artificially enlarge the tetrahedrons to generate overlaps.

Thank you,

Aniello Esposito

Another way would be to actually enlarge the tetrahedrons and describe the structure as a union, but this is not necessary more elegant. Putting bodies next to each other can potentially produce thin layers like this. In principle the tracking should deal correctly with such cases, i.e. take the decision only after computing the step made in the current volume before a crossing. Small steps can be ignored.



Thank you for the rapid reply. Enlarging the the bodies is what I wanted to avoid. However, I will try to enlarge them and define them as union as you proposed. Is there a performance loss in this case compared to volume assemblies ?

I am not sure if I have understood your second suggestion. I am doing a FindNextBoundaryAndStep and then it is possible that I land in such a thin layer. By doing a small artificial step (and then go back) in the actual direction I can check if I effectively am in such a thin layer. Are you saying that I should avoid the crossing, i.e. FindNextBoundary, and do the mentioned small search from here ? Or what do you mean by ‘small steps can be ignored’ ?


Yes, booleans can be penalizing in time as O(n) with the number of components.
What I meant with small steps was:

  • propagate with FindNextBoundaryAndStep -> you will reach such a thin layer
  • Do your stepping action in the current volume (e.g. energy deposition), but only if the step size is bigger than say 1E-6 (0.01 microns). This is now true, so you count:
    dE = k*step;
    Edep += dE;
  • propagate again -> you will reach the next tetrahedron at a tiny step that you ignore

Note that if the observable you collect is proportional with the step (like Edep) you even do not need to put any step protection as dE will be zero for the artificial layers.


Hello Andrei,

Actually I choosed the assemblies du to their performance. When I cross a boundary some scattering happens in my algorithm. So it is not only an energy deposition as you described. I have to check whether I am in
such a thin layer in order to decide if I should ignore all physical processes or not. I think that I will keep for the present my current version described in the first post.

As another check I could have a look at the primitives, i.e. tetrahedrons, in my root geometry after creation. Is there an efficient way to retrieve the tetrahedrons in my geometry starting from the top volume ? At the end I would like to have a list of tetrahedrons described by four points (not the vertices when the shape is created but the definitive vertices in the geometry).

Thank you,