Hi all!
I was playing around in kicad (
Please don't look at/pay attention to the rest of the components/board or the size of the heatsink, the board is not laid out yet and this is purely a theoretical question!) and found a heatsink 3D model for a TO-220 package. My first instinct was to mount it like this:

It seemed logical as it
looks like it should go
in there, while this might not even be the case. But then I wondered, when the heat spreads to the fins etc, won't you create a chamber of heat around the TO-220?
So what about flipping the heatsink around so the fins radiate away from the TO-220?

This way it seems more practical as the heat is radiated away from the TO-220 instead of accumulating around it.
Yet in many datasheets I see TO-220s mounted to heatsinks according to the 1st picture. I know that picture 1 is normal for TO-220s that are supposed to be mounted flat on the board. But this is purely a question for upright mounted TO-220s and heatsinks.
So what is more proper? What is the theory?