from __future__ import division
from math import sqrt, pi, log
d=18#
lg=25+25#
Eb=210*10**3#
Ecl=90*10**3#
A=pi*d**2/4#
kb=A*Eb/lg#
x=(5*(lg+(0.5*d))/(lg+(2.5*d)))#
km=pi*Ecl*d/(2*log(x))#
C=kb/(kb+km)#
sigp=600#
At=192#
Pi=0.75*sigp*At#
F=200#
C=0.322#
Pb=F*C*10**3#
FOS=2#
W=At*sigp#
N=Pb*FOS/(W-Pi)#
print "N is %0.2f "%(N)#
from math import sqrt, pi, log
d=16#
D=1.5*d#
t=20#
tg=4#
#Let Gasket diameter in compression zone be d1
d1=D+(2*t)+tg#
lg=40#
E=207*10**3#
kb=pi*d**2*E/(lg*4)#
Ecl=90*10**3#
x=(5*(lg+(0.5*d))/(lg+(2.5*d)))#
kp=pi*Ecl*d/(2*log(x))#
Ag=pi*(d1**2-d**2)/4#
Eg=480#
kg=Ag*Eg/tg#
km=kg*kp/(kg+kp)#
C=kb/(kb+km)#
At=157#
sigp=600#
Pi=0.75*At*sigp/2#
FOS=2#
Pf=At*sigp/FOS#
W=Pf-Pi#
P=W/C#
N=5#
F=P*N#
p=F*4/(pi*120**2)#
print "p is %0.3f N/mm**2 "%(p)#
from numpy import mat, pi, sqrt
sigp=600#
FOS=3#
siga=sigp/FOS#
d=16#
D=1.5*d+60#
#Let Gasket diameter in compression zone be d1
d1=(300-160)/2#
#Let compressive stress in gasket for leak proof joint be sigl
sigl=12#
At=mat([[1, 157],[2 ,192], [3, 245]])
d=mat([[1 ,16],[2 ,18],[3, 20]])
n=3#
Pi = range(0,n)
Pc = range(0,n)
for i in range(0,n):
Pi[i]=At[i,1]*d[i,1]
Pc[i]=3*pi*(d1**2-d[i,1]**2)
if (Pi[i]>=Pc[i]):
print "The Design is safe"
print "d is %0.0f mm "%(d[i,1])#