Input File Structure

Basic Input Structure

A Serpent input file is a plain text file with a .inp extension. The input is organized into different sections containing various keywords and parameters. Unlike some other Monte Carlo codes, Serpent uses a free-format input structure that is generally more readable and flexible.

Here's an example of the basic structure:

text
% This is a comment line in Serpent

% --- Material definitions:
mat fuel -10.4
92235.09c -0.04
92238.09c -0.96
8016.09c  -0.134

% --- Surface definitions:
surf 1 cyl 0.0 0.0 0.4

% --- Cell definitions:
cell 1 0 fuel -1

% --- Run parameters:
set pop 10000 100 20

Important: While Serpent is fairly flexible with the order of input sections, it's good practice to follow a consistent structure. This makes your input files easier to read and reduces the chance of errors.

Comments and Organization

Comments in Serpent start with the percent sign (%) and continue to the end of the line. Comments are ignored by the code and are only for human readers.

text
% This entire line is a comment
mat fuel -10.4 % This is also a comment

Recommended Organization

For clarity and maintainability, we recommend organizing your input files in the following order:

  1. Header comments: Description of the model, author, date, etc.
  2. Material definitions: All materials used in the model
  3. Surface definitions: Geometric surfaces
  4. Cell definitions: Volumes defined by surfaces
  5. Lattice definitions: Regular structures like fuel assemblies
  6. Detector definitions: Tallies for scoring results
  7. Physics parameters: Cross-section libraries, physics options
  8. Run parameters: Particle population, cycles, etc.

Pro Tip: Use separator comments (like % --- Section name:) to clearly divide your input file into logical sections. This makes it much easier to navigate, especially in complex models.

Input Card Types

Serpent input consists of different types of "cards" (similar to command lines), each with its own syntax. Here are the main types:

Material Cards (mat)

Define material compositions:

mat fuel -10.4 tmp 900
92235.09c -0.04
92238.09c -0.96
8016.09c -0.134

Surface Cards (surf)

Define geometric surfaces:

surf 1 cyl 0.0 0.0 0.4
surf 2 sqc 0.0 0.0 0.63

Cell Cards (cell)

Define volumes using surfaces:

cell 1 0 fuel -1
cell 2 0 water 1 -2

Pin and Lattice Definitions

Define pins and lattice structures:

pin 1
fuel 0.4
clad 0.5
water

lat 10 1 0.0 0.0 5 5 1.26
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1

Setting Cards (set)

Define global parameters:

set pop 10000 100 20
set bc 2
set acelib "sss_endfb7u.xsdata"

Detector Cards (det)

Define result tallies:

det 1 de 1e-11 1e-10 1e-9 1e-8 1e-7 1e-6 1e-5 1e-4 1e-3 1e-2 1e-1 1e0 1e1 1e2
det 1 dt 2
det 1 dm fuel

Continuation Lines

Sometimes input lines can get very long. Serpent supports line continuation in most input cards, allowing you to break long lines into multiple lines.

Continuing Material Definitions

Material definitions are naturally continued by listing nuclides on separate lines:

text
mat fuel -10.4
92235.09c -0.04
92238.09c -0.96
8016.09c  -0.134

Other Continuations

Other input cards typically continue onto the next line if the line is not complete with required parameters:

text
det flux de 1e-11 1e-10 1e-9 1e-8 1e-7 1e-6 1e-5 1e-4
           1e-3 1e-2 1e-1 1e0 1e1 1e2

Note: Unlike some other Monte Carlo codes, Serpent doesn't use special continuation characters. The code determines if a line is complete based on the expected number of parameters for each card type.

Input Validation

Serpent checks input files for syntax errors and logical inconsistencies when it starts running. If there are errors, Serpent will stop and display error messages.

Common Input Errors

  • Unknown keywords or commands: Typos or unsupported features
  • Missing parameters: Not providing required values
  • Inconsistent geometry: Overlapping cells or undefined regions
  • Undefined materials: Referencing materials that aren't defined
  • Data library issues: Missing or incorrect cross-section paths

Pro Tip: When you get input errors, Serpent usually provides the line number and description of the error. Always check the error message carefully - it often points directly to the issue.

Input File Best Practices

Organization Tips

  • Use consistent naming conventions for surfaces, cells, materials, etc.
  • Group related items together (e.g., all fuel materials, all detector definitions)
  • Include a header comment with model description, purpose, author, date
  • Document non-obvious choices with inline comments

Numbering Conventions

Develop a systematic numbering scheme for model components:

  • Materials: e.g., 10-19 for fuels, 20-29 for structural materials
  • Surfaces: e.g., 100-199 for fuel pin surfaces, 200-299 for assembly boundaries
  • Cells: Similar grouping by function or region

Real-World Practice: For complex models, consider creating a template with predefined sections and commenting standards. This ensures consistency across different simulations and makes it easier for others to understand your work.

Examples of Complete Inputs

Let's see a simple but complete Serpent input file:

text
% Simple PWR pin cell example
% Created for the Nuclear Monte Carlo Guide
% Temperature in Kelvin, dimensions in cm

% --- Material definitions:
mat fuel -10.4 tmp 900
92235.09c -0.031
92238.09c -0.969
8016.09c  -2.0

mat clad -6.56 tmp 600
40090.09c -0.9845
50120.09c -0.0155

mat water -0.7 tmp 574 moder lwtr 1001
1001.09c  2
8016.09c  1

therm lwtr lwj3.11t

% --- Surface definitions:
surf 1 cyl 0.0 0.0 0.4096  % Fuel outer radius
surf 2 cyl 0.0 0.0 0.4178  % Clad inner radius
surf 3 cyl 0.0 0.0 0.4750  % Clad outer radius
surf 4 sqc 0.0 0.0 0.63    % Pin cell boundary (half pitch)

% --- Cell definitions:
cell 1 0 fuel  -1      % Fuel region
cell 2 0 clad   1 -2   % Gap region
cell 3 0 clad   2 -3   % Clad region
cell 4 0 water  3 -4   % Moderator region
cell 5 0 outside 4     % Outside world

% --- Settings:
set acelib "sss_endfb7u.xsdata"
set bc 2                  % Reflective boundary conditions
set pop 10000 100 20      % Neutron population parameters

% --- Detector for flux spectrum:
det 1 de 1e-11 1e-10 1e-9 1e-8 1e-7 1e-6 1e-5 1e-4 1e-3 1e-2 1e-1 1e0 1e1 1e2
det 1 dt 2
det 1 dm fuel

This example demonstrates a complete pin cell model with all the essential components we've discussed. It's organized in logical sections with clear comments.