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.

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.

problem xy nr 9 -  Two parallel plates in vacuum - inequal length (mesh 200 x 200) - electrode points on numerical meshe problem xy nr 9 -  Two parallel plates in vacuum - inequal length (mesh 200 x 200) - distribution of electrostatic potential V(x,y), jet colormap problem xy nr 9 -  Two parallel plates in vacuum - inequal length (mesh 200 x 200) - equipotential lines

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:

At the moment Liebmann consists of modules:

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.

Running DEMO program

  1. First unzip LIebmann project archove to known directory.
  2. Source code files are situated in dorectory: source_code_ansi_c.

Names of executable fiels are:

Microprecessor architecture

Text terminal under MS Windows(TM)

In Windows OS we can run compiled program using console cmd.exe

  1. Run cmd.exe in Windows menu (text terminal).
  2. Change directory to directory with DEMO executables.
  3. Now we can run program (for example problem No.1) - use command: DEMO.XY.exe 1
  4. If program executes successfully, results are written to outputs catalogs.
  5. 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.
  6. 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.

  1. We run MSYS2 UCRT64
  2. On my computer project is situated in directory (for user ADS) C:\msys64\home\ADS
  3. We enter catalog with executables DEMO (cd Liebmann_project/source_code_ansi_c).
  4. We can run program (for example problem No.1) - we use command: ./DEMO.XY.exe 1
  5. If program executes successfully, results are written to outputs catalogs.
  6. 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.
  7. 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.

  1. Unzip project.
  2. We enter to unzipped project.
  3. Source files and executables are in directory: source_code_ansi_c
  4. Some files must have privilegdes to be executed: 2 commands: chmod +x *.run , chmod +x *.bash
  5. We can run program (for example problem No. 1) - we use command: ./DEMO.XY.exe 1
  6. If program executes successfully, results are written to outputs catalogs.
  7. 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.
  8. 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).

Licence

Liebmann software is available under free license GPL v.3.0+ (version 3.0 or any later).
Licencja GPL v.3.0+

Galleries

Example - map of electrostatic potential of plane vacuum diode with lateral plates at the cathode potential.
V_xy_flat_diode

Download

Info about project

References

Charged particle optics

  1. Pierre Grivet, "Electron Optics", 2nd. edition, Part 1 Optics, Pergamon Press 1972
  2. Pierre Grivet, "Electron Optics", Pergamon Press 1965
  3. James R.Nagel, "Solving the Generalized Poisson Equation Using the Finite-Difference Method (FDM)"
  4. Albert Septier, "Focusing of Charged Particles", Volume I, Academic Press 1967.
  5. Bohdan Paszkowski, "Optyka Elektronowa", Wydanie II, Wydawnictwa Naukowo - Techniczne, Warszawa 1965 (Polish edition)
  6. Bohdan Paszkowski, "Electron Optics", Iliffe Books Ltd. 1968 (English edition)
  7. DWO Heddle, "Electrostatic Lens Systems", IOP Publishing, Bristol and Philadelphia 2000
  8. Jon Orloff, "Handbook od Charged Particle Optics", 2nd edition, CRC Press 2009
  9. Albert Septier, "Applied Charged Particle Optics", Part A, Academic Press 1980

Programming and numerical methods

  1. Introduction to algorithmization and programming, lecture and exercises, UMCS 2003
  2. Bogdan Buczek, "Algorytmy. Ćwiczenia." Helion 2008
  3. Algorithmization and programming, lecture and exercises, UMCS 2007
  4. Niklaus Wirth, "Algorytmy + struktury danych = programy", wydanie szóste, Wydawnictwo Naukowo - Techniczne, Warszawa 2002 (Polish edition)
  5. Niklaus Wirth, "Algorithms + data structures = programs", first edition, Prentice Hall 1976 (English edition).
  6. Programming in C language, lecture and exercises, UMCS, 2007
  7. Donald Alcook, "Illustrating C", Cambridge University Press (1994).
  8. Numerical methods, lecture and exercises, UMCS 2006
  9. MATLAB - environment for numerical calculations (it has got wide documentation) link
  10. SIMION - charged particle optics simulation software link
  11. IBSimu - free ion beam simulator (with space charge efects) (GNU GPL license) link
  12. NetPBM file format link
  13. BMP file format link
  14. OpenGL tutorial: loading BMP files yourself
  15. Stephen Prata, "C Primer Plus", Addison - Wesley (English edition)
  16. Stephen Prata, "Szkoła programowania. Język C.", Helion, Gliwice(Polish edition)
  17. Kyle Loudon, "Mastering Algorithms with C", 3rd Edition, O'Reilly Media (1999)
  18. Kyle Loudon, "Algorytmy w C, Helion Gliwice (Polish edition)
  19. Richard Reese, "Understanding and using C pointers", O'Reilly Media (English edition)
  20. Richard Reese, "Wskaźniki w języku C. Przewodnik", Helion Gliwice (2014) (Polish edition)
  21. Zed A. Shaw, "Learn C the Hard Way: Practical Exercises on the Computational Subjects You Keep Avoiding (Like C)", Addison - Wesley (English Edition)
  22. 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)
  23. Andrew Koenig, "C traps and pitfalls", Addison-Wesley Professional (1989)
  24. https://cplusplus.com (for example reference to standard C library, examples) link
  25. https://en.wikibooks.org/wiki/C_Programming link
  26. https://pl.wikibooks.org/wiki/C link
  27. https://stackoverflow.com (np.for example problems with compilation, tutorials etc.) link
  28. Andrew Hunt, David Thomas, "Pragmatic Programmer, The: From Journeyman to Master", Addison Wesley 1999 (English edition)
  29. Andrew Hunt, David Thomas, "Pragmatyczny programista. Od czeladnika do mistrza.", Helion Gliwice, (Polish edition)
  30. B. M. Harwani, "Practical C Programming. Solutions for modern C developers to create efficient and well-structured programs", Packt 2020.
  31. 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.
  32. 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

foto_1 foto_2 foto_3 foto_4

Some time later another versions of theory seemed to have any sense

foto_5 foto_6

Final versions for LaTeX

foto_7 foto_8

footer

This static site does not use any cookies or gather any data.