San Francisco Example
An Ohio-class nuclear missile submarine collides with a freighter in the fog, off the coast of San Francisco, half-way between Alcatraz Island and Fisherman's Wharf. One of the sub's missiles accidentally detonates in the collision.
All 8 MIRVed warheads on the missile detonate in an explosion that yields 800 kilotons. The fissionable material contained in the other thermonuclear warheads on board contributes another megaton, bringing the overall yield to 1.8 megatons. The heavy fog that contributed to the collision greatly attenuates the thermal pulse. The resulting explosion leaves behind not only the usual radioactive by-products, but also a large amount of unused fissionable material.
A population density of 15,000 people per square mile, uniformly distributed. Over 90% of the people are inside. The shock wave will spread out uniformly.
It is very unlikely that an accident like the one contemplated could actually happen. Great care is taken in the designing of these weapons systems specifically to prevent an accident from taking place. However, of all nations nuclear forces, the submarines are the most autonomous (have the fewest safety lockouts).