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(*, flag_phi_abs, n_steps_per_cell, method, out_folder, default_field_map_folder, phi_s_definition='historical', **kwargs)[source]

Bases: BeamCalculator

The fastest beam calculator, adapted to high energies.

Parameters:
  • flag_phi_abs (bool)

  • n_steps_per_cell (int)

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

  • out_folder (Path | str)

  • default_field_map_folder (Path | str)

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

flag_cython = False
__init__(*, flag_phi_abs, n_steps_per_cell, method, out_folder, default_field_map_folder, phi_s_definition='historical', **kwargs)[source]

Set the proper motion integration function, according to inputs.

Parameters:
  • flag_phi_abs (bool)

  • n_steps_per_cell (int)

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

  • out_folder (Path | str)

  • default_field_map_folder (Path | str)

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

_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.

Return type:

None

alternative_run(elts, update_reference_phase=False, **kwargs)[source]

Compute beam propagation in 1D, envelope calculation.

This is the same as run, but without type hints in the docstring. Also without printing the default value in the docstring. Should have the same appearance as the classic run().

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

  • update_reference_phase (bool, default: False) – To change the reference phase of cavities when it is different from the one asked in the TOML. To use after the first calculation, if BeamCalculator.flag_phi_abs does not correspond to CavitySettings.reference.

Returns:

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

Return type:

SimulationOutput

run(elts, update_reference_phase=False, **kwargs)[source]

Compute beam propagation in 1D, envelope calculation.

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

  • update_reference_phase (bool, optional) – To change the reference phase of cavities when it is different from the one asked in the TOML. To use after the first calculation, if BeamCalculator.flag_phi_abs does not correspond to CavitySettings.reference. The default is False.

Returns:

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

Return type:

SimulationOutput

run_with_this(set_of_cavity_settings, elts, use_a_copy_for_nominal_settings=True)[source]

Use solver on elts, including the set_of_cavity_settings.

Parameters:
  • set_of_cavity_settings (SetOfCavitySettings | None) – The new cavity settings to try. If it is None, then the cavity settings are taken from the FieldMap objects.

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

  • use_a_copy_for_nominal_settings (bool, optional) – To copy the nominal CavitySettings and avoid altering their nominal counterpart. Set it to True during optimisation, to False when you want to keep the current settings. The default is True.

Returns:

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

Return type:

SimulationOutput

post_optimisation_run_with_this(optimized_cavity_settings, full_elts, **specific_kwargs)[source]

Run Envelope1D with optimized cavity settings.

With this solver, we have nothing to do, nothing to update. Just call the regular run_with_this() method.

Parameters:
Return type:

SimulationOutput

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.

Parameters:
Return type:

None

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

Set entry phase.

Parameters:
Return type:

None