Techniqueadvanced
Exponential transform
Also called path stretching.
Biases the free-flight distribution to stretch paths in a preferred direction and corrects the weight, for deep penetration problems.
The exponential transform changes the law of the free flight in a Monte Carlo transport code. Instead of the true total cross section , the flight distance is sampled with the biased cross section , where is the cosine between the flight direction and a preferred direction (toward the detector) and is a parameter. Flights toward the detector get longer and flights away from it get shorter, and the weight of the particle is multiplied by the ratio of the true density to the biased one, so every tally keeps its mean. It is importance sampling of the flight distance. For a beam in a pure absorber it can reach zero variance, but with scattering a large gives an infinite variance, so it is used with care, usually together with implicit capture and weight windows.
In plain words
A particle that must get through a thick wall to reach a detector usually stops early. The exponential transform cheats: it lets particles that fly toward the detector go further than they really would, and makes particles that fly away stop sooner.
To stay honest, each particle keeps a weight. A particle that was helped to go far gets a smaller weight, and one that was held back gets a larger weight. On average, the weights undo the cheating exactly.
The danger is the particles that move away from the detector and are then turned back by a collision. Their weights can grow very large. If the cheating is too strong, a few such particles decide the whole result, and the error estimate becomes wrong.
When it applies
- Deep penetration: the tally is many mean free paths away from the source in one main direction, and the importance grows about exponentially in that direction.
- The medium absorbs a fair part of the particles at each collision, or the transform is used only in the thick part of the geometry.
- The code carries weights and has a way to control them, such as a weight window or a weight cutoff with roulette.
It does not apply in voids or thin regions, where there are almost no collisions to bias, nor where the importance does not have one main direction, for example a detector that particles reach from many sides.
The template
The template replaces the flight of free-flight sampling in one cell. The holes are the preferred direction and the parameter .
EXPONENTIAL-TRANSFORM-FLIGHT(x, Ω, w)- 1
μ ← Ω · u ▷ hole: the preferred direction u - 2
Σ* ← Σt (1 - p μ) ▷ hole: the parameter p, with 0 ≤ p < 1 - 3
s ← -ln(ξ) / Σ* ▷ ξ uniform in (0, 1] - 4
d ← the distance to the cell boundary along Ω - 5
if s ≥ d then w ← w · exp(-(Σt - Σ*) d), and the particle crosses the boundary - 6
else w ← w · (Σt / Σ*) · exp(-(Σt - Σ*) s), and the particle collides at x + s Ω
Line L5 uses the ratio of the probabilities to reach the boundary, . Line L6 uses the ratio of the densities of a collision at , .
The mean does not change. This is a theorem. Let be the weight factor of one flight. Over the two outcomes,
for any function of the outcome, which is the analog expectation. So each flight is an importance sampling step with the correct weight, and by induction over the flights every linear tally keeps its mean. This needs , which holds for .
Classic examples
A beam through a pure absorber. A beam enters a pure absorber of optical thickness along , so and . The particle gets through with probability , and then it has the weight . The score is with probability and 0 otherwise. Its mean is for every , and its relative variance per history is :
| probability to get through | relative variance per history | |
|---|---|---|
| 0 (analog) | 22 025 | |
| 0.5 | 0.00674 | 147.4 |
| 0.9 | 0.368 | 1.718 |
| 0.99 | 0.905 | 0.105 |
As every particle gets through with the exact weight , which is a zero variance game. Here the importance grows like , and makes the stretched flight follow it exactly.
An infinite medium with scattering: infinite variance. This is a theorem, with a short proof. Take an infinite medium with isotropic scattering and scattering ratio , a source with an isotropic direction, analog absorption, and the tally = the sum of the weights at all collisions, whose mean is in every game. With the transform, the weight factor of a flight in the direction is , and
With uniform on , , and . The weight at collision is a product of independent factors, so and for . Collision happens with probability . Summing,
if , and if . For , and this is the second moment of the geometric number of collisions. The variance is infinite for :
| 0.3 | 0.5 | 0.7 | 0.9 | 0.99 | |
|---|---|---|---|---|---|
| 1.0317 | 1.0986 | 1.2390 | 1.6358 | 2.6734 | |
| largest with finite variance | 0.969 | 0.910 | 0.807 | 0.611 | 0.374 |
The cause is the flights with : they are made short, but if they are long anyway, the factor is huge.
The sample variance can be wrong even when the variance is finite. In the same medium with , histories (random.Random(4)) give the mean and the sample second moment for (exact ), and the mean and the sample second moment for (exact ). Both variances are finite, but the same computation with gives in the denominator, which is negative for near when , so for one flight. The variance of the variance is then infinite, and the sample variance underestimates the true one in most runs (a measurement for these seeds, explained by the infinite fourth moment).
Deep penetration in practice. In shielding codes the transform is used in the thick layers of a shield, with chosen so that is close to the rate at which the importance grows toward the detector, together with implicit capture to keep the stretched particles alive and a weight window to remove the heavy backward particles. This choice of is a rule of thumb from the beam example. Methods that use an adjoint solve, such as CADIS, often replace it by windows alone.
Variations
- A fixed stretching rate. with a constant instead of , matched to the decay rate of the importance.
- With angle biasing. The direction after a collision is also biased toward , with its own weight factor, so that more flights are stretched. This raises the risk of large weights further.
- Local transforms. Different and in different cells, or a transform only in the cells of the shield.
- Forced collisions and path length biasing in thin cells. The opposite case: the flight is biased to collide in a thin region instead of passing through it.
- Transforms from an adjoint. The parameters can come from the gradient of an approximate adjoint, as in some automated variance reduction schemes.
Pitfalls
- Infinite variance. With scattering, a above the limit of the table makes the variance infinite. The run still prints a mean and an error, and the error looks fine. Use a weight window or a weight cutoff with roulette, and check the largest scores.
- Unreliable error bars. Even with a finite variance, the fourth moment can be infinite for , so the estimated error and its convergence can be far off. Check the variance of the variance.
- The wrong weight at a boundary. At a boundary crossing the factor is , not the density ratio of line L6. Using the density ratio there biases the tally.
- Preferred direction that is wrong. If the importance grows in another direction, the transform pushes particles the wrong way, and the variance rises.
- close to 1 with scattering. Backward flights get , so they are very short, and the few long ones carry enormous weights.
Exercises
- Show that for one flight in a cell of finite thickness, with both outcomes of lines L5 and L6.
- Derive and its average over .
- Derive the second moment of in the infinite medium, and find the largest with a finite variance for .
- In the beam example, show that the relative variance is the analog value for a slab of optical thickness .
- Show that for when , and explain what this means for the error bar of a run.
References
- Ivan Lux and Laszlo Koblinger, Monte Carlo Particle Transport Methods, Neutron and Photon Calculations, CRC Press, 1991, the treatment of biased path length sampling and the exponential transform among the non-analog games
- Jerome Spanier and Ely M. Gelbard, Monte Carlo Principles and Neutron Transport Problems, Addison-Wesley, 1969, Dover reprint 2008, the chapters on non-analog random walks and on the exponential transformation
- Malvin H. Kalos and Paula A. Whitlock, Monte Carlo Methods, second edition, Wiley-VCH, 2008, Chapter 6, on radiation transport, with importance sampling of the flight distance
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 4R5WT6 Edit this page History Report an error Markdown