Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduction of an "energy loss" element #632

Merged
merged 11 commits into from
Jul 31, 2023
Merged

Introduction of an "energy loss" element #632

merged 11 commits into from
Jul 31, 2023

Conversation

lfarv
Copy link
Contributor

@lfarv lfarv commented Jul 24, 2023

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 lfarv added enhancement Matlab For Matlab/Octave AT code Python For python AT code C For C code / pass methods labels Jul 24, 2023
@lfarv lfarv marked this pull request as draft July 24, 2023 14:39
@lfarv
Copy link
Contributor Author

lfarv commented Jul 24, 2023

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.

/* list of required fields */
plhs[0] = mxCreateCellMatrix(2,1);
mxSetCell(plhs[0],0,mxCreateString("EnergyLoss"));
mxSetCell(plhs[0],1,mxCreateString("EnergyLoss"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mxSetCell(plhs[0],1,mxCreateString("Energy"));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected!

@lfarv
Copy link
Contributor Author

lfarv commented Jul 24, 2023

I did some tests in python, not yet in Matlab

@lnadolski
Copy link
Contributor

lnadolski commented Jul 24, 2023

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
Copy link
Contributor

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

  • 10830 turns (theory at zero amplitude : 9858)
  • 3746 turns (theory at zero amplitude : 3634)

image

@lfarv
Copy link
Contributor Author

lfarv commented Jul 25, 2023

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

@lnadolski
Copy link
Contributor

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 lfarv marked this pull request as ready for review July 25, 2023 16:51
@lfarv
Copy link
Contributor Author

lfarv commented Jul 25, 2023

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

  • the element constructor sets the passmethod to 'IdentityPass': by default, it's disabled.
  • the Energy field is added or removed when enabling/disabling longitudinal motion, exactly as for dipoles

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

For me, it's ready.

@lfarv lfarv changed the title Added EnergyLossRadPass Introduction of an "energy loss" element Jul 25, 2023
@lnadolski
Copy link
Contributor

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.

  • U0 is correct since called with atgetU0(ring,'method','tracking');
  • all the rest in not compatible at his point

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.

update documentation
Copy link
Contributor

@lnadolski lnadolski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ringpara need some update

Copy link
Contributor

@lnadolski lnadolski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works well for me!

@lfarv
Copy link
Contributor Author

lfarv commented Jul 31, 2023

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

@lfarv lfarv merged commit 2f14d8e into master Jul 31, 2023
31 checks passed
@lfarv lfarv deleted the EnergyLossRadPass branch July 31, 2023 17:32
@simoneliuzzo simoneliuzzo mentioned this pull request Sep 8, 2023
@lcarver lcarver mentioned this pull request Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C For C code / pass methods enhancement Matlab For Matlab/Octave AT code Python For python AT code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants