Class EnvTrackerAdapt
- All Implemented Interfaces:
Remote
,IAlgorithm
,IArchive
,IContextAware
Tracking algorithm for EnvelopeProbe
's. The
EnvelopeProbe
's state, which is a CovarianceMatrix
object, is advanced using the linear dynamics portion of any beamline element
(IElement
exposing object) transfer map. The linear portion is
represented as a matrix, thus, the state advance is accomplished with a
transpose conjugation with this matrix.
The effects of space charge are also included in the dynamics calculations. Space charge effects are also represented with a matrix transpose conjugation, however, the matrix is computed using the values of the probe's correlation matrix. The result is a nonlinear effect. The space charge forces are computed using a linear fit to the fields generated by an ellipsoidal charge distribution with the same statistics described in the probe's correlation matrix. The linear fit is weighted by the beam distribution itself, so it is more accurate in regions of higher charged density. For a complete description see the reference below.
This algorithm uses a second-order accurate, adaptive step sizing algorithm where the step size is continually adjusted to maintain an given error tolerance in the residual.
- Author:
- Christopher K. Allen
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class xal.model.alg.EnvelopeTrackerBase
EnvelopeTrackerBase.EmitGrowthModel, EnvelopeTrackerBase.PhasePlane
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Error condition in integration accuracystatic final int
1st order accurate integration algorithmstatic final int
2nd order accurate integration algorithmstatic final int
Range of available integration accuraciesstatic final Class<EnvelopeProbe>
probe type recognized by this algorithmstatic final int
l-1 normstatic final int
l-2 normstatic final int
l-infinity normstatic final String
string type identifier for algorithmstatic final int
current algorithm versionFields inherited from class xal.model.alg.EnvelopeTrackerBase
ATTR_EMITGROWTH, ATTR_SCHEFF, ATTR_STEPSIZE, ATTR_USEDCBEAM, ATTR_USESPACECHARGE, LABEL_OPTIONS, TBL_LBL_ENVBASETRACKER
Fields inherited from class xal.model.alg.Tracker
ATTRTAG_DEBUG, ATTRTAG_RFGAP_PHASE, ATTRTAG_TYPE, ATTRTAG_UPDATE, ATTRTAG_VER, NODETAG_ALG, NODETAG_TRACKER, TBL_LBL_ALGORITHM, TBL_PRIM_KEY_NAME, UPDATE_ALWAYS, UPDATE_CUSTOM, UPDATE_ENTRANCE, UPDATE_ENTRANCEANDEXIT, UPDATE_EXIT
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new, uninitialized instance ofEnvTrackerAdapt
EnvTrackerAdapt
(EnvTrackerAdapt sourceTracker) Copy constructor for EnvTrackerAdapt -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Creates a deep copy of EnvTrackerAdaptvoid
doPropagation
(IProbe ifcProbe, IElement elem) Propagates the probe through the element using a second-order accurate adaptive step size algorithm for space charge calculations.int
Get the current accuracy order of the space charge stepping algorithm.double
Return the acceptable tolerance in the residual error between a full step and two half steps.double
Return the initial step size for this algorithm.int
Get the type of Lebesque norm used for matrices.int
Return the maximum allowable number of steps to propagate a probe through an element.double
Return the maximum allowable step size.double
Return the maximum allowable step size.double
Step size adjustment slack tolerance.double
Return the current step size, that is, the step size currently used in the propagation.void
Initialize the algorithm object for propagation.void
load
(String strPrimKeyVal, EditContext ecTableData) Load the parameters of thisIAlgorithm
object from the table data in the givenEditContext
.void
load
(DataAdaptor daptArchive) Load the parameters of the algorithm from a data source exposing theIArchive
interface.void
save
(DataAdaptor daptArchive) Save the settings particular to this subclass ofTracker
.void
setAccuracyOrder
(int intOrder) Set the integration accuracy order for the underlying stepping algorithm.void
setErrorTolerance
(double dblErr) Set the acceptable error in the residual correlation matrix.void
setInitStepSize
(double dblStepSize) Set the initial step size for applying space charge corrections.void
setMatrixNorm
(int enmNorm) Set the type of Lebesque norm used in the matrix calculations.void
setMaxIterations
(int intMaxIter) Sets the maximum allowable number of steps to propagate a probe through an element.void
setMaxStepSize
(double dblMaxStep) Set the maximum allowable step size.void
setMaxStepSizeDriftPmq
(double dblMaxStepDriftPmq) Set the maximum allowable step size.void
setSlackTolerance
(double dblSlack) Set the slack size in the adaptive step size determination.void
setStepSize
(double dblStepSize) Set the current step size for applying space charge corrections.protected void
stepThinElement
(EnvelopeProbe probe, IElement ifcElem) new stepThinElement by Sako, taken from EnvelopeTracker Advances the probe state through a subsection of the element with the specified length.Methods inherited from class xal.model.alg.EnvelopeTrackerBase
compEmitGrowthFunction, compLongFourierTransform, compScheffMatrix, compTransFourierTransform, correctLongSigmaPhaseSpread, correctSigmaPhaseSpread, correctTransFocusingPhaseSpread, correctTransSigmaPhaseSpread, effPhaseSpread, fourierLong1dGaussian, fourierLong1dUniform, fourierLong3dGaussian, fourierLong3dUniform, fourierLongTrace3d, fourierTrans1dGaussian, fourierTrans1dUniform, fourierTrans3dGaussian, fourierTrans3dUniform, fourierTransTrace3d, getEmitGrowthModel, getEmittanceGrowth, getEmittanceGrowthFlag, getSpaceChargeFlag, getUseDCBeam, getUseSpacecharge, modTransferMatrixForEmitGrowth, phaseSpread, setEmitGrowthModel, setEmittanceGrowth, setUseDCBeam, setUseSpacecharge
Methods inherited from class xal.model.alg.Tracker
advanceProbe, getDebugMode, getElemPosition, getProbeType, getProbeUpdatePolicy, getRfGapPhaseCalculation, getStartElementId, getStopElementId, getType, getVersion, isStopElementIncluded, newFromEditContext, newFromEditContext, newInstance, propagate, registerProbeType, retractProbe, setDebugMode, setElemPosition, setIncludeStopElement, setProbeUpdatePolicy, setRfGapPhaseCalculation, setStartElementId, setStopElementId, unsetStartElementId, unsetStopElementId, validElement, validProbe
-
Field Details
-
NORM_LINF
public static final int NORM_LINFl-infinity norm- See Also:
-
NORM_L1
public static final int NORM_L1l-1 norm- See Also:
-
NORM_L2
public static final int NORM_L2l-2 norm- See Also:
-
ACCUR_ERROR
public static final int ACCUR_ERRORError condition in integration accuracy- See Also:
-
ACCUR_ORDER1
public static final int ACCUR_ORDER11st order accurate integration algorithm- See Also:
-
ACCUR_ORDER2
public static final int ACCUR_ORDER22nd order accurate integration algorithm- See Also:
-
ACCUR_RANGE
public static final int ACCUR_RANGERange of available integration accuracies- See Also:
-
TYPE_ID
string type identifier for algorithm -
VERSION
public static final int VERSIONcurrent algorithm version- See Also:
-
CLS_PROBE_TYPE
probe type recognized by this algorithm
-
-
Constructor Details
-
EnvTrackerAdapt
public EnvTrackerAdapt()Creates a new, uninitialized instance ofEnvTrackerAdapt
-
EnvTrackerAdapt
Copy constructor for EnvTrackerAdapt- Parameters:
sourceTracker
- Tracker that is being copied
-
-
Method Details
-
copy
Creates a deep copy of EnvTrackerAdapt -
initialize
public void initialize()Initialize the algorithm object for propagation. Internal state of algorithm object is initialized: - Step size is set to initial step size - Start/Stop elements are inspected- Specified by:
initialize
in interfaceIAlgorithm
- Overrides:
initialize
in classTracker
- See Also:
-
setInitStepSize
public void setInitStepSize(double dblStepSize) Set the initial step size for applying space charge corrections. Note that the step size will be modified as the algorithm progresses according to the adaptation rule. The current step size is reset to this value anytime theinitialize()
method is called.- Parameters:
dblStepSize
- initial step size in meters- See Also:
-
setStepSize
public void setStepSize(double dblStepSize) Set the current step size for applying space charge corrections. Note that the step size will be modified as the algorithm progresses according to the adaptation rule.- Overrides:
setStepSize
in classEnvelopeTrackerBase
- Parameters:
dblStepSize
- initial step size in meters
-
setMaxStepSize
public void setMaxStepSize(double dblMaxStep) Set the maximum allowable step size. If this value is set then the step sizing algorithm will never generate steps larger than the provided value regardless of the residual error. If this value is cleared to zero, then the step size is unbound.- Parameters:
dblMaxStep
- maximum allowable step size in meters
-
setMaxStepSizeDriftPmq
public void setMaxStepSizeDriftPmq(double dblMaxStepDriftPmq) Set the maximum allowable step size. If this value is set then the step sizing algorithm will never generate steps larger than the provided value regardless of the residual error. If this value is cleared to zero, then the step size is unbound.- Parameters:
dblMaxStepDriftPmq
- maximum allowable step size in meters
-
setMaxIterations
public void setMaxIterations(int intMaxIter) Sets the maximum allowable number of steps to propagate a probe through an element. If the number of steps increases beyond this number a race condition is assumed and an exception is thrown during the propagation. If the value is zero then no maximum step count is enforced.- Parameters:
intMaxIter
- maximum allowable single-element step count
-
setErrorTolerance
public void setErrorTolerance(double dblErr) Set the acceptable error in the residual correlation matrix. The residual correlation matrix is determined by going a full step, then two half step and taking the difference in the resulting correlation matrices. The step size is continually adjusted to keep the resulting residual error at or about this given tolerance value. Thus, yield a more accurate solution however they also result in small step sizes.- Parameters:
dblErr
- acceptable residual error
-
setAccuracyOrder
public void setAccuracyOrder(int intOrder) Set the integration accuracy order for the underlying stepping algorithm. For example, when using a second-order accurate algorithm the residual error is of the order h^2 where h is the step size.- Parameters:
intOrder
- integration order
-
setSlackTolerance
public void setSlackTolerance(double dblSlack) Set the slack size in the adaptive step size determination. That is, if the suggested new step size differs only by this percentage, then no action is taken. Explicitly, if the new step size lies in the interval [h-dblSlack, h+dblSlack], then nothing is done. This feature prevents excessive micro-management of the step size.- Parameters:
dblSlack
- size of the slack region in meters
-
setMatrixNorm
public void setMatrixNorm(int enmNorm) Set the type of Lebesque norm used in the matrix calculations.- Parameters:
enmNorm
- enumeration constant of familyEnvTrackerAdapt.NORM_*
-
getInitStepSize
public double getInitStepSize()Return the initial step size for this algorithm. This is the step size when beginning a propagation. Note that the actual step size used afterwards will likely change due to the adaptive nature of the algorithm.- Returns:
- initial step size in meters
-
getStepSize
public double getStepSize()Return the current step size, that is, the step size currently used in the propagation.- Overrides:
getStepSize
in classEnvelopeTrackerBase
- Returns:
- the current step size in meters
-
getMaxIterations
public int getMaxIterations()Return the maximum allowable number of steps to propagate a probe through an element. If the number of steps increases beyond this number a race condition is assumed and an exception is thrown during the propagation. If the value is zero then no maximum step count is enforced.- Returns:
- maximum allowable step count while propagating thru a single element
-
getMaxStepSize
public double getMaxStepSize()Return the maximum allowable step size. The step sizing algorithm is bound by this value, or unbounded if zero.- Returns:
- maximum allowable step size in meters
-
getMaxStepSizeDriftPmq
public double getMaxStepSizeDriftPmq()Return the maximum allowable step size. The step sizing algorithm is bound by this value, or unbounded if zero.- Returns:
- maximum allowable step size in meters
-
getAccuracyOrder
public int getAccuracyOrder()Get the current accuracy order of the space charge stepping algorithm.- Returns:
- order of the integration algorithm accuracy
- See Also:
-
getErrorTolerance
public double getErrorTolerance()Return the acceptable tolerance in the residual error between a full step and two half steps.- Returns:
- tolerable residual error
-
getSlackTolerance
public double getSlackTolerance()Step size adjustment slack tolerance. If adjustments in the step size are less than this percentage, we do nothing.- Returns:
- size of the slack region in meters
-
getMatrixNorm
public int getMatrixNorm()Get the type of Lebesque norm used for matrices.- Returns:
- 0 for l-inf norm, 1 for l-1 norm, 2 for l2 norm
-
doPropagation
Propagates the probe through the element using a second-order accurate adaptive step size algorithm for space charge calculations. The new probe state is first computed by taken a full step with the second- order accurate transfer matrix with includes space charge effect. The algorithm then computes the new probe state by taking two half-steps. The residual error (correlation matrix) between the two states is computed. If the norm of the matrix is below the error tolerance (@see #getErrorTolerance) the step may be lengthened. If the residual error is greater than tolerance the step size must be shortened and the new probe state recomputed.- Specified by:
doPropagation
in classTracker
- Parameters:
ifcProbe
- probe to propagateelem
- element acting on probe- Throws:
ModelException
- invalid probe type or error in advancing probe- See Also:
-
load
Load the parameters of thisIAlgorithm
object from the table data in the givenEditContext
. Here we load only the parameters specific to the base class. It is expected that Subclasses should override this method to recover the data particular to there own operation.- Specified by:
load
in interfaceIContextAware
- Overrides:
load
in classEnvelopeTrackerBase
- Parameters:
strPrimKeyVal
- primary key value specifying the name of the data recordecTableData
- EditContext containing table data- Throws:
DataFormatException
- bad data format - error in reading- See Also:
-
load
Load the parameters of the algorithm from a data source exposing theIArchive
interface. The superclassload
method is called first, then the properties particular toEnvTrackerAdapt
are loaded.- Specified by:
load
in interfaceIArchive
- Overrides:
load
in classEnvelopeTrackerBase
- Parameters:
daptArchive
- data source containing algorithm configuration- Throws:
DataFormatException
- bad format in algorithm data- See Also:
-
save
Save the settings particular to this subclass ofTracker
. The superclasssave
method is called first, then the properties particular toEnvTrackerAdapt
are saved.- Specified by:
save
in interfaceIArchive
- Overrides:
save
in classEnvelopeTrackerBase
- Parameters:
daptArchive
- data sink exposingIArchive
interface- See Also:
-
stepThinElement
new stepThinElement by Sako, taken from EnvelopeTracker Advances the probe state through a subsection of the element with the specified length. Applies a space charge kick at the end of the element subsection for any probe having nonzero beam current.- Parameters:
ifcElem
- interface to the beam elementprobe
- interface to the probe- Throws:
ModelException
- bad element transfer matrix/corrupt probe state
-