Effect of surroundings on the transient energy transfer in a layer of radiating gas