Parallel capable? : yes

Parameter Name | Units | Type | Default | Description |

L | double | 0.0 | Total length | |

B_MAX | double | 0.0 | Maximum on-axis magnetic field. | |

BX_MAX | double | 0.0 | Maximum on-axis magnetic field. Ignored if B_MAX is nonzero. | |

BY_MAX | double | 0.0 | Maximum on-axis magnetic field. Ignored if B_MAX is nonzero. | |

DX | double | 0.0 | Misaligment. | |

DY | double | 0.0 | Misaligment. | |

DZ | double | 0.0 | Misaligment. | |

TILT | double | 0.0 | Rotation about beam axis. | |

PERIODS | long | `0` |
Number of wiggler periods. | |

STEPS_PER_PERIOD | long | 10 | Integration steps per period. | |

INTEGRATION_ORDER | long | 4 | Integration order (2 or 4). | |

BY_FILE | STRING | NULL | Name of SDDS file with By harmonic data. | |

BX_FILE | STRING | NULL | Name of SDDS file with Bx harmonic data. | |

BY_SPLIT_POLE | long | `0` |
Use "split-pole" expansion for By? | |

BX_SPLIT_POLE | long | `0` |
Use "split-pole" expansion for Bx? | |

SYNCH_RAD | long | `0` |
Include classical synchrotron radiation? | |

ISR | long | `0` |
Include incoherent synchrotron radiation (scattering)? | |

ISR1PART | long | 1 | Include ISR for single-particle beam only if ISR=1 and ISR1PART=1 | |

SINUSOIDAL | long | `0` |
Ideal sinusoidal wiggler? If non-zero, BX_FILE and BY_FILE are not used. | |

VERTICAL | long | `0` |
If SINUSOIDAL is non-zero, then setting this to non-zero gives a vertical wiggler. Default is horizontal. |

Tracks through a wiggler using canonical integration routines of Y. Wu (Duke University).

Parameter Name | Units | Type | Default | Description |

HELICAL | long | `0` |
Ideal helical wiggler? If non-zero and SINUSOIDAL is also non-zero, BX_FILE and BY_FILE are not used. | |

FORCE_MATCHED | long | 1 | Force matched dispersion for first harmonics? If non-zero, start and end of magnetic field will be inset from the ends of the device if phase is not 0 or . | |

FIELD_OUTPUT | STRING | NULL | Name of file to which field samples will be written. Slow, so use only for debugging. | |

VERBOSITY | long | `0` |
A higher value requires more detailed printouts related to computations. | |

GROUP | string | NULL | Optionally used to assign an element to a group, with a user-defined name. Group names will appear in the parameter output file in the column ElementGroup |

This element simulates a wiggler or undulator using a modified version of Ying Wu's
canonical integration code for wigglers. To use the element, one must
supply an SDDS file giving harmonic analysis of the wiggler field.
The field expansion used by the code for a horizontally-deflecting
wiggler is (Y. Wu, Duke University, private communication).

(12) |

The file must contain the following columns:

- The harmonic amplitude, , in column
`Cmn`. - The phase, in radians, in column
`Phase`. The phase of the first harmonic should be 0 or in order to have matched dispersion. - The three wave numbers, normalized to
, where
is the wiggler period. These are given in columns
`KxOverKw`,`KyOverKw`, and`KzOverKw`.

In Version 17.3 and later, for matrix computations `elegant` uses
a first-order matrix derived from particle tracking when it
encounterse a CWIGGLER. Tests show that this gives good agreement in
the tunes from tracking and Twiss parameter calculations. For
radiation integrals, an idealized sinusoidal wiggler model is used
with bending radius equal to
for each plane.
Energy loss, energy spread, and horizontal emittance should be estimated
accurately.

`elegant` allows specifying field expansions for on-axis and
components, so one can model a helical wiggler. However, in this
case one set of components should have
or
,
while the other should have
.
Using Wu's code, the latter set will not have matched dispersion. Our
modified version solves this by delaying the beginning of the field
components in question by and ending the field prematurely
by . This causes all the fields to start and end at the
crest, which ensures matched dispersion. The downside is that the
(typically) vertical wiggler component is missing a full period of
field. One can turn off this behavior by setting `FORCE_MATCHED=0`

.

**Additional field expansions**

Y. Wu's code included field expansions for a vertically-deflecting wiggler as well as the horizontally-deflecting wiggler given above. In both cases, these expansions are suitable for a wiggler with two poles that are above/below or left/right of the beam axis. They are not always suitable for devices with more complex pole geometries.

Another geometry that is important is a ``split pole'' wiggler, in which
each pole is made from two pieces. Such configurations are seen, for example,
in devices used to produce variable polarization. In such cases, the
expansion given above may not be appropriate. Here, we summarize the form of the
various expansions that `elegant` supports. For brevity, we show the
form of a single harmonic component.

Horizontal wiggler, normal poles, produces only on-axis. Specified
by setting `BY_SPLIT_POLE=0`, and giving `BY_FILE` or `SINUSOIDAL=1` with `VERTICAL=0`.

(13) | |||

(14) |

where .

Horizontal wiggler, split poles, produces only on-axis. Specified
by setting `BY_SPLIT_POLE=1`, and giving `BY_FILE` or `SINUSOIDAL=1` with `VERTICAL=0`.

(15) | |||

(16) |

where .

Vertical wiggler, normal poles, produces only on-axis. Specified
by setting `BX_SPLIT_POLE=0`, and giving `BX_FILE` or `SINUSOIDAL=1` with either `VERTICAL=1` or
`HELICAL=1`.

(17) | |||

(18) |

where .

Vertical wiggler, split poles, produces only on-axis. Specified
by setting `BX_SPLIT_POLE=1`, and giving `BX_FILE` or `SINUSOIDAL=1` with either `VERTICAL=1` or
`HELICAL=1`.

(19) | |||

(20) |

where .