Class IdealRfGapUpgraded
- All Implemented Interfaces:
IRfCavityCell
,IRfGap
,IComponent
,IElement
Represents the action of an ideal RF gap. Gap is modeled as a thin element whose accelerating action is given by the Panofsky formula.
The gap provides acceleration to the propagation probe as well as longitudinal focusing and radial defocusing. These mechanisms are implemented according to that provided by an ideal gap where the effects can be described analytically.
CKA NOTES:
· The gap length L should not be used in any time or phase calculations since it is absorbed by adjacent drift spaces. (So I believe.) For example, drift time Δt should probably not include the term Δt ∝ ωL/2.
· The phase correction parameter Δφ I believe is the change in probe phase due to propagation from the first gap in the cavity. Thus, the first gap has a correction of Δφ and the probe phase there φ0 is simply the cavity phase φcav.
· It is essential that the probe has the correct phase coming into this element. If this is a first gap (see
#isFirstGap()
)
then that phase must be the phase of the cavity, given by
getPhase()
. Thus, we must set the probe phase to the
phase of the cavity at these special gaps. (This is unfortunately necessary
since we cannot implement RF cavity elements with the current lattice
generator.) In the Element/Algorithm/Probe architecture elements do not
modify probes. Thus, although it's a kluge no matter which way you do it, the
probe phase should be reset by the algorithm.
· There are provisions for both an offset of gap electrical center with geometric center and for the Fourier sine transit time factor S. And both values are used. This creates a potential inconsistency since the sine transit time factor can account for any shifts in the field center (i.e., the Fourier sine and cosine transforms together can represent any continuous function.) I'm not sure if the provided S(β) is taken at the geometric center or the electrical center (there it would probably be zero). If at the geometric center you are probably shifting everything right back to the geometric center by using the offset.
· The above condition is localized in the method
compGapPhaseAndEnergyGain(IProbe)
which determines when
to add the phase change due to the gap offset. It is added into the phase
change when the phase and energy are computed directly by the Panofsky method
(i.e., method compGapPhaseAndEnergyGainDirect(IProbe)
).
When the S(β) transit time factor is used to compute the phase
and energy gain (i.e., method
compGapPhaseAndEnergyGainIndirect(IProbe)
) the change
in phase due to gap offset is not added.
· The above method
compGapPhaseAndEnergyGain(IProbe)
also consolidates the
two different methods of computing the phase and energy gains through the
gap. One method is the direct method based upon the Panofsky equation (and
where the phase change is 0 through the gap). This method is used when the
useRfGapPhaseCalculation flag in the probe's algorithm object is
set to false
. If it is set to true
then the
indirect, iterative (and presumably more accurate) method is used to solve a
transcendental equation for the phase and energy changes through the gap.
- Since:
- November 22, 2005
- Version:
- Nov 23, 2014
Jan 16, 2015
July 29, 2015 - Author:
- Christopher K. Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enumeration specifying the method of phase and energy gain calculation. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
The number 2πstatic final String
Parameters for XAL MODEL LATTICE dtdstatic final String
Description of the Fieldstatic final String
Description of the Fieldstatic final String
the string type identifier for all IdealRfGapUpgraded objectsFields inherited from class xal.model.elem.Element
dblNodeLen, dblNodePos
Fields inherited from interface xal.model.IElement
LIGHT_SPEED, PERMEABILITY, PERMITTIVITY, UNIT_CHARGE
-
Constructor Summary
ConstructorsConstructorDescriptionJavaBean constructor - creates a new uninitialized instance of IdealRfGapUpgraded BE CAREFULIdealRfGapUpgraded
(String strId, double dblETL, double dblPhase, double dblFreq) Creates a new instance of IdealRfGapUpgraded -
Method Summary
Modifier and TypeMethodDescriptiondouble
compEffectivePhaseAtGap
(IProbe probe) Provided for legacy calculations.double
compLongFocusing
(IProbe probe) Get the longitudinal focusing constant for a particular probe.double
compMidGapBeta
(IProbe probe) Compute and return the mid-gap normalized velocity for the given probe.double
compTransFocusing
(IProbe probe) Get the transverse focusing constant for a particular probe.void
Compute the synchronous phase and the energy gain for a cavity gap.double
elapsedTime
(IProbe probe) Returns the time taken for the probe to propagate through element.double
energyGain
(IProbe probe) Compute the energy gain of the RF gap for a probe including the effects of calculating the phase advance.int
Returns the index of this cell within the parent RF cavity.double
Returns the structure mode number q for the cavity in which this gap belongs.double
getE0()
Get the on accelerating field (V/m)double
Return the energy gain of a cavity gap previously calculated.double
getETL()
Return the ETL product of the gap, where E is the longitudinal electric field, T is the transit time factor, and L is the gap length.double
Get the operating frequency of the RF gap.double
Returns the cell length (m)double
Return the displacement of the "effective gap" (i.e., the gap model) from the true center of the actual RF gap center.double
double
getPhase()
Return the RF phase delay of the gap with respect to the synchronous particle.double
Return the synchronous phase of a cavity gap, which must be previously calculated using computeSynchronousPhase.void
initializeFrom
(LatticeElement element) Conversion method to be provided by the userboolean
Returns flag indicating whether or not this gap is in the initial or terminal cell in a string of cells within an RF cavity.boolean
Indicates whether or not this cell is the first cell of an RF cavity.double
longitudinalPhaseAdvance
(IProbe probe) Compute and return the longitudinal phase advance (w.r.t. the RF) for the given probe while propagating through this element.void
print
(PrintWriter os) Dump current state and content to output stream.void
setCavityCellIndex
(int indCell) Set the index n of this cell within the enclosing RF cavity.void
setCavityModeConstant
(double dblCavModeConst) Sets the structure mode number q for the cavity in which this cell belongs.void
setE0
(double e) Set the on accelerating field E - the on axis field (V/m)void
setETL
(double dblETL) Set the ETL product of the RF gap where E is the longitudinal electric field of the gap, T is the transit time factor of the gap, L is the length of the gap.void
setFrequency
(double dblFreq) Set the operating frequency of the RF gap.void
setLongitudinalPhaseReference
(double longitudinalPhaseEntrance) void
setPhase
(double dblPhase) Set the phase delay of the RF in gap with respect to the synchronous particle.toString()
protected PhaseMap
transferMap
(IProbe probe) Compute the transfer map for an ideal RF gap.double
Compute the wavelength of the RF.Methods inherited from class xal.model.elem.ThinElement
applyErrors, elapsedTime, energyGain, getLength, longitudinalPhaseAdvance, transferMap
Methods inherited from class xal.model.elem.Element
addCloseElements, backPropagate, backPropagate, compDriftingTime, compProbeLocation, getAlignX, getAlignY, getAlignZ, getCloseElements, getHardwareNodeId, getId, getLatticePosition, getNodeLen, getNodePos, getParent, getPhiX, getPhiY, getPhiZ, getPosition, getType, getUID, propagate, propagate, setAlign, setAlignX, setAlignY, setAlignZ, setHardwareNodeId, setId, setParent, setPhiX, setPhiY, setPhiZ, setPosition
-
Field Details
-
TYPE
the string type identifier for all IdealRfGapUpgraded objects- See Also:
-
PARAM_ETL
Parameters for XAL MODEL LATTICE dtd- See Also:
-
PARAM_PHASE
Description of the Field- See Also:
-
PARAM_FREQ
Description of the Field- See Also:
-
DBL_2PI
public static final double DBL_2PIThe number 2π- See Also:
-
-
Constructor Details
-
IdealRfGapUpgraded
Creates a new instance of IdealRfGapUpgraded- Parameters:
strId
- instance identifier of elementdblETL
- field/transit time/length factor for gap (in volts )dblPhase
- operating phase of gap (in radians )dblFreq
- operating RF frequency of gap (in Hertz )
-
IdealRfGapUpgraded
public IdealRfGapUpgraded()JavaBean constructor - creates a new uninitialized instance of IdealRfGapUpgraded BE CAREFUL
-
-
Method Details
-
computeSynchronousPhaseAndEnergyGain
Description copied from interface:IRfGap
Compute the synchronous phase and the energy gain for a cavity gap.- Specified by:
computeSynchronousPhaseAndEnergyGain
in interfaceIRfGap
-
getSynchronousPhase
public double getSynchronousPhase()Description copied from interface:IRfGap
Return the synchronous phase of a cavity gap, which must be previously calculated using computeSynchronousPhase.- Specified by:
getSynchronousPhase
in interfaceIRfGap
- Returns:
- synchronous phase [rad]
-
getEnergyGain
public double getEnergyGain()Description copied from interface:IRfGap
Return the energy gain of a cavity gap previously calculated.- Specified by:
getEnergyGain
in interfaceIRfGap
- Returns:
-
getGapLength
public double getGapLength()Returns the cell length (m)CKA This method never returned the cavity cell length. It always returned the length of the gap within the cell. Fortunately everywhere this method was used it was used in that context. Thus I have changed the name from
getCellLength
togetGapLength
. I have also renamed the corresponding class variable.Of course the gap is being modeled as a thin element and has no length proper. The length L given here is simply the value that produces the appropriate acceleration potential V0 = E0L when using a hard-edge model.
CKA NOTES:
· I believe this is the length of the overall gap cell structure, not just the gap itself.
· Specifically, it is the distance from one gap center to the next in an accelerating structure.
· I'm not sure if the electric field maximum is averaged over this quantity, I suppose it should be.- Returns:
- The dblGapLength value
-
getGapOffset
public double getGapOffset()Return the displacement of the "effective gap" (i.e., the gap model) from the true center of the actual RF gap center. The true center would be the value provided to the SMF accelerator hierarchy.- Returns:
- the difference between the RF gap true center and effective center (in meters)
- Since:
- Nov 17, 2014
-
wavelengthRF
public double wavelengthRF()Compute the wavelength of the RF.- Returns:
- RF wavelength in meters
-
compMidGapBeta
Compute and return the mid-gap normalized velocity for the given probe.NOTE:
- Because of the state-dependent nature of the energy calculations (this needs to be fixed), this function will only work correctly if the function energyGain() is consistent.
- CKA: I believe this has been fixed.- Parameters:
probe
- probe containing energy information- Returns:
- average or "mid-gap" velocity in units of c
- See Also:
-
compEffectivePhaseAtGap
Provided for legacy calculations. This method computes the phase of the gap necessary to account for the cavity mode field distribution. For example, if the phase of the probe at the gap is φ0 and the mode amplitude factor for cell/gap n is An, then the energy gain ΔWn is
ΔWn = qAnETL cos φ0 .
Combining the An and cos φ0 we get
ΔWn = qETL cos (φ0 + nqπ) ,
where q is the cavity mode constant (see
). This method returns the cosine argument of the later expression.getCavityModeConstant()
- Parameters:
probe
- probe being propagated through gap- Returns:
- the combined phase φ0 + nqπ combining the propagation time of the probe and the spatial structure of the field
- Since:
- Jan 15, 2015 by Christopher K. Allen
-
compTransFocusing
Get the transverse focusing constant for a particular probe. The focusing constant is used in the construction of the transfer matrix for the RF gap. A gap provides longitudinal focusing and transverse defocusing as well as a gain in beam energy. This focusing constant describes the effect in the transverse direction, which is defocusing when the gap is accelerator and, therefore, typically negative.
The value represents the thin lens focusing constant for an ideal RF gap (this is the inverse of the focal length). To compute the focusing action for the lens we must include beam energy, which is changing through the gap. We use the value of beta for which the beam has received half the total energy gain.
- Parameters:
probe
- beam energy and particle charge are taken from the probe- Returns:
- (de)focusing constant (in radians/meter )
-
compLongFocusing
Get the longitudinal focusing constant for a particular probe. The focusing constant is used in the construction of the transfer matrix for the RF gap. A gap provides longitudinal focusing and transverse defocusing as well as a gain in beam energy. This focusing constant describes the effect in the longitudinal direction, which is focusing and, therefore, positive.
The value represents the thin lens focusing constant for an ideal RF gap (this is the inverse of the focal length). To compute the focusing action for the lens we must include beam energy, which is changing through the gap. We use the value of beta for which the beam has received half the total energy gain.
- Parameters:
probe
- beam energy and particle charge are taken from the probe- Returns:
- (de)focusing constant (in radians/meter )
-
getETL
public double getETL()Return the ETL product of the gap, where E is the longitudinal electric field, T is the transit time factor, and L is the gap length. -
getPhase
public double getPhase()Return the RF phase delay of the gap with respect to the synchronous particle. -
getFrequency
public double getFrequency()Get the operating frequency of the RF gap.- Specified by:
getFrequency
in interfaceIRfGap
- Returns:
- frequency of RF gap (in
Hertz )
-
setETL
public void setETL(double dblETL) Set the ETL product of the RF gap where E is the longitudinal electric field of the gap, T is the transit time factor of the gap, L is the length of the gap.The maximum energy gain from the gap is given by qETL where q is the charge (in coulombs) of the species particle.
-
setPhase
public void setPhase(double dblPhase) Set the phase delay of the RF in gap with respect to the synchronous particle. The actual energy gain from the gap is given by qETLcos(dblPhi) where dbkPhi is the phase delay. -
setFrequency
public void setFrequency(double dblFreq) Set the operating frequency of the RF gap.- Specified by:
setFrequency
in interfaceIRfGap
- Parameters:
dblFreq
- frequency of RF gap (inHertz )
-
setE0
public void setE0(double e) Set the on accelerating field E - the on axis field (V/m) -
getE0
public double getE0()Get the on accelerating field (V/m) -
setCavityCellIndex
public void setCavityCellIndex(int indCell) Description copied from interface:IRfCavityCell
Set the index n of this cell within the enclosing RF cavity. The index origin begins at 0, specifically, the first cell in the cavity will have a cell index of O. Since cell phase φ seen by the probe is
φ = nqπ + φ0
where q is the cavity structure constant and φ0 is the klystron driving phase, the first cell always has the phase of the klystron.When considered with an RF gap, it can be convenient to consider the phase rather as a spatial component of the field and combine it with the field amplitude. We simply get a signum function effect where the new field E>n at cell n is given by
En = E0 cos(nqπ)
where E0 is the usual gap field strength.See the discussion below on cavity mode constants.
- Specified by:
setCavityCellIndex
in interfaceIRfCavityCell
- Parameters:
indCell
- index of the cavity cell within the cavity, starting at 0- Since:
- Jan 8, 2015 by Christopher K. Allen
- See Also:
-
setCavityModeConstant
public void setCavityModeConstant(double dblCavModeConst) Description copied from interface:IRfCavityCell
Sets the structure mode number q for the cavity in which this cell belongs. Here the structure mode number is defined in terms of the fractional phase advance between cells, with respect to π. To make this explicit
q = 0 ⇛ 0 mode
q = 1/2 ⇒ π/2 mode
q = 1 ⇛ π mode
Thus, a cavity mode constant of q = 1/2 indicates a π/2 phase advance between adjacent cells and a corresponding cell amplitude function An of
An = cos(nqπ)
where n is the index of the cell within the coupled cavity.- Specified by:
setCavityModeConstant
in interfaceIRfCavityCell
- Parameters:
dblCavModeConst
- the cavity mode structure constant for the cavity containing this cell- Since:
- Jan 8, 2015 by Christopher K. Allen
- See Also:
-
getCavityCellIndex
public int getCavityCellIndex()Description copied from interface:IRfCavityCell
Returns the index of this cell within the parent RF cavity. The index origin starts at zero.- Specified by:
getCavityCellIndex
in interfaceIRfCavityCell
- Returns:
- the cell number within the parent cavity, starting at zero
- Since:
- Jan 8, 2015 by Christopher K. Allen
- See Also:
-
getCavityModeConstant
public double getCavityModeConstant()Returns the structure mode number q for the cavity in which this gap belongs. Here the structure mode number is defined in terms of the fractional phase advance between cells, with respect to π. To make this explicit
q = 0 ⇛ 0 mode
q = 1/2 ⇒ π/2 mode
q = 1 ⇛ π mode
Thus, a cavity mode constant of q = 1/2 indicates a π/2 phase advance between adjacent cells and a corresponding cell amplitude function An of
An = cos(nqπ)
where n is the index of the cell within the coupled cavity.- Specified by:
getCavityModeConstant
in interfaceIRfCavityCell
- Returns:
- the cavity mode constant for the cell containing this gap
- Since:
- Nov 20, 2014
- See Also:
-
- RF Linear Accelerators, Thomas P. Wangler (Wiley, 2008).
-
isEndCell
public boolean isEndCell()Returns flag indicating whether or not this gap is in the initial or terminal cell in a string of cells within an RF cavity.- Specified by:
isEndCell
in interfaceIRfCavityCell
- Returns:
true
if this gap is in a cavity cell at either end of a cavity cell bank,false
otherwise- Since:
- Jan 23, 2015 by Christopher K. Allen
-
isFirstCell
public boolean isFirstCell()Description copied from interface:IRfCavityCell
Indicates whether or not this cell is the first cell of an RF cavity.- Specified by:
isFirstCell
in interfaceIRfCavityCell
- Returns:
true
if this is the initial cell in an RF cavity,false
otherwise- Since:
- Jan 23, 2015 by Christopher K. Allen
- See Also:
-
elapsedTime
Returns the time taken for the probe to propagate through element.- Specified by:
elapsedTime
in classThinElement
- Parameters:
probe
- propagating probe- Returns:
- The time taken to propagate through gap including phase shift δφ and any gap offset Δl (asymmetric drifting at initial and final energies)
-
energyGain
Compute the energy gain of the RF gap for a probe including the effects of calculating the phase advance.- Specified by:
energyGain
in classThinElement
- Parameters:
probe
- uses the particle species charge- Returns:
- energy gain for this probe (in electron-volts )
-
longitudinalPhaseAdvance
Compute and return the longitudinal phase advance (w.r.t. the RF) for the given probe while propagating through this element.- Overrides:
longitudinalPhaseAdvance
in classThinElement
- Parameters:
probe
- probe experiencing a phase advance through this element- Returns:
- the change in phase while going through the element
- Since:
- Nov 23, 2014
- See Also:
-
transferMap
Compute the transfer map for an ideal RF gap.- Specified by:
transferMap
in classThinElement
- Parameters:
probe
- compute transfer map using parameters from this probe- Returns:
- transfer map for the probe
- Throws:
ModelException
- this should not occur
-
initializeFrom
Conversion method to be provided by the user- Specified by:
initializeFrom
in interfaceIComponent
- Overrides:
initializeFrom
in classElement
- Parameters:
element
- the SMF node to convert
-
toString
-
print
Dump current state and content to output stream. -
setLongitudinalPhaseReference
public void setLongitudinalPhaseReference(double longitudinalPhaseEntrance) - Specified by:
setLongitudinalPhaseReference
in interfaceIRfCavityCell
-
getLongitudinalPhaseReference
public double getLongitudinalPhaseReference()- Specified by:
getLongitudinalPhaseReference
in interfaceIRfCavityCell
-