# Variance Reduction¶

Author: | Elliott Biondo, Kalin Kiesling |
---|

## CADIS Method¶

The Consistent Adjoint-Driven Importance Sampling (CADIS) method [1] is a Monte
Carlo variance reduction method that utilizes a deterministic estimate of the
adjoint flux (the *importance*) to generate a biased source and weight windows
that optimize a Monte Carlo simulation relative to a detector response
function. One major feature of the scheme is “consistency”, that is, weight
windows are chosen such that particles are always born within them.

In the CADIS method the response is defined as:

where is the probability distribution function describing the source strength as a function of the phase space variable (which may represent any combination of space, energy, and direction). is the adjoint flux relative to the detector response function being optimized. The CADIS method defines the biased source distribution as:

The corresponding weight window lower bounds are defined by:

where is the ratio of the weight window upper bound to the weight window lower bound (default of 5 in MCNP5).

### PyNE implementation¶

The PyNE implementation of the CADIS method is a mesh-based implementation and is designed to be used in conjunction with the mesh-based source sampling capabilities in the source_sampling module. This means that the above method, which is continuous in phase space must be adapted for discretization of space (mesh volume elements) and energy (in energy bins).

Source density (, units: ) is the canonical quantity for representing a mesh-based source within PyNE. This means that the first step of the CADIS method within PyNE is to create a PDF from a source density mesh. The total source strength is first found by integrating the source density over space () and energy ():

The PDF can then be defined by:

The response can then be calculated by integrating the product of and the adjoint flux over all phase space:

The weight window lower bound is then:

These values are tagged to the weight window output mesh and can be printed out as an MCNP5 WWINP file. In the event that the adjoint flux is 0 for some , the value is replaced with 0. MCNP5 will not play the weight window game when a particle enters a region of phase space where the weight window lower bound is 0.

The biased source strength is:

However, the biased source strength is not the quantity of interest, because the source_sampling module is expecting biased source densities. The biased source densities that are tagged to the output mesh are:

### Assumptions¶

The source density mesh and adjoint flux mesh must have the spatial bounds.

### Sample Calculations¶

In this section the expected results for the the test_variancereduction.py unit test “test_cadis_multiple_e” are calculated. Consider a 2D mesh with the following properties.

Here, the vector quantities represent values at two energy groups. First calculate and :

The expected results are:

Notice that the value in the vector that is a division by 0 has been replaced with 0.

## MAGIC Method¶

The Method of Automatic Generation of Importances by Calculation (MAGIC) is a global variance reduction technique in which an initial particle distribution, in the form of fluxes, populations, or weights is obtained and then used to generate mesh-based weight windows or importances. This method recognizes the initial particle distribution will be poor in some highly attenuated regions but upon iteration of the MAGIC method, the solution will improve. Below are the steps for the MAGIC method. [2]

- Run MCNP, in analogue mode, to set up a flux meshtally. Multigroup cross section data and a high energy cut-off, corresponding to a mean-free path no greater than the mesh voxel size, should be used.
- Process the resulting meshtally data by normalizing the flux to have a value of 0.5 in the source (or highest) region. Use the normalized flux to create a new weight window file to be used for MCNP.
- Modify the original MCNP input to use the generated weight window file and run again.
- If results are are sufficient, no further iterations are necessary. Else, repeat starting from step 2 until desired flux results are obtained.
- If a high energy cut-off was used, reduce the cut-off energy and repeat iterations until the particle distribution is acceptable. The final iteration should be performed with the appropriate energy cut-off and cross section data.

### PyNE implementation¶

The implementation of MAGIC in PyNE uses a PyNE meshtally object, which is the result of a meshtal file processed by PyNE’s mcnp.Meshtally. Using the results of the meshtal file and a specified tolerance for relative error and null value , the flux will be normalized for each energy bin and then be used to generate a wwinp file to be used in a subsequent iteration. The steps are as follows:

- Read meshtally and determine maximum flux for each enery bin .
- Normalize flux in every mesh voxel for each energy bin according to to obtain a new . If the relative error for voxel in energy bin is larger than the tolerance value , then set flux to the null value instead.

- Use new flux values to create a weight window tag on the provide meshtally and use PyNE’s Wwinp class to create a weight window mesh.

### Sample Calculations¶

In this section, the expected results of the test_variancereduction.py unit test “test_magic_multi_bins” are shown. In this test, a 3D 2x2 mesh is given. Each voxel contains flux data corresponding to 2 energy bins. The mesh is described by the following flux and relative error data.

First, the maximum flux for each energy bin is found. In this case the maximum for energy bin occurs in voxel 4 and in voxel 1 for energy bin . In the first energy bin, the flux values are normalized by and in the second . If the error tolerance is set and the null value set to , then voxels 2 and 3 in the second energy bin have errors larger than the tolerance and are therefore set to the null value while everything else is normalized. The following is the result.

The values are then set as the new weight window values.

## References¶

- [1] Haghighat, A. and Wagner, J. C., “Monte Carlo Variance Reduction with
- Deterministic Importance Functions,” Progress in Nuclear Energy, Vol. 42, No. 1, pp. 25-53, 2003.
- [2] Davis, A. and Turner, A., “Comparison of global variance reduction
- techniques for Monte Carlo radiation transport simulations of ITER,” Fusion Engineering and Design, Vol. 86, Issues 9-11, pp. 2698-2700, 2011.