ocelot-collab / ocelot

OCELOT is a multiphysics simulation toolkit designed for studying FEL and storage ring-based light sources.
GNU General Public License v3.0
86 stars 58 forks source link

Difference with CSRtrack result by including space-charge effect #243

Closed laxmisubramanyam closed 6 months ago

laxmisubramanyam commented 6 months ago

Hi @sergey-tomin @st-walker,

I exactly followed Tutorial N5. To make it more realistic, I just included the space-charge effect.

The final result, after including space-charge, shows quite noticeable difference with CSRtrack result (see the attached figure). Whereas, in tutorial N5 the result is in agreement with CSRtract result.

How to understand this difference.

csr = CSR(n_bin=300, m_bin=5, sigma_min=.2e-6)

sc = SpaceCharge()
sc.nmesh_xyz = [63, 63, 63]
sc.step = 0.1

# track with SC and witout CSR effect

navi = Navigator(lat)
navi.unit_step = 0.5 # m

# add space-charge process to navigator with start and stop elements
navi.add_physics_proc(sc, start_csr, lat.sequence[-1])

p_array_no = deepcopy(p_array_i)
print("\n tracking without CSR effect .... ")
start = time()
tws_no, p_array_no = track(lat, p_array_no, navi)
print("\n time exec:", time() - start, "sec")

# track with SC and with CSR effect

#again create Navigator with needed step in [m]
navi = Navigator(lat)
navi.unit_step = 0.5 # m

# add sc & csr process to navigator with start and stop elements
navi.add_physics_proc(sc, start_csr, lat.sequence[-1])
navi.add_physics_proc(csr, start_csr, lat.sequence[-1])

start = time()
p_array_csr = deepcopy(p_array_i)
print("\n tracking with CSR effect .... ")
tws_csr, p_array_csr = track(lat, p_array_csr, navi)
print("\n time exec:", time() - start, "sec")

arcline_traj_SC_CSR