Energy exchange in a stably stratified flow with laterally distorting duct