FieldElement#

class wake_t.beamline_elements.FieldElement(length, dt_bunch, bunch_pusher='boris', n_out=1, name='field element', fields=[], auto_dt_bunch=None, push_bunches_before_diags=True)[source]#

Generic class for any beamline element based on field tracking.

Parameters:
lengthfloat or str

Length of the plasma stage in m.

dt_bunchfloat, str or list of float and str

The time step for evolving the particle bunches. An adaptive time step can be used if this parameter is set to 'auto' and a auto_dt_bunch function is provided. A list of values can also be provided. In this case, the list should have the same order as the list of bunches given to the track method.

bunch_pusherstr

The pusher used to evolve the particle bunches in time within the specified fields. Possible values are 'rk4' (Runge-Kutta method of 4th order) or 'boris' (Boris method).

n_outint

Number of times along the stage in which the particle distribution should be returned (A list with all output bunches is returned after tracking).

namestr

Name of the plasma stage. This is only used for displaying the progress bar during tracking. By default, 'field element'.

fieldslist

List of Fields that will be applied to the particle bunches.

auto_dt_bunchcallable, optional

Function used to determine the adaptive time step for bunches in which the time step is set to 'auto'. The function should take solely a ParticleBunch as argument.

push_bunches_before_diagsbool, optional

Whether to push the bunches before saving them to the diagnostics. Since the time step of the diagnostics can be different from that of the bunches, it could happen that the bunches appear in the diagnostics as they were at the last push, but not at the actual time of the diagnostics. Setting this parameter to True (default) ensures that an additional push is given to all bunches to evolve them to the diagnostics time before saving. This additional push will always have a time step smaller than the the time step of the bunch, so it has no detrimental impact on the accuracy of the simulation. However, it could make convergence studies more difficult to interpret, since the number of pushes will depend on n_diags. Therefore, it is exposed as an option so that it can be disabled if needed.

Methods

track([bunches, opmd_diag, diag_dir, ...])

Track bunch through element.