Simulating Charge Distribution on a Thin Sheet of Conductor on JavaScript

by square1a in Circuits > Software

64 Views, 0 Favorites, 0 Comments

Simulating Charge Distribution on a Thin Sheet of Conductor on JavaScript

Simulating charge distribution on a thin sheet of conductor on JavaScript

To access the simulator, go to GitHub: https://github.com/bz36912/charge-simulator

Download the three files and save in the same folder.

After downloading, open the html file.

theory and assumptions

  1. models charge motion using Coulomb's Law
  2. At the end of simulation, charges reach electrostatic equilibrium
  3. charges in conductor move freely without any resistive force beside the electrostatic force of other charges

If you want to modify the software, keep reading. If not, just download the files from GitHub linked above.

Supplies

To edit the program, you need a JavaScript editor, like Visual Studio Code (VScode).

Change the Colour

customise colour step.PNG

Go to line 24 to 27 of the JavaScript (.js) file.

The arrays store the RGB (red, green blue) values for the colour.

To find the RGB values, go to: https://www.rapidtables.com/convert/color/rgb-to-hex.html

Step 2: Change Simulation Settings

Screen Shot 2022-04-10 at 10.23.54 pm.png

Line numbers for constant values below are in the image above.

Bigger values offer better accuracy, but use more processing power (which may crash the software)

numCharge: number of point charges used in the simulation. Needs to be a square number (**2 just means square)

numStep: number of time steps. The simulation iterates after each time step, and charge position updates after each step.

Large initialStepSize helps charge particles spread out faster, but if numStep is too low the speed of charge towards the end of simulation would still be fast (since speed gets reduced after each time step). You want the speed towards the end of simulation to be slow, so charge position can be slowly fine tuned into its electrostatic equilibrium position.

initialStepSize: initial speed of the charge particles.

Short duration uses more processing power (which may crash the software).

stepDuration: the length of each step in milli-seconds