Pick a heatsink for voltage regulator
You can solve a heat problem in the same way you would solve a current-through-a-resistor problem. Current is equivalent to heat, resistance is thermal resistance, and voltage is temperature.

You have 2W of heat current through a series of heat resistors: Rj-c (5K/W), add 1K/W for the imperfect contact between the case and your heatsink, and the heatsink-to-air (40K/W). The total is 46K/W. With a heat flow of 2W this will cause a temperature gradient of 98 K: the junction will be 98K hotter than the ambient air. 

A difficult question in such calculations is how low you can guarantee the ambient air to be. Let's assume (maximum) 40C. Then the (maximum) junction temperature is 40 + 98 = 138C. 

The (Fairchild) LM7805 lists 125C as maximum operating temperature under the 'absolute maxima'. Note that in principle the absolute maxima can NOT be used for design calculations, but the graphs later on have curves up to 125C, so on THAT ground the figure of 125C is OK to use.

125 &lt; 138, so with an ambient temperature of 40C and 2A your heatsink might not be enough. (I say might because I used the worse case figures. But as a designer, you should!)

I suggest you find yourself a heatsink that is a bit bigger, aim for 20K/W. This will also make the heatsink less hot to the tough (but still far too hot for touching comfortably! calculate for yourself how hot it will be.).