# Charge Repulsion¶

This article discusses the **charge repulsion** feature, rather than the
*Poisson Solver in SIMION*.

## Background¶

Generally speaking, *Space Charge* makes calculation more complex
because the field and particle trajectory calculations are
mutually coupled.
There are also two main cases to consider:

**Time independent**- If the space-charge distribution is steady state (time independent), like a long continuous beam of steady current, there are ways solve this “self consistently” by iterating back and forth between the two calculations until they mutually converge, assuming the calculation does converge. Some of the newer*Poisson Solver in SIMION*examples SIMION Example: poisson in SIMION 8.1 work toward that type of thing and achieve correct answers.**Time dependent**- If the space charge distribution is time dependent (e.g. move particle bunch in an ion trap), then it ideally would involve a Poisson solve on every time step, which would be significantly more expensive to do accurately, outside of 2D. FDTM is one such approach used for electromagnetic waves (outside of typical SIMION scope).

Now the **charge repulsion** feature (which has been available
at least as far back as SIMION 7.0) makes an important approximation that
simplifies the above calculation.
It assumes that the electric field from the electrodes
(surface charges on electrodes) is
independent from and unaffected by the electric field from the space charge.
It merely superimposes the two fields.
So, the fields and trajectory calculations are each done once and not
mutually coupled.
Charge repulsion ignores the possibility that the
space charge applies force to surface charges on electrodes, causing
rearrangements in the surface charges, which in turn alter the electric
field seen by the particles–the space-charge distribution and the electric
field becoming coupled, i.e. mutually dependent.
This might be significant e.g. if the space-charge is close to an electrode,
like the surface of a thermionic cathode operated at the space-charge
(child’s law limit: http://simion.com/definition/childs_law.html ).
There’s a comment in the documentation that this feature
was originally intended and reckoned useful to estimate the onset of
space-charge effects but was not necessary confident to give
quantitative results.
There is a SIMION Example: repulsion set of examples (created in SIMION 8.0)
that evaluate the accuracy of charge repulsion feature against a full
self-consistent Poisson solve for a few different examples.
The results are largely consistent except when high space-charge gets
close to surfaces which would perturb the electrode surface charge
distribution, an effect that the charge repulsion feature ignores.
This evaluation could be more extensive, but we can say there are cases
where the charge repulsion feature shows quantitative behavior
and cases where it is merely order of magnitude, and high space-charge
near an electrode surface (e.g. space-charge limited cathode emission)
logically and in practice falls more into the latter case.

As a counter-example, just imagine the following simple scenario: a single particle with charge q at a distance r from an electrode of 0V potential. In the absence of electrodes, the particle gives a potential of k q / r. Merely superimposing the field from the electrodes and the field from the space-charge computed independently (as charge repulsion does) would conclude that the potential at the electrode is is kq/r, which is not the case since the potential is 0V by definition. The Poisson solver would conclude the potential is exactly 0V at the electrode. This would be less of an issue if kq/r is negligible at large r.

For a fuller treatment of this, use the *Poisson Solver in SIMION* rather
than the charge repulsion methods.
The Poisson solver can require an iterative calculation of fields and
trajectories and is a bit more effort to set up and tune to obtain a
convergence than the simpler charge repulsion methods and more
suitable for time-independent cases.
On the other hand, the charge repulsion methods are computationally
quite practical and quick to set up, even under time-dependence (e.g. RF).
These are in the SIMION Example: poisson in SIMION 8.1.
See also *Space Charge*.

Please be aware that the set of particles simulated
(Particles Define screen) is often only
a sample of the total population of actual particles.
(see *Monte Carlo Method*).
Therefore, each particle has two different charges:

- The ratio of
**charge/mass ratio**on each simulated particle (defined on the Particles Define screen) determines the acceleration on the particles by the electric fields (by the*Lorentz Force Law*). For example, an electron is 1 e / 1 u. - The
**total amount of charge**(defined by the charge repulsion factor) determines how much particles themselves contribute to electric fields. This contributes to repulsions between particles. The units for this are coulombs or amps. So, an electron simulated may represent a charge in coulombs that is some (typically large) multiple of 1 e.

## Types of Charge Repulsion Methods¶

There are two main types of charge repulsion methods supported in SIMION, the choice largely dependent on if your space-charge is time-dependent or not or if your particles are in the shape of a beam:

**Coulombic repulsion**and**Factor repulsion**(similar to Coulombic repulsion) - point charges in coulombs, time-dependent**Beam repulsion**- beam lines in amps, time-independent

**Coulombic and factor repulsion** treat
each particle as a point charge (or charge cloud of non-zero radius)
in coulombs that can move through space over time.
Particles repel each other according to Coulomb’s law, which is
superimposed on the *Lorentz Force Law* forces.
It’s fairly simple.

The **difference between Coulombic and Factor repulsion** is in the former
the “repulsion amount” parameter expresses the total charge of all
particles in coulombs, whereas in the latter it expresses the total
charge of all particles as a multiplying factor (e.g. each particle
represents N actual particles).
You can confirm that they give identical results.
There is, however, a slight difference between Coulombic and Factor
repulsion methods when using a factor repulsion of 1, as mentioned in
the Computational Methods appendix of the *SIMION User Manual*:
“The single exception is when Factor repulsion is set to 1.0.
Then SIMION always uses 3.0e-11 mm, 10 times the classical electron radius
for the effective cloud diameter.”
That is practically speaking a point charge, rather than using larger clouds
that reduce high scattering forces when two particles happen to approach closely.
If you have no more than a few hundred real particles, it may be preferable
to simulate every particle as the point charge they are (Factor repulsion 1).

**Beam repulsion** treats each particle *trajectory* as a line of
current in amps.
If you draw a plane through a transverse cross section of the beam, line
currents of particles intersecting that plane repel each other according
to *Coulomb’s Law*.
In Beam repulsion, particle #1 is treated specially and typically would be
defined as a particle within the center of the beam.
At each time step of the trajectory integration, SIMION computes a plane
intersecting the position of particle #1 and that is normal to particle #1’s
velocity, and SIMION computes the positions of the other particles on that
plane and applies *Coulomb’s Law* forces between the line charges
corresponding to only the particles in that plane.
(Side note: Something a little unusual is that within the given trajectory
integration step, particles in that plane can have different actual time
of flights if the particles cross that plane at different times; the
SIMION manual refers to this as “space-coherent integration”.)

**Comparison:**
Beam repulsion is typically used when your space charge is time-independent
and in the form of a continuous beam, like an electron gun.
Coulombic repulsion can be used for time-independent and time-dependent
space charge, like a particle bunch that moves through space
(e.g. time of flight) or particles going in all different directions but
confined in an RF ion trap.
Coulombic repulsion is simpler and more general
but might not be as efficient when Beam repulsion is applicable.
Any system simulated with Beam repulsion can be simulated with
Coulombic repulsion but not vice-versa.
Beam repulsion also only looks at space charges within the plane
(transverse beam broadening) and ignores
space-charges in front of or behind the integration plane (e.g.
virtual cathode or space charges repelling particles backward), whereas
Coulombic repulsion looks at space charge forces in all directions.

**Comparison to piclib**:
If you’ve used the *Poisson Solver in SIMION*, an analogy might be made that
piclib “charge mode” is to Charge repulsion as
piclib “current mode” is to Beam repulsion.
The latter two are for time-independent steady state beams, specifying
current in amps.

**Further information**:
Details on the charge repulsion methods are in the Calculation Methods
appendix of the 8.0/8.1 *SIMION User Manual* and in SIMION Example: repulsion in
SIMION 8.0.4 or above.

## More Notes on the Meaning of Particle Charge¶

To reiterate, there’s two common ways to interpret the charge on simulated particles:

- assign a charge (coulombs) to a particle point charge
- assign a current (amps = coulombs/second) to a ray trajectory path traversed by a particle.

Example #1: you may have 20000 particles, and each particle may
represent **1 e of charge**.
So assign a charge (in Coulombs) to each particle.
Or, for a more efficient calculation, we may simulate a sample
of only 100 particles that each represent 200 real particles.
Now in order for these particles to represent a current
(amps=coulombs/second), a certain number of particles need to cross a
plane over a certain time.
You could give the 100 particles a range of time of birth (TOB)
values and measure the rate at which those particles cross a plane
(e.g. in Data Recording, measure time of flight TOF when particles
cross a plane).

Example #2: you may have 10 particles that trace 10 total rays,
and each ray may represent **2 mA or current**.
So assign a current (in Amps) to each ray formed by each particle.
The total beam current, assuming no ray terminates prematurely
is the sum 20 mA.
Typically here the space-charge distribution (beam shape) is assumed
time-independent, so TOB is not important and we can just leave it
at 0 for all particles.
This approach is likely what you want if the beam shape is
time-independent and you want to measure current.
The previous approach is more general but may require more particles.

These ideas are more general than the charge repulsion feature. Those two methods don’t require SIMION’s charge repulsion features if you merely want to measure beam current (or current density = current / area) without particle-particle repulsion effects.

Related discussion:
*Measure current*.

## Coulombic Repulsion¶

**Q: For Coulombic repulsion, the principle is Coulomb’s law, right?**

Yes. The particles (point charges or larger clouds of charges), repel each
other with *Coulomb’s Law* forces between each pair of particles.

**Q: If using Coulombic repulsion, if I want to represent 20000 actual ions
with 20 simulated ions, would I specify the repulsion value as 20000*1.6*10^-19?**

Yes. The repulsion factor here is the total number of coulombs of all particles physically existent.

**Q: If using Factor repulsion, if I want to represent 20000 actual ions
with 20 simulated ions, would I specify the repulsion value
as 1000?**

Yes. The repulsion factor here is number of times each charge gets multiplied by. It will give the same results as the previous example.

**Q: How should I specify time of birth (TOB)?**

Particles simulated should be a statistically representative sample of all particles physically in the simulation. Their stating points may be differentiated in space or time, and if so you must represent that in your simulation. If you have particles emanating from a cathode and want to simulate that over a period of X microseconds, then specify X as the TOB. If you want to simulate a steady state condition, then just make X sufficiently larger than the time-of-flight (TOF) of your particles, or alternately consider if Beam Repulsion is more appropriate.

## Beam Repulsion¶

**Q: What’s the principle of Beam repulsion?
Still Coulomb force formula like in Coulombic repulsion?**

It’s still a Coulomb force.
Beam repulsion considers each particle trajectory as a tube of current,
with tubes affecting each other by *Coulomb’s Law*.

Beam repulsion is generally intended for a particle beam with a time-independent (steady state) space-charge distribution. That is, the beam shape and current is, at least to approximation, unchanging over time (not rapidly pulsed).

To understand the forces applied, imagine that you cut a transverse cross
section through some location on the beam.
You would have a plane with points where each ray intersects the plane.
Now, the forces SIMION applies for any particle on that plane are the
Coulomb forces between the points on that plane.
It ignores, however, any Coulomb forces from particles in front of or
behind the plane, at least within that plane.
So, for any ray being traced along the beam, the Beam repulsion is
only taking into account transverse forces in the beam that widen the beam.
It does not directly take into account for example Child’s law http://simion.com/definition/childs_law.html
(which regulates the maximum emission current of a space-charge limited
emission surface) where space-charge in front of a particle in a beam can
repel the particle *backward*, thereby limiting the amount of current
that can go through the beam.
It does, however, force particles laterally, which does at high enough
current likewise have current limiting effect at a similar current level,
although its not intended to model that effect quantitatively.

The way Beam repulsion calculates does limit its applicability to fairly regular beam shapes. Along the entire length of the beam there must exist cross sectional planes that cut through all particles in the beam. This prevents beams with greater than 90 degree pencil angles. You can’t have a particle at a certain location in the beam having a velocity diverging more than 90 degree from particle #1. If you do, SIMION will terminate the particle (observed as an ion killed event in Data Recording).

Any simulation calculated under Beam repulsion can also be calculated under Coulombic repulsion–but not vice versa.

**Q: Does Beam repulsion consider magnetic force caused by current?**

No. If you need that, we do have a Biot-Savart solver
(*Biot-Savart Law*) that could use
particle trajectories as the lines of current.
SIMION Example: poisson/pipe_with_beam pipe_beam_bfieldself.lua
does something like that.

**Q: For Beam repulsion, should time-of-birth (TOB) be set to a
0 for particles, not to a distribution like in Coulombic repulsion?**

TOB is not really relevant under Beam repulsion. Normally you would just set it to zero for all particles. You can specify a TOB, but the TOB just shifts the times on each particle observed when recording the beam and doesn’t affect the beam shape under Beam repulsion.

**Q: With Beam repulsion, how can a simulate a beam with a current 1e-5 A?**

Assuming the simulation can be calculated under Beam repulsion (see notes above), just set the Beam repulsion amount (on the Particles tab) to 1e-5 A. TOB can be left at zero for all particles. The number of particles you simulate is not too important, as long as it is large enough to be statistically representative and small enough to not cause long run times.

Some of the examples in SIMION Example: repulsion to simulate under both Beam and Coulombic repulsion and achieve similar results.

**Q: What is the “ion killed” event in Data Recording? 32 (Ion killed)**

That event typically occurs during Beam repulsion when the constraints of Beam repulsion cannot be met. That event generally occurs when one particle diverges more than 90 degrees away from particle #1, often due to very high repulsion, sometimes even physically impossible levels of space-charge. SIMION Beam repulsion simply stops the particle and continues with the rest. However, this is not desirable and generally must be corrected.

With Beam repulsion, at every step of the (Grouped) particle integration, SIMION looks at the position and velocity vector of particle #1. It defines a plane that touches that position point and has a surface normal parallel to that velocity vector. Within the current particle integration step, SIMION tries to advance the trajectories of all other particles to reach that plane. There are various conditions where this is not possible. Perhaps the particle never touches that plane or perhaps particle #1 no longer exists. All particles need to be able to be fly on a plane perpendicular to the velocity vector of particle #1. In particular, if particle #1 stops then the other particles must stop as well.

**First particle**

Note also that for Beam repulsion, the first particle (particle #1) is treated specially (“leader of the pack” in the manual description) and generally is recommended to be placed in the center of the beam to reduce the chance of problems (e.g. ion killed events due to other particle too far off the normal plane defined by the first particle).

## Charge Weighting Factor¶

Each particle can be assigned a unique charge weighting factor (CWF) in the Particle definitions. The purpose of the CWF is to allow the total space-charge (coulombs or amps defined in the charge repulsion value) to be unevenly distributed among all simulated particles. Typically just set all particles to the same CWF value (1) so that the real charge is distributed evenly among all simulated particles.

As an example, if you fly two electrons (1 e charge) that have CWF values of 2 and 3 and the repulsion amount value is 1E-5 C, then the two simulated particles would represent 4E-6 C and 6E-6 C respectively rather than 5E-6 C for both.

Sometimes uneven distribution is useful, like if you want to represent two beams, one with 10 times the current of the other beam but without using 10 times the number of simulated particles to represent it.

## Run-Time¶

Charge repulsions have a computational complexity on the order O(N^2), do to each pair-wise repulsion, which means that if you double the number of particles N, then computation time increases by a factor of four (2 squared). Therefore people typically limit the number of particles to a hundred or thousand or so to keep computation times reasonable. Technically, there are ways to make it O(N log N) but typically we just limit the number of particles.

## Charge Repulsion with Poisson¶

The charge repulsion and *Poisson Solver in SIMION* features
normally should not be used together, as they would be counting
space-effects twice.
There *might* be some applications for merging the two approaches,
like having some particle charge contribute to piclib and other
particle charge contribute to charge repulsion.
But don’t do this unless you really know what you’re doing.
The current version of piclib has a safety check that charge repulsion is
not used (`sim_repulsion` is none).

## User Programming¶

**Q: How can I program charge repulsion in Lua to affect space-charge
during a Fly’m?**

Here are the main parameters related to space charge:

- The
`ion_charge`reserved variable (same as the charge on the Particles screen) is the charge per single particle, in units of elementary mass units (e). This`ion_charge`is the “q” variable in the*Lorentz Force Law*. E.g. for typical carbon, ion_charge = 14. If you change q, you will greatly affect how the particles bend within the electric field because this determines the charge/mass ratio of the particle being flown. - The charge repulsion method
`sim_repulsion`(`'none'`,`'beam'`,`'coulomb'`, or`'factor'`) (same as the repulsion type on the Particles tab) is the type of charge repulsion, if any. This would typically be defined in a`load`,`flym`, or`initialize_run`segment.`sim_repulsion`requires SIMION version 8.1.0.45 or above. - The
`sim_repulsion_amount`reserved variable is the repulsion amount, which you see on the Particles tab. Its units are coulombs or amps depending on the charge repulsion method. It represents the total amount of real charge of all the particles flown. Increasing this variable essentially multiplies the number of particles flown. It is described further in the Computational Methods appendix of the*SIMION User Manual*.`sim_repulsion_amount`requires SIMION version 8.1.0.45 or above. - The
`ion_cwf`reserved variable is the “charge weighting factor” for the current particle. This is the “CWF” parameter you see on the Particles Define screen. Typically this variable is 1. Changing it, typically from an`initialize`segment, allows different groups of particles to be weighted by different amounts as described in the Computational Methods appendix of the*SIMION User Manual*.`ion_cwf`requires SIMION version 8.1.0.45 or above.

**More repulsion notes**

On each time step, SIMION iterates through the particles to advance them in that time step. The repulsion acceleration added to the particles is the sum of the last known contributions of repulsions from the particles. But on the first time step, when processing particle number n, only particle numbers i < n have so far been processed.

## See Also¶

- SIMION Example: repulsion - SIMION charge repulsion examples and README
*Space Charge**Poisson Equation**Poisson Solver in SIMION**Particle Trajectory Calculations*