SERPENT Guide
Surface Types & Operations
Advanced Surface Types
While we covered basic surface types in the Simple Geometries section, Serpent supports a wide variety of surface types for complex geometry definition. Let's explore these in more detail:
Axis-Aligned and General Planes
In addition to basic planes, Serpent supports more specific plane definitions:
% Axis-aligned planes
surf pxa px 10.0 % Plane perpendicular to x-axis at x=10.0
surf pya py -5.0 % Plane perpendicular to y-axis at y=-5.0
surf pza pz 0.0 % Plane perpendicular to z-axis at z=0.0
% General plane: ax + by + cz = d
surf p1 plane 1.0 2.0 3.0 5.0 % Plane with equation x + 2y + 3z = 5Quadratic Surfaces
Serpent supports general quadratic surfaces for creating complex shapes:
% General quadratic surface: Ax² + By² + Cz² + Dxy + Eyz + Fzx + Gx + Hy + Iz + J = 0
surf quad1 quad 1.0 1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 -25.0 % Sphere of radius 5 at origin
surf quad2 quad 1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.0 % Infinite cylinder along z-axisNote: While general quadratic surfaces are powerful, specialized surface types like spheres and cylinders are preferred when possible, as they are more efficient computationally and less error-prone.
Specialized Surface Types
Truncated Cone
Truncated cones are useful for modeling fuel regions with varying diameter:
% Truncated cone centered on z-axis
surf cone1 trcz 0.0 0.0 -5.0 0.0 0.0 10.0 2.0 3.0
% Parameters: x1 y1 z1 x2 y2 z2 R1 R2
% Creates a cone from point (0,0,-5) with radius 2.0 to (0,0,10) with radius 3.0Torus
Tori can be used for complex components like pipe bends:
% Torus around z-axis
surf torus1 torz 0.0 0.0 0.0 5.0 1.0
% Parameters: x y z R r
% Creates a torus centered at (0,0,0) with major radius 5.0 and minor radius 1.0Rectangular and Hexagonal Prisms
These are particularly useful for lattice geometries in reactor models:
% Rectangular prism (cuboid)
surf rect1 rect -10.5 10.5 -10.5 10.5 -50.0 50.0
% Parameters: xmin xmax ymin ymax zmin zmax
% Hexagonal prism along z-axis
surf hex1 hexxc 0.0 0.0 10.5
% Parameters: x y pitch (flat-to-flat distance / sqrt(3))Hex Prism Tip: For hexagonal lattices (common in some reactor designs), the hexxc and hexac surfaces are extremely useful.hexxc is for flat-to-flat orientation along x-axis, whilehexac is for corner-to-corner orientation.
Surface Transformations
Serpent allows you to transform surfaces through translation, rotation, and scaling. This is particularly useful for repeated structures at different positions or orientations.
Translation
Translate a surface from its original position:
% Define a sphere at the origin
surf s1 sph 0.0 0.0 0.0 5.0
% Translate the same sphere to position (10,0,0)
surf s2 sph 0.0 0.0 0.0 5.0
trans s2 10.0 0.0 0.0Rotation
Rotate a surface around coordinate axes:
% Define a cylinder along z-axis
surf c1 cylz 0.0 0.0 2.0
% Rotate the cylinder 90 degrees around y-axis (becomes x-axis aligned)
surf c2 cylz 0.0 0.0 2.0
rot c2 0.0 90.0 0.0 % Rotation angles in degrees around x, y and z axesCombined Transformations
Apply both translation and rotation:
% Create a cylinder, rotate it, then translate it
surf c3 cylz 0.0 0.0 1.0
rot c3 0.0 90.0 0.0 % First rotate
trans c3 5.0 5.0 0.0 % Then translatePro Tip: Order matters with transformations. Rotations are applied first, then translations. If you need more complex transformation sequences, consider breaking them into multiple steps with intermediate surfaces.
Surface Cloning
For repeated geometries, Serpent allows surface cloning with transformations:
Basic Surface Cloning
% Original cylinder
surf c1 cylz 0.0 0.0 1.0
% Clone with offset for a second parallel cylinder
surf c2 clone c1
trans c2 5.0 0.0 0.0
% Multiple clones with different transformations
surf c3 clone c1
surf c4 clone c1
surf c5 clone c1
trans c3 -5.0 0.0 0.0
trans c4 0.0 5.0 0.0
trans c5 0.0 -5.0 0.0Practical Example: Control Rod Fingers
Surface cloning is particularly useful for structures with repeated elements:
% Define a control rod finger
surf rod0 cylz 0.0 0.0 0.5
% Clone for control rod cluster with 5 fingers
surf rod1 clone rod0
surf rod2 clone rod0
surf rod3 clone rod0
surf rod4 clone rod0
% Position the fingers in a cross pattern
trans rod1 2.0 0.0 0.0
trans rod2 -2.0 0.0 0.0
trans rod3 0.0 2.0 0.0
trans rod4 0.0 -2.0 0.0Efficiency Note: Surface cloning not only makes your input file more readable, but it also allows Serpent to optimize memory usage and tracking algorithms for identical surfaces with transformations.
Advanced Boolean Operations
Serpent supports complex Boolean operations to define cell regions. Understanding these operations is crucial for efficient geometry modeling.
Boolean Operations Syntax
- Intersection: Space or blank between surface definitions
- Union: Colon
:between surface definitions - Complement: Negative sign
-before surface - Grouping: Parentheses
( )for operation precedence
Complex Boolean Examples
Here are examples of more complex Boolean operations:
% Define some basic surfaces
surf s1 sph 0.0 0.0 0.0 5.0 % Sphere
surf c1 cylz 2.0 0.0 2.0 % Cylinder
surf p1 pz 0.0 % Plane
% Cell in the sphere excluding the cylinder (intersection and complement)
cell 1 0 fuel -s1 c1
% Union of regions (logical OR)
cell 2 0 water (-s1 -c1) : (p1 -c1)
% Complex nested operations (use parentheses for clarity)
cell 3 0 clad (-s1 p1) : (c1 (-p1)) % Region inside sphere above plane OR inside cylinder below planeWarning: Complex Boolean operations can be difficult to debug. For complex geometries, it's often better to break them down into simpler cells and use universes and lattices (covered in later sections) to combine them.
Complicated Surface Examples
Example 1: Control Rod Guide Tube
A practical example combining multiple surface types to create a control rod guide tube:
% Guide tube with flow holes
% Main tube surfaces
surf tube_in cylz 0.0 0.0 0.57 % Inner tube radius
surf tube_out cylz 0.0 0.0 0.62 % Outer tube radius
surf top pz 200.0 % Top of the tube
surf bot pz -200.0 % Bottom of the tube
% Flow hole surfaces
surf hole1 cylx 0.0 0.58 0.15 % Flow hole 1 (x-axis)
surf hole2 cylx 0.0 -0.58 0.15 % Flow hole 2 (opposite side)
surf hole3 cyly 0.58 0.0 0.15 % Flow hole 3 (y-axis)
surf hole4 cyly -0.58 0.0 0.15 % Flow hole 4 (opposite side)
% Cell definitions
cell guide_tube 0 zircaloy tube_in -tube_out -top bot hole1 hole2 hole3 hole4
cell guide_water 0 water -tube_in -top bot
cell flow_hole1 0 water -hole1 tube_in -tube_out -top bot
cell flow_hole2 0 water -hole2 tube_in -tube_out -top bot
cell flow_hole3 0 water -hole3 tube_in -tube_out -top bot
cell flow_hole4 0 water -hole4 tube_in -tube_out -top bot
cell outside 0 water tube_out : top : -botExample 2: Hemispherical Detector
Creating a hemispherical detector using surface intersections:
% Hemispherical detector geometry
surf sph1 sph 0.0 0.0 0.0 5.0 % Sphere
surf pz1 pz 0.0 % Splitting plane
% Hemisphere detector (sphere above the plane)
cell detector 0 detector_mat -sph1 -pz1
% Surrounding water
cell water 0 water (-sph1 pz1) : (sph1) % Everything elseExample 3: Toroidal Geometry
A more complex geometry using toroids (relevant for fusion reactor models):
% Toroidal geometry for fusion reactor
surf tor1 torz 0.0 0.0 0.0 100.0 20.0 % Main torus
surf pol1 cyly 100.0 0.0 5.0 % Poloidal field coil
surf pol2 clone pol1 % Second coil
trans pol2 -100.0 0.0 0.0 % Move to opposite side
% Plasma region inside torus
cell plasma 0 plasma_mat -tor1
% Poloidal field coils
cell coil1 0 copper -pol1
cell coil2 0 copper -pol2
% Vacuum vessel (remaining space)
cell vessel 0 steel -tor1 pol1 pol2Pro Tip: For complex geometries like these examples, always use the set gcu command to generate geometry plots for verification. Visualizing your geometry helps catch errors early.
Optimization Techniques
Efficient surface and cell definitions can significantly improve simulation performance:
Surface Simplification
- Use axis-aligned surfaces when possible (e.g.,
pzinstead ofplane) - Prefer specialized surface types (e.g.,
cylz) over general quadratics - Place the origin sensibly to minimize the number of non-zero coordinates
Cell Optimization
- List the most likely surface to be hit first in cell definitions
- Break complex Boolean expressions into simpler cells
- Use complementary cells where appropriate (define one region, then use "everything else" for another)
Bounding Volumes
For complex geometries, using bounding volumes can speed up particle tracking:
% Example with bounding volume
% Define a bounding box
surf box rect -50 50 -50 50 -50 50
% Define complex geometry components
% ... (Various surface definitions) ...
% First check if particle is in the bounding box
cell outside 0 outside_material box
% Only track inside the box if needed
cell inside 0 inside_material -box (... complex boolean operations ...)Performance Note: Neutron transport in Monte Carlo codes spends most of the computational time in geometry tracking. Efficient geometry definitions can speed up your simulations significantly, especially for complex models.