Injection Efficiency

Moderators: cyao, michael_borland

Post Reply
marlibgin
Posts: 54
Joined: 15 Mar 2011, 12:43

Injection Efficiency

Post by marlibgin » 20 Jan 2020, 14:09

Hi all
I am trying something really simple ... on paper.
Calculating the injection efficiency (IE) by counting the number of particles tracked after a certain number of turns
This is part of a MOGA optimization where errors are introduced/propagated through different calculations

The fragment where I perform the IE calculation is reported below

At the watch-point W3 an INTERVAL of 100 counts is defined, then a run_control with n_passes = 101, so after 100 turns a result
is saved. Ideally a *.w3 file should be created with 2 pages, page=1 with a parameter Particles=1000
and page=2 with Particles<=1000 (some electrons being lost in the ring).

The critical element, in this case, seems to be the introduction of the file <rootname>.param (red block), which contains
a definition of INTERVAL=1 for watchpoint W3. However my idea was to override this definition by using alter_elements (green lines)

Elegant though does not seem to care about this

So the question is: why alter_element seems not to do its job?

Thanks very much for any clue ... Marco

! -------------------------------------------------
! Injection Efficiency with OFF-axis beam at -5.0mm
! -------------------------------------------------

&run_setup
lattice = <rootname>.new
use_beamline = RINGRF,
p_central_mev = 3.5e3,
default_order = 3,
rootname = <rootname>
semaphore_file = %s.done0
magnets = %s.mag
losses = %s.lost
&end

&load_parameters
filename = <rootname>.param
allow_missing_elements = 1
&end



&alter_elements
name=W3,
item=INTERVAL,
value = 100

differential=0,
multiplicative=0
&end


&alter_elements
name=RFC,
item=CHANGE_T,
value="0",
differential=0,
multiplicative=0
&end

&run_control
n_steps = 1,
n_indices = 0,
n_passes = 101
reset_rf_for_each_step = 1
first_is_fiducial = 0
restrict_fiducialization = 0
&end

&twiss_output
filename = %s.twi
concat_order = 2
radiation_integrals = 1
compute_driving_terms = 1
&end

&sdds_beam
input = input_coords.sdds,
input_type = "elegant",
sample_interval = 1,
reuse_bunch = 0,
&end

&track
center_on_orbit=0,
center_momentum_also=0,
offset_by_orbit=1,
offset_momentum_also=1
&end

! -----------------
! Momentum Aperture
! -----------------

etc, etc ...

michael_borland
Posts: 1927
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: Injection Efficiency

Post by michael_borland » 20 Jan 2020, 16:29

Marco,

Try setting alter_at_each_step=1 on the &alter_elements commands. Otherwise, the command takes place immediately and then gets squashed by &load_parameters.

Alternatively, you can use put exclude_type_pattern="WATCH" in the load_parameters command, so it will ignore data for WATCH elements.

--Michael

Dhital
Posts: 14
Joined: 24 Oct 2018, 14:11
Location: NY

Re: Injection Efficiency

Post by Dhital » 30 Jul 2020, 16:36

Hi Michael,

Using this example I tried the following but unable to get output for each interval. It printout each turns instead of specific turns.

&run_setup
lattice = SR_1000MeV.lte,
use_beamline = SR_cooler,
p_central = 293.54100292171,
parameters = "%s.param",
! rootname = <rootname>
default_order = 2,
always_change_p0 = 0,
&end

&load_parameters
filename = "%s.param"
allow_missing_elements = 1,
exclude_type_pattern="WATCH"
&end

&alter_elements
name=w1,
item=INTERVAL,
value = 100,
allow_missing_elements=1,
alter_at_each_step=1
&end
and I have defined w1 as:
w1: watch,filename="%s.w1",mode="coordinates"

I am trying this in elegant. Finally I have to apply it for pelegant. I need to run for million turns and need to save specific turns due to some memory issues.

Any help will be appreciated.

Sincerely,
Bhawin

michael_borland
Posts: 1927
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: Injection Efficiency

Post by michael_borland » 06 Oct 2020, 14:24

Bhawin,

What you are doing should work. I do basically the same thing all the time. Try using &save_lattice at the end of the run to save your lattice and verify that it is as you expect.

--Michael

Dhital
Posts: 14
Joined: 24 Oct 2018, 14:11
Location: NY

Re: Injection Efficiency

Post by Dhital » 12 Oct 2020, 10:19

Hi Michael,

Now, it works. Thank you so much.

Sincerely,
Bhawin

Post Reply