-
|
Hello, I have designed a ring where the initial position starts from a straight section where there shall be no dispersion, the first cell is: Drift-Solenoid - Drift kind of straight cell. I give my own generated distribution using: import amrex.space3d as amr
import pandas as pd
from impactx import Config, ImpactX, elements,distribution,twiss
file = pd.read_csv("input_impact.dat",sep='\s+',skiprows=1).values
xt = file[:,0]
xpt = file[:,1]
yt = file[:,2]
ypt = file[:,3]
Tt = file[:,4]
Tpt = file[:,5]
qm_eev = 1.0 / 938.0/ 1e6 # proton charge/mass in e / eV
###================ This piece of code works as input own distribution
dx_podv = amr.PODVector_real_std()
dy_podv = amr.PODVector_real_std()
dt_podv = amr.PODVector_real_std()
dpx_podv = amr.PODVector_real_std()
dpy_podv = amr.PODVector_real_std()
dpt_podv = amr.PODVector_real_std()
for p_dx in xt:
dx_podv.push_back(p_dx)
for p_dy in yt:
dy_podv.push_back(p_dy)
for p_dt in Tt:
dt_podv.push_back(p_dt)
for p_dpx in xpt:
dpx_podv.push_back(p_dpx)
for p_dpy in ypt:
dpy_podv.push_back(p_dpy)
for p_dpt in Tpt:
dpt_podv.push_back(p_dpt)
pc.add_n_particles(dx_podv,dy_podv,dt_podv,dpx_podv,dpy_podv,dpt_podv,qm_eev,bunch_charge_C)When I check the step file, the zeroth step, where it is at the beginning of the cell, the dispersions in x and y reads: (0.2037306687794294,-0.2772598763007251) I have tried using the distribution function generation defined with 6D gaussian using the **twiss helper function, and it give the same result. I realized in the manual, for defining the Gaussian distribution from I wonder if this is due to the way I defined the coordinates and need some more parameters to define or there is some other reason? The distribution I generate is a specific coupled distirbution in distr = distribution.Gaussian(
**twiss(
beta_x=10.0,
beta_y=10.0,
beta_t=60000.0,
emitt_x=0.5e-6,
emitt_y=0.5e-6,
emitt_t=5e-05,
alpha_x=0.0,
alpha_y=0.0,
alpha_t=0.0,
),
)
sim.add_particles(bunch_charge_C, distr, 40000)I wonder why the "dispersion" functions in the step file gives non-zero entries for a straight cell at the beginning of the ring... Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
Hi @OLuckyG, Sorry for the delay, there was some travel and vacation on my end. The values are calculated from particles and dispersion calculations tend to be non-converged and noisy with low particle numbers. Do your values get better when you add more particles and converge to expected values? Their calculation is done here: |
Beta Was this translation helpful? Give feedback.
Hi @OLuckyG,
Sorry for the delay, there was some travel and vacation on my end.
The values are calculated from particles and dispersion calculations tend to be non-converged and noisy with low particle numbers. Do your values get better when you add more particles and converge to expected values?
Their calculation is done here:
https://github.com/BLAST-ImpactX/impactx/blob/25.09/src/diagnostics/ReducedBeamCharacteristics.cpp#L293-L297