3d field
Cartesian 3D Field ExampleĀ¶
InĀ [1]:
Copied!
from impact import Impact
# plotting modules
from impact.plotting import layout_plot
from bokeh.plotting import output_notebook
from bokeh.plotting import show
output_notebook(hide_banner=True)
from impact import Impact
# plotting modules
from impact.plotting import layout_plot
from bokeh.plotting import output_notebook
from bokeh.plotting import show
output_notebook(hide_banner=True)
InĀ [2]:
Copied!
# Make Impact object
ifile = "../templates/3dfield/ImpactT.in"
I = Impact(ifile)
# I.numprocs = 0
I.header["Bcurr"] = 0 # turn off space charge for speed
# Make Impact object
ifile = "../templates/3dfield/ImpactT.in"
I = Impact(ifile)
# I.numprocs = 0
I.header["Bcurr"] = 0 # turn off space charge for speed
InĀ [3]:
Copied!
# Show a MAD-style printout of each element in the lattice
I.print_lattice()
# Show a MAD-style printout of each element in the lattice
I.print_lattice()
SC_2D_to_3D: rotationally_symmetric_to_3d, description=name:SC_2D_to_3D, s=-0.1 !steering !0.0 1 1 -1 0.10 1.0 0.10 0.000 0.0 0.000 0.0 / !3D rf field rf_field: emfield_cartesian, description=name:rf_field, L=0.0866528, zedge=0.0, rf_field_scale=-111.11, rf_frequency=11424000000.0, theta0_deg=292.0, filename=1T1.T7, radius=0.002, s=0.0866528 !solenoid field sol: solrf, description=name:sol, L=0.2, zedge=0.0, rf_field_scale=0.0, rf_frequency=0.0, theta0_deg=0.0, filename=rfdata102, radius=0.01, x_offset=0.0, y_offset=0.0, x_rotation=0.0, y_rotation=0.0, z_rotation=0.0, solenoid_field_scale=0.5658, s=0.2 !change time step size change_dt: change_timestep, description=name:change_dt, dt=5e-13, s=0.2 drift_1: drift, description=, L=0.34, zedge=0.2, radius=0.15, s=0.54 !terminate the simulation !0.0 1 1 -99 0.55 1.0 0.55 /
InĀ [4]:
Copied!
# Note that emfield_cartesian plotting is not yet implemented!
I.plot(figsize=(9, 6))
# Note that emfield_cartesian plotting is not yet implemented!
I.plot(figsize=(9, 6))
InĀ [5]:
Copied!
# Plot the gun field directly
FM = I.fieldmaps["1T1.T7"]["field"]
FM.plot_onaxis("Ez")
# Plot the gun field directly
FM = I.fieldmaps["1T1.T7"]["field"]
FM.plot_onaxis("Ez")
InĀ [6]:
Copied!
layout = layout_plot(I.input["lattice"], height=300, width=600)
show(layout)
layout = layout_plot(I.input["lattice"], height=300, width=600)
show(layout)
InĀ [7]:
Copied!
%%time
I.run()
%%time
I.run()
CPU times: user 680 ms, sys: 53 ms, total: 733 ms Wall time: 55.5 s
InĀ [8]:
Copied!
I.plot(figsize=(9, 6))
I.plot(figsize=(9, 6))
InĀ [9]:
Copied!
I.plot("norm_emit_x", y2="mean_kinetic_energy", figsize=(9, 6))
I.plot("norm_emit_x", y2="mean_kinetic_energy", figsize=(9, 6))
InĀ [10]:
Copied!
I.particles["final_particles"].plot("z", "x")
I.particles["final_particles"].plot("z", "x")
InĀ [11]:
Copied!
I.particles["final_particles"].plot("z", "pz")
I.particles["final_particles"].plot("z", "pz")