-
Notifications
You must be signed in to change notification settings - Fork 39
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
TWISS drift with EXACT flag has errors in the time variable #1123
TWISS drift with EXACT flag has errors in the time variable #1123
Conversation
Great! Could you add the file 220614a13.txt as additional twiss-test? |
I have the test all set up; as written it depends on #1121 having been applied as well. Do you want me to add it to the pull request as-is, comment out lines in the the .cfg files to only check the twiss and sectormap output for now (so that it's not dependent on the ptc changes in #1121), or create a separate pull request for the test? |
I merged #1121 , so you can add the test. Two more things.
is missing! This is needed to introduce energy error in presence of cavities. Can you add or remove the line outside the if statement?
Thanks again! |
Simplifies the code and makes it easier to get things right
Also simplified the code.
b3570fa
to
7d7fabd
Compare
I've added the test case to the pull request. |
Below there is some explanation for deltap (a parameter that introduces an energy error and redefine momenta) and pt (the coordinate). Indeed, PTC, as far as I know, does not have the same mechanism to introduce energy error. I think it can be done using total_time=True and changing the RF frequency, but I have never tried. |
In PTC we could introduce a dtbyds like in TWISS to obtain the same functionality; however, we would need to keep in mind that the momenta will differ from those of MAD-X, that are scaled by Ps. In TWISS the scaling by Ps is essential to keep pt small, given that transfer map are correct in pt to first order (beside now the drift in the exact option). If we equipped TWISS with correct transfer maps (which we will very likely be forced to do to handle FCC lattices) we could abandon the Ps normalization in favour of P0 like PTC. Still, even in this context, the dtbyds is an useful feature to keep to study energy errors. |
Thanks @rdemaria for that info. It would be helpful to get the explanation correct in the MAD-X manual, what's there appears to be incomplete and not entirely consistent. Given that, the code for exact drifts should be handling everything correctly (I did some checks on a FODO cell with dipoles with and without exact drifts). |
This is very nice! Indeed there was an error in the time variable for the maps. I also discovered this but then the LHC commissioning got in the way. For me this is fine to merge since it does the same thing but with the correct time! |
The code for the exact drift for
twiss
miscalculates the time components of the linear and second order maps (magnitude, not sign). Here's an example demonstrating it: 220614a13.txt; all thevalue
commands should output something zeroish. Note for the example to make sense, you need to have applied #1121 (the fix for the sign error for the time variable in linear and higher order maps in PTC).