SERPENT Guide
Running Simulations in Serpent
Simulation Settings Basics
Serpent simulations are controlled through various settings parameters defined in the input file. The most important settings are specified using the set card.
Here's an example of basic simulation settings:
% --- Simulation settings ---
set pop 10000 100 20 % Population size, active cycles, inactive cycles
set bc 2 % Boundary conditions (2 = reflective)
set acelib "sss_endfb7u.xsdata" % Path to cross-section library
set seed 1234567 % Random number seed (optional)Population Control
The set pop card is one of the most important settings, controlling the number of neutrons and cycles in your simulation.
set pop NPOP NACT NINACTWhere:
- NPOP: Number of neutrons per cycle
- NACT: Number of active cycles
- NINACT: Number of inactive cycles
Important: Inactive cycles are used to converge the source distribution before collecting statistics. Results are only tallied during active cycles. For criticality calculations, using enough inactive cycles is crucial for accurate results.
Choosing Population Size
Guidelines for setting population parameters:
- Simple models (pin cells, small assemblies):
- 10,000 - 50,000 neutrons per cycle
- 100 - 200 active cycles
- 20 - 50 inactive cycles
- Complex models (full-core reactor models):
- 100,000 - 1,000,000 neutrons per cycle
- 200 - 500 active cycles
- 50 - 100 inactive cycles
Pro Tip: For initial testing, use smaller populations (e.g., 1,000 neutrons, 10 active, 5 inactive) to quickly check for geometry errors. Once you confirm the model runs without errors, increase the population for production runs.
Boundary Conditions
Boundary conditions define what happens when neutrons reach the edge of your geometry. They are set using the set bc card:
set bc BOUNDARY_TYPECommon boundary condition options:
- 1: Vacuum boundary (neutrons escape and are killed)
- 2: Reflective boundary (neutrons reflect at the boundary)
- 3: Periodic boundary (neutrons reappear at the opposite boundary)
You can specify different boundary conditions for each dimension using multiple values:
set bc 2 1 2 % Reflective in X, vacuum in Y, reflective in ZCommon Applications:
- For pin cell models, reflective boundaries (2) simulate an infinite lattice
- For 3D assembly models, reflective on X/Y and vacuum on Z simulates an infinite array of finite-height assemblies
- For full-core models, vacuum boundaries (1) are typically used
Cross-Section and Library Settings
Serpent needs to know which nuclear data libraries to use. These are specified using the set acelib card:
set acelib "sss_endfb7u.xsdata" % Path to cross-section libraryAdditional data settings include:
set declib "sss_endfb7.dec" % Decay data library
set nfylib "sss_endfb7.nfy" % Fission yield library
set sfylib "sss_endfb7.sfy" % Spontaneous fission yield dataNote: Make sure the libraries referenced in your input file are installed on your system. The default installation includes several standard libraries, but you may need to specify the full path if using custom libraries.
Simulation Modes
Criticality (k-eigenvalue) Mode
This is the default mode in Serpent, used for reactor physics calculations. It solves the criticality eigenvalue problem, finding k-effective and the neutron flux distribution.
No special settings are needed for this mode, just specify population parameters:
set pop 50000 200 50 % Population size, active cycles, inactive cyclesExternal Source Mode
For fixed-source problems (like shielding calculations), you can use external source mode. This requires defining a source using the src card:
% Define a point source of 14 MeV neutrons
src 1 sc 0.0 0.0 0.0 % Source at origin
src 1 sp 14.0 % Monoenergetic source at 14 MeV
% Run in external source mode
set nps 1000000 % Number of source neutrons to simulateNote: In external source mode, use set nps to specify the total number of source particles instead of set pop.
Running the Simulation
Command Line Execution
Once your input file is ready, running Serpent is straightforward. From the command line:
sss2 input_file.inpYou can add command line options for additional control:
sss2 -omp 8 input_file.inp % Run with 8 OpenMP threadsCommon Command Line Options
-omp N: Run with N OpenMP threads-mpi: Launch in MPI mode (for cluster execution)-replay: Reproduce results using the same random seed-dbg: Run in debug mode
Monitoring the Simulation
During execution, Serpent will output progress information to the terminal, including:
- Cycle number and progress
- Current k-effective estimate and standard deviation
- Simulation speed (neutrons/second)
- Memory usage
Pro Tip: For large simulations, you can use the Linux nohup command to run Serpent in the background, allowing you to log out without interrupting the calculation:nohup sss2 -omp 16 input_file.inp > output.log &
Performance Considerations
Memory Usage
Serpent's memory requirements depend on:
- Complexity of the geometry
- Number of materials and nuclides
- Population size
- Number and complexity of tallies (detectors)
For large simulations, you can monitor memory usage with the -memstat option:
sss2 -memstat input_file.inpParallel Computing
Serpent supports both shared-memory (OpenMP) and distributed-memory (MPI) parallelization:
% OpenMP (multi-threading on a single machine)
sss2 -omp 16 input_file.inp
% MPI (distributed across multiple nodes)
mpirun -np 64 sss2 -mpi input_file.inpNote on Scaling: Serpent generally scales well with OpenMP up to the number of physical cores on your machine. For very large models, MPI may provide better scaling across multiple compute nodes.
Example: Complete Simulation Setup
Here's a complete example showing all the key simulation settings for a pin cell model:
% --- Simulation settings section ---
% Cross-section library path
set acelib "sss_endfb7u.xsdata"
% Population control
set pop 50000 200 50 % 50k neutrons, 200 active, 50 inactive cycles
% Boundary conditions
set bc 2 % Reflective on all sides (infinite lattice)
% Random seed (optional, for reproducibility)
set seed 1234567
% Neutron physics options
set nfg 4 % Use 4-group structure for few-group constants
set ures 1 % Enable unresolved resonance probability table sampling
set gcu 2 % Generate geometry plots (0=none, 1=ps, 2=png)
% Optional settings for faster simulation
set opti 1 % Enable optimization mode
set stabgen 1 % Dynamic stabilization of source points
% --- Output control ---
set printm 1 % Print material compositions
set power 40000 % Normalize to 40 kW powerNote: This example includes a comprehensive set of simulation parameters. For many basic cases, you can start with just the essential settings (set pop,set bc, and set acelib) and add more as needed.