Skip to content

someonewhoexists1210/Magnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0eff695 · · Feb 20, 2026

History

14 Commits
Feb 20, 2026
Feb 20, 2026
Feb 20, 2026
Feb 20, 2026
Feb 20, 2026

Repository files navigation

Magnet

Magneto Sim

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))

Features

  • 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

Tech Stack

Backend

  • Numpy
  • Flask
  • Scipy

Frontend

  • THREE.js
  • OrbitControls

Physics

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)

Installation

1. Clone the Repo

2. Install dependencies

pip install -r requirements.txt

3. Run the app

First add app.run() inside the main.py file, then run it.

Controls

  • 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published