Can a compass be used in a submarine? This question is motivated by several "myths" I have heard recently - I want to know if there is a problem with using a compass inside a submarine. I can see two different issues, so I'm wondering if anyone can clarify (if you do some googling on this issue, you will see all answers from "yes" to "no", most of which include very suspicious physics).
1) Does the submarine somehow "shield" the magnetic field of the Earth? Well, it seems obvious that a submarine is not a Faraday cage, but it is a giant hunk of metal so there could in principle be an issue. I guess they are generally made of something like steel, so it would magnetize (weakly), but the magnetization should match the field of the Earth so the compass should still read true, right?
2) Electrical activity in the submarine can produce magnetic fields larger than the Earth. This is likely true - on this site you can see that non-nuclear submarines used batteries capabible of producing currents around 15,000 A (of course this site called that the "power" of the battery, so maybe it's not a good reference). Anyway, a current of 15,000 A would match the field of the Earth (assuming 0.5 G) at a distance
$$B=\frac{\mu_0 I}{2 \pi r}\rightarrow r\sim 60 m$$
In any case, this seems like a pretty reasonable argument - maybe it does not apply to the nuclear case however.
Anyone have any ideas? 
COMMENT: Is there a tag for this kind of question? Something about using basic physics to "mythbust"?
 A: Yes, a compass can be used in a submarine. It is not much different than a ship fir a compass.  As the magnetic field is a slowly-varying field, it will not be fully shielded by the hull.
However, there will be magnetic distortion.  Magnetic distortion is divided into hard and soft iron terms.  The hard iron terms are biases that add to the magnetic field strength and are due to permanent magnets or electrical fields.  The hard iron bias is represented as a vector addition to the real (earth's) magnetic field.  The soft iron term is a $3\times 3$ matrix that represents the warping of the ambient magnetic field by the presence of ferrous material.  It is a gain multiplier and includes cross terms (hence the 3x3 matrix).  The equation for the resulting magnetic field is:
$$\mathbf{H}_m = S  \mathbf{H}_e + \mathbf{b}$$
where $\mathbf{H}_m$ is the 3D measured magnetic vector, $\mathbf{H}_e$ is the earth's magnetic field, $S$ is the $3\times 3$ soft iron matrix and $\mathbf{b}$ is the hard iron bias vector.
More specifically, we really should be careful about the frames of reference we are dealing with. With $H_m$ in the frame of the submarine, we can write
$$\mathbf{H}_m = S R \mathbf{H}^{(E)}_e +\mathbf{b},$$
where the superscript $(E)$ refers to the frame fixed to the Earth and $R$ is the rotation matrix between the Earth's frame (sometimes called the north-east-down) frame and the frame of the submarine. 
Thus, the compass will work, but it will not tell you which way is north without knowing the distortion coefficients.  There are methods, and ships use them, to determine the distortion coefficients.  It usually requires driving in a circle to map out the distortions.
A: I believe the answer is "very unlikely."  But not for the reason you might think.
The primary reason for the existence of submarines is stealth.  Modern submarines are extraordinarily difficult to detect.  Very few phenomena penetrate water at any significant depth.  Magnetic fields are something that does pass through water well.  Since submarines are made out of huge chunks of metal, and have huge electrical systems (every modern submarine has an electric motor for propulsion), and for several other reasons they distort the earth's magnetic field.  Thus, the birth of the Magnetic Anomaly Detector (MAD).
A very common countermeasure to MAD adapted by most submarines is to manage their magnetic field, so they "blend in" to their environment.  There are a variety of ways to accomplish this; passively (in which case the other answer would apply), to actively (in which case, you will not be able to use a compass.)
For a more detailed discussion of the issues, see the paper:  Management of 
 Naval Vessel's Electromagnetic Signatures A Review of Sources and Countermeasures  Surface ships have these issues as well, as many sea mines use magnetic anomalies to trigger.  
