.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples\01_example_cylindrical_lens.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_01_example_cylindrical_lens.py: Electrode Creation ------------------- Before creating any electrodes, we need to familiarize ourselves with a few concepts. First- whenever you initialize a system, you need to pick nr, nz, axial_size and radial_size. nr is the grid resolution in the r-dimension, and nz is the same for the z-dimension. Axial_size is the total length of the domain in meters in the z-dimension, and radial_size is the same for the r-dimension. This means the grid resolution in the z-dimension is axial_size/nz, and in the r-dimension is radial_size/nr. You should, if using nonstandard values for these, ensure you're aware of these so you can properly convert from grid units to meters. You can initialize a two-cylinder lens with -5000V and 0V respectively as follows: .. GENERATED FROM PYTHON SOURCE LINES 13-55 .. image-sg:: /auto_examples/images/sphx_glr_01_example_cylindrical_lens_001.png :alt: Picht, Display Options :srcset: /auto_examples/images/sphx_glr_01_example_cylindrical_lens_001.png :class: sphx-glr-single-img .. code-block:: Python :lineno-start: 13 import numpy as np from picht import ElectronOptics, ElectrodeConfig import matplotlib.pyplot as plt system = ElectronOptics(nr=100, nz=600, axial_size=0.6, radial_size = 0.1) electrode = ElectrodeConfig( start=30, width=100, ap_start=30, ap_width=40, outer_diameter = 50, voltage=-5000 ) system.add_electrode(electrode) electrode1 = ElectrodeConfig( start=160, width=100, ap_start=30, ap_width=40, outer_diameter = 50, voltage=0 ) system.add_electrode(electrode1) potential = system.solve_fields() trajectories = system.simulate_beam( energy_eV= 1000, start_z=0, r_range=(0.04, 0.06), angle_range=(0, 0), num_particles=10, simulation_time=2e-8 ) figure = system.visualize_system( trajectories=trajectories, display_options=[True, False, False, False]) #only switches on the lens visualization, keeps the e-field, b-field and animations off in the start, so the generated thumbnails look cleaner plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 5.215 seconds) .. _sphx_glr_download_auto_examples_01_example_cylindrical_lens.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 01_example_cylindrical_lens.ipynb <01_example_cylindrical_lens.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 01_example_cylindrical_lens.py <01_example_cylindrical_lens.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 01_example_cylindrical_lens.zip <01_example_cylindrical_lens.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_