SUMMARY
In this article, we present a computational electrodynamic simulator that maps out the electric vector field of any given stationary point chargesystem using python. The motivation behind this particular project was the drawbacks in conventional methods of electric field mapping which use manual methods that result in unwanted errors. In this project we chose Python as our preferred programming language for its simplicity and wide-ranging versatility. The primary packages that were used in developing this application were NumPy, PyCharge, and Plotly. PyCharge [1] is an open-source Python simulator for computational electrodynamics that can auto simulate dipoles modelled as Lorentz oscillators and calculate the electromagnetic fields and potentials produced by moving point charges.
Using this package we create a stationary charge with x, y and z coordinates and a value of charge as its inputs. The Point charges that are subclasses of the Charge base class and have predetermined trajectories are calculated by the Simulation class as electromagnetic fields and potentials. The computed electric field magnitude is stored in anumpyarray. A mesh grid is deployed to which the magnitudes stored in the array is fed into. This mesh grid is then used to plot an interactive 3-d plot using Plotly [2], a plotting library. The vectors in the plot are represented using cones and their directions denote the vector’s direction as well. And for representing the magnitude of vectors, a color scale is used, hence the color and size of the cones are proportional to the magnitude. Hovering the cursor above the vectors will display the x, y and z coordinates of the individual vectors.
Finally, the end result is a vivid interactive 3-D plot of the electric vector field of the given 1-D distribution. The plot can be viewed from any angle and is downloadable as a png.