In [1]:

```
from __future__ import division
import math
#Initializing the variables
a = 2.7; #Upper edge
b = 1.2 ; #Lower edge
width = 1.5; #Width of trapezoidal plate
h = 1.1; #Height of water column above surface
rho = 1000;
g = 9.81 #Acceleration due to gravity
phi = 90 #Angle between wall and surface
#Calculations
A = 0.5*(a+b)*width; #Area of Trapezoidal Plate
y = (2*(0.5*width*0.75)*0.5 + (1.2*width)*0.75)/A;
z = y+h; #Depth of center of pressure
R = rho*g*A*z #Resultant force
I0 = 1.2*1.5**3/12 +1.2*1.5*1.85**2 + 1.5*1.5**3/36 + 1.5*0.75*1.6**2 #Second moment of area
D = (math.sin(math.degrees(phi)))**2*I0/(A*z); #depth of center of pressure
M = R*(1.8533-1.1); #Moment about hinge
print "Moment about the hinge line (kN/m):",round(M/1000)
```

In [2]:

```
from __future__ import division
import math
#Initializing the variables
w = 1.8; #Width of plate
h1 = 5; #Height of plate and water in upstream
h2 = 1.5; #Height of water in downstream
rho = 1000;
g = 9.81 ; #Acceleration due to gravity
#Calculations
def waterForce(area,meanHeight):
F = rho * g * area * meanHeight;
return F
P = waterForce(w*h1,h1/2)-waterForce(w*h2,h2/2);# Resultant force on gate
x = (waterForce(w*h1,h1/2)*(h1/3) - waterForce(w*h2,h2/2)*(h2/3))/P;# point of action of p from bottom
R = P/(2*math.sin(math.radians(20))); # Total Reaction force
Rt = 1.18*R/4.8; #Reaction on Top
Rb = R - Rt ; #Reaction at bottom
print "Reaction at top (kN):",round(Rt/1000,1)
print "Reaction at bottom (kN):",round(Rb/1000,2)
```

In [3]:

```
from __future__ import division
import math
#Initializing the variables
D = 1.8; #Depth of tank
h = 1.2; #Depth of water
l = 3; #Length of wall of tank
p = 35000; #Air pressure
rho = 10**3; #Density of water
g = 9.81; #Acceleration due to gravity
#Calculations
Ra = p*D*l; #Force due to air
Rw = .5*(rho*g*h)*h*l; #Force due to water
R = Ra + Rw; # Resultant force
x = (Ra*0.9+Rw*0.4)/R; # Height of center of pressure from base
print "Resultant force on the wall (kN) :",round(R/1000,2)
print "Height of the centre of pressure above the base (m) :",round(x,2)
```

In [4]:

```
from __future__ import division
import math
#Initializing the variables
R = 6; # Radius of arc
h = 2*R*math.sin(math.radians(30)); #Depth of water
rho = 10**3; #Density of water
g = 9.81; #Acceleration due to gravity
#Calculations
Rh = (rho*g*h**2)/2; # Resultant horizontal force per unit length
Rv = rho*g*((60/360)*math.pi*R**2 -R*math.sin(math.radians(30))*R*math.cos(math.radians(30)));# Resultant vertical force per unit length
R = (Rh**2+Rv**2)**0.5; # Resultant force on gate
theta = 180/math.pi*math.atan(Rv/Rh); #Angle between resultant force and horizontal
print "Magnitute of resultant force (kN/m) :",round(R/1000,2)
print "Direction of resultant force to the horizontal(Degrees):",round(theta,2)
```

In [5]:

```
from __future__ import division
import math
#Initializing the variables
B = 6; # Width of pontoon
L = 12; #Length of pontoon
D = 1.5; #Draught of pontoon
Dmax = 2; #Maximum permissible draught
rhoW = 1000; #Density of fresh water
rhoS = 1025; #Density of sea water
g = 9.81; #Acceleration due to gravity
#Calculations
def Weight(D):
W = rhoW*g*B*L*D;
return W
W = Weight(D); # Weight of pontoon in fresh water = weight of water displaced
Ds = W/(rhoS*g*B*L); #Draught in sea water
L = Weight(Dmax) - Weight(D); # maximum load that can be supported
print "Weight of pontoon (kN) :",round(W/1000,1)
print "Draught in sea (m) :",round(Ds,2)
print "Load (kN) :",round(L/1000,2)
```

In [6]:

```
from __future__ import division
import math
#Initializing the variables
D = 1.8; # Diameter of buoy
H = 1.2; #Height of buoy
W = 10*10**3; #Weight of buoy
L = 2*10**3; #Load
G = 0.45; # Center of gravity
rho = 1025; #Density of sea water
g = 9.81; #Acceleration due to gravity
#Calculations
Z = 4*(W+L)/(rho*g*math.pi*D**2); # Depth of Immersion
BG = (math.pi*D**4/64)/(math.pi*D**2*Z/4);
Z = 0.5*Z +BG; # Position of combined center of gravity
Z1 = ((W+L)*Z-0.45*W)/L; #Maximum height of load above bottom
print "Maximum height of center of gravity above bottom (m) :",round(Z1,3)
```

In [7]:

```
from __future__ import division
import math
#Initializing the variables
l = 20; # Length of barage
b = 6; #Width of barage
r = 3; #Radius of circular top of barage
W = 200*10**3; #Weight of empty barage
d1 = 0.8; # Depth of water in 1st half
d2 = 1; # Depth of water in 2nd half
rho = 1000; #Density of water
R = 0.8; #Relative density of liquid
g = 9.81; #Acceleration due to gravity
ZG = 0.45; # Center of gravity of barage
#Calculations
I00 = l*b**3/12 +math.pi*b**4/128;
ICC = l*(.5*b)**3/12;
L = d1*rho*g*l*b/2*(d1+d2); # Weight of liquid load
W = L + W; #Total weight
A = l*b +math.pi*r**2/2; # Area of plane of waterline
V = W/(rho*g); # Volume of vessel submerged
D = V/A ; #Depth submerged
ZB = .5*D; #Height of center of buoyancy
NM = ZB-ZG +(1/V)*(I00-R*2*ICC); # Effective metacentric height
P = R*rho*g*l*b/2*(d2-d1); #overturning moment
theta = math.atan(P*1.5/(W*NM))*180/math.pi; #Angle of roll
# converting into degrees and minutes
thetaD=round(theta-1)
thetaM=(theta-thetaD)*60/100
print "Angle of roll is",thetaD,"degrees",round(thetaM,2),"minutes"
```