Skip to content

Instantly share code, notes, and snippets.

@nag92
Created November 14, 2018 15:07
Show Gist options
  • Save nag92/b238e1f61d689602ff862246316a4f92 to your computer and use it in GitHub Desktop.
Save nag92/b238e1f61d689602ff862246316a4f92 to your computer and use it in GitHub Desktop.
from math import pi
def rect_interia(b,h):
return (1/12.0)*b*h**3
def circ_interia(ro,ri):
return 0.25*pi*(ro**4 - ri**4)
b = 12
h = 6
ro = 12
ri = 6
Eb = 15000
Ed = 130000
alpha = 0
P = 130
Ad = b*h
Ab = 0.25*pi*(ro**2 - ri**2)
Id = rect_interia(b,h) + Ad*(ro+0.5*h)
Ib = circ_interia(ro,ri)
pl = (Ed*Id)/(Eb*Ib)
pa = (Ed*Ad)/(Eb*Ab)
beta = ri/ro
gamma = (ro+0.5*h)/ro
tb = ro - (pa*gamma*ro)/(1+pa)
F = -P/Ab
k = 1.0/(1+pa)
num = (alpha - k*gamma)*(tb/ro)
dem = 0.25*(1+beta**2)*(1+pl) + (gamma**2)*k
print -F*(k + num/dem)
Ad = b*h
Ab = 0.25*pi*(ro**2 - ri**2)
Id = rect_interia(b,h) + Ad*(ro+0.5*h) + rect_interia(b,h) + Ad*(ro-0.5*h)
Ib = circ_interia(ro,ri)
pl = (Ed*Id)/(Eb*Ib)
pa = (Ed*Ad)/(Eb*Ab)
beta = ri/ro
gamma = (ro+0.5*h)/ro
tb = ro - (pa*gamma*ro)/(1+pa)
F = -P/Ab
k = 1.0/(1+pa)
num = (alpha - k*gamma)*(tb/ro)
dem = 0.25*(1+beta**2)*(1+pl) + (gamma**2)*k
print -F*(k + num/dem)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment