A model of the thermal bar circulation in a long basin