Skip to content
Development documentation — This site follows the main branch and may differ from an installed release. View the changelog.

Boris particle update

BEACH advances one particle step in two stages: it constructs a candidate trajectory, then resolves the first collision or boundary crossing on that trajectory. The candidate combines a predicted-midpoint field sample, a Boris velocity update, and a trapezoidal position update. Public state and checkpoints keep (x,v)(\mathbf{x},\mathbf{v}) at the same time level before and after the step.

StateTime level
Inputxn,vn\mathbf{x}^n,\mathbf{v}^n
Field samplePredicted position xmid\mathbf{x}_\mathrm{mid}
Output candidatexn+1,vn+1\mathbf{x}^{n+1},\mathbf{v}^{n+1}
Magnetic fieldUniform sim.b0

For step interval Δt\Delta t, current velocity predicts the midpoint

xmid=xn+12vnΔt.\mathbf{x}_\mathrm{mid}= \mathbf{x}^n+\frac{1}{2}\mathbf{v}^n\Delta t.

The field snapshot is evaluated once there:

Emid=Esnapshot(xmid).\mathbf{E}_\mathrm{mid}= \mathbf{E}_\mathrm{snapshot}(\mathbf{x}_\mathrm{mid}).

The snapshot composes the element-charge field, sim.e0, and any selected periodic zero mode or outer profile exactly once. Particles in one batch share the snapshot formed from element charge at the start of that batch. See Field evaluation for its construction.

With use_box=true, only the field-sample position is mapped into the solver’s valid region.

AxisTreatment of xmid\mathbf{x}_\mathrm{mid}
Both low and high faces periodicWrap into the primary box with modulo
OtherwiseClamp between box_min and box_max

Candidate trajectory endpoints remain in physical coordinates so that the next stage can order a triangle collision against a box-boundary crossing.

For particle charge qq, mass mm, and B=sim.b0\mathbf{B}=\texttt{sim.b0}, first apply a half electric acceleration:

v=vn+qmEmidΔt2.\mathbf{v}^-= \mathbf{v}^n+\frac{q}{m}\mathbf{E}_\mathrm{mid}\frac{\Delta t}{2}.

The magnetic rotation is

t=qmBΔt2,s=2t1+t2,\mathbf{t}=\frac{q}{m}\mathbf{B}\frac{\Delta t}{2}, \qquad \mathbf{s}=\frac{2\mathbf{t}}{1+\lVert\mathbf{t}\rVert^2}, v=v+v×t,v+=v+v×s,\mathbf{v}'=\mathbf{v}^-+\mathbf{v}^-\times\mathbf{t}, \qquad \mathbf{v}^+=\mathbf{v}^-+\mathbf{v}'\times\mathbf{s},

followed by the other half electric acceleration:

vn+1=v++qmEmidΔt2.\mathbf{v}^{n+1}= \mathbf{v}^++\frac{q}{m}\mathbf{E}_\mathrm{mid}\frac{\Delta t}{2}.

The implementation uses the standard Boris rotation with t2=ttt^2=\mathbf{t}\cdot\mathbf{t}.

Form the candidate position with the trapezoidal rule

Section titled “Form the candidate position with the trapezoidal rule”

After velocity is updated, the candidate position uses same-time input and output velocities in the trapezoidal rule:

xn+1=xn+12(vn+vn+1)Δt.\mathbf{x}^{n+1}= \mathbf{x}^n+\frac{1}{2} \left(\mathbf{v}^n+\mathbf{v}^{n+1}\right)\Delta t.

For a uniform electric field alone, this matches the constant-acceleration velocity and displacement. Regression tests for a smooth spatial electrostatic field verify second-order convergence of candidate position and velocity when combined with the predicted-midpoint field sample.

Split the step at collisions and boundary crossings

Section titled “Split the step at collisions and boundary crossings”

The equations above produce a full-step candidate (xn+1,vn+1)(\mathbf{x}^{n+1},\mathbf{v}^{n+1}). It becomes the accepted state when the candidate trajectory has no triangle collision or box-boundary crossing.

Triangle collisions and ordinary box crossings are ordered along the straight trajectory segment within the step that connects xn\mathbf{x}^n and xn+1\mathbf{x}^{n+1}. A triangle collision absorbs the particle at the hit point. If a reflection action (reflect or redistributed_reflect) or periodic face is crossed first, BEACH obtains the position from the chord parameter. The event velocity follows the chord tangent and is normalized to the speed implied by the discrete work of the predicted-midpoint electric field,

vevent2=vn2+2qmEmid(xeventxn).\lVert\mathbf{v}_\mathrm{event}\rVert^2= \lVert\mathbf{v}^n\rVert^2+ 2\frac{q}{m}\mathbf{E}_\mathrm{mid}\cdot (\mathbf{x}_\mathrm{event}-\mathbf{x}^n).

BEACH then constructs a new Boris candidate for the remaining interval. This keeps the normal velocity direction consistent with the chord crossing and preserves event speed for any pure magnetic field. A non-positive or non-finite reconstructed speed fails closed. However, BEACH also uses the chord crossing fraction as the remaining-time fraction; it does not solve the exact physical crossing time under acceleration or magnetic rotation. This is a time-discretization approximation of the trajectory-chord event model, so runs that use boundary actions or the potential-barrier decision must check convergence with dt, dt/2, and, when needed, dt/4. At the z-high outer interface, the applicable coupling path refines crossing time from a quadratic trajectory consistent with the Boris endpoints. See Particle collision and boundary events.

ConditionProperty
Pure BPreserves v\lVert\mathbf{v}\rVert to roundoff
Prescribed uniform E/BVelocity update is reversible under a sign change of Δt\Delta t
Smooth prescribed fieldCurrent same-time update is second order in position and velocity
Mesh collision or open-boundary escapeIrreversible process that ends tracking at the collision or boundary point
Self-consistent field changing between batchesSnapshot fixed within a batch and refreshed after charge commit

Choose dt from trajectories and charging results

Section titled “Choose dt from trajectories and charging results”

dt must resolve particle rotation, spatial field variation, and collision geometry:

  • cyclotron angle qBΔt/m|q|\lVert\mathbf{B}\rVert\Delta t/m
  • transit time over the spatial electric-field variation scale
  • transit time near triangles and box faces
  • transit time through a rapidly changing outer-interface profile

Triangle intersections use the straight trajectory segment within a step. When an orbit bends strongly in one step or passes fine geometry, reduce the time step until collision positions converge. Compare dt, dt/2, and when needed dt/4 using trajectories, hit elements, absorption and escape statistics, and post-batch element charge. Keeping max_step fixed halves the maximum physical tracking time when dt is halved, so adjust max_step when comparing the same time horizon.