Deterministic electromagnetic and electromechanical simulation for rotating permanent magnets and stationary coils
Spinning Magnets Lab is a scientific simulator developed to study how rotating permanent magnets interact with stationary coils, electrical loads, and rotor mechanics. The main objective is not visual novelty, but physically interpretable prediction: magnetic field distribution, coil flux, flux linkage, induced voltage, load current, electrical power, reaction torque, and mechanical power should emerge from a clear and auditable computational chain.
The project is designed as a virtual laboratory instrument. It is intended for engineers, researchers, experimenters, and technically curious users who want to inspect generator behavior with the same mindset used for real measurement systems: clear assumptions, explicit units, deterministic results, transparent numerical methods, and repeatable comparison between machine configurations.
Version 0.9.4 advances the simulator into a deterministic, instrument-oriented electromechanical analysis environment. The system is now driven by an authoritative runtime engine with time-domain energy integration, power validation, and phase-resolved diagnostics, enabling physically consistent analysis of generator behavior.
The software exists to answer a focused class of questions:
This makes the simulator useful for conceptual generator studies, flux visualization, coil placement comparison, solver benchmarking, machine preset comparison, rotor sweep diagnostics, and scientific documentation.
Spinning Magnets Lab follows a physics-first development philosophy. The simulator should remain understandable and reproducible, which means every major computational step should have a clear owner and a defensible physical interpretation.
At its current stage, the simulator models a rotor carrying permanent magnets and a stator region containing one or more coils. From that machine description it computes derived geometry, evaluates the magnetic field, samples the field over the coil aperture, derives electrical quantities from the resulting flux linkage, and can propagate those results into load response, power balance, and rotor mechanics.
| Domain | What is represented |
|---|---|
| Geometry | Disc radius, slot count, magnet placement, coil placement, orientation, and working plane positions |
| Field solving | Magnetic flux density vector B(x,y,z) from the currently selected magnet model |
| Flux integration | Surface integration of B · n over the coil aperture using deterministic quadrature |
| Induction | Flux linkage history and induced voltage derived from time change of linkage |
| Load response | Open, resistive, and dynamic RL-style current response based on coil and load parameters |
| Power balance | Electrical output, mechanical input power, and efficiency-style comparison metrics |
| Mechanics | Rotor speed, shaft torque, reaction torque, net torque, and safety-related mechanical quantities |
| Analysis | Rotor sweep signatures, per-angle machine metrics, and exportable analysis results |
| Instruments | Probe readout, coil prediction table, scope traces, performance diagnostics, and solver comparison metrics |
The simulator is based on standard electromagnetic and electromechanical concepts used in classical engineering analysis. These include the magnetic field of permanent magnets, magnetic flux through a finite surface, flux linkage of a multi-turn coil, Faraday’s law of induction, current response under electrical load, and mechanical power/torque relationships at a rotating shaft.
Φ = ∬ (B · n) dA over the coil surface.λ = NΦ for a coil with N turns.V = -dλ/dt.This is why coil outputs are not guessed from simple proximity or visual overlap. They arise from explicit field sampling and integration, and they can now be propagated into load response and power balance rather than stopping at open-circuit voltage alone.
Spinning Magnets Lab is intentionally built as a layered system. A new visualization can be added without changing the induction engine. A new field solver can be introduced without moving physics into the UI. A new preset machine can be added without rewriting the renderer. That separation is central to the credibility of the tool.
The simulator is now better understood as a compact deterministic laboratory stack:
One of the major additions is rotor sweep. Instead of evaluating only the current display angle, the simulator can now step through a full mechanical revolution and build a deterministic signature of the machine over angle. This allows direct comparison of how electrical power, mechanical power, shaft torque, reaction torque, and net torque evolve throughout one turn.
Rotor sweep is especially useful for identifying waveform shape, torque ripple, phase relationships, asymmetric geometry effects, and the influence of load configuration across a full cycle. It also provides a stronger basis for generator benchmarking than a single static snapshot.
The simulator now includes multiple preset machine configurations intended for different use cases, from simple laboratory baselines to more ambitious generator-style arrangements. These presets make it easier to learn the system, compare machine families, and start from stable known-good configurations.
This matters because a scientific tool becomes more useful when users can move quickly between documented reference machines instead of rebuilding every geometry from scratch.
Project intent, scientific philosophy, scope, and feature overview for the simulator.
Open About →Formal equations, derivation notes, solver assumptions, and numerical method details.
Open Mathematics →File ownership, module boundaries, deterministic pipeline, and implementation responsibilities.
Open Architecture →Many simulator problems start when the codebase lets rendering, UI events, or convenience shortcuts silently alter physical state. Spinning Magnets Lab avoids that. Physics belongs to the engine path, not the presentation path. This matters because engineers need repeatability. When a parameter changes, the result should change for a reason that can be explained.
This is especially important when comparing field solvers, validating coil responses, benchmarking presets, studying torque balance, or using the simulator to prepare real laboratory experiments.
This documentation is written for a technical audience. It assumes familiarity with at least some of the following topics:
Even so, the project also values visual accessibility. The simulator should help people learn by inspection, without compromising the integrity of the underlying model.
The simulator is strongest when used as a controlled prediction and comparison environment for rotating-magnet generator systems. It now reaches beyond pure induction visualization into load-aware electromechanical analysis, but it is still not intended to replace full finite-element multiphysics workflows, nonlinear magnetic material solvers, thermal models, structural finite-element analysis, or complete external network simulation.
Its strength is clarity: a compact scientific environment where geometry, field structure, flux behavior, induced voltage, current response, power flow, and torque interaction can be inspected in a way that remains understandable.
Spinning Magnets Lab is distributed as a self-contained web application and can be deployed locally or on servers using container technology. A prebuilt container image is available on Docker Hub, allowing the simulator to run without manual setup of web servers or dependencies.
The container provides a ready-to-use environment with static file serving, support for Web Workers, and full compatibility with the simulator’s import/export features. No additional configuration or networking setup is required for standard use.
aridev1/spinning-magnets-labdocker run -p 8080:80 aridev1/spinning-magnets-lab:latesthttp://localhost:8080 in a browserBecause the simulator runs entirely in the browser, all computation remains local to the user’s machine. Imported and exported project data stays under user control and is not transmitted externally.