wersja polska (Polish version)
main page
Liebmann - (still unfinished) software to make charged particle optics computations.
About program
Liebmann software is intended to make computatios of electron / ion optical systems.
Now it can determine distribution of electric field potential in vacuum (metal electrodes and vacuum, without dielectric).
Laplace equation
Liebmann software can solve Laplace equation.
This is partial differential equation, which describes electrostatic field in vacuum.
We postulate, that metal electrodes have fixed electrostatic potentials and they are surrounded by electrostatic field. We want to detemine distribution of electrostatic potential of this field. We want do determine electrostatic potential in all mesh points, which represent vacuum.
Example below describes such non-standard problem. This is two - dimensional problem (X-Y). Left picture describes numerical meshes, which are used in computations. There are two plane plates. However, they have inequal length. Numerical mesh has 200 rows and 200 columns. Green electrode has potential -1.0 [V]. Red electrode has potential +1.0 [V]. White points in electrode surrounding represent vacuum. We want to determine electrostatic potential distribution in vacuum points. It can be calculated using for example relaxation method, which can be done by Liebmann program. The middle picture describes computation result - mapping calculated potential to colours. Mapping algorithm is "jet" (described in documentation). Right picture shows equipotential lines. Detailed description if this problem has been showed in gallery (problem No. 9).
Pictures on this site have 2 pixels wide frames.
Relaxation method
Liebmann program uses relaxation method (consecutive approximations). This method is also named Liebmann'a relaxation method. The goal is determination of distribution of electrostatic potential at points, which represent vacuum. The relaxation method consists in processing relaxation procedure for each point, which represents vacuum. If this point is inside mesh this procedure may seem to be easy (in 2D X-Y geometry) (adding potentials of 4 nearest neighbours of given mesh - from left, right, up, bottom and then multiply this sum by 4). After each relaxation procedure we check, how much new value differs from old value stored in our point. It enable us to check the maximal change of potental on whole the mesh during relaxation procedure. If another relaxation procedure processed on mesh does not change significantly the potential distribution, then computation is stopped and our potential distribution on mesh is treated as a newly found solution. Obtained results are written to output files.
Technical details
Liebmann software is based on robust FLOSS tools (ANSI C language, gcc compiler).
Liebmann is being developed on 2 environments:
- Linux Mint - (gcc, xed, texlive, netpbm)
- MS Windows(TM) - gcc (MinGW-w64, MSYS2, ucrt), Notepad++, MiKTeX, Faststone Image Viewer)
At the moment Liebmann consists of modules:
- Module (relax_xy) contains algorithms to calculate distribution of electrostatic potential in 2D flat coordinates (X-Y).
- Module (mesh_xy) contains functions to support numerical meshes (eg. setting potentials of nodes, writing mesh to file .DAT. BMP, .PPM)
- Module (anls_xy) contains algorithms to analyze output data (eg. determination of equipotential lines).
- Module (relax_rz) calculates electrostatic field in 2D cylindrical coordiantes (Z-Rs).
- Module (colormap) does mapping of potential and other calculated values to colours.
- Files (demo_xy_problems) contains functions to define problems to solve (10 problems per file). Definition of problems (shape of electrodes) uses elements of geometry - rectangles, circles and ellipses.
These modules are written in ANSI C language. Only writing to BMP file requires stdint.h file from C99 standard.
At the moment defining of problem to solve is defined "directly in source code".
DEMO executables
Liebmann algorithms are used in two executables DEMO_*.
These programs are such as technology demonstration of Liebmann possibilities.
- Program DEMO_XY determines electrostatic field for a few electrostatic problems, which are have been defined "in program's code".
- Program DEMO_ZR determines electrostatic field of 3 electrode electrostatic unipotential "einzel" lens. At the moment it has not been checked carefully.
Running DEMO program
- First unzip LIebmann project archove to known directory.
- Source code files are situated in dorectory: source_code_ansi_c.
Names of executable fiels are:
- DEMO_XY.exe (version for MS Windows (TM) operating system).
- DEMO_XY.run (version for Linux operating system).
Microprecessor architecture
- Exacutables has been compiled by default for architecture x86_64.
- If we want to change architecture, we must recompile project with changed compiler options (flag march).
Text terminal under MS Windows(TM)
In Windows OS we can run compiled program using console cmd.exe
- Run cmd.exe in Windows menu (text terminal).
- Change directory to directory with DEMO executables.
- Now we can run program (for example problem No.1) - use command: DEMO.XY.exe 1
- If program executes successfully, results are written to outputs catalogs.
- We must remember, that only catalog outputs_xy_jpg is extraordinary. In Linux OS this catalog is written during serial conversion files from standard PPM do JPG.
- To watch PPM files additional image viewer is needed, for example Fast Stone Image Viewer (TM).
Option with MSYS2 environment. Liebmann project id being developed in MSYS2, UCRT64 environment. This environment uses bash shell.
- We run MSYS2 UCRT64
- On my computer project is situated in directory (for user ADS) C:\msys64\home\ADS
- We enter catalog with executables DEMO (cd Liebmann_project/source_code_ansi_c).
- We can run program (for example problem No.1) - we use command: ./DEMO.XY.exe 1
- If program executes successfully, results are written to outputs catalogs.
- We must remember, that only catalog outputs_xy_jpg is extraordinary. In Linux OS this catalog is written during serial conversion files from standard PPM do JPG.
- To watch PPM files additional image viewer is needed, for example Fast Stone Image Viewer (TM).
Under MSYS2 UCRT64 environment we can also compile project. We need gcc package for appropriate version of environment. I use command (for pacman package manager):
pacman -S mingw-w64-ucrt-x86_64-gcc
Windows should see gcc compiler, so we need to add another path to Path System Enviromnent (path to tools for MSYS2).
C:\msys64\ucrt\bin
When we have gcc under MSYS2 UCRT64 enviromnent, we can compile project by script build_demo_xy_mingw_ucrt.
Text terminal under Linux
In Linux we run text console.
- Unzip project.
- We enter to unzipped project.
- Source files and executables are in directory: source_code_ansi_c
- Some files must have privilegdes to be executed: 2 commands: chmod +x *.run , chmod +x *.bash
- We can run program (for example problem No. 1) - we use command: ./DEMO.XY.exe 1
- If program executes successfully, results are written to outputs catalogs.
- We must remember, that catalog outputs_xy_jpg is extraordinary. We can convert all files from format PPM to JPG using script demo_xy_convert_to_jpg.bash. We need to install package netpbm.
- To watching picture standard picture viewer should be sufficient.
Compilation
Each program has its own compiling script. Their names are "build" and appropriate rest of name.
Script build runs compiler gcc (Linux) or MinGW (Windows) with many addidtional flags (based on GNU GSL library). Under Linux each script must have permission to be run (command chmod u+x *.bash).
Results
Computation results are written (or not, if failure) to "outputs" catalog for each program.
Graphic files have format .PBM and text files have .dat extension. Under Linux .PBM files should be easily displayed by default file manager. Under Windows you can use additional image viewer (I have tested Fast Stone Image Viewer).
- Computation results are written (or not, if failure) to directories "outputs" for appropriate program and format.
- Graphic files have formats .BMP and .PPM
- Text files have extension .dat.
- Under Linux OS .PPM files could be able to be opened by typical picture viewer.
- Under Linux OS all the .PPM files can be converted to .JPG standard and moved to other catalog by script demo_xy_convert and package netpbm (ppmtojpeg program).
- Under Windows OS user can watch .BMP files. Additional picture browser can be used to browse .PPM files (I have tested with Fast Stone Image Viewer).
Licence
Liebmann software is available under free license GPL v.3.0+ (version 3.0 or any later).
Galleries
Example - map of electrostatic potential of plane vacuum diode with lateral plates at the cathode potential.
Download
Info about project
References
Charged particle optics
- Pierre Grivet, "Electron Optics", 2nd. edition, Part 1 Optics, Pergamon Press 1972
- Pierre Grivet, "Electron Optics", Pergamon Press 1965
- James R.Nagel, "Solving the Generalized Poisson Equation Using the
Finite-Difference Method (FDM)"
- Albert Septier, "Focusing of Charged Particles", Volume I, Academic Press 1967.
- Bohdan Paszkowski, "Optyka Elektronowa", Wydanie II, Wydawnictwa Naukowo - Techniczne, Warszawa 1965 (Polish edition)
- Bohdan Paszkowski, "Electron Optics", Iliffe Books Ltd. 1968 (English edition)
- DWO Heddle, "Electrostatic Lens Systems", IOP Publishing, Bristol and Philadelphia 2000
- Jon Orloff, "Handbook od Charged Particle Optics", 2nd edition, CRC Press 2009
- Albert Septier, "Applied Charged Particle Optics", Part A, Academic Press 1980
Programming and numerical methods
- Introduction to algorithmization and programming, lecture and exercises, UMCS 2003
- Bogdan Buczek, "Algorytmy. Ćwiczenia." Helion 2008
- Algorithmization and programming, lecture and exercises, UMCS 2007
- Niklaus Wirth, "Algorytmy + struktury danych = programy", wydanie szóste, Wydawnictwo Naukowo - Techniczne, Warszawa 2002 (Polish edition)
- Niklaus Wirth, "Algorithms + data structures = programs", first edition, Prentice Hall 1976 (English edition).
- Programming in C language, lecture and exercises, UMCS, 2007
- Donald Alcook, "Illustrating C", Cambridge University Press (1994).
- Numerical methods, lecture and exercises, UMCS 2006
- MATLAB - environment for numerical calculations (it has got wide documentation) link
- SIMION - charged particle optics simulation software link
- IBSimu - free ion beam simulator (with space charge efects) (GNU GPL license) link
- NetPBM file format link
- BMP file format link
- OpenGL tutorial: loading BMP files yourself
- Stephen Prata, "C Primer Plus", Addison - Wesley (English edition)
- Stephen Prata, "Szkoła programowania. Język C.", Helion, Gliwice(Polish edition)
- Kyle Loudon, "Mastering Algorithms with C", 3rd Edition, O'Reilly Media (1999)
- Kyle Loudon, "Algorytmy w C, Helion Gliwice (Polish edition)
- Richard Reese, "Understanding and using C pointers", O'Reilly Media (English edition)
- Richard Reese, "Wskaźniki w języku C. Przewodnik", Helion Gliwice (2014) (Polish edition)
- Zed A. Shaw, "Learn C the Hard Way: Practical Exercises on the Computational Subjects You Keep Avoiding (Like C)", Addison - Wesley (English Edition)
- Zed A. Shaw, "Programowanie w C. Sprytne podejście do trudnych zagadnień, których wolałbyś unikać (takich jak język C)", Helion Gliwice (Polish Edition)
- Andrew Koenig, "C traps and pitfalls", Addison-Wesley Professional (1989)
- https://cplusplus.com (for example reference to standard C library, examples) link
- https://en.wikibooks.org/wiki/C_Programming link
- https://pl.wikibooks.org/wiki/C link
- https://stackoverflow.com (np.for example problems with compilation, tutorials etc.) link
- Andrew Hunt, David Thomas, "Pragmatic Programmer, The: From Journeyman to Master", Addison Wesley 1999 (English edition)
- Andrew Hunt, David Thomas, "Pragmatyczny programista. Od czeladnika do mistrza.", Helion Gliwice, (Polish edition)
- B. M. Harwani, "Practical C Programming. Solutions for modern C developers to create efficient and well-structured programs", Packt 2020.
- Richard F. Gilberg, Behrouz A. Forouzan, "Data Structures: A Pseudocode Approach with C". Second Edition, (C) 2005 Course Technology, a division of Thomson Learning, Inc.
- Suad Alagic, Michael A. Arbib, "The Design of Well-Structured and Correct Programs", Springer 1978
I would not recommend search publications in "shadow libraries" (violation of copyrights etc.).
Photos of project realization
The beginnings were not brillant. In fact I don't know, whether final versions are fully correct.
I did my best. The third attempt was probably better.
Early drafts
Some time later another versions of theory seemed to have any sense
Final versions for LaTeX
footer
This static site does not use any cookies or gather any data.
Darmowy hosting zapewnia PRV.PL