Change coordinate system
jank324 opened this issue · 7 comments
I'll try to clearly document the changes we want to make.
@jp-ga Please check if there's anything incorrect.
The coordinate system should be explained properly in the documentation.
Transverse
Change the current coordinates
The new transverse momentum should be the scaled one w.r.t. the reference momentum
This should be merely a change in the documentation at this point as the linear transfer matrices are still correct.
Longitudinal
For the longitudinal coordinate we will stay with
The longitudinal coordinates are derived from the
Note:
- This coordinate
$(\tau, \delta)$ is the same as in OCELOT - In A. Wolski's book, the sign of
$\tau$ is inverted - Related to the Mad-x coordinates
$(T, PT)$ as$(\tau, \delta) = (- T, PT)$ , (according to this paper also in TEAPOT, PyORBIT, ) - Related to the Bmad coordinates
$(z, p_z)$ (Bmad manual 15.28, 15.32) as$z_\text{Bmad} = -\beta \tau$ (not the reference velocity$\beta_0$ ) and$p_{z, \text{Bmad}} = \frac{\Delta E}{E_0} = \beta_0 \delta$
In addition, we should also clearly distinguish the reference energy
Right now the attribute is called Beam.energy
and should return the energy. We could add another property Beam.p0c
as convenient method
If we are already in here, maybe we should also think about the fact that beam's currently don't track their reference s
and whether doing so would be make sense (for example in light of the space charge implementation).
@jank324 Now that we're clarifying the meaning of a few variables, does it make sense to rename also the properties
In Cheetah now
So that we can provide a new property
@jank324 Now that we're clarifying the meaning of a few variables, does it make sense to rename also the properties s and p?
In Cheetah now s actually stands for τ as in OCELOT (or −z as in other simulation code like mad-x). s is usually used as the position of the reference particle along the beamline, (independent variable). Also having the real s would make sense now since we have space charge integration etc.
p is the dimensionless relative energy offset, which is δ in most literatures, probably we can rename it to something like dp? So that we can provide a new property p or momentum to denote the actual momentum of a particle.
Yes, this sounds like it would make a lot of sense to do this now.
I'll try to clearly document the changes we want to make. @jp-ga Please check if there's anything incorrect.
The coordinate system should be explained properly in the documentation.
Transverse
Change the current coordinates (x,x′,y,y′) to the canonical cooridnates (x,px,y,py).
The new transverse momentum should be the scaled one w.r.t. the reference momentum px=PxP0 (as in bmad).
This should be merely a change in the documentation at this point as the linear transfer matrices are still correct.
Longitudinal
For the longitudinal coordinate we will stay with (τ,δ), where τ=ct−sβ0=c(t−t0(s))=cΔt, and δ=Ep0c−1β0=E−E0p0c=E−E0β0E0. For particle arriving at a earlier time than the reference particle (bunch head), τ<0. The longitudinal coordinates are derived from the F2=(zβ0−ct)(1β0+δ) (A. Wolski Eq. 2.45).
Note:
This coordinate (τ,δ) is the same as in OCELOT
In A. Wolski's book, the sign of τ is inverted
Related to the Mad-x coordinates (T,PT) as (τ,δ)=(−T,PT), (according to this paper also in TEAPOT, PyORBIT, )
Related to the Bmad coordinates (z,pz) (Bmad manual 15.28, 15.32) as zBmad=−βτ (not the reference velocity β0) and pz,Bmad=ΔEE0=β0δ
The longitudinal momentum coordinate in Bmad is
In addition, we should also clearly distinguish the reference energy E0 and reference momentum p0 (p0c), which will be different for non-relativisitic particles. Right now the attribute is called
Beam.energy
and should return the energy. We could add another propertyBeam.p0c
as convenient method
I think the distinction between Beam.energy
is Beam.ref_energy
or something similar.
As a reference, this is how I implemented the coordinate transform for bmadx:
cheetah/cheetah/bmadx_utils.py
Lines 4 to 62 in 0d702e6