-
Notifications
You must be signed in to change notification settings - Fork 16
Add envelope tracking module #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Benchmark sets macrosize=0 in PIC calculation
Benchmark successful for particles outside envelope vs. PIC
ExamplesBenchmark: RMS evolutionhttps://github.com/austin-hoover/PyORBIT3/blob/envelope/examples/Envelope/bench_kv.py This example compares the envelope tracker to PIC ( Benchmark: particle-core evolutionhttps://github.com/austin-hoover/PyORBIT3/blob/envelope/examples/Envelope/bench_kv_particle.py This example tracks test particles in the field of the beam. To do this in the PIC solver, we set the test-particle macrosizes to 0 so that they do not contribute to the electric field calculation. The following plots show the period-by-period Matchinghttps://github.com/austin-hoover/PyORBIT3/blob/envelope/examples/Envelope/match_kv.py This example demonstrates matching of the beam envelope to a periodic lattice. The following plots show the beam envelope before/after matching. Plottinghttps://github.com/austin-hoover/PyORBIT3/blob/envelope/examples/Envelope/plot_kv.py We show the 2D pairwise projections of 4D phase space coordinates sampled from the distributions: |
|
Forgot to mention: the |








This PR adds an
orbit.envelopemodule for beam envelope tracking. The routines in this module are not space charge solvers; rather, they are methods to integrate ODEs describing the beam envelope dynamics for specified phase space distributions.Background
We define an upright KV distribution function as
where$J_x(x, x')$ and $J_y(y, y')$ are the Courant-Snyder (CS) invariants in a linear, uncoupled focusing lattice, $\tilde{J}_x$ and $\tilde{J}_y$ are maximum values of $J_x$ and $J_y$ , and $\delta$ is the Dirac delta function. The distribution projects to a uniform density within an ellipse in the $x-y$ plane, with radii $c_x = 2 \sqrt{\langle{xx}\rangle}$ and $c_y = 2 \sqrt{\langle{yy}\rangle}$ . The equations of motion for a particle in the beam are:
where$k_x$ is the linear external focusing strength in the $x$ plane, $k_y$ is the linear external focusing strength in the $y$ plane, and $Q$ is the beam perveance. The envelope radii evolve according to a set of coupled ODEs [Lund 2004]:
where$\varepsilon_x$ and $\varepsilon_y$ are the invariant (4-rms) emittances:
The Danilov distribution is a limiting case of the generalized KV distribution. We define the KV distribution as
where$J_1(x, x', y, y')$ and $J_2(x, x', y, y')$ are generalized CS invariants in a linear focusing lattice. If we take the limit $\tilde{J}_2 \rightarrow 0$ (single mode), we find
We define this limiting case as the Danilov distribution. The beam projects to a uniform density within a tilted ellipse. Equations for the beam envelope are found in [Danilov 2003] [Hoover 2021].
Implementation
The KV envelope equations can be integrated numerically. To work with PyORBIT, one needs to extract the linear focusing strength at each point in the lattice and then call an ODE solver; for example using$x$ and $y$ coordinates representing the envelope radii $c_x$ and $c_y$ . The nonlinear kicks are implemented by special envelope tracking nodes added to the lattice. The same can be done for the Danilov distribution. This method assumes the single-particle tracking through
scipy. We can instead use PyORBIT to perform the integration by tracking aBunchwith the first particleAccLatticeobject is linear; this is not true, even for drifts or quads, but is often approximately true, especially for particles with small energy offset and if fringe fields are ignored.This approach also makes it easy to implement particle-core models, where we track test particles subject to the field of the beam envelope [Holmes 1998]. The forces acting on particles inside and outside the the beam are derived in [Parzen 2021]. We treat every additional particle in the beam (beyond the first one or two particles containing the envelope parameters) as a test particle.
Changes
orbit.core.envelope.KVEnvelopeTracker. Does the envelope tracking at the C++ level.orbit.core.envelope.DanilovEnvelopeTracker. Does the envelope tracking at the C++ level.orbit.envelope.KVEnvelope. Represents a KV distribution. Converts to and fromBunchobjects (where the first particle represents the beam envelope parameters).orbit.envelope.DanilovEnvelope. Represents a Danilov distribution. Converts to and fromBunchobjects (where the first two particles represent the beam envelope parameters).orbit.envelope.KVEnvelopeTracker. Adds envelope tracking nodes to the lattice and tracksKVEnvelopeobjects, optionally with test particles. Also has ability to find matched (periodic) envelope solution.orbit.envelope.DanilovEnvelopeTracker. Adds envelope tracking nodes to the lattice and tracksDanilovEnvelopeobjects, optionally with test particles. Also has ability to find matched (periodic) envelope solution./examples/Envelopedirectory.Future extensions
CovMatrixobject which is tracked, instead of using the technique above, where we track aBunch.orbit.matchingwhich uses the external ODE solver approach for KV distribution. We could integrate intoorbit.envelope.References