%
%   PIPE_FRICTION_1A.M   Function file for use in FZERO 
%
%   Evaluates   F(V) = V^2 - 2g(h+L)/(1 + fL/D)  
%   where f is friction factor (given by the Swamee-Jain correlation)
%
      function F = pipe_friction_1a(V)
      global DD h LL g visc rough
      Re = V*DD/visc;                              % Reynolds number
      RR = rough/DD;                               % relative roughness
      f = 0.25/(log10(RR/3.7 + 5.74/Re^0.9))^2;    % friction factor
      F = V^2 - 2*g*(h+LL)/(1 + f*LL/DD);
%
%   end of function

