Analysis of the flow in gravity currents propagating up a slope