Magnetic Field Produced By Solenoid
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.