function k = contractionLoss(a1,a2)
% contractionLoss  Minor loss coefficient for a sudden contraction
%
% Synopsis:  k = contractionLoss(a1,a2)
%
% Input:  a1 = upstream (large) area
%         a2 = downstream (small) area
%
% Output:  k = minor loss coefficient for sudden contraction in round pipe

% Reference:  F.M. White, "Fluid Mechanics", 3rd ed, 1994, McGraw-Hill, p 340
% Note:       ar = area ratio = d2^2/d1^2
ar = a2/a1;
if ar>1,  error('Downstream area is larger than upstream area');  end

if ar<0.76
  k = 0.42*(1 - ar);  %  empirical formula for dia ratio less than 0.76
else
  k = (1 - ar)^2;     %  formula for sudden expansion
end
