Skip to content
Projects

Overview

beamtracer solves steady ion beams in their own field: the extraction of positive or negative ions from a plasma, their acceleration and focusing by electrodes and solenoids, and the charge changes of a fast beam on a gas or a plasma. Nothing depends on time. The beam is the fixed point of a field solve, a trace of the trajectories and a deposit of their space charge, on a 2D mesh, planar per unit depth or cylindrically symmetric (x,r)(x, r).

Each equation on these pages is declared on the code that implements it, as a method card, and checked by the tests: six closed forms against SymPy rules, seven discretisations against their order of convergence. The pages of the section list the cards module by module; this one shows how they fit together.

BeamOptics

classsource

Steady ion beams in planar or cylindrical geometry.

poisson
∇2ϕ=−ρb+ρpε0\nabla^2 \phi = -\frac{\rho_b + \rho_p}{\varepsilon_0}
plasma
ρp=s ρ0 e−s(ϕ−Up)/T,ρ0=∑beamsJv0\rho_p = s\, \rho_0\, e^{-s (\phi - U_p) / T}, \qquad \rho_0 = \sum_\mathrm{beams} \frac{J}{v_0}
motion
dxdt=v,dvdt=qm(E+v×B),E=−∇ϕ\frac{d\mathbf x}{dt} = \mathbf v, \qquad \frac{d\mathbf v}{dt} = \frac{q}{m}\left(\mathbf E + \mathbf v \times \mathbf B\right), \qquad \mathbf E = -\nabla\phi
space charge
ρb=1Vnode∑stepssign⁡(q) I Δt×(1−f)\rho_b = \frac{1}{V_\mathrm{node}} \sum_\text{steps} \operatorname{sign}(q)\, I\, \Delta t \times (1 - f)
Assumes
  • steady: the beam is the fixed point of field solve, trace and deposit (time is always 0)
  • planar (x,y)(x, y) per unit depth or cylindrically symmetric (x,r)(x, r); the solenoids and a measured axial profile only in cylindrical geometry
  • an imposed static E\mathbf E and/or B\mathbf B from a field map (beamtracer.field_map) in the frame of the grid, added to the solved field and the solenoids
  • a Boltzmann plasma species: electrons (s=−1s = -1) for positive-ion extraction, positive ions (s=+1s = +1) for negative-ion extraction; the extracted species are traced beams
  • configuration in e, u and eV, converted to C, kg and J; with MPI the trajectories are shared between the ranks and every rank solves the field
Built from
  1. Mesh. Uniform nodes of spacing hh; the electrodes are simgeometry shapes, and the distance from a node to an electrode surface is bracketed in 255ths of a cell.
  2. Poisson’s equation with the Boltzmann plasma species, by finite differences (Shortley-Weller next to the electrodes, the axis by L’Hôpital) and Newton’s method, second order in hh.
  3. Fields: the electric field on the edges between the nodes, at the electrode surfaces taken over the bracketed distance; the magnetic field of solenoids or a measured profile, expanded off the axis.
  4. Beams seeded from an emission line with a quasi-random Sobol beam (the same on every iteration), traced by RK4, their charge IΔtI \Delta t deposited at the midpoint of every step.
  5. Charge changes of every trajectory on the targets it crosses, as fractions (third order in the step) or as sampled events, with the tallies a plasma model takes its sources from.
  6. The Vlasov iteration ties them together, relaxing the charge density until the potential stops changing:

vlasov_iterate

functionsource

Run iterations Vlasov iterations.

iteration 0
ϕ0=the vacuum solution, with the free nodes at x<xplasma held at Up (with a plasma)\phi^0 = \text{the vacuum solution, with the free nodes at } x < x_\mathrm{plasma} \text{ held at } U_p \text{ (with a plasma)}
solve
∇2ϕn=−ρbn+ρp(ϕn)ε0,Newton from ϕn−1\nabla^2 \phi^{n} = -\frac{\rho_b^{n} + \rho_p(\phi^{n})}{\varepsilon_0}, \qquad \text{Newton from } \phi^{n-1}
relaxation
ρbn+1=(1−ω) ρbn+ω ρnew(ϕn),ρb1=ρnew(ϕ0)\rho_b^{n+1} = (1 - \omega)\, \rho_b^{n} + \omega\, \rho_\mathrm{new}(\phi^{n}), \qquad \rho_b^1 = \rho_\mathrm{new}(\phi^0)
convergence
max⁡∣ϕn−ϕn−1∣<tolerance\max |\phi^{n} - \phi^{n-1}| < \text{tolerance}
Assumes
  • ρnew\rho_\mathrm{new} the compensated deposit of the beam traced in ϕn\phi^n, re-seeded identically every iteration; ω\omega = relaxation in (0,1](0, 1] acts on the charge density, not on the potential
  • the Boltzmann species built once, at n=1n = 1, with ρ0\rho_0 given or the beams' ∑J/v0\sum J / v_0
  • at most iterations; an unconverged iteration returns its last state without a warning (stats['converged'] is 0); the returned trace is that of the newest potential
  • with MPI every rank solves the whole field and the deposits are summed
Built from
  1. Beam moments at diagnostic planes: rms emittance, Twiss parameters and the mismatch, with the trajectories of a cylindrical beam as rings.

Around the solve:

  • The neutralizer iterates the traced beam with the global plasma model of the channel (wellbalanced) to a fixed point of the path fractions.
  • The beamline carries the beam on as 3D markers on straight lines: a grid of beamlets, the duct with its reionization, a residual-ion dump or stray field (Boris push), a calorimeter and the fits the experiments make.
  • The design problems, the einzel lens (with its thin-lens and paraxial estimates) and the H- beamlet, are searched by differential evolution, which ranks the designs by feasibility first.

SI units in the solver; the configuration takes charges in e, masses in u and energies and temperatures in eV, and converts them to C, kg and J. The beam moves along +x+x; in cylindrical geometry yy is the radius rr and a trajectory stands for a ring, in planar geometry a current is per metre of depth. Currents are magnitudes: the sign of the space charge is that of the particles’ charge.

  • No time dependence and no relativity (the normalised emittance uses β\beta only).
  • No 3D fields in the traced region, no planar or non-axisymmetric magnetic fields.
  • The source plasma is not modelled: the beams’ current densities are inputs, the Boltzmann species has no inertia, flow or sheath, and the meniscus is where its density falls off.
  • No collisions besides the charge changes (no scattering, energy loss or secondaries); the targets are prescribed, not transported.
  • The beamline has no space charge, no fields in the duct, no gas in the field region and no wall physics.
  • No convergence safeguards: an unconverged Vlasov iteration, Newton solve or neutralizer fixed point returns its last iterate, flagged but without a warning.

Besides the checks of the cards, the tests compare the field with the coaxial and uniformly charged cylinders, the Child-Langmuir diode with −V(x/d)4/3-V (x/d)^{4/3}, Busch’s theorem through a solenoid, the charge-state fractions with plasmacoll’s on the line density, the analog mean with the fractions mode, a parallel beam in the neutralizer with the global model, the duct transmission and reionization with their closed forms, the Boris push with the Larmor circle, and the thin-lens voltage of the einzel lens with a scan of the full model.