In [1]:

```
import math
from numpy import roots
from sympy import acot
#design a trapezoidal concrete lined channel
#Given
Q = 100.; #discharge
S = 25./100000; #bed slope
N = 0.016; #rogsity coefficient
s = 1.5; #side slope
V = 1.5; #limiting velocity
# Calculations
#umath.sing manning's equation V = (R**2/3*S**1/2)/N;
R = (V*N/(S**0.5))**(1.5); #hydraulic mean depth
#for s = 1.5;
theta = acot(1.5);
A = Q/V;
P = A/R;
#umath.sing equation of area and perimeter of trapezium
#perimeter of trapezium = b+2d(theta+cot(theta));
#area of trapezium = bd+d**2(theta+cot(theta));
#we get
y = [1,-17.1,31.9]
d = roots(y)[1];
#we get D = 14.968917 and 2.1310826.
#taking d = 2.1310826;
b = P-4.18*d;
b = round(b*100)/100;
d = round(d*100)/100;
print "required bed width = %.2f m."%(b);
print "required bed depth = %.2f m"%(d);
```

In [2]:

```
import math
#design a trapezoidal concrete lined channel
#Given
Q = 100.; #discharge
S = 25./100000; #bed slope
N = 0.016; #rogsity coefficient
s = 1.5; #side slope
r = 8.; #b/d ratio
# Calculations
#umath.sing manning equation V = (R**2/3*S**1/2)/N;
#Perimeter = A/R
#V = Q/A and on simplification we get
d = ((101/10.09)*(12.18/10.09)**(2./3))**(3./8);
b = r*d;
b = round(b);
d = round(d*100)/100;
# Results
print "required bed width = %.2f m."%(b);
print "required bed depth = %.2f m"%(d);
```

In [3]:

```
import math
from sympy import acot
#design a concrete lined channel
#Given
Q = 45.; #discharge
S = 1./10000; #bed slope
s = 5./4; #side slope
N = 0.018; #rogosity coefficient(manning N)
#channel is assumed to be of triangular section
theta = acot(s);
#umath.sing manning equation V = (R**2/3*S**1/2)/N;
#V = Q/A;
#perimeter of trapezium = b+2d(theta+cot(theta));
#area of trapezium = bd+d**2(theta+cot(theta));
#we get
d = (Q*2.86/1.925)**(3./8);
d = round(d*100)/100;
# Results
print "required depth of triangular channel = %.2f m"%(d);
```

In [4]:

```
import math
#design a concrete lined channel of trapezoidal section
#Given
Q = 250.; #discharge
S = 1./6000; #bed slope
s = 1.5; #side slope
d = 3.; #limiting depth
N = 0.015; #rogosity coefficient
#umath.sing Perimeter = A/R;
#perimeter of trapezium = b+2d(theta+cot(theta));
#area of trapezium = bd+d**2(theta+cot(theta));
#Q = A*V; and on simplification
#we get
#(3b+18.81)**5/3/(b+12.54)**2/3 = 290.47;
#solving it by trial and error method we get
b = 44.6;
# Results
print "required bed width = %.2f m."%(b);
print "required bed depth = %i m"%(d);
```

In [5]:

```
import math
#Given
H = 10.; #depth of impervious stratum from top soil
D = 1.8; #position of drain below top soil surface
Hw = 1.5; #depth of highest point of water
k = 1.e-4; #permeability consmath.tant
# Calculations
#math.since water has to be removed in 24 hours
b = H-Hw;
a = H-D;
L = (4*k*(b**2-a**2)*100*24*3600/0.8)**0.5;
# Results
print "drains should be spaced at %i m c/c."%(L);
```

In [6]:

```
import math
#Given
L = 30.; #spacing between drans
Q = 4.e-6; #discharge
a = 8.;
b = 8.3;
# Calculations
k = 1000000*Q*L/(4*(b**2-a**2));
k = round(k*100)/100;
# Results
print "permeability coefficient = %.2fD-6 m/sec."%(k);
```

In [7]:

```
import math
#Given
L = 50.; #spacing between drains
k = 1.e-5; #permeability coefficient
a = 10.;
b = 10.3;
# Calculations
Q = 4*k*(b**2-a**2)/L;
Pav = Q*24*3600*100*100/L;
# Results
print "annual average rainfall = %i cm"%(Pav);
```

In [8]:

```
import math
#Given
r1 = 2; #ka/kb
r2 = 1./1.5; #La/Lb
r3 = 5./6; #(b**2-a**2)a/((b**2-a**2)b)
# Calculations
Rq = r1*r3/r2;
Rp = Rq/r2;
# Results
print "ratio of discharge at A and B = %.2f."%(Rq);
print "ratio of average rainfall at A and B = %.2f."%(Rp);
```

In [9]:

```
import math
#decide whether it is economically feasible to provide canal lining
#Given
li = 2.5; #seepage loss for lined channel
p1 = 25.; #wetted perimeter for lined channel
t = 12.; #thickness of concrete lining
lf = 0.02; #seepage loss for unlined channel
p2 = 20.; #wetted perimeter for unlined channel
#assume 1 km length of canal
#annual benifit
#(1).seepage
A1 = p1*1000; #area of wetted perimeter
li = li*p1/1000; #seepage loss
A2 = p2*1000; #area of wetted perimmeter for unlined channel
lf = p2*lf/1000; #seepage loss for unlined channel
s = li-lf; #saving in water loss
a1 = s*p1*100000; #annual revenue saved
#(2)maintainence
a2 = 0.4*25000; #saving in maintainance math.cost
ts = a1+a2; #total annual benifit
#annual math.cost
A1 = p2*1000; #area of lining for unlinrd canal
C = 100*A1; #math.cost of lining
#interest rate is 6%
i = 0.06;
N = 50;
a = (C*i*(i+1)**N)/((1+i)**N-1); #annual math.cost of lining or capital recovery factor
bcr = ts/a; #benifit math.cost ratio
bcr = round(bcr*1000)/1000;
print "Benifit math.cost ratio = %.2f."%(bcr);
#as bcr>1
print " ;Since it is more than 1.Hence, it is economically justifiable. ";
```

In [10]:

```
import math
#Given
Ecd = 20; #electrical conductivity of drainage water
Eci = 1.5; #m mho/cm
Dc = 55.5; #consumptive use
# Calculations
Lr = Eci/Ecd;
D = Dc/(1-Lr);
# Results
print "required depth of water to be applied = %i mm."%(D);
```

In [11]:

```
import math
#Given
Eci = 1.4; # m mho/cm
Ece = 11.; #saturated extract of soil
Dc = 85.; #consumptive use requirement of crop
# Calculations
#let us assume Ecd = 2Ece
Lr = Eci/(2*Ece);
Di = Dc/(1-Lr);
Di = round(Di*10)/10;
# Results
print "required depth of water to be applied = %.2f mm."%(Di);
```

In [12]:

```
import math
#percentage of earth work is saved in lined section
#Given
s = 1.5; #side slope
Q = 15.; #discharge
S = 1./4000; #bed slope
Nl = 0.014; #manning n for lined channel
Nu = 0.028; #manning n for ulined channel
fb = 0.75; #free board
#considering the perimeter of trapezoidal section
#taking minimum perimeter for given area
#i.e dP/dD = 0
#we get
#A = 2.1D**2; R = D/2; and P = 4.2D
#for linrd channel
#Q = AR**(2/3)*S**0.5
#substituting above values we get
D = (10.0396)**(3./8);
B = 0.6*D;
R = D/2;
tau = 9.81*R*S*1000;
tau = round(tau*1000)/1000;
print "for lined canal:";
print "average boundary shear stress = %.2f N/square m."%(tau);
Dc = D+fb; #total depth of cutting
A1 = (B+1.5*Dc)*Dc;
#for unlined channel
#Q = AR**(2/3)*S**0.5
#substituting above values we get
D = 3.08;
B = 0.6*D;
R = D/2;
tau = 9.81*R*S*1000;
tau = round(tau*100)/100;
print "for unlined canal:";
print "average boundary shear stress = %.2f N/square m."%(tau);
Dc = D+fb; #total depth of cutting
A2 = (B+1.5*Dc)*Dc;
per = (A2-A1)*100/A2;
per = round(per*100)/100;
print "percent saving of earth = %.2f percent."%(per);
```

In [13]:

```
import math
from numpy import roots
#design a lined canal
#Given
Q = 100.; #discharge
S = 1./2500; #bed slope
V = 2.; #maximum permissible velocity
n = 0.013; #manning n
s = 1.25; #side slope
# Calculations
A = Q/V;
#from manning formula V = (R**2/3*S**1/2)/N;
R = (V*n/S**0.5)**1.5;
P = A/R;
#now umath.sing the equation of area and perimeter of trapezoid
#area = D(B+2.5D)
#perimeter = B+3.2D;
#we get
y = [1.95,-33.73,50]
D = roots(y)[1];
#we get D = 15.660087 and 1.6373489
#taking D = 1.6373489;
B = P-3.2*D;
B = round(B*10)/10;
D = round(D*100)/100;
# Results
print "required bed width = %.2f m."%(B);
print "required bed depth = %.2f m"%(D);
```

In [14]:

```
import math
#Given
B = 5.; #bed width
D = 2.; #bed depth
S = 1./1600; #bed slope
n = 0.015; #manning n
# Calculations and Results
A = B+2*D; #area of lining
#let B1 and D1 be new width and depth of bed
#for getting maximum discharge we diffrentiate Q and equating it to zero
#Q = S**0.5*B1D1**5/3/n
#we get
D1 = 45./16;
B1 = 9-2*D1;
Q1 = S**0.5*B1*D1**5/3/n;
D1 = round(D1*10000)/10000;
print "new width of bed = %.2f m."%(B1);
print "new depth of bed = %.2f m."%(D1);
print " maximum discharge = %.2f cumec."%(Q1);
R = D;
V = R**(2./3)*S**0.5/n;
F = V/(9.81*D)**0.5; #froud number
R = D1;
V = R**(2./3)*S**0.5/n;
F = V/(9.81*D1)**0.5; #froud number
print "Froud number is less than 1 in both case.Hence flow doesnot change from sub-critical to super critical.";
```

In [15]:

```
import math
from sympy import acot
#area to be irrigated
#Given
B = 5.; #bed width
D = 2.5; #bed depth
s = 1.5; #side slope
S = 1./1000; #bed slope
n = 0.016; #manning n
k = 10.; #kor period
d = 150.; #field irrigation requirement
# Calculations
theta = acot(s);
A = B*D+D**2*(theta+1/math.tan(theta));
P = B+2*D*(theta+1/math.tan(theta));
R = A/P;
Q = A*R**(2./3)*S**0.5/n;
V = Q*k*24*3600; #volum of water supply by channel
A = V*10/(d*10000);
Q = round(Q*100)/100;
A = round(A)*100;
# Results
print "maximum carrying capacity of canal = %.2f cumec."%(Q);
print "Area to be irrigated = %.2f hectares."%(A);
```