|MadSci Network: Physics|
We can not see the magnetic field. I think when you say "all magnetic fields are in a closed circular shape", what you really mean is the magnetic field lines, which are used to depict the magnetic field in many physics books. The magnetic field fills the whole space. It has different strengths and directions at different points. If we hold a very small bar magnet in the magnetic field and our feeling is sensitive enough, we can feel an torque and force on the magnet. The torque tries to rotate the magnet until its axis (the line through its two poles) becomes parallel to a specific direction, which is the direction of the magnetic field at that point. The force tries to move the magnet to a new position where the strength of the magnetic field is greater. If we draw such curves whose tangential line always agrees with the direction of the magnetic field, we'll see these curves are always closed, but not always circular. These curves are called magnetic field lines. Therefore, the magnetic field lines are only visual aid for understanding variation of the direction and strength of the magnetic field in the space. The closed-ness of the magnetic field line does have an implication for the characteristics of the magnetic field, that is, there is no magnetic charge or magnetic monopole in the world, unlike the electric field. All the magnetic fields are essentially generated by electric currents and circle around the currents. You may wonder about the magnetic field generated by a permanent magnet. Actually it is gnerated by the spin of the electrons in the permanent magnet, which can also be regarded as a kind of current. This rule is called Ampere's Law and it has a beautiful mathematical representation. However there is still a large distance to the practicle calculation of the magnetic field. There is another rule called Bio-Savart Law for practical applications. It may look a bit tedious, but actually it is easy to use. If you know the currents, you only need an integration, which is actually just cutting the current into small pieces and then summing up the magnetic field generated by each piece. As to the spark, I think there are several possibilities: it may be caused by static charges or voltage difference between the electromagnet and the permanent magnet, and it may be caused by sudden changes of the magnetic field. It is easy to determine whether it is related to the magnetic field. Since magnetic field itself does not generate electric field and only its variation can generate electric field (Faraday's Law), if the sparks only appears when you switch on or off the electromagnet, it is most probably caused by the varation of the magnetic field. But if the sparks appear even when there is no current change in the electromagnet, you can try measuring the voltage difference between the electromagnet and the permanent magnet since there may be some electric leakage. [1-3]http://www.treasure-troves.com/physics/physics.html
Try the links in the MadSci Library for more information on Physics.