Page 1 of 2
modulate_elements
Posted: 06 Feb 2013, 09:16
by fliller
Michael,
I am attempting to do a simulation where I vary quadrupoles with time while tracking particles. I am using modulate_elements to vary the quadrupoles. I does not seem to be working however. Attached is the lattice file and a file called Tester.ele. Tester.ele produces the results that I expect when I look at the output of the watchpoint. DoTuneVariation_OCtopole.ele attempts to do the same thing using modulate_elements. The file that defines the quad strength is QuadScan.sdds, and just sets the quads to a constant value. Evcept for how the tune is changed, the two files should be identical (I think).
Am I doing anything wrong?
Ray
Re: modulate_elements
Posted: 06 Feb 2013, 10:02
by michael_borland
Ray,
It think if you set "refresh_matrix=1" in the &modulate_elements commands you should see the expected behavior.
Basically, elegant is not set up to recalculate the element's matrix as modulation is performed, because some elements have a matrix that isn't used for tracking. Kind of tricky, I know.
--Michael
Re: modulate_elements
Posted: 06 Feb 2013, 12:10
by fliller
Michael,
I tried that with version 25.0.2 and it did not work. So I upgraded to 25.1, and it still did not work.
Ray
Re: modulate_elements
Posted: 06 Feb 2013, 12:15
by michael_borland
Ray,
Your QuadScan.sdds file has no variation in the qf or qd columns
Code: Select all
% sddsprintout -format=double=%21.15e -col QuadScan.sdds
Printout for SDDS file QuadScan.sdds
time qf qd
---------------------------------------------------------------------
0.000000000000000e+00 2.073075000000000e+00 -1.362636000000000e+00
5.283655000000000e-04 2.073075000000000e+00 -1.362636000000000e+00
1.056731000000000e-03 2.073075000000000e+00 -1.362636000000000e+00
1.585097000000000e-03 2.073075000000000e+00 -1.362636000000000e+00
2.113462000000000e-03 2.073075000000000e+00 -1.362636000000000e+00
2.641828000000000e-03 2.073075000000000e+00 -1.362636000000000e+00
3.170193000000000e-03 2.073075000000000e+00 -1.362636000000000e+00
3.698559000000000e-03 2.073075000000000e+00 -1.362636000000000e+00
--Michael
Re: modulate_elements
Posted: 06 Feb 2013, 12:31
by fliller
Michael,
Correct. But you will notice that it is different than the lattice file. The lattice is set to a tune of 9.64. The Tester.ele adjusts the tunes of the lattice to 9.751 and then tracks.
The other file sets the quads to the values with should give a tune of 9.751 and then tracks. I'd expect that the tracking output of both .ele files would be identical for the posted case, and they are not.
Ray
Re: modulate_elements
Posted: 06 Feb 2013, 13:36
by michael_borland
Ray,
There appears to be a bug. I'm looking into it to see if there is a workaround.
--Michael
Re: modulate_elements
Posted: 06 Feb 2013, 13:48
by michael_borland
Ray,
The problem is that the code is only set up to modulate the first element of any group of elements with the same name. Until I can fix this, you'll need to give each modulated element a different name and include a &modulate_elements command for each. Alternatively, if you give names like "QF001", "QF002", etc., it should work to give one &modulate_elements command with name="QF0??".
--Michael
Re: modulate_elements
Posted: 06 Feb 2013, 14:20
by fliller
Michael,
I gave all of the elements names like QF01, QF02, etc. Then I tried the QF0? trick. That did not work, either giving me a SegV or another error. But if I give a separate &modulate_elements for each QF, then it is golden.
Thanks for the help/hack.
Ray
Re: modulate_elements
Posted: 06 Feb 2013, 14:26
by michael_borland
Ray,
I posted a fix for this bug under the Bugs topic. If you build from source, that should get you going.
If not, I hope to release the next revision in a few weeks.
--Michael
Re: modulate_elements
Posted: 06 Feb 2013, 14:36
by michael_borland
Ray,
Glad to hear the hack worked.
Can you send me the input files for the separated-names case? It will make a good addition to my regression tester.
--Michael