Modeling of heat transfer in abandoned oil and gas wells