A browser based 3D open-source magnetic field and force simulator for multiple coils
Visit https://darshj.pythonanywhere.com/! (note that running the calculation may take upto 20 seconds for simulations with many coils, so try to keep the number of coils and loops low))
- Add and edit multiple coils
- Adjustable coil parameters, including:
- Position
- Radius
- Number of loops
- Number of layers
- Current
- Frequency and Phase
- Angle
- Force calculations on the coils
- Interactive
- Timeline playback
- Arrows for vector fields and forces
- Numpy
- Flask
- Scipy
- THREE.js
- OrbitControls
The coil is first split up into "Nseg" many segments, which is then used to calculate the magnetic field using the Biot Savart law
The current over timeframes is made using a sin wave with an amplitude of the max current
The forces are calculated using
dF = I dl × B_external
excluding the coils own magnetic field (the coil aint gonna accelerate itself)
pip install -r requirements.txt
First add app.run() inside the main.py file, then run it.
-
Add coil: creates a new editable coil
-
Edit panel: adjust parameters
-
Calculate: compute field and forces
-
Timeline: scrub animation frames
-
Play/Pause: animate AC behavior
-
Toggles:
- Grid
- Field vectors
- Force arrows
- Vector scale