MCNP geometry for ray-trace
Running SRTC from the release bundle. These docs are written against the
srtccommand line. In the distributed bundle that command lives inside the container, so run it through Compose from the unpacked bundle directory:docker compose run --rm -v "$PWD":/io backend srtc --helpFiles you pass in should sit under the mounted
/io, and that is also where to write outputs. On Linux the container runs as an unprivileged user, so add--user "$(id -u):$(id -g)"when writing to a mounted directory or the run fails with a permission error creating the output directory:docker compose run --rm --user "$(id -u):$(id -g)" -v "$PWD":/io backend \ srtc -i examples/fwd_transport/oltaris_al_si.deck -o /io/out/results.out \ --depth-g-cm2 1.0 --histories 100000 --seed 1The physics libraries are already in place, and the shipped example decks resolve against them, so the examples below run as written. See Downloads to get the bundle, and the Viewer guide for the browser GUI, which needs none of this.
Ray-trace mode can use MCNP-style cell/surface definitions instead of analytic
sphere/cube/slab models. Geometry is parsed by the geometry
crate (same CSG engine as 3D Monte Carlo) and walked ray-by-ray to accumulate
areal depth τ [g/cm²] per material.
See also: raytrace.md, examples/raytrace/mcnp_cube.deck.
Enabling
docker compose run --rm backend srtc raytrace -i examples/raytrace/mcnp_cube.deck
Set RAYTRACE GEOMETRY=MCNP and supply geometry via one of the deck cards below.
Deck cards
MCNP_GEOMETRY
Inline block or external file:
MCNP_GEOMETRY BEGIN
1 182 -2.699 -1 imp:n=1 $ Al cube
2 0 1 imp:n=0 $ outside world
c
1 RPP -0.5 0.5 -0.5 0.5 -0.5 0.5
END
MCNP_GEOMETRY FILE=shield.mcnp
SURFACES / CELLS
Alternative section syntax (lines are appended to the MCNP geometry text):
SURFACES
1 RPP -0.5 0.5 -0.5 0.5 -0.5 0.5
2 PZ 0.0
END
CELLS
1 182 -2.699 -1 -2
2 27 -8.96 -1 2
3 0 1
END
MCNP_MATERIAL
Map traditional MCNP m1, m2, … numbers to srtc materials:
MCNP_MATERIAL ID=1 MATERIAL=IRON
MCNP_MATERIAL ID=2 MATERIAL=WATER
Alternatively, put the srtc MaterialKind numeric id
directly in the cell card (e.g. 182 for aluminium).
Detector position (Cartesian)
Detector origin [cm] for ray casting:
DETECTOR MATERIAL=SI THICKNESS_CM=0.01 X=0 Y=0 Z=0
RAYTRACE DETECTOR_X=0 DETECTOR_Y=0 DETECTOR_Z=0
FC point detectors inside MCNP geometry blocks are also parsed (FC1 TYPE POINT 0 0 0).
Surface types (phase 1)
| MCNP | Meaning |
|---|---|
PX d |
Plane x = d |
PY d |
Plane y = d |
PZ d |
Plane z = d |
SO r |
Sphere at origin, radius r |
S cx cy cz r |
General sphere |
CX/CY/CZ r |
Infinite cylinder on axis |
RPP xmin xmax ymin ymax zmin zmax |
Rectangular parallelepiped (macrobody) |
SPH cx cy cz r |
Sphere macrobody |
RCC vx vy vz hx hy hz r |
Right circular cylinder macrobody |
Additional types (P, GQ, KX/KY/KZ, TX/TY/TZ) are supported by the parser
but are less used in verification decks.
Cell syntax
<cell_id> <material_id> <density> <surface senses...> [imp:...=value]
- Material
0= void; importanceimp:...=0marks the outside/world (kill) cell. - Sense:
−n= inside surface n (negative half-space);+nor baren= outside (positive). - Density: negative value = g/cm³ (MCNP convention); used with
MATERIALdeck overrides.
Example — Al shell between r = 5 and r = 10 cm:
1 271 -7.874 -1
2 11 -1.0 1 -2
3 0 2 -3
4 0 3 imp:n=0
c
1 SO 5.0
2 SO 10.0
3 SO 20.0
Geometry build rules
Rules a deck must satisfy for the 3D MC / adjoint transport and the web viewer to load and score it correctly.
World region + graveyard
- Every deck needs an outermost world region whose bounding surface encloses all
other geometry, and a graveyard (kill) cell —
imp=0, material0(void) — in the space outside it. Tracks that reach the graveyard are terminated. - The world/graveyard is what stops particles that miss the assembly; without it, tracks can escape before interacting with all geometry and the run under-scores.
World auto-sizing (viewer)
When a deck is saved through the viewer, the world surface is resized automatically
(viewer-server auto_size_world):
- The bounding box is computed over every non-world region's AABB.
- The world becomes a sphere (
SPH cx cy cz r) centered on that bbox, with radius = the largest single-axis extent ("major dimension"). The world diameter is therefore ≥ 2× the major dimension, and the assembly's bbox half-diagonal (≤ 0.87·major) sits comfortably inside with ≥ major/2 of void margin per side. Radius is floored at1.0cm for degenerate/tiny assemblies. - The rewritten card is tagged
$ auto-sized world (>=2x major dim). Only the world region's bounding surface is replaced; all other surface and cell cards are left untouched.
Coordinates
- Surface and macrobody coordinates may be negative — build geometry anywhere in space, not just the positive octant (e.g. a stack centered on the origin with cells at negative z).
Materials
- Cell material ids must resolve to a material present in the multigroup library
(
data/processed/<lib>/multigroup_coupled.h5). Built ids injendl-5: 182 = Al, 269 = W, 271 = Fe, 88 = Si (thesolar_celllibrary adds 35 = SiO₂). - An id not in the library falls back to the library's default (first) material
(
MultigroupXs::matrices), so an unintended id will silently transport as the wrong material — always use a real id. Material0is void.
Macrobodies and senses
- RPP requires ordered bounds:
xmin < xmax,ymin < ymax,zmin < zmax. - Cell sense
-N= inside surface/body N (negative half-space);+Nor bareN= outside. For a macrobody,-Nis the region enclosed by the body.
Detectors
- Place point detectors (
FC ... TYPE POINT x y z) inside a material region, not exactly on a surface/material boundary — a detector on a boundary can read zero. Nudge it just inside (e.g.-101E-4instead of the boundary at-100E-4).
Ray-trace path
From the detector point, each ray direction is walked through CSG regions. Every
non-void segment contributes τ = ρ · ℓ [g/cm²]. Results feed the same dose-depth
and spectrum estimators as analytic geometry modes.
Gaps vs full MCNP
| Supported | Not yet |
|---|---|
| Planes PX/PY/PZ, spheres SO/S, cylinders CX/CY/CZ | Full surface catalog (ellipsoids, cones with transforms, …) |
| Macrobodies RPP, SPH, RCC | Arbitrary lattice/universe fills |
Cell booleans :, #, parentheses |
Periodic surfaces, embedded universes |
| FC point/surface/volume detectors | Full tally card suite |
| Cartesian detector from deck | Rotated/transformed surfaces (TR cards) |
Incremental additions can extend crates/geometry/src/surface.rs and the deck
parser without changing the ray-trace API.