Magnetospheric convection and upper atmospheric dynamics