Combinatorial Geometry / Constructive Solid Geometry (CSG)
Introduction¶
Combinatorial Geometry or Constructive Solid Geometry (CSG) forms the basis of geometry coding in FLUKA (Ahdida et al. (2022), Battistoni et al. (2015)) and MCNP (Rising et al. (2025)), which are general-purpose Monte Carlo radiation transport codes extensively used worldwide.
It works by combining simple building blocks such as planar and quadratic surfaces, boxes and cylinders, ellipses and spheres -- FLUKA calls them bodies and MCNP calls them surfaces.
Realistic geometries can be achieved by combining those simple bodies/surfaces as needed, to form volumes -- FLUKA calls them regions while MCNP calls them cells. Increasing complexity in combinatorial geometry can be achieved by combining (or overlapping) more bodies/surfaces.
On the screens to come we’ll walk through the “ultimate” demo of combinatorial geometry or CSG: a challenge problem of connecting two pipes.

Screenshots are of FLAIR (Donadon et al. (2024)), which revolutionized radiation-transport geometry coding with its interactive and responsive Graphical User Interface (GUI). Originally developed for FLUKA, and backed by popular demand, FLAIR is expanding to cover MCNP, GEANT4 and PHITS.
Looks easy and trivial¶
Joining 2 cylindrical pipes. Looks trivial?
This is an excellent demo of combinatorial geometry.

How would we go about coding the geometry?
Bodies / surfaces¶
Let’s start with two pairs of concentric cylinders:
horizontal
inner surface (which I name A_in);
outer surface (which I name A_out).
vertical
inner surface (which I name B_in);
outer surface (which I name B_out).
Horizontal, inner body or surface:¶

Horizontal, outer body or surface:¶

Vertical, inner body or surface:¶

Vertical, outer body or surface:¶

Are these four bodies/surfaces all we need to construct the L-shape pipe?
Regions / cells¶
This could be our first attempt to combine the four bodies/surfaces from the previous screen:
A_in;
A_out;
B_in;
B_out;
to form volumes (regions/cells):
OUTSIDE (1 zone);
INSIDE (3 zones);
PIPE (2 zones).
OUTSIDE, zone #1¶

INSIDE, zone #1¶

INSIDE, zone #2¶

INSIDE, zone #3¶

PIPE, zone #1¶

PIPE, zone #2¶

However, the geometry isn’t what we wanted. The two pipes aren’t connected at the joint. Instead, they’re sticking out at each other.
Download¶
Second attempt¶
So we make the following edits to try fix the problem so that the pipes stop sticking out at each other:
Region / cell | Zone | Before | After |
|---|---|---|---|
PIPE | 1 | +A_out -A_in | +A_out -A_in -B_out |
PIPE | 2 | +B_out -B_in | +B_out -B_in -A_out |
PIPE, zone #1¶

PIPE, zone #2¶

Errors¶

The pipes indeed stop ticking out at each other. But we now have a new problem: the two pipes are disconnected, anything flowing through is going to leak!
Solution #1¶
Body / surface¶
Here, we add one additional body/surface.

Regions / cells¶
OUTSIDE, zone #1¶

OUTSIDE, zone #2¶

OUTSIDE, zone #3¶

INSIDE, zone #1¶

INSIDE, zone #2¶

PIPE zone #1¶

PIPE zone #2¶

Download¶
Solution #2¶
Body / surface¶
In place of adding a diagonal as given in solution #1 on the previous screen, we introduce a plane disecting the horizontal pipe into half, and another plane disecting the vertical pipe into half.


Regions / cells¶
OUTSIDE, zone #1¶

OUTSIDE, zone #2¶

OUTSIDE, zone #3¶

INSIDE, zone #1¶

INSIDE, zone #2¶

INSIDE, zone #3¶

INSIDE, zone #4¶

INSIDE, zone #5¶

PIPE zone #1¶

PIPE zone #2¶

PIPE zone #3¶

PIPE zone #4¶

PIPE zone #5¶

PIPE zone #6¶

PIPE zone #7¶

PIPE zone #8¶

Download¶
- Ahdida, C., Bozzato, D., Calzolari, D., Cerutti, F., Charitonidis, N., Cimmino, A., Coronetti, A., D’Alessandro, G. L., Donadon Servelle, A., Esposito, L. S., Froeschl, R., García Alía, R., Gerbershagen, A., Gilardoni, S., Horváth, D., Hugo, G., Infantino, A., Kouskoura, V., Lechner, A., … Widorski, M. (2022). New Capabilities of the FLUKA Multi-Purpose Code. Frontiers in Physics, 9. 10.3389/fphy.2021.788253
- Battistoni, G., Boehlen, T., Cerutti, F., Chin, P. W., Esposito, L. S., Fassò, A., Ferrari, A., Lechner, A., Empl, A., Mairani, A., Mereghetti, A., Ortega, P. G., Ranft, J., Roesler, S., Sala, P. R., Vlachoudis, V., & Smirnov, G. (2015). Overview of the FLUKA code. Annals of Nuclear Energy, 82, 10–18. 10.1016/j.anucene.2014.11.007
- Rising, M. E., Armstrong, J. C., Bolding, S. R., Bull, J. S., Casswell, L., Clark, A. R., Forster, R. A., Frederick, C. S., Giron, J. F., Jones, F. B., Josey, C. J., Kelley, T. M., Kulesza, J. A., Lively, M. A., Little, R. C., Swaminarayan, S., Sweezy, J. E., Vaquer, P. A., Weaver, C. A., & Zukaitis, A. J. (2025). The MCNP ® 6 code: A decade of progress. EPJ Nuclear Sciences & Technologies, 11, 9. 10.1051/epjn/2025003
- Donadon, A., Hugo, G., Theis, C., & Vlachoudis, V. (2024). FLAIR3 – recasting simulation experiences with the Advanced Interface for FLUKA and other Monte Carlo codes. EPJ Web of Conferences, 302, 11005. 10.1051/epjconf/202430211005