Field due to Currents

An electric current going through wire coiled into the shape of a cylinder produces fields that are uniformly straight inside the coil. If you put a iron rod inside this coil, the rod becomes magnetised. This is how an electromagnet is made.

solenoid and straight wire fields

Such a coil is called a solenoid. If you wrap your right hand around this solenoid with your fingers in the direction of the current and stretch out your thumb, you thumb will point in the direction of the magnetic field (to the north pole of the electromagnet).

This is called the right hand thumb rule.

If instead the current flows through a straight wire, then it will produce a magnetic field that goes around the wire. If you wrap your right hand around this wire with your thumb in the direction of the current, then you fingers will point in the direction of the field.

In both the solenoid and the straight wire, if the current is increased, the field becomes stronger. If the current changes direction, the field changes direction.