# Macroparticle Weights

As discussed in macroparticles, simulation particles in VSim can represent any number of physical particles. This ratio of physical to macro particles is called the weight of the particle, and in VSim simulations can be run with either constant` or variable` weights. The benefit of constant weight particles is that they are simpler, reactions with them do not cause an increase in the number of macroparticles during the simulation, and one can easily relate the physical density to macroparticle density.

However, there are drawbacks to constant density simulations, namely when the simulation also contains reactions. As discussed in Reactions, statistics are important for Monte Carlo-based reactions (all reactions within VSim), and so maintaining a minimum number of particles per cell is required for reaction accuracy (in general this number is 10 or more). So an ideal simulation would have homogenous macroparticle density regardless of the underlying physical density. This makes variable weights preferable over constant weight simulations when:

• Physical density is irregular, such that constant weight particle would need to vary in number more than an order of magnitude from one location to another within the simulation domain

• Using cylindrical coordinates, as the equilibrium macroparticle distribution is heterogeneous.

This is not to say that variable weight simulations are perfect, just preferred. Variable weight simulations have the following drawbacks:

• Particles with very small weights can have little effect on the local field values, while taking just as much computational resources as large weighted particles

• Particles with very large weight particles can disrupt local field values

• Reactions with variable weight particles will split the largest particle into two pieces, automatically increasing the number of macroparticles in the simulation even for simple reactions like elastic scattering

These issues can be solved via Splitters and Combiners using Managed Weights.

## Managed Weights

An ideal PIC simulation will:

• Have homogenous macroparticle density

• Have a constant (in time) total number of macroparticles

• Have enough particles-per-cell to maintain good reaction statistics

Neither constant nor variable weight particles can satisfy all these conditions in any non-trivial physics simulation. This is where Managed Weights can significantly improve both performance and accuracy of the simulation.

Managed Weights uses algorithms that split and combine macroparticles to attempt to keep the particles-per-cell constant in each cell, while also preventing the weights from becoming too large or too small. Splitters, as their name suggests, take a single macroparticle and split it into two macroparticles, each with half the weight. This prevents regions of low physical density from becoming sparsely represented by macroparticles. Splitters are simple and work very well.

Combiners do the opposite of splitters, taking multiple macroparticles and combining them into a smaller number of macroparticles. This, however, is much more complex since the goal is not just to preserve the weight, but also the phase space information of the combined particles. There are therefore many algorithms to choose from within VSim. Descriptions of these algorithms can be found in nullSelfCombination. There is, unfortunately, so a one-size-fits-all solution for combining, and often one must try multiple algorithms before finding the one that works best for a given simulation.

## Combining Algorithms

Combining algorithms must consider which quantities to conserve through the combining process. Quantities to consider are mass, charge, energy, momentum, flux, and phase space distribution shape.

Algorithms:

• PairwiseDecimation - This is the simplest combination algorithm, which selects two particles, deletes one and adds its mass/charge to the other. While this will not conserve anything except for mass/energy for any given pair, the idea is that other quantities will be preserved on average. Assuming the decimation algorithm chooses particles uniformly randomly, the shape of the particle distribution should unchanged, after many combinations, with the amplitude of the distribution decreasing. However, if the combining algorithm is slow compared to the physics processes, this will produce erroneous physics as processes will see intermediate distributions due to the combining.

• PairwiseInelastic - This algorithm randomly selects two particles and combines them into a single particle. This algorithm conserves mass, charge, and momentum (does not conserve energy). This is achieved by giving the resulting particle the mean position and velocity of the initial particles.

• PairwiseInelasticLimited - This algorithm is a pair-wise combining approach similar to PairwiseInelastic except that it allows users to avoid combining particles that are above the user specified limit. Just as in PairwiseInelastic, this algorithm conserves mass, charge, and momentum.

• QuartetElastic - This algorithm randomly selects four particles and combines them down to two. By selecting more particles, more degrees of freedom are available for conserving quantities. In this case, we conserve mass, charge, and energy (does not conserve momentum).

• PairwiseElastic - This algorithm groups particles within a cell into velocity phase-space bins and then particles in each velocity phase-space bin are combined pair-wise. In this approach mass, charge, energy, and momentum are conserved, and only particles near each other in phase space are combined, attempting to also preserve the shape of the phase space.

• FluxConserving - This algorithm conserves mass, energy, momentum, and flux by combining four particles into two. This is ideal for simulations with particle beams or in general a net flow of particles (ie. non-zero mean phase-space distribution).