envelope_1d module

Define class to compute beam propagation in envelope, 1D, no space-charge.

This solver is fast, but should not be used at low energies.

class Envelope1D(*, reference_phase_policy, default_field_map_folder, beam_kwargs, export_phase, phi_s_definition='historical', n_steps_per_cell, method, **kwargs)[source]

Bases: BeamCalculator

The fastest beam calculator, adapted to high energies.

The following elements are explicitly supported. Note that, by default, an element that is implemented but not explicitly supported is replaced by a DRIFT. In 1D, this is perfectly acceptable for most non-implemented elements that act on the transverse dynamics, such as THIN_LENS.

Aperture

Edge

SuperposedFieldMap

Bend

FieldMap

SuperposedPlaceHolderElt

Diagnostic

Quad

ThinSteering

Drift

Solenoid

Parameters:
  • reference_phase_policy (Literal['phi_0_abs', 'phi_0_rel', 'phi_s'] | Literal['as_in_original_dat'])

  • default_field_map_folder (Path | str)

  • beam_kwargs (BeamKwargs)

  • export_phase (Literal['phi_0_abs', 'phi_0_rel', 'phi_s'] | Literal['as_in_original_dat'] | Literal['as_in_settings'])

  • phi_s_definition (Literal['historical', 'lagniel'], default: 'historical')

  • n_steps_per_cell (int)

  • method (Literal['RK4', 'leapfrog'])

flag_cython = False
__init__(*, reference_phase_policy, default_field_map_folder, beam_kwargs, export_phase, phi_s_definition='historical', n_steps_per_cell, method, **kwargs)[source]

Set the proper motion integration function, according to inputs.

Parameters:
  • reference_phase_policy (Literal['phi_0_abs', 'phi_0_rel', 'phi_s'] | Literal['as_in_original_dat'])

  • default_field_map_folder (Path | str)

  • beam_kwargs (BeamKwargs)

  • export_phase (Literal['phi_0_abs', 'phi_0_rel', 'phi_s'] | Literal['as_in_original_dat'] | Literal['as_in_settings'])

  • phi_s_definition (Literal['historical', 'lagniel'], default: 'historical')

  • n_steps_per_cell (int)

  • method (Literal['RK4', 'leapfrog'])

Return type:

None

_set_up_specific_factories()[source]

Set up the factories specific to the BeamCalculator.

This method is called in the BeamCalculator.__init__(), hence it appears only in the base BeamCalculator.

Todo

default_field_map_folder has a wrong default value. Should take path to the .dat file, that is not known at this point. Maybe handle this directly in the InstructionsFactory or whatever.

Return type:

None

run_with_this(accelerator_id, set_of_cavity_settings, elts, **kwargs)[source]

Use solver on elts, including the set_of_cavity_settings.

Parameters:
  • accelerator_id (str) – Associated Accelerator.id. Looks like: 0000001_Solution.

  • set_of_cavity_settings (SetOfCavitySettings) – The cavity settings to use for every cavity in elts. They can be given by an optimization algorithm, or taken from cavity objects.

  • elts (ListOfElements) – List of elements in which the beam must be propagated.

Return type:

SimulationOutput

Returns:

Holds energy, phase, transfer matrices (among others) packed into a single object.

init_solver_parameters(accelerator)[source]

Create the number of steps, meshing, transfer functions for elts.

The solver parameters are stored in the beam_calc_param attribute of Element.

Parameters:

accelerator (Accelerator) – Object which ListOfElements must be initialized.

Return type:

None

property is_a_multiparticle_simulation: bool

Return False.

property is_a_3d_simulation: bool

Return False.

_post_treat_cavity_settings(cavity_settings, results, length_m)[source]

Compute synchronous phase, accelerating field and acceptances.

Also store these quantities in cavity_settings.

Todo

Integrate this to CavitySettings.

Parameters:
Return type:

None

_abc_impl = <_abc._abc_data object at 0x7318faeff340>
_store_entry_phase_in_settings(phi_bunch_abs, cavity_settings)[source]

Set entry phase.

Parameters:
Return type:

None