OpenMC Guide
Settings Parameters in OpenMC
Understanding Settings
The Settings class controls simulation execution: particle counts, run mode, source definition, and physics options.
What Settings Control
- Number of particles
- Type of calculation
- Source definition
- Physics options
Common Uses
- Reactor criticality
- Shielding analysis
- Dose calculations
- Source problems
Basic Settings
The most common settings:
Essential Settings
python
# Create settings
settings = openmc.Settings()
# Basic parameters
settings.batches = 100 # Total batches
settings.inactive = 20 # Initial batches to skip
settings.particles = 10000 # Particles per batch
# Set calculation type
settings.run_mode = 'eigenvalue' # For reactors
# settings.run_mode = 'fixed source' # For shieldingTutorial snippet — no separate file in examples repo
Tip: Start with fewer particles/batches for testing, then increase for production runs. More particles = better statistics but longer runtime.
Source Definition
Source definitions specify where particles originate:
Reactor Source
python
# Source in fuel regions
lower_left = (-10, -10, -10)
upper_right = (10, 10, 10)
source = openmc.IndependentSource(
space=openmc.stats.Box(lower_left, upper_right)
)
settings.source = sourceTutorial snippet — no separate file in examples repo
External Source
python
# Point source for shielding
source = openmc.IndependentSource(
space=openmc.stats.Point((0,0,-50)),
energy=openmc.stats.Discrete([14e6], [1.0])
)
settings.source = sourceTutorial snippet — no separate file in examples repo
Advanced Options
Physics Options
python
# Energy settings
settings.cutoff = {
'energy_neutron': 1.0e-2 # 0.01 eV neutron energy cutoff
}
# Temperature handling
settings.temperature = {
'method': 'nearest'
}Tutorial snippet — no separate file in examples repo
Convergence
python
# Run until k-eff std. dev. < 0.1%
settings.keff_trigger = {
'type': 'std_dev',
'threshold': 0.001
}
settings.trigger_active = True
settings.trigger_max_batches = 500Tutorial snippet — no separate file in examples repo
Best Practices
Tips for Good Results
- Use enough inactive batches (20-50) for source convergence
- Check convergence with more particles before production
- Save settings to XML with settings.export_to_xml()
- Use triggers for precise error control
- Match source to your problem type