Open ColwynGulliford opened 1 year ago
@ColwynGulliford "call::" is always needed. If there is some documentation that indicates otherwise please tell me where and I will fix it.
@ColwynGulliford beam_init parameters not set in example. Please correct.
Re: "call::", it's ok if it's always needed, but shouldn't a seg fault be avoided? When that happens it will kill a python kernel, say if someone is running pytao.
To run the example requires the following commands:
set global lattice_calc_on = False set beam_init position_file = initial_tao_particles.h5 set ele beginning e_tot = 1122995.9603226997 set beam_init n_particle = 1000 set beam_init bunch_charge = 1.0000000000000002e-12 set bmad_com csr_and_space_charge_on = False set ele * csr_method = off set global lattice_calc_on = True set global track_type = beam set global track_type = single
I've put these into the file "commands.tao" and reattached the example. Thanks!
Sorry I was misinterpreting. The bomb has been fixed and I am working on the emit problem.
Hi Dave,
I've updated the example files to have non-zero initial emittances / energy spread. This avoids the issues with the dispersion. I also have computed the emittance from GPT using the formula from Bmad (orange curve):
Note that in the solenoid there isn't any dispersion to first order:
This is why the gpt and gpt disp. removed curves are the same. So the way the projected emittance is computed is not described correctly by the formula:
I've attached an updated example with the non-zero emittance beam below:
Attached are particle x, px, y, py coordinates dumped at 3 z locations (in file name) from GPT: gpt_particles_at_0.0.txt gpt_particles_at_1.0.txt gpt_particles_at_0.5.txt
I traced down the problem to be that effectively Bmad is correcting for the vector potential in the solenoid when it reports the phase space position even though it is using the mechanical momentum when tracking tracking. This is an old convention which has outlived its usefulness. I will work on a fix...
I was able to confirm that, the momenta Tao reports is really:
In a solenoid Lz ~ Bsol, so this is the canonical momentum. I can make GPT agree with Tao if I use that variable:
I created a simple example of a uniform pancake beam (all particles z=0) and send it through a solenoid in GPT and Tao. I plot the transverse beam size:
and see good agreement. However it appears the projected emittance is not being computed, and perhaps calling the x.norm_emit from the bunch_comb is really just returning a.norm_emit:
Here GPT shows the projected emittance increase as particles enter the solenoid, whereas there is no increase in Tao.
Also, I noticed if I don't put "call::" in front of the field map file name in the lattice file, Tao segmentation faults.
The complete working example is attached. sol.zip