PH1 Computational Ion Optics with IBSimu
This page contains material for the students of the course.
Slides
The introduction slides.
The ,main slides.
Getting started with the computing enironment
You can use your own computer if you have IBSimu 1.0.6 or 1.0.6dev on it. Another possibility is to use a Linux server at ph1.phys.jyu.fi, which has IBSimu 1.0.6 installed. You can access the server from the computer class Windows computer with SSH client putty. To use X Window graphics you need to
- Start the Xming server on the Windows computer
- Tick Connection → SSH → X11 → Enable X11 forwarding in putty
From a Linux computer one can connect to the server with ssh -X ph1.phys.jyu.fi
On the Linux server one needs to configure the environment to use IBSimu installed at /home/tvkalvas/ directory. This is done by editing the file .bashrc in your home directory. I recommend using emacs text editor. The .bashrc should contain at least the following lines:
export LD_LIBRARY_PATH="/home/tvkalvas/lib" export PKG_CONFIG_PATH="/home/tvkalvas/lib/pkgconfig"After modifying the .bashrc you should either log out and log in again or execute the file with
source .bashrc
Emacs
The recommended editor for the course is emacs. You can start editing a file, for example .bashrc with the command
emacs .bashrc &
By ending the command with & the command is executed in the background and the command line stays active for other use.
Here are the most common keyboard commands for emacs:
Ctrl-X Ctrl-S | Save file |
Ctrl-X Ctrl-C | Exit editor |
Ctrl-G | Cancel command |
Ctrl-X Ctrl-F | Find (open) file |
Ctrl-X B | Switch to another already opened file |
Ctrl-K | Kill. Cut the rest of the line and store to copy-paste buffer |
Ctrl-Y | Yank. Paste contents from the copy-paste buffer. |
Compilation of IBSimu dependent programs
To compile a program using IBSimu library it is easiest to use a Makefile such as the one shown below:
CC = g++ LDFLAGS = `pkg-config --libs ibsimu-1.0.6` CXXFLAGS = -Wall -g `pkg-config --cflags ibsimu-1.0.6` einzel: einzel.o $(CC) -o einzel einzel.o $(LDFLAGS) einzel.o: einzel.cpp clean: $(RM) *.o einzel
The compilation using this Makefile is done by calling make.
First example: Cylindrically symmetric simulation of an einzel lens
The first example shows the transport of a 10 keV, 1 mA Ar-8+ beam through a cylindrically symmetric, accelerating einzel lens with 5 kV voltage.
Source file: einzel.cpp
Makefile: Makefile
Geometry plot: geom.png
Second example: Ion extraction from plasma 2D
Source file: plasma.cpp
Makefile: Makefile
Geometry file: geom.dxf
Third example: Solenoid lens
Source file: solenoid.cpp
Makefile: Makefile
B-field file: sol.txt
Fourth example: 3D einzel lens
Source file: einzel3d.cpp
Makefile: Makefile
DXF-file: einzel3d.dxf
Fifth example: Slit beam extraction from plasma
Source file: slit.cpp
Makefile: Makefile
DXF-file: einzel3d.dxf
Sixth example: Slit beam extraction from plasma 3D
Homework for Tuesday: Make a 3D simulation from the fifth example. Use geometry from the STL-file below. Compare to the 2D case of the fifth example. How much does the projected emittance change?
STL-files:
slit_assembly_plasma_1.stl,
slit_assembly_puller_2.stl,
slit_assembly_gnd_3.stl
You need to translate the geometry with command such as
s1->translate( Vec3D(-0.5*(0.225303+0.525303),-0.5*(0.156421+0.456421),0.233167) ); to achieve sensible location of electrodes.
Source file: slit3d.cpp
Source file: analysis.cpp
Makefile: Makefile
Seventh example: Wien filter
Source file: wien.cpp
Makefile: Makefile
Eighth example: Cesium sputter source toy model
Source file: sputter.cpp
Makefile: Makefile
DXF-file: sputter.dxf
Ninth example: LIISA negative hydrogen ion source
Source file 1: liisa.cpp
Source file 2: liisa_mg.cpp
Source file 3: liisa_cont.cpp
Makefile: Makefile
DXF-file: LIISA_geom.dxf
B-field file: LIISA_bfield.txt
Tenth example: Fitting
Source file: fit.cpp
Fitting program: linfit.tar.gz
Description: README
Makefile: Makefile
B-field file: solfield_100A.txt
Eleventh example: 14 GHz ECR ion source extraction
Source file 1: ecr.cpp
Source file 2: analysis.cpp
Makefile: Makefile
DXF-file: geom.dxf
B-field file: bfield.txt
Twelfth example: Negative ion extraction parametric study
Homework for Thursday: Make a parametric study of J, eir, Tt, E0, Tp, Rf, Up.
Source file: simu.cpp
Makefile: Makefile
DXF-file: geom.dxf
Thirteenth example: Rough/Fine mesh simulation
Example on how to couple rough simulation and a fine simulation
Source file: simu.cpp
Makefile: Makefile
DXF-file: geom.dxf
Rough B-field file: bfield.dat
Fine B-field file: bfield_fine.dat
Source file: simu.cpp
Helper class: scalarfield2d.hpp
Helper class: scalarfield2d.cpp