Click to place sources — drag to reposition
Theory
Infinite straight wire:
$$B = \frac{\mu_0 I}{2\pi r}$$Magnetic dipole (far field):
$$B_r = \frac{\mu_0 m}{4\pi r^3}2\cos\theta, \quad B_\theta = \frac{\mu_0 m}{4\pi r^3}\sin\theta$$Place current-carrying wires and bar magnets on the canvas to visualize magnetic fields in real time. Explore Ampere's Law, dipole fields, and the attraction/repulsion between parallel currents.
Click to place sources — drag to reposition
Infinite straight wire:
$$B = \frac{\mu_0 I}{2\pi r}$$Magnetic dipole (far field):
$$B_r = \frac{\mu_0 m}{4\pi r^3}2\cos\theta, \quad B_\theta = \frac{\mu_0 m}{4\pi r^3}\sin\theta$$The magnetic field around an infinitely long, straight conductor is derived from Ampère's Law. The field strength is inversely proportional to the radial distance from the wire.
$$B = \frac{\mu_0 I}{2\pi r}$$$B$ : Magnetic field magnitude (Teslas). $\mu_0$ : Permeability of free space ($4\pi \times 10^{-7}$ T·m/A). $I$ : Current in the wire (Amperes). $r$: Perpendicular distance from the wire (meters).
The field of a magnetic dipole (like a bar magnet) is more complex and depends on both distance and angle. It's often described using spherical coordinates.
$$B_r = \frac{\mu_0 m}{4\pi r^3}2\cos\theta, \quad B_\theta = \frac{\mu_0 m}{4\pi r^3}\sin\theta$$$B_r$, $B_\theta$ : Radial and angular components of the magnetic field. $m$ : Magnetic dipole moment (A·m²). $\theta$ : Angle from the dipole's north-south axis. The field strength decays much faster with distance ($1/r^3$) compared to a straight wire.
Electric Motors & Generators: The interaction between magnetic fields from permanent magnets and current-carrying coils is the fundamental principle behind electric motors and generators. Engineers use these exact field calculations to design efficient and powerful devices.
Magnetic Resonance Imaging (MRI): MRI machines use incredibly strong and precisely shaped magnetic fields, generated by superconducting coils (essentially wires with massive current), to align hydrogen atoms in the body. The field uniformity is critical for clear imaging.
Particle Accelerators: To steer and focus beams of charged particles at near-light speeds, physicists use arrays of electromagnets. Calculating the exact magnetic field profile, like the dipole fields in this simulator, is essential for controlling the particle paths.
Fault Current Protection: Circuit breakers and protective relays often use the magnetic field generated by fault currents (sudden, high current) to trigger a disconnection. The force on a mechanism increases with $B$, which is proportional to $I$, allowing for fast, reliable protection of electrical grids.
Let's go over a few points where people often stumble when starting with the simulator. First, the point that "magnetic field lines are not physical lines". The lines drawn on the screen are "guide lines" that visualize the direction and strength of the magnetic field. A line becoming thicker or the number of lines increasing solely represents a higher magnetic flux density. When you review CAE analysis results in practical work, remember the meaning of this visualization.
Next, the simulation's assumptions. This tool uses simplified models like "infinitely long straight currents" or "ideal bar magnets". For instance, an actual coil has a finite length, so the shape of the field lines near its ends will differ slightly from the simulator. Also, it's important to note that it ignores the influence of surrounding materials (permeability). If there is a current near iron, the magnetic field lines will concentrate and be drawn towards the iron. Be cautious when directly applying the fundamental principles learned with the tool to complex real-world machines.
Finally, a pitfall in parameter settings. Let's think about current values in realistic orders of magnitude. For example, the magnetic field created by a few amps from a household outlet is much smaller than the Earth's magnetic field. On the other hand, a large current of several thousand amps, like in a welding machine, generates enough force to make nearby iron tools move noticeably. Even when experimenting with the simulator, imagining "how much is this current value in reality?" will help sharpen your physical intuition.
Magnetic Field Lines Simulator is a fundamental topic in engineering and applied physics. This interactive simulator lets you explore the key behaviors and relationships by directly manipulating parameters and observing real-time results.
By combining numerical computation with visual feedback, the simulator bridges the gap between abstract theory and physical intuition — making it an effective learning tool for students and a rapid-verification tool for practicing engineers.
For a copper wire carrying 35 A at 0.05 m distance, the magnetic field is B = (4π×10⁻⁷ × 35)/(2π × 0.05) = 140 µT. Set currentSliderNum to 35 and densitySliderNum to 75 field lines. The simulator renders tight concentric rings near the conductor, spreading outward logarithmically. At 0.1 m, field reduces to 70 µT, confirming inverse-distance scaling critical for transformer and motor design validation.