%
%   PARALLEL_FLOW_2A.M  Function file to solve for the Flow Rates in 
%                    Two Parallel Pipes using Matlab's fsolve command
%
      function F = parallel_flow_2a(Q)
      global D A L eoD sumK nu g Qtot
      Re = (D./(nu*A)).*abs(Q);                            % Reynolds number
      f = 0.25./(log10(eoD/3.7 + 5.74./Re.^0.9)).^2;       % friction factor
      K = (f.*L./D + sumK)./(2*g*A.*A);                    % resistance coeffs
      F = [sum(Q)-Qtot; K(1)*Q(1)*Q(1)-K(2)*Q(2)*Q(2)];    % nonlinear function
%
%   end of function
