PTC Improvements and BugFixes#1200
Conversation
…on extraneous fringe call
…ling with orders with two digits
…ling with orders with two digits
…o use fint and fintx (fint2) separately. Comment out return so that rbend can have the rest of the attributes set
…e to be able to use more fringes in PTC
…on to rbend, sbend, quadrupole, sextupole and octupole. Stop solenoid being set to a marker in case of knl and ksl
…e, add k0 and k0s to octupole. Improve solenoid to act like multipole when l=0 and thick with l~=0
This reverts commit 30514d1.
To observe identical results, on the previous reference file, change n_wedge to 5 in sh_def_kind.f90
| track(5,i) = (sigf + (xf*pyf - yf*pxf)*Z) * beti | ||
| ! JG: 25.07.2023 - Fix for T variable to match PTC, | ||
| ! see http://cds.cern.ch/record/290467/files/arXiv:acc-phys_9510005.pdf | ||
| track(5,i) = (sigf + (xf*track(4,i) - yf*track(2,i))*Z) * beti |
There was a problem hiding this comment.
matter of taste but I would write (sigf + (xf*pyf_- yf*pxf_)*Z) * beti
There was a problem hiding this comment.
The variables pxf_ and pyf_ are currently being used by this function, could potentially have new variables called pxi and pyi :
Line from 3550
! Ripken formulae p.28 (3.35 and 3.36)
xf = track(1,i)
pxi = track(2,i)
yf = track(3,i)
pyi = track(4,i)
psigf = track(6,i) * beti
Then it becomes
| track(5,i) = (sigf + (xf*track(4,i) - yf*track(2,i))*Z) * beti | |
| track(5,i) = (sigf + (xf*pyi - yf*pxi)*Z) * beti |
|
Are the additional ptc attributes needed for all the elements in madx_dict.c? They have a memory impact. |
For the elements, quadrupole, sextupole, octupole, rbend and sbend, they all go through the fringe maps, so for activation of fringes, yes. However, if you are concerned about memory, there are some elements that do not have fringe maps, such as the electrostatic separator, in which you could remove current arguments, such as |
|
About memory impact, the fringe field attributes use about 8 numbers (let's round it to 10). So for example for the LHC, loading LHCB1 and LHCB2 in memory will use 500 MB (1GB after a matching), while the attribute will use 8 bytes x 10 attributes x 10000 elements ~ 0.5 MB. If all elements get those attributes (not the case) rounding up all numbers leads to a 0,1% memory increase. Just running PTC once will put this memory increase in the shadow... |
… needs misalignment)
Harmon in crab cavity is now correctly transferred, so it is not calculated when harmon = 0.
… tests. Other option is for the twiss table to read -1 and know that fint == fintx in this case
… is faster with the old version
|
I see you are still adding important stuff. How much time do you need to complete it? |
|
It should now be complete, all the tests pass, the final check that fails is unlikely to be due to this pull request, I suspect that the failure can be fixed with a |
|
Please see pull request #1203. With this fix, we can rerun the failing check, allowing it to pass. If you would like to see that the master fails, you can rerun this test, as I did for https://github.com/jgray-19/MAD-X/tree/master. |
|
ok I merge! |
|
can you add your PRs to https://github.com/MethodicalAcceleratorDesign/MAD-X/blob/master/Changes.md ? |
|
Yes, of course! Will look at this tomorrow. |
Please see presentation for the list of changes to the code.
Changes to note:
ptc_setswitchcallednocharge. If you set this value tofalse, PTC receives the true value of the charge from yourbeamrather than 1. This has a significant effect on the tests, where it used to tell the user that the charge that had been "set" was the charge from thebeam, not the actual charge that was set. Furthermore, in debug mode, ifnochargeis set is output, therefore the tests have been changed to accommodate this.ptcrbendandtruerbendhas been removed. Now we usetrue_rbend, therefore the diamond sequence has been changed accordingly.n_wedgeto 0 is more stable (due to no 0 rotations), however this means that the test fails at on the final digit of the test-ptc-twiss-56Dt-ini_map_man and test-ptc-align tests. These tests have therefore been changed.l=0 and (lrad=0 or ksi=0). The tests have now been changed accordingly.trsolof trrun.f90). This is the only changed to the physics of MAD-X, everything else is changes to MAD-X-PTC, including documentation.--EDIT--
I have now removed the changes to the solenoid equation. After running the tests, I found that both versions converged to the thick lens in the solenoid, but the previous implementation converged fastest in MAD-X, this is not the case in PTC or MAD-NG.
Closes issues:
#1160, #1135 and #1165 (was never completed)