Class IdealRfGapUpgraded

All Implemented Interfaces:
IRfCavityCell, IRfGap, IComponent, IElement

public class IdealRfGapUpgraded extends ThinElement implements IRfGap, IRfCavityCell

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
  • Field Details

  • Constructor Details

    • IdealRfGapUpgraded

      public IdealRfGapUpgraded(String strId, double dblETL, double dblPhase, double dblFreq)
      Creates a new instance of IdealRfGapUpgraded
      Parameters:
      strId - instance identifier of element
      dblETL - 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

      public void computeSynchronousPhaseAndEnergyGain(IProbe probe)
      Description copied from interface: IRfGap
      Compute the synchronous phase and the energy gain for a cavity gap.
      Specified by:
      computeSynchronousPhaseAndEnergyGain in interface IRfGap
    • 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 interface IRfGap
      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 interface IRfGap
      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 to getGapLength. 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

      public double compMidGapBeta(IProbe probe)
      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

      public double compEffectivePhaseAtGap(IProbe probe)

      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 getCavityModeConstant()). This method returns the cosine argument of the later expression.

      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

      public double compTransFocusing(IProbe probe)

      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

      public double compLongFocusing(IProbe probe)

      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.
      Specified by:
      getETL in interface IRfGap
      Returns:
      the ETL product of the gap (in volts ).
    • getPhase

      public double getPhase()
      Return the RF phase delay of the gap with respect to the synchronous particle.
      Specified by:
      getPhase in interface IRfGap
      Returns:
      phase delay w.r.t. synchronous particle (in radians ).
    • getFrequency

      public double getFrequency()
      Get the operating frequency of the RF gap.
      Specified by:
      getFrequency in interface IRfGap
      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.

      Specified by:
      setETL in interface IRfGap
      Parameters:
      dblETL - ETL product of gap (in volts ).
    • 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.
      Specified by:
      setPhase in interface IRfGap
      Parameters:
      dblPhase - phase delay of the RF w.r.t. synchronous particle (in radians ).
    • setFrequency

      public void setFrequency(double dblFreq)
      Set the operating frequency of the RF gap.
      Specified by:
      setFrequency in interface IRfGap
      Parameters:
      dblFreq - frequency of RF gap (in Hertz )
    • setE0

      public void setE0(double e)
      Set the on accelerating field E - the on axis field (V/m)
      Specified by:
      setE0 in interface IRfGap
      Parameters:
      e - The new E0 value
    • getE0

      public double getE0()
      Get the on accelerating field (V/m)
      Specified by:
      getE0 in interface IRfGap
      Returns:
      The e0 value
    • 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 interface IRfCavityCell
      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 interface IRfCavityCell
      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 interface IRfCavityCell
      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 interface IRfCavityCell
      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 interface IRfCavityCell
      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 interface IRfCavityCell
      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

      public double elapsedTime(IProbe probe)
      Returns the time taken for the probe to propagate through element.
      Specified by:
      elapsedTime in class ThinElement
      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

      public double energyGain(IProbe probe)
      Compute the energy gain of the RF gap for a probe including the effects of calculating the phase advance.
      Specified by:
      energyGain in class ThinElement
      Parameters:
      probe - uses the particle species charge
      Returns:
      energy gain for this probe (in electron-volts )
    • longitudinalPhaseAdvance

      public 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.
      Overrides:
      longitudinalPhaseAdvance in class ThinElement
      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

      protected PhaseMap transferMap(IProbe probe) throws ModelException
      Compute the transfer map for an ideal RF gap.
      Specified by:
      transferMap in class ThinElement
      Parameters:
      probe - compute transfer map using parameters from this probe
      Returns:
      transfer map for the probe
      Throws:
      ModelException - this should not occur
    • initializeFrom

      public void initializeFrom(LatticeElement element)
      Conversion method to be provided by the user
      Specified by:
      initializeFrom in interface IComponent
      Overrides:
      initializeFrom in class Element
      Parameters:
      element - the SMF node to convert
    • toString

      public String toString()
      Overrides:
      toString in class Element
      Since:
      Jan 22, 2015 by Christopher K. Allen
      See Also:
    • print

      public void print(PrintWriter os)
      Dump current state and content to output stream.
      Overrides:
      print in class Element
      Parameters:
      os - output stream object
    • setLongitudinalPhaseReference

      public void setLongitudinalPhaseReference(double longitudinalPhaseEntrance)
      Specified by:
      setLongitudinalPhaseReference in interface IRfCavityCell
    • getLongitudinalPhaseReference

      public double getLongitudinalPhaseReference()
      Specified by:
      getLongitudinalPhaseReference in interface IRfCavityCell