Can anybody help me to find books or MATLAB code examples for solving electric field of the electron gun(fig.1)with finite difference method? Python code examples are also perfect. the schematic of the electron gun

The electron gun includes three electrodes,1,2,3.The voltages of three electrodes are 0V,100V,1000V,respectively.

  • $\begingroup$ Do you need to find the electric field and the trajectory of electrons? $\endgroup$ – nicoguaro Jan 30 '18 at 12:49
  • 4
    $\begingroup$ What have you tried so far? Your question in essence asks others to write a code for you. $\endgroup$ – Wolfgang Bangerth Jan 30 '18 at 13:09
  • $\begingroup$ I have tried to solve this problem with MATLAB, but I think the MATLAB codes is not perfect. So I want to find some similar examples. $\endgroup$ – yee Jan 31 '18 at 1:19

I think the canonical way to solve this problem (at least in a classroom setting) is to approximate the Laplacian (the PDE that governs the scalar potential $V$) using finite differences in Cartesian coordinates. When you apply Gauss-Jacobi algorithm to such a linear system, you end up with a particularly simple scheme: at each successive iteration, every potential sample $V_{i,j}$ should be overwritten with the average of its four neighbors (up/down/left/right). Your dirichlet conditions ($V = 1000$, etc) just become "dead" sample points whose values never change, but they do still contribute to the averages of any adjacent "live" points.

So initially, you'll have an all-zero grid of $V_{i,j}$'s, except for the dirichlet samples that are initialized with the prescribed values. Each iteration, updated values of $V$ will "creep" across the model one point at a time. In the limit (infinite number of iterations) the $V_{i,j}$'s will converge to the solution to the Laplacian (albeit rather slowly). You can embellish the scheme slightly into Gauss-Seidel or successive over-relaxation if you wish.

Once you are satisfied with your solution for $V_{i,j}$, you can use it to find the $\vec E$ field, using the usual relationship $\vec E=-\nabla V$. This postprocessing step can also be accomplished by finite differences.

This isn't necessarily a great method. But it's easy to derive and requires minimal programming skill, so it's commonly taught. See, for example, http://faculty.otterbein.edu/DRobertson/compsci/em-stud.pdf, you could probably find other similar materials with some searching.


Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.