Complex Geometries

Building realistic models from basic shapes

What you'll learn

After the first pin · 2 / 1412 min read
  • Write intersections, unions, and complements, and use parentheses to control the order they are evaluated in.
  • Describe a region that is not simply connected — a guide tube array, for example — with the : operator.
  • Carve equipment out of a room by listing cells after #.
  • Place a rotated copy of a component with a tr card, and say what the * prefix changes.
  • Check a geometry before transport using the VOID card, plotting, VOL, and the lost-particle messages.

Before you start

Boolean Operations

Real nuclear systems require combining basic shapes using Boolean logic. MCNP uses three operations to create complex geometries from simple surfaces.

The Three Operations

Intersection (AND)

Space between surfaces

-1 2 -3

Union (OR)

Multiple separate regions

-1:-2:-3

Complement (NOT)

Exclude specific cells

#10 #20

Intersection: Bounded Regions

Intersection creates regions that satisfy multiple conditions simultaneously. This is how you build finite volumes from infinite surfaces.

Simple Fuel Pellet

mcnp
c Basic cylindrical pellet
1  cz   0.4096    $ Pellet radius
2  pz   0.0       $ Bottom face
3  pz   1.0       $ Top face

c Fuel pellet cell  
10  1  -10.4  -1 2 -3    imp:n=1    $ UO2 pellet

Cell 10 is inside cylinder 1 (-1) AND above plane 2 (2) AND below plane 3 (-3). All three conditions must be true.

Complete Fuel Pin

mcnp
c PWR fuel pin surfaces
1  cz   0.4096    $ Fuel radius
2  cz   0.4178    $ Gap radius
3  cz   0.4750    $ Clad radius
4  pz   0.0       $ Pin bottom
5  pz   366.0     $ Pin top

c Pin regions
10  1  -10.4   -1 4 -5        $ UO2 fuel
11  0           1 -2 4 -5     $ Helium gap
12  2  -6.56    2 -3 4 -5     $ Zircaloy clad
13  3  -0.714   3 4 -5        $ Water around pin

Each region uses intersection to define bounded volumes. The fuel is inside the fuel cylinder and between the axial planes.

Union: Multiple Regions

Union operations (using colons) combine separate regions into single cells. This simplifies input files for discontinuous structures.

Guide Tube Array

mcnp
c Four guide tubes in assembly
1  c/z  5.4 5.4   0.612     $ Guide tube 1
2  c/z  5.4 16.2  0.612     $ Guide tube 2  
3  c/z  16.2 5.4  0.612     $ Guide tube 3
4  c/z  16.2 16.2 0.612     $ Guide tube 4
5  pz   0.0                 $ Assembly bottom
6  pz   366.0               $ Assembly top

c Guide tube steel (single cell for all four)
20  1  -7.8  (-1:-2:-3:-4) 5 -6    $ Steel tubes (solid cylinders)
21  2  -0.7  (1 2 3 4) 5 -6         $ Water outside all tubes

Cell 20 combines four separate cylindrical regions with union (the steel). Cell 21 uses intersection of the positive sides of all cylinders for the water region outside all tubes.

Detector Array

mcnp
c 2x2 detector crystals
1  rcc  0 0 0    0 0 5  2.5     $ Crystal 1
2  rcc  6 0 0    0 0 5  2.5     $ Crystal 2
3  rcc  0 6 0    0 0 5  2.5     $ Crystal 3
4  rcc  6 6 0    0 0 5  2.5     $ Crystal 4
5  rpp  -3 9  -3 9  -1 6       $ Housing box

c Detector assembly
30  1  -3.67  (-1:-2:-3:-4)          $ NaI crystals
31  2  -2.7   -5 1 2 3 4             $ Aluminum housing
32  0          5                     $ Outside air

Union combines four crystals into one material region. The housing is inside the box but outside all crystals.

Complement: Excluding Regions

Complement operations use the # symbol to exclude specific cells. This is useful for defining void spaces around complex objects.

Room with Equipment

mcnp
c Room and equipment
1  so   2.0       $ Source sphere
2  so   12.0      $ Shield sphere
3  rpp  -50 50  -50 50  -30 30    $ Room boundary

c Definitions
10  1  -19.3   -1              $ Source
20  2  -11.3   -2 1            $ Lead shield
30  0          -3 2 #40 #50    $ Air (excluding equipment)
40  3  -7.8    -4              $ Steel table
50  4  -2.7    -5              $ Detector

c Equipment surfaces
4  rpp  -10 10  -5 5  -25 -20  $ Table
5  rcc   30 0 0   0 0 10  5    $ Detector

Cell 30 defines air in the room but excludes the table (#40) and detector (#50). This is simpler than complex Boolean operations.

Practical Assembly Example

Let's build a realistic fuel assembly step by step, showing how to combine operations systematically.

Step 1: Define Components

mcnp
c Assembly components
1  cz   0.4096    $ Fuel radius
2  cz   0.4178    $ Gap radius  
3  cz   0.4750    $ Clad radius
4  cz   0.561     $ Guide tube inner radius
11 cz   0.612     $ Guide tube outer radius
5  px  -10.71     $ Assembly boundaries
6  px   10.71
7  py  -10.71
8  py   10.71
9  pz   0.0       $ Bottom
10 pz   366.0     $ Top

Step 2: Create Pin Cells

mcnp
c Fuel pin at origin
20  1  -10.4   -1 9 -10        $ UO2 fuel
21  0           1 -2 9 -10     $ Helium gap
22  2  -6.56    2 -3 9 -10     $ Zircaloy clad

c Guide tube at (5.4, 5.4)
23  2  -6.56    4 -11 9 -10  trcl=1  $ Guide tube wall (Zircaloy)
24  3  -0.714  -4 9 -10      trcl=1  $ Water inside guide tube

c Transformation
tr1  5.4 5.4 0    $ Translation to position

Step 3: Assembly Water

mcnp
c Water around all pins
25  3  -0.714  5 -6 7 -8 9 -10 #20 #21 #22 #23 #24    $ Water
26  0          -5:6:-7:8:-9:10                          $ Outside

Cell 25 fills the assembly box but excludes all pin cells. This creates the water moderator around the fuel pins.

Advanced Techniques

Parentheses Grouping

Use parentheses to group complex Boolean operations and control evaluation order.

mcnp
c Complex grouping
1  1  -2.7  (-1 2):(-3 4)  $ Two separate regions

Transformation Cards

Use TR cards to rotate and translate surfaces, enabling repeated placement of identical components.

mcnp
c Rotated component
c Full rotation matrix for 90° about z-axis:
c   x'=y, y'=-x, z'=z
c (* prefix = angles in degrees, not cosines)
*tr1  0 0 0  90 0 90  180 90 90  90 90 0

Boolean geometry fails in two ways, and only one of them announces itself. Overlapping cells and gaps between them are both undefined geometry: a particle that reaches an overlap has two cells claiming it and a particle that reaches a gap has none, and MCNP reports the second as a lost particle while the first can go unnoticed for a long time. Missing parentheses in an expression that mixes : with intersections produce a perfectly valid cell that simply is not the one you meant.

The subtler problem is complexity for its own sake. A cell description that needs three levels of nested parentheses is usually a cell that should have been a universe, and the alternative is worth reaching for before the expression gets long enough that nobody can check it.

Geometry Checking

Check a complicated geometry before you spend transport time on it, because a geometry error found after a four-hour run costs four hours. The void card strips all materials from the problem, which lets particles stream through and expose gaps and overlaps far faster than a transport run would. Plotting is the other half of that check: MCNP's own plotter, or an external viewer, will show you a slice through the model and make an overlap visible in a way no output listing does.

Then run something short and read the output rather than the answer. Lost particles are listed explicitly, with the coordinates where tracking failed, and those coordinates point straight at the offending surface. If any tally divides by a volume that MCNP cannot compute — which is the normal situation for cells in a lattice or a filled universe — supply it on a vol card, or the run is a fatal error rather than an approximation.

Keeping it manageable

Build up rather than out. A complicated region assembled from simple shapes, checked at each step, is far easier to debug than the same region written in one go — and the intermediate checks are cheap. Number surfaces and cells in blocks that mean something, so that surface 200 through 210 belongs to one component and you can tell that from the number alone.

Comment the Boolean logic, not the syntax. Nobody needs to be told that : is a union, but everybody benefits from a note saying which physical region a five-term expression is meant to describe. And keep asking whether a universe would be simpler: repeated structures are what universes exist for, and Boolean expressions that describe the same shape four times are four chances to make a typo.

Card semantics on this page follow MCNP6.3.1 Theory & User Manual (LA-UR-24-24602 Rev. 1), §2.2.1 Complement Operator, §5.5.3 TR: Coordinate Transformation and §5.5.4 TRCL: Cell Coordinate Transformation.

Full reference list on the attribution page.

Check yourself

  • Write intersections, unions, and complements, with parentheses where the order matters?
  • Describe a region that is not simply connected using :?
  • Carve equipment out of a room by listing cells after #?
  • Place a rotated copy with a tr card, and say what the * prefix changes?
  • Check a geometry before transport with VOID, plotting, and VOL?