Beam ion interaction using IONEFFECTS element

Moderators: cyao, michael_borland

Saroj_Jena
Posts: 13
Joined: 16 Nov 2020, 08:34

Beam ion interaction using IONEFFECTS element

Post by Saroj_Jena » 08 Nov 2021, 23:11

I am studying beam –ion instability for a ultra-low emittance storage ring and I am using Pelegant recent version (2021.3) for this. I have referred your article “Modeling ion effects for the Argonne Advanced Photon Source upgrade”, PRAB 2019. I tried with example file of APS U. I have few query regarding data extraction from Pelegant , please clarify them.

I did simulation for 100 turns to estimate ion density by inclusion of one IONEFFECTS element and also tried 10 equidistance IONEFFECTS element in the ring. I calculate the ion density by qIons divided by (the length between ion elements* charge of q). When I plot t vs ion density , It gives single plot for 1 IONEFFECTS element and 10 plot for 10 IONEFFECTS element. And when I make “use_bunched_mode = 1”, it gives me large no. of plots. how can I plot the average ion density in a ring vs time or turn.. And also, if IONEFFECTS element are not placed at equidistance, how ion density will be calculated. Please help me with the sddsplot script.


How can I plot ion instability amplitude vs. time or turn from which normally fast beam ion stability growth time can be calculated. In literature, it is the Jy but in elegant ebeam output or watchpoint output, I could get Cy which is centroid of each bunch at each turn. Please help me with the sddsplot script.

In strong-strong interaction, the emittance growth can also be estimated. Can this be observed by plotting vertical emittance by sddsplot -col=Pass,ey -graph=line ion1.wp00. Does it means weak-strong interaction if I set macro_ions = 1 and strong-strong interaction if I set macro_ions = more than 1.

In the .lte file, two watch elements are there which I followed from APS U example file, Does the input for start_pid and end_pid has correlation with number of turn we track.

The feature of arbitrary bunch filling pattern in new version is really very interesting. In the generateBunchTrain, pattern string has the form: <n1>*<s1>*<i1> <n2>*<s2>*<i2> ... where <n1> is the number of bunches, <s1> is the spacing in rf buckets, and <i1> is the relative intensity. Does this <i1> considers only integer number or it can take fraction too like 1.5, 0.5 etc...

I have attached my elegant files too. Please help, if I am doing any mistake.

Thanks for go through long list of querries

With regards
Saroj Jena
Attachments
ion1.ele
(1.27 KiB) Downloaded 123 times
hbsrsNov21.lte
(4.74 KiB) Downloaded 140 times

jcalvey
Posts: 19
Joined: 08 Jan 2021, 12:20

Re: Beam ion interaction using IONEFFECTS element

Post by jcalvey » 12 Nov 2021, 13:10

Hello Saroj,

This series of commands will plot the average ion density of the APS ring:

sddsprocess ion1.ionDens -pipe=out -process=qIons,last,qLast | sddscollapse -pipe | sddsbreak -pipe=in ion1.ionDens.break -decreaseOf=s
sddsprocess ion1.ionDens.break -process=qLast,sum,qTot -process=Pass,first,iPass
sddsprocess ion1.ionDens.break -define=param,lambda_ion,"qTot e_mks / 1104 /"
sddsplot ion1.ionDens.break -param=iPass,lambda_ion

You should replace the 1104 with the circumference of your ring.


To plot the instability amplitude vs time (as a fraction of vertical beam size):

sddsprocess ion1.ebeam ion1.ebeam.break -redefine=col,ampy,"Cy abs Sy /" -redefine=col,ampx,"Cx abs Sx /"
sddsprocess ion1.ebeam.break -process=ampy,max,ampyMax -redefine=param,iPass,Pass -process=ampx,max,ampxMax \
-process=ampx,rms,ampxRms -process=ampy,rms,ampyRms -process=Sy,rms,SyRms -process=Sx,rms,SxRms
sddsplot ion1.ebeam.break -param=iPass,ampyMax

To plot RMS vertical beam size:
sddsplot ion1.ebeam.break -param=iPass,SyRms


macro_ions is the number of ion macroparticles generated for each ion species, at each IONEFFECTS element, per bunch passage. This will quickly add up to many macroparticles. So the code is always strong-strong.

The start_pid and end_pid are the macroparticle indices that are counted for the bunch. So for 100 macroparticles per bunch, the first bunch has start_pid=1 end_pid=100, the second has start_pid=101 end_pid=200, etc. This is not related to the number of turns tracked.

generateBunchTrain should work with fractional intensities, if you have the latest version. Let me know if this doesn't work.

-Joe

Saroj_Jena
Posts: 13
Joined: 16 Nov 2020, 08:34

Re: Beam ion interaction using IONEFFECTS element

Post by Saroj_Jena » 18 Nov 2021, 00:37

Dear Joe,

Thanks a lot for answering my querries.

In plotting the ion density with the scripts, it does not plot the ion density since beginning. Please find the figure in the attachment.

I am using the latest version 2021.3.0 . I have checked with fractionional intensities in generating bunch train. It does not give any error but plot of intensity vs bucketnumber shows that it only considers the integer part.

With Regards
Saroj Jena
Attachments
iondensity_1train.png
iondensity_1train.png (10.57 KiB) Viewed 4481 times

tiansk
Posts: 39
Joined: 16 Mar 2012, 22:01

Re: Beam ion interaction using IONEFFECTS element

Post by tiansk » 19 Nov 2021, 01:13

jcalvey wrote:
12 Nov 2021, 13:10
Hello Saroj,

This series of commands will plot the average ion density of the APS ring:

sddsprocess ion1.ionDens -pipe=out -process=qIons,last,qLast | sddscollapse -pipe | sddsbreak -pipe=in ion1.ionDens.break -decreaseOf=s
sddsprocess ion1.ionDens.break -process=qLast,sum,qTot -process=Pass,first,iPass
sddsprocess ion1.ionDens.break -define=param,lambda_ion,"qTot e_mks / 1104 /"
sddsplot ion1.ionDens.break -param=iPass,lambda_ion

You should replace the 1104 with the circumference of your ring.


To plot the instability amplitude vs time (as a fraction of vertical beam size):

sddsprocess ion1.ebeam ion1.ebeam.break -redefine=col,ampy,"Cy abs Sy /" -redefine=col,ampx,"Cx abs Sx /"
sddsprocess ion1.ebeam.break -process=ampy,max,ampyMax -redefine=param,iPass,Pass -process=ampx,max,ampxMax \
-process=ampx,rms,ampxRms -process=ampy,rms,ampyRms -process=Sy,rms,SyRms -process=Sx,rms,SxRms
sddsplot ion1.ebeam.break -param=iPass,ampyMax

To plot RMS vertical beam size:
sddsplot ion1.ebeam.break -param=iPass,SyRms


macro_ions is the number of ion macroparticles generated for each ion species, at each IONEFFECTS element, per bunch passage. This will quickly add up to many macroparticles. So the code is always strong-strong.

The start_pid and end_pid are the macroparticle indices that are counted for the bunch. So for 100 macroparticles per bunch, the first bunch has start_pid=1 end_pid=100, the second has start_pid=101 end_pid=200, etc. This is not related to the number of turns tracked.

generateBunchTrain should work with fractional intensities, if you have the latest version. Let me know if this doesn't work.

-Joe

Hi,Joe

Thank you for the processing commands.I've got a question to consult you:In the ion1.ionDens file,
The first ten pages of column data qIons the last data is like(Let's say the whole ring has 10 IONEFFECTS points):[2.973959e-13
5.949169e-13
5.949957e-13
5.945871e-13
5.948576e-13
5.950268e-13
5.949863e-13
5.948041e-13
5.946711e-13
2.974974e-13]

Why is the first and last different from the others? How is ion generation handled in the program? For uniformly filled beam mode,I guess the qIons_delta should be the same,but in the ion1.ionDens file,the qIons_delta not quite the same.

With Regards
Tiansk

Saroj_Jena
Posts: 13
Joined: 16 Nov 2020, 08:34

Re: Beam ion interaction using IONEFFECTS element

Post by Saroj_Jena » 29 Nov 2021, 00:04

Helo Joe,
I plot the instability amplitude as per the script you have mentioned in previous reply. The instablity amplitude increases beyond 1 or 2 times beam size, which is not following the theoritical prediction perhaps. Please find the figure of instability amplitude vs turn which shows it increases upto 10 times beam size in vertical plane. Can you please clarify it . Also please answer my previous query on ion denisty plot.

Find the elegant files with which the result was obtained, which may give some clue for the output or where I am doing mistake.

With Regards
Saroj Jena
Attachments
ionstudy.rar
(9.36 KiB) Downloaded 120 times
instabilityamp.png

jcalvey
Posts: 19
Joined: 08 Jan 2021, 12:20

Re: Beam ion interaction using IONEFFECTS element

Post by jcalvey » 03 Dec 2021, 17:14

Saroj,
In plotting the ion density with the scripts, it does not plot the ion density since beginning. Please find the figure in the attachment.
The script plots the ion density at the end of each turn. So for your case, it looks like the density is near its maximum after a single turn.

I am using the latest version 2021.3.0 . I have checked with fractionional intensities in generating bunch train. It does not give any error but plot of intensity vs bucketnumber shows that it only considers the integer part.
I've attached a script that will do this, and an example bunch waveform. To use it you need to do the following:
  • In makeBunch.ele, set n_particles_per_bunch to the number of particles you want in the highest charge bunch. Note that all beam macroparticles in elegant have the same charge, so the other bunches will have fewer particles.
  • Run makeBunch.ele
  • cp makeBunch.out <rootname>.bunRef (where <rootname> is your choice)
  • Set up a fill file (see attached example). It should have two columns: Index, and WaveformNorm. Index is the bunch index (including empty buckets). WaveformNorm should be 1 for the highest charge bunch, and 0 for empty buckets. For other bunches, WaveformNorm should be the fraction of the bunch charge relative to the highest charge bunch.
  • Run the script: makeBunchTrainWF -rootname <rootname> -momentum <energy in GeV> -nBunches <harmonic number> -nPerBunch <number you put in makeBunch.ele> -bunchWF <name of the fill file>
Finally, in ion1.ele, replace the sdds_beam command with:

&sdds_beam
input = <rootname>.bun,
track_pages_separately = 0,
use_bunched_mode = 1
&end
Attachments
makeTrainFiles.zip
(2.82 KiB) Downloaded 124 times

jcalvey
Posts: 19
Joined: 08 Jan 2021, 12:20

Re: Beam ion interaction using IONEFFECTS element

Post by jcalvey » 05 Dec 2021, 13:06

Tiansk,
Why is the first and last different from the others? How is ion generation handled in the program? For uniformly filled beam mode,I guess the qIons_delta should be the same,but in the ion1.ionDens file,the qIons_delta not quite the same.
There are two reasons for this. First, in the example file, the first element starts at the beginning of the lattice. In the present implementation of the code, the first element does not know about the end of the lattice, so the effective length does not wrap around. So the first element would cover s=0 to s=50, the second s=50 to s=150, the third s=150 to s=250, etc. To give all elements the same effective length, you could add the following:

ILM_2SECT: ILMATRIX,L=55.2,NUX=1.810,NUY=0.9635,NUX1M=0.0,NUY1M=0.0,&
BETAX=19.488,BETAY=2.886,ALPHAX=-8.09E-5,ALPHAY=-0.00691,&
ETAX=0.172,ETAY=0.0,ETAPX=2.71E-6,ALPHAC=0.0,ALPHAC2=0.0

RING_ILM10_EVEN: LINE=(q,recirc,wp00,wp162,ILM_2SECT,&
ion0,ILM_4SECT,ion0,ILM_4SECT,ion0,ILM_4SECT,ion0,ILM_4SECT,&
ion0,ILM_4SECT,ion0,ILM_4SECT,ion0,ILM_4SECT,ion0,ILM_4SECT,&
ion0,ILM_4SECT,ion0,ILM_2SECT,extru)

And use RING_ILM10_EVEN as your beamline in ion1.ele.

Also, make sure you have the latest version of elegant. Old versions handled the effective length slightly differently.

-Joe

tiansk
Posts: 39
Joined: 16 Mar 2012, 22:01

Re: Beam ion interaction using IONEFFECTS element

Post by tiansk » 06 Dec 2021, 02:18

Hi,Joe:
Thank you for your explanation .I have another question about data processing, When I use multi-bunch train beam fillings, the column Sy & Sx in the ebeam file are 1 for NULL bucket, so :

sddsprocess ion1.ebeam ion1.ebeam.break -redefine=col,ampy,"Cy abs Sy /" -redefine=col,ampx,"Cx abs Sx /" ........

will not be the actual beam size, how do I get rid of unreasonable values?

With Regards
Tiansk
Attachments
ebeam.zip
(621.44 KiB) Downloaded 158 times

Saroj_Jena
Posts: 13
Joined: 16 Nov 2020, 08:34

Re: Beam ion interaction using IONEFFECTS element

Post by Saroj_Jena » 06 Dec 2021, 05:29

jcalvey wrote:
03 Dec 2021, 17:14
Saroj,
In plotting the ion density with the scripts, it does not plot the ion density since beginning. Please find the figure in the attachment.
The script plots the ion density at the end of each turn. So for your case, it looks like the density is near its maximum after a single turn.

I am using the latest version 2021.3.0 . I have checked with fractionional intensities in generating bunch train. It does not give any error but plot of intensity vs bucketnumber shows that it only considers the integer part.
I've attached a script that will do this, and an example bunch waveform. To use it you need to do the following:
  • In makeBunch.ele, set n_particles_per_bunch to the number of particles you want in the highest charge bunch. Note that all beam macroparticles in elegant have the same charge, so the other bunches will have fewer particles.
  • Run makeBunch.ele
  • cp makeBunch.out <rootname>.bunRef (where <rootname> is your choice)
  • Set up a fill file (see attached example). It should have two columns: Index, and WaveformNorm. Index is the bunch index (including empty buckets). WaveformNorm should be 1 for the highest charge bunch, and 0 for empty buckets. For other bunches, WaveformNorm should be the fraction of the bunch charge relative to the highest charge bunch.
  • Run the script: makeBunchTrainWF -rootname <rootname> -momentum <energy in GeV> -nBunches <harmonic number> -nPerBunch <number you put in makeBunch.ele> -bunchWF <name of the fill file>
Finally, in ion1.ele, replace the sdds_beam command with:

&sdds_beam
input = <rootname>.bun,
track_pages_separately = 0,
use_bunched_mode = 1
&end

Dear Calvey,
Thanks a lot for the explanation on bunch filling pattern.

Can you please suggest me how to plot the ion density since begining.

Also please comment on my previous query on instability amplitude which was plotted by redifining a column with -redefine=col,ampy,"Cy abs Sy /" . Why in my case, the instability amplitude saturates after reaching 10 times or more of beam size, whereas I think it should saturates in 1 or 2 times beam size as the electric field increases linearly upto beam size and thereafter becomes nonlinear and reduces too.

Thanks and regards
Saroj Jena

jcalvey
Posts: 19
Joined: 08 Jan 2021, 12:20

Re: Beam ion interaction using IONEFFECTS element

Post by jcalvey » 06 Dec 2021, 13:14

Saroj and Tiansk,

These are all good questions. Please be patient, I'm working through them in the order received
Saroj wrote:Find the elegant files with which the result was obtained, which may give some clue for the output or where I am doing mistake.
In your example file, is atrain.sdds the full bunch train? If so, you should comment out the duplicate_stagger[4] line in your sdds_beam command.

Post Reply