Gravity wave dynamics and effects in the middle atmosphere