MCNP Guide
MCNP Troubleshooting Guide
Systematic approaches to solving common MCNP problems
Error Categories
MCNP errors fall into four main categories: input format, geometry, physics, and statistical errors. Each requires different troubleshooting approaches.
Input Errors
Cause: Syntax mistakes, typos
Solution: Check line format, spelling
Example: Missing blank lines, wrong keywords
Geometry Errors
Cause: Incomplete space definition
Solution: Add missing cells, fix overlaps
Example: Lost particles, void regions
Physics Errors
Cause: Missing cross sections, bad materials
Solution: Update libraries, fix compositions
Example: Unknown isotopes, density issues
Statistical Errors
Cause: Poor sampling, insufficient histories
Solution: Variance reduction, more particles
Example: Large uncertainties, failed tests
Lost Particle Errors
Lost particles are the most common MCNP problem. They occur when particles can't determine their location due to geometry gaps or overlaps.
Typical Error Message
bad trouble in subroutine track
nps = 843
x,y,z = 0.523000 1.892000 0.000000
u,v,w = 0.866025 0.500000 0.000000
cell = 2This error shows the particle location (x,y,z), direction (u,v,w), and last known cell. Use this information to identify geometry problems in that specific region.
Quick Fixes
c Add a graveyard cell to catch lost particles
999 0 -999 imp:n=1 $ Inner boundary
1000 0 999 imp:n=0 $ Outer graveyard
c Use VOID card to test geometry without physics
VOID
c Add debug tally to track particles
f4:n 2 $ Volume flux in problem cell
e4 1e-11 1e-6 1 $ Energy bins for diagnosis
c Check geometry with plots
plot origin 0 0 0 extent 10 10 10 pixels 800 800The graveyard catches particles that would otherwise be lost. VOID eliminates physics to focus on geometry. Debug tallies help track particle behavior.
Systematic Debugging
1. Identify the problem region
Use the error coordinates to find which surfaces or cells are involved.
2. Check for gaps
Ensure all space is defined. Add void cells where needed.
3. Verify surface equations
Double-check surface definitions and orientations.
4. Test with simple geometry
Simplify the problem to isolate the specific issue.
Cross Section Problems
Cross section errors occur when MCNP can't find nuclear data for specified isotopes or when material definitions are inconsistent.
Missing Cross Section Data
c Error: cross-section table 92235.70c not found
c Problem: Outdated library identifier
m1 92235.70c 0.045 $ Old library
92238.70c 0.955
c Solution: Update to available library
m1 92235.80c 0.045 $ Current library
92238.80c 0.955
c Check available libraries
c Look in XSDIR file for valid identifiersAlways use consistent library identifiers (.80c, .70c, etc.) throughout your model. Check the XSDIR file to see what's available on your system.
Material Normalization Errors
c Problem: Fractions don't add up correctly
m1 92235.80c 0.045 $ 4.5%
92238.80c 0.955 $ 95.5%
8016.80c 0.267 $ Wrong oxygen fraction
c Solution: Proper UO2 stoichiometry
m1 92235.80c 0.045 $ U-235 (4.5% of uranium)
92238.80c 0.955 $ U-238 (95.5% of uranium)
8016.80c 2.000 $ O-16 (2 atoms per U atom)
c Alternative: Use negative fractions (atom fractions)
m1 92235.80c -0.045 $ 4.5 atom%
92238.80c -0.955 $ 95.5 atom%
8016.80c -2.000 $ 200 atom%For compounds like UO₂, use stoichiometric ratios. Positive fractions are by weight, negative fractions are by atom count. Don't mix the two types.
Convergence Problems
Poor statistical convergence leads to unreliable results. Common causes include insufficient particle histories, source placement, and variance reduction needs.
Criticality Convergence
c Problem: k-effective not converging
kcode 1000 1.0 50 100 $ Too few cycles
c Solution: More cycles and better source
kcode 10000 1.0 100 500 $ More histories, longer run
ksrc 0 0 0 5 5 5 -5 -5 -5 $ Multiple source points
c Check convergence with plots
prdmp 2j 1 $ Print k-effective vs cycleUse at least 10,000 particles per cycle and 300+ active cycles. Place multiple source points in high-importance regions. Monitor convergence plots.
Deep Penetration Issues
c Problem: Poor statistics in shielding calculation
f5:n 100 0 0 1 $ Point detector with poor stats
c Solution: Use variance reduction
imp:n 1 1 1 1 2 4 8 16 $ Geometric importance
sdef pos=0 0 0 erg=2 $ 2 MeV source
c Weight windows for deep penetration
wwn1:n 5j 1 $ Weight window lower bounds
wwg 21 0 $ Generate weight windows
c Source biasing
sb1 0 0.5 1.0 $ Bias source toward detectorDeep penetration problems need variance reduction. Use importance sampling, weight windows, or source biasing to improve statistics where needed.
Common Input Mistakes
Format Errors
Missing blank lines
Must have blank lines between cell cards, surface cards, and data cards.
Line continuation errors
Use & at end of line and 5 spaces at start of next line for continuation.
Comment formatting
Use 'c' at start of line or '$' anywhere in line for comments.
Card name typos
Check spelling of card names (kcode, not kode; sdef, not sdef).
Diagnostic Tools
Geometry Checking
c Visual geometry check
plot origin 0 0 0
extent 20 20 20
pixels 800 800
c Particle tracking
prdmp 2j 1 1 1 1
c Volume calculations
vol 1 2 3 4 5Physics Verification
c Material verification
print 40 50 60
c Cross section check
print 70 72 73
c Source diagnostics
print 110 118Debugging Strategy
Step-by-Step Approach
1. Start simple
Begin with basic geometry and add complexity gradually.
2. Check one section at a time
Test cells, surfaces, and data cards separately when possible.
3. Use diagnostic outputs
Enable verbose output to see what MCNP is actually doing.
4. Compare with known solutions
Validate your model against benchmarks or analytical solutions.
5. Document your fixes
Keep notes on what caused problems and how you solved them.
Prevention Tips
Most MCNP problems can be prevented with careful input preparation. Always validate your geometry with plots before running physics calculations.
Keep your input files well-commented and organized. Use consistent naming conventions and document your modeling assumptions. This makes debugging much easier when problems arise.