Magnetic Field Produced By Solenoid

A solenoid, when a current is passing through it, produces an induced magnetic field similar to a bar magnet. The direction of the induced field is deduced from the right hand grip rule.

The current in the solenoid on the left enters at the bottom, flows around the loop out of the screen, then behind, winding up the solenoid. According to the right hand grip rule the magnetic field inside the solenoid is upp. It exits the solenoid at the top, producing a North magnetic pole, and enters at the bottom producing a South magnetic pole.