atcollab / at

Accelerator Toolbox
Apache License 2.0
48 stars 31 forks source link

Introduction of an "energy loss" element #632

Closed lfarv closed 11 months ago

lfarv commented 12 months ago

This is a tentative answer to #629. A new 'EnergyLoss' element is added, together with its 'EnergyLossRadPass' passmethod.

This element simulates an abrupt energy loss. The longitudinal motion and damping times are affected accordingly. Equilibrium emittances also, but since there is no diffusion term associated, the computed emittances assume that the losses occur in a non-dispersive location.

The "energy loss" element is defined by its energy loss in eV.

lfarv commented 12 months ago

Hello @lnadolski, This is the 1st step: no new element class, so for the moment, the element must be defined as:

eloss = at.Marker('name', PassMethod='EnergyLossRadPass', EnergyLoss=40000.0, Energy=6.0e9)

Or, in Matlab:

eloss=atmarker('name','PassMethod','EnergyLossRadPass','EnergyLoss',40000.0,'Energy',6e9);

It is not yet handled by enable_6d/disable_6d, so you should append it to a ring where 6d is already enabled. However, I would appreciate some tests to validate the concept.

lfarv commented 12 months ago

I did some tests in python, not yet in Matlab

lnadolski commented 12 months ago

Dear @lfarv

I will come back to you tomorrow to review the code. It seems to works well for matlab

image

The new damping times seem fine. U0 for the bare lattice is 457 keV with damping times of 7.8/14.2/12.2 ms Jx is 1.83 U0 with extra loss is 946 keV with damping times of 49/69/43 ms Jx becomes 1.40 as expected from simple analytical computation

atx does not fully work, waiting to get atdisable6d fixed ;-) U0 is correct using the tracking option.

U0 = atgetU0(myringRadOn, 'method', 'tracking');

Regarding the 6D closed orbit, the fixed point for the energy is -201 keV for the nominal lattice and -657 keV as expected 👍

image

Regards,

Laurent.

lnadolski commented 12 months ago

Fitting the envelop, I have got : a longitudinal damping time of

image

lfarv commented 12 months ago

@lnadolski : all this looks nice! I'm going on with the dedicated element class.

lnadolski commented 12 months ago

Dear @lfarv

For me, the Matlab version is fine and fulfills the goal. To be improved: The code does not complain is the energy is missing

lfarv commented 12 months ago

@lnadolski : the Energy field is now handled by the enable/disable_6d method, as it is for magnetic elements (dipoles)

Saving/loading works, The total energy loss is correctly computed for both 'integral' and 'tracking' methods

For me, it's ready.

lnadolski commented 12 months ago

I have tested the code using the new constructor eloss=atenergyloss('name','PassMethod','EnergyLossRadPass','EnergyLoss',deltaU0,'Energy',2.75e9);

The only function not yet updated is ringpara.

Having 3 functions ringpara, atsummary and atx makes sometimes a bit of confusion. Maybe you should simplify in the future and avoid too much redundancy. ringpara should stay for back compatibility but be of proxy of atx or atsummary for instance.

lfarv commented 11 months ago

@lnadolski: a new approval is needed after solving conflicts with the master branch…