3D Magnetic Field of a Current – Straight Wire, Circular Loop and Solenoid

PhysicsElectric & Magnetic FieldsAges 17–18

Use with my class

A rotatable 3D model of the magnetic field lines around a long straight wire (concentric circles, right-hand grip rule), a circular loop and a solenoid. Adjust the current I, reverse its direction and drag a probe to change the distance r; small compass needles on the plane turn to follow B, and the magnetic flux density B = 2·10⁻⁷ I/r (straight wire), 2π·10⁻⁷ I/R (centre of the loop) or 4π·10⁻⁷ nI (inside the solenoid) updates continuously. The Ampère's law screen has up to three parallel wires and a circular, square or hand-drawn loop, comparing ∮B·dl with μ₀I_enc; the Biot–Savart screen cuts a straight segment or an arc into N elements and adds their dB at a point P.

Lesson: Magnetic field of a current in a long straight wire, a circular loop and a solenoid; magnetic flux density

What it shows

An electric current produces a magnetic field whose shape depends on the conductor. Around a long straight wire the field lines are concentric circles and B = 2·10⁻⁷ I/r, so B halves when the distance doubles. At the centre of a circular loop B = 2π·10⁻⁷ I/R, while inside a long solenoid the field is uniform, B = 4π·10⁻⁷ nI, and outside it resembles a bar magnet's field. The field lines of the loop and solenoid are traced with the Biot–Savart law, the right-hand grip rule gives their direction, and small compass needles align with B at each point. Two more screens go further: Ampère's law, where the line integral of B around any loop depends only on the current threaded through it, and the Biot–Savart law, where the field of a finite segment or an arc is built up from current elements.

How to use

Start with Long straight wire, set the current and drag the yellow ball to change r, recording B at several distances to test B ∝ 1/r. Before pressing Reverse current, ask students to predict with the right-hand grip rule how the compass needles will turn. Then choose Circular loop and Solenoid from the source menu, vary Loop R, n and I, and compare the field patterns. Drag to rotate the 3D view and use Reset view to return. On Ampère's law, drag the wires, change the currents or press Draw loop, and compare ∮B·dl with μ₀I_enc. On Biot–Savart, raise N and watch the sum approach the exact value.

Parameters you can change

  • Source of the magnetic field Long straight wire, Circular loop, Solenoid
  • Current I 0.5–20 A
  • Current direction Forward (straight wire: upwards), Reverse (straight wire: downwards)
  • Distance r from the straight wire / radius R of the loop 1–10 cm
  • Turns per metre of the solenoid n 100–5000 turns/m
  • Screen Field of a current, Ampère's law, Biot–Savart law
  • Current I₂ in the second wire (Ampère screen; positive: upwards) -20–20 A
  • Current I₃ in the third wire (Ampère screen; 0: no wire) -20–20 A
  • Shape of the Amperian loop Circle, Square
  • Radius (or half-side) of the Amperian loop 1–12 cm
  • x coordinate of the loop centre -10–10 cm
  • z coordinate of the loop centre -10–10 cm
  • Conductor on the Biot–Savart screen Straight segment, Arc
  • Length L of the straight segment 2–24 cm
  • Distance d from P to the segment / radius R of the arc 1–10 cm
  • Height h of the point P -10–10 cm
  • Angle α of the arc at its centre 10–360 °
  • Number of elements N 1–60

Questions to explore

  1. When the distance r from the straight wire doubles, what does the probe show happens to B?
  2. Using the right-hand grip rule, which end of the solenoid is the north pole, and what changes when the current is reversed?
  3. Why are the compass needles inside the solenoid all parallel, while around the straight wire they form circles?

Common questions

What does Ampère's law say?

Ampère's law says that the line integral of B around any closed loop equals μ₀ times the current threaded through it: ∮B·dl = μ₀I_enc. Wires outside the loop change B on the loop but add nothing to the integral. The law gives the field of a long straight wire quickly, because B is constant on a circle around it.

What is the Biot–Savart law used for?

The Biot–Savart law gives the magnetic field of any current-carrying conductor by adding the contributions of its small current elements. Each element gives dB = (μ₀/4π)·I dl × r̂ / r², and the total field is the vector sum of all these dB. It is used for finite segments, arcs and loops, where Ampère's law offers no shortcut.

How can you make the magnetic field inside a solenoid stronger?

The field inside a long solenoid gets stronger if you increase the current or the number of turns per metre, because B = 4π·10⁻⁷ nI. Doubling either one doubles B. With n = 1000 turns/m and I = 5 A, B is about 6.3 mT. For a long solenoid, the radius does not appear in the formula.