function [u_L,u_G]=velocity(W_L,W_G,W_L_choke,W_G_choke,W_L_in,W_G_in,alpha_L,rho_G,z,data)
%   Function that computes flow velocities based on momentum input 
%   and flow directions for a staggered grid scheeme.
%
%   Written by Espen Storkaas Jan 16th 2003
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[d_L,d_G]=flowdir(W_L,W_G);
%alpha_L=mean([alpha_L(data.I_i) alpha_L(data.I_i+1)],2);
%rho_G=mean([rho_G(data.I_i) rho_G(data.I_i+1)],2);
u_L=W_L./(data.rho_L*alpha_L(data.I_i+d_L));
u_G=W_G./(rho_G(data.I_i+d_G).*(1-alpha_L(data.I_i+d_G)));
u_Lc=W_L_choke/(data.rho_L*alpha_L(end)*data.A);
u_Gc=W_G_choke/(rho_G(end)*(1-alpha_L(end))*data.A);
u_L_in=W_L_in/(data.rho_L*alpha_L(1)*data.A);
u_G_in=W_G_in/(rho_G(1)*(1-alpha_L(1))*data.A);
u_L=[u_L_in;u_L;u_Lc];
u_G=[u_G_in;u_G;u_Gc];