Triangular weir modelling

Weirs Laws

function [Q] = vnotch(T,h,alfa,Cd,e)
% T   : 1 for true V-Notch
% T   : 2 pour V-Notch equivalent
% h   : upstream level
% Q   : discharge
% Initialisation ---------------------------------------------
R2G = sqrt(2*9.81);
if (T==1)
% triangular weir
  Q=1.32*tan(alfa/2)*h^2.47;
else
% Equivalent horizontal weir
if (h>0)
  L=e*tan(alfa/2);
  Q=Cd*R2G*L*h^1.5;
end
if (h>e)
  Q=Q+Cd*R2G*2*L*(h-e)^1.5;
end
if (h>2*e)
  Q=Q+Cd*R2G*2*L*(h-2*e)^1.5;
end
if (h>3*e)
  Q=Q+Cd*R2G*2*L*(h-3*e)^1.5;
end
if (h>4*e)
  Q=Q+Cd*R2G*2*L*(h-4*e)^1.5;
end
end

Comparison of the results obtained by using the two laws on an example

% Parameters --------------------------------------------
pas=0.005;
val=100;
alfa=pi/2;
e=0.1;
Cd=0.38;
% Calculation ------------------------------------------------
for i=1:val
   [Q(i,1)]=vnotch(1,i*pas,alfa,Cd,e);
   [Q(i,2)]=vnotch(2,i*pas,alfa,Cd,e);
end
% discharge deviation
plot(Q);
% relative deviation in %
plot((Q(:,2)-Q(:,1))/Q(:,1));