Implement envelope tracker#112
Conversation
This will be used to set the correct particle mass and energy.
This method applies the linear transformation S -> M S M^T.
… into env-tracker
Replace these with identity matrix
|
Thanks! that's very helpful. If matrix multiplication is dominating then there's not all that much to do. I added some checks to skip the matrix multiplication tilt angle is zero in |
|
I've added a function to generate the matrix for RF gap nodes, copied from Each envelope tracking step needs to track the synchronous particle. For most elements this will just be increasing the time by |
|
One other thing you could try that may or may not be worth the effort is using Numba to do some JIT compilation where possible. You'll eat an initial cost to do the compilation the first time you run the tracker, but the byte code can be cached so that subsequent runs are faster (or have the potential to be). You would probably need to factor out types made accessible from bindings, e.g., the synchronous particle instance, and instead directly pass in the raw values you need to the kernels you want to be JIT compilable. |
Right now every unknown element will throw an error except MultipoleTEAPOT if all k are zero
|
WIth these small modifications: Envelope: Bunch (10,000 particles): |
|
With 2D space charge: Envelope: Bunch (100,000 particles, 64 x 64 x 1 grid): |
|
Some improvement with 2D space charge: |
No time saved because to get cov you need to call outer(mu, mu) and subtract from moment matrix. This is more straightforward
This PR implements an envelope/centroid tracker (Issue #51). We track the covariance matrix$\mathbf{\Sigma} = \langle \mathbf{x} \mathbf{x}^T \rangle$ and centroid $\mathbf{\mu} = \langle \mathbf{x} \rangle$ , where $\mathbf{x} = [x, x', y, y', z, \Delta E ]^T$ is the 6D phase space vector.
Evolution equations:
We track the$7 \times 7$ matrix $\mathbf{S} = \langle \mathbf{y} \mathbf{y}^T \rangle$ , where $\mathbf{y} = [x, x', y, y', z, dE, 1]^T$ :
Evolution equations for$\mathbf{y}$ :
where$\mathbf{N}$ is defined as
Accelerator nodes and child nodes are mapped to transfer matrices at the Python level. An error is raised if the node is not recognized. Space charge is handled by assuming a uniform charge density within an ellipsoid in the$x$ -$y$-$z$ plane (for 3D space charge) or within an ellipse in the $x$ -$y$ plane (for 2D space charge).