Optimizing the quadrupole strengths
Moderators: cyao, michael_borland
-
- Posts: 26
- Joined: 10 Feb 2022, 08:08
Re: Optimizing the quadrupole strengths
Thank you Michael. Sorry for the syntax mistake, i made some improves and now looks like this parameters are being generated in a right way.
I have one question about the beam generation. I am trying to simulate a gaussian beam of electron with sigma_x and sigma_y equals to 4 mm through this transport line. But, looking at examples and at the manual, i didn't find a way to generate the beam with this sigma. Is there an way to define this sigma on bunched_beam setup command? Also, if you had an example where this beam parameter is used, it also will be very helpull!
Thank you again for your time!
I have one question about the beam generation. I am trying to simulate a gaussian beam of electron with sigma_x and sigma_y equals to 4 mm through this transport line. But, looking at examples and at the manual, i didn't find a way to generate the beam with this sigma. Is there an way to define this sigma on bunched_beam setup command? Also, if you had an example where this beam parameter is used, it also will be very helpull!
Thank you again for your time!
-
- Posts: 1959
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Optimizing the quadrupole strengths
You can use the bunched_beam_moments command instead of bunched_beam. For example,
--Michael
Code: Select all
&bunched_beam_moments
n_particles_per_bunch = 1000,
distribution_type[0] = 3*"gaussian", ! Gaussian in (x, x'), (y, y'), (s, dp/p)
distribution_cutoff[0] = 3*3, ! Cut off gaussian random numbers at 3 sigma in all planes
S1_beta = 4e-3, S3_beta = 4e-3, ! 4mm rms size
S2_beta = 1e-4, S4_beta = 1e-4, ! 0.1 mrad rms divergence
S5_beta = 1.5e-3, ! 0.15% rms energy spread
S6_beta = 3e-3, ! 3 mm rms bunch length
&end
-
- Posts: 26
- Joined: 10 Feb 2022, 08:08
Re: Optimizing the quadrupole strengths
Thank you for the quick response! I used bunched_beam_moments, and looks like the beam is correct. But, the values obtained for focusing strenght optimization doesn't seem right.
If possible, can you take a look if the steps that i made seen correct?
In order to optimize my structure to focus the gaussian beam at the end of my beam line, i followed this steps:
1º) I used the run0.ele and run1.ele (attached), with transport6quad.lte, in order to find the Twiss parameters that will be used on optimization.
2º) For the optimization: i used transport.ele and transportOPT6quad.lte (attached), with the Twiss parameters acquired on step 1º. Then it returned me the values of the focusing strenghts needed to focus the beam at the end of my beam line.
Thank you for your time!
If possible, can you take a look if the steps that i made seen correct?
In order to optimize my structure to focus the gaussian beam at the end of my beam line, i followed this steps:
1º) I used the run0.ele and run1.ele (attached), with transport6quad.lte, in order to find the Twiss parameters that will be used on optimization.
2º) For the optimization: i used transport.ele and transportOPT6quad.lte (attached), with the Twiss parameters acquired on step 1º. Then it returned me the values of the focusing strenghts needed to focus the beam at the end of my beam line.
Thank you for your time!
- Attachments
-
- Attached.rar
- (2.73 KiB) Downloaded 159 times
-
- Posts: 1959
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Optimizing the quadrupole strengths
Can you provide the command to make run0.terms?
--Michael
--Michael
-
- Posts: 26
- Joined: 10 Feb 2022, 08:08
Re: Optimizing the quadrupole strengths
Sorry for the late. Yes. I used this sddsprocess command bellow.
# Make a first run that simulates a measurement
elegant run0.ele
# Create columns with expressions for optimization terms
sddsprocess run0.sig run0.terms \
-match=col,ElementName=M1 \
-print=col,xTerm,"%s#%ld.Sx %le / 1 1e-3 sene",ElementName,ElementOccurence,Sx \
-print=col,yTerm,"%s#%ld.Sy %le / 1 1e-3 sene",ElementName,ElementOccurence,Sy
# Peform fitting
elegant run1.ele
Thank you!
# Make a first run that simulates a measurement
elegant run0.ele
# Create columns with expressions for optimization terms
sddsprocess run0.sig run0.terms \
-match=col,ElementName=M1 \
-print=col,xTerm,"%s#%ld.Sx %le / 1 1e-3 sene",ElementName,ElementOccurence,Sx \
-print=col,yTerm,"%s#%ld.Sy %le / 1 1e-3 sene",ElementName,ElementOccurence,Sy
# Peform fitting
elegant run1.ele
Thank you!
-
- Posts: 1959
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Optimizing the quadrupole strengths
I think it was basically working. I made a few changes to improve agreement of run0 and run1. Look for "!MB" in the .ele files.
There's a script called runScript that runs the various simulations and plots the results.
I don't see any connection between run0.ele/run1.ele and transport.ele.
Also, transport.ele is matching at the first M1 element, in the middle of the beamline. I'm not sure if that was intended. It means that the quads downstream of that point are unconstrained.
--Michael
There's a script called runScript that runs the various simulations and plots the results.
I don't see any connection between run0.ele/run1.ele and transport.ele.
Also, transport.ele is matching at the first M1 element, in the middle of the beamline. I'm not sure if that was intended. It means that the quads downstream of that point are unconstrained.
--Michael
- Attachments
-
- example.zip
- (3.2 KiB) Downloaded 153 times
-
- Posts: 26
- Joined: 10 Feb 2022, 08:08
Re: Optimizing the quadrupole strengths
Hi Michael!
Thank you for the comments.
I was thinking that run0.ele and run1.ele could be used to find the twiss_parameters alpha_x, alpha_y, beta_x, beta_y. Then, as the optimization part envolves only the files: "transport.ele" and "transportOPT6quad.lte", i copied and paste these values of alpha_x,alpha_y, beta_x, beta_y, on twiss_output on optimization. But looking here on !MB points, this steps are not corrected?
I am not sure if it stays clear, but i have two lattice files, one for this twiss parameters values (transport6quad.lte) and one for optimization part (transportOPT6quad.lte).
Thank you again!
Thank you for the comments.
I was thinking that run0.ele and run1.ele could be used to find the twiss_parameters alpha_x, alpha_y, beta_x, beta_y. Then, as the optimization part envolves only the files: "transport.ele" and "transportOPT6quad.lte", i copied and paste these values of alpha_x,alpha_y, beta_x, beta_y, on twiss_output on optimization. But looking here on !MB points, this steps are not corrected?
I am not sure if it stays clear, but i have two lattice files, one for this twiss parameters values (transport6quad.lte) and one for optimization part (transportOPT6quad.lte).
Thank you again!
-
- Posts: 1959
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Optimizing the quadrupole strengths
It's not really clear to me what you want to do.
Do you have an incoming beam with particularly size and divergence, and you need to adjust the quadrupoles to match it to some beta and alpha values at the end? If not, what's the task?
--Michael
Do you have an incoming beam with particularly size and divergence, and you need to adjust the quadrupoles to match it to some beta and alpha values at the end? If not, what's the task?
--Michael
-
- Posts: 26
- Joined: 10 Feb 2022, 08:08
Re: Optimizing the quadrupole strengths
Hi Michael, sorry for the late!
Yes! I am trying to adjust (through optimization) the positions and focusing strength of the 6 quadrupoles of my TransportOPT6quad, to focus the beam at the end of my beam line. As you can see, now i am only trying to optimize the focusing strength to understand the process.
About this part of matching to some beta and alpha values at the end: maybe the concept of matching is not really clear to me. For example, on the twiss_output part of my elegant.ele file, matched equals to 1 means that the twiss parameters would be found by ELEGANT, while using to 0 means that i would have to put the initial values, would be this?
Thank you one more time!
Yes! I am trying to adjust (through optimization) the positions and focusing strength of the 6 quadrupoles of my TransportOPT6quad, to focus the beam at the end of my beam line. As you can see, now i am only trying to optimize the focusing strength to understand the process.
About this part of matching to some beta and alpha values at the end: maybe the concept of matching is not really clear to me. For example, on the twiss_output part of my elegant.ele file, matched equals to 1 means that the twiss parameters would be found by ELEGANT, while using to 0 means that i would have to put the initial values, would be this?
Thank you one more time!
-
- Posts: 1959
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Optimizing the quadrupole strengths
Yes, the "matched" parameter to &twiss_output is confusingly named. It really means "periodic". If it is zero, then you must supply the initial values. These are in principle independent of the beam parameters, but usually people set things up so they correspond.
Are you trying to minimize the beam size after your size quadrupoles, with the incoming beam parameters given by
If so, then you don't need to perform tracking at all. Just set up &twiss_output with matched=0 and give the initial beta function values that correspond to those beam sizes. Then, using the optimizer, minimize betax and betay at the end of the beamline by adjusting the quadrupoles. You also don't need the TWISS element in the beamline; that would be useful if you wanted to also vary the incoming twiss parameters, which I don't think is the case.
--Michael
Are you trying to minimize the beam size after your size quadrupoles, with the incoming beam parameters given by
Code: Select all
&bunched_beam_moments
bunch = %s.bun !!! Save for reuse
n_particles_per_bunch = 1000,
distribution_type[0] = 3*"gaussian", ! Gaussian in (x, x'), (y, y'), (s, dp/p)
distribution_cutoff[0] = 3*3, ! Cut off gaussian random numbers at 3 sigma in all planes
S1_beta = 4e-3, S3_beta = 4e-3, ! 4mm rms size
S2_beta = 3.2e-3, S4_beta = 3.2e-3, ! 3.2 mrad rms divergence
S5 = 3e-3, ! 0.3% rms energy spread (0.75[energy spread MeV]/ 250[beam MeV])*100%
S6 = 3e-3, ! 3 mm rms bunch length
&end
--Michael