  Here we compute the ion distribution produced by an electron beam when
ion-clearing electrodes are installed. This ion density is established as an
equilibrium between gas ionization and ion clearing. The transverse ion
distributions are shown to strongly peak in the beam's center, producing very
nonlinear forces on the electron beam. We will analyze perturbations to the
beam properties by these nonlinear fields. To obtain reasonable simulation
speeds, we develop fast algorithms that take advantage of adiabatic invariants
and scaling properties of Maxwell's equations and the Lorentz force.
  Our results are very relevant for high current Energy Recovery Linacs, where
ions are produced relatively quickly, and where clearing gaps in the electron
beam cannot easily be used for ion elimination. The examples in this paper
therefore use parameters of the Cornell Energy Recovery Linac project. For
simplicity we only consider the case of a circular electron beam of changing
diameter. However, we parameterize this model to approximate non-round beams
well. We find suitable places for clearing electrodes and compute the
equilibrium ion density and its effect on electron-emittance growth and halo
development. We find that it is not sufficient to place clearing electrodes
only at the minimum of the electron beam potential where ions are accumulated.
