Variance Reduction Techniques

Making Monte Carlo simulations more efficient

What you'll learn

After the first pin · 11 / 1412 min read
  • Recognise the problems that need variance reduction: deep penetration, small detectors, rare events, distant regions.
  • Build an importance ladder with imp:n and imp:p, keeping ratios between adjacent cells to two or four.
  • Bias a source in direction or energy with sb, and say how it differs from the physical sp distribution.
  • Generate weight windows from a flux tally with wwg, then run with wwn and the generator card removed.
  • Confirm that a variance reduction scheme improved the figure of merit without biasing the answer.

Before you start

Why Variance Reduction?

Standard Monte Carlo can be inefficient when few particles reach regions of interest. Variance reduction techniques guide more particles to important areas without biasing results.

Common Problem Types

Deep penetration

Radiation through thick shields

Small detectors

Few particles naturally reach target

Rare events

Low probability interactions

Distant regions

Far from source location

Cell Importances: Start Here

Cell importances are the simplest and most widely used variance reduction technique. They tell MCNP which regions are more important to your problem.

Basic Concept

When a particle moves from low to high importance, MCNP splits it into multiple particles. When moving from high to low importance, particles may be killed (Russian roulette).

mcnp
c Shielding problem - importance increases toward detector
1  1  -1.0   -1        imp:n=1     $ Source region
2  2  -7.8    1 -2     imp:n=2     $ First shield layer
3  2  -7.8    2 -3     imp:n=4     $ Second shield layer
4  2  -7.8    3 -4     imp:n=8     $ Third shield layer  
5  0          4 -5     imp:n=16    $ Detector region
6  0          5        imp:n=0     $ Outside (kill particles)

The pattern above is the whole technique: importance rises steadily along the direction you want particles to travel, doubling at each boundary. Keep the ratio between adjacent cells somewhere between 2 and 4. A large jump splits one particle into many at a single surface, and those copies are correlated — they all descend from the same history, so they add tally weight without adding independent information, which inflates the variance of the variance rather than reducing the error. Powers of two are a good first guess because they are easy to reason about when the answer comes out wrong.

The outermost cell is the exception to the pattern: imp:n=0 kills particles outright, which is what you want for the region beyond the problem. Every MCNP deck needs one such cell covering the complement of the geometry, and it does double duty here — it both bounds the model and stops effort being spent on particles that have left.

Practical Example: Shielding

Let's set up importance for a typical shielding problem where we want to calculate dose rates behind a concrete wall.

mcnp
c Co-60 source behind concrete wall
c Slab geometry inside bounding sphere
1  1  -8.9    -1        imp:n=1 imp:p=1     $ Cobalt source
2  2  -2.3     1 -2 -6  imp:n=2 imp:p=2     $ Concrete (0-30 cm)
3  2  -2.3     2 -3 -6  imp:n=4 imp:p=4     $ Concrete (30-60 cm)
4  2  -2.3     3 -4 -6  imp:n=8 imp:p=8     $ Concrete (60-90 cm)
5  0           4 -6     imp:n=16 imp:p=16   $ Air behind wall
6  0           6        imp:n=0 imp:p=0     $ Outside world

c Surfaces
1  so  2.5     $ Source sphere
2  px  30      $ Concrete slab boundary (30 cm)
3  px  60      $ Concrete slab boundary (60 cm)
4  px  90      $ Concrete slab boundary (90 cm)
6  so  300     $ Outer boundary sphere

c Tallies
f4:p  5        $ Photon flux in air behind wall
c ANSI/ANS-6.1.1-1977 photon flux-to-dose factors, copied from
c Listing F.26 in Appendix F.1 of the 6.3 manual. Energies in MeV,
c factors in (rem/h)/(p/cm2/s), log-log interpolation.
de4   log  0.01  0.03  0.05  0.07  0.1   0.15  0.2   0.25
           0.3   0.35  0.4   0.45  0.5   0.55  0.6   0.65
           0.7   0.8   1.0   1.4   1.8   2.2   2.6   2.8
           3.25  3.75  4.25  4.75  5.0   5.25  5.75  6.25
           6.75  7.5   9.0   11.0  13.0  15.0
df4   log  3.96e-6 5.82e-7 2.90e-7 2.58e-7 2.83e-7 3.79e-7
           5.01e-7 6.31e-7 7.59e-7 8.78e-7 9.85e-7 1.08e-6
           1.17e-6 1.27e-6 1.36e-6 1.44e-6 1.52e-6 1.68e-6
           1.98e-6 2.51e-6 2.99e-6 3.42e-6 3.82e-6 4.01e-6
           4.41e-6 4.83e-6 5.23e-6 5.60e-6 5.80e-6 6.01e-6
           6.37e-6 6.74e-6 7.11e-6 7.66e-6 8.77e-6 1.03e-5
           1.18e-5 1.33e-5

Notice that both neutron and photon importances increase toward the detector, which ensures adequate sampling of both particle types.

The dose table is pasted from the manual, not recalled. MCNP 6.3 removed the built-in IC=20 style tables and reprinted them in Appendix F.1 precisely so that you copy them. It matters here because the photon response is not a smooth curve: it falls by a factor of fifteen from 10 to 70 keV as photoelectric absorption in tissue gives way to Compton scattering, then climbs steadily out to 15 MeV. A table typed from memory smooths that dip away and returns a plausible number instead of an error. See Setting Up Tallies for what IC and IU still accept.

Source Biasing

Source biasing samples particles from distributions that favor important directions or energies. This helps when only a fraction of source particles contribute to your tallies.

Directional Biasing

mcnp
c Bias source toward detector (par=2 = photon)
sdef  pos=0 0 0  par=2  erg=1.25  dir=d1
si1   H  -1 0.8 1         $ Cosine histogram bin edges
sp1      0  0.2 0.7       $ SP = physical (true) probabilities
sb1      0  0.15 0.8      $ SB = biased sampling (weights adjust)

This biases photons toward the forward direction (cosine > 0.8), increasing the fraction that reach a forward detector.

Energy Biasing

mcnp
c Bias toward high-energy neutrons
sdef  pos=0 0 0  par=1  erg=d2
si2   H  0.1 1.0 10.0     $ Energy histogram bins (MeV)
sp2      0   0.3 0.1      $ Fission spectrum (approx)
sb2      0   0.3 0.5      $ Biased (favor high energy)

This example biases the source toward high-energy neutrons, useful for fast neutron dose calculations.

Weight Windows (Advanced)

Weight windows provide automatic population control throughout the geometry. They're more sophisticated than simple importances but require more setup.

Two-Step Process

Step 1: Generate Windows

mcnp
c Generate weight windows from flux tally
f4:n  (1 2 3 4 5)    $ Flux in all cells
wwg   4              $ Generate from tally 4
nps   1e5            $ Preliminary run

Step 2: Use Windows

mcnp
c Use generated windows (remove wwg card)
wwn1:n  1e-6 2e-6 4e-6 8e-6 1e-5   $ Lower bounds per cell (energy interval 1)
nps    1e6                          $ Main calculation

Choosing the Right Technique

Work from the simplest technique upward, and change one thing at a time. Cell importances come first because they are the easiest to reason about and the easiest to undo. Source biasing comes next, in direction or in energy, when the geometry tells you that most of the source particles are being emitted in a direction or at an energy that cannot contribute. Only then move to weight windows, which handle geometry too complicated to ladder by hand, forced collisions for regions thin enough that particles usually pass through without interacting, and point detectors for a score at a specific location.

The discipline of one change at a time matters more here than in most of MCNP, because variance reduction techniques interact. Two schemes that each help can hurt together — an importance ladder pushing particles toward a detector while a biased source already sends them there over-samples the same path twice. If you change three things and the figure of merit drops, you have no way to know which one did it.

Checking Your Results

Variance reduction is supposed to buy precision without moving the answer, and the only way to know it did is to have an answer to compare against. Run the problem analog first, even if it gives a relative error of 50 %, because that run is your baseline: the biased result must agree with it inside the combined uncertainty. A biased run that disagrees with the analog is not a better estimate, it is a broken one.

Then check the figure of merit rather than the relative error. FOM = 1/(R²T) captures the trade you are actually making, since a scheme that halves the error while tripling the run time has made things worse and the error alone will not tell you that. And watch the ten statistical checks: variance reduction that produces a small error with a rising variance of the variance is concentrating the tally in a few heavily-weighted histories, which is the failure mode that looks most like success.

Most variance-reduction failures come from overdoing it. Importance ratios much larger than four, source biasing sharp enough that the interesting region is sampled by a handful of heavily weighted particles, and several techniques stacked at once all produce the same symptom: a small relative error attached to a result you should not trust.

The two structural mistakes are separate. Forgetting imp:n=0 on the outer cell leaves the geometry unbounded, and never running the analog comparison means there is nothing the biased answer can be checked against.

Card semantics on this page follow MCNP6.3.1 Theory & User Manual (LA-UR-24-24602 Rev. 1), §5.12.1 IMP: Cell Importance, §5.12.3 Weight-window Cards and §5.9.8 DE and DF: Dose Energy and Dose Function.

The dose table is Listing F.26 in Appendix F.1, copied rather than recalled.

Full reference list on the attribution page.

Check yourself

  • Recognise the problems that need variance reduction before wasting a long run on them?
  • Build an importance ladder with ratios of two to four between adjacent cells?
  • Bias a source with sb, and say how that differs from changing the physical sp?
  • Generate weight windows with wwg, then run with wwn and the generator removed?
  • Confirm the figure of merit improved without biasing the answer?