Last active
June 20, 2019 01:59
-
-
Save terjehaukaas/bac0b9ea016cfe74075f7e8acefb057e to your computer and use it in GitHub Desktop.
Alternative Structures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------------------------------------------ | |
# The following Python code is implemented by Professor Terje Haukaas at | |
# the University of British Columbia in Vancouver, Canada. It is made | |
# freely available online at terje.civil.ubc.ca together with notes, | |
# examples, and additional Python code. Please be cautious when using | |
# this code; it may contain bugs and comes without any form of warranty. | |
# Please see the Programming note for how to get started, and notice | |
# that you must copy certain functions into the file terjesfunctions.py | |
# | |
# The following code is particularly intended to accompany the code for | |
# linear static structural analysis. | |
# ------------------------------------------------------------------------ | |
# ------------------------------------------------------------------------ | |
# TRUSS | |
# ------------------------------------------------------------------------ | |
# Constants | |
P = 300000.0 | |
E = 200000.0 | |
A = 5000.0 | |
# Nodes (x, y) | |
nodes = np.array([(0.0, 0.0), | |
(1500.0, 0.0), | |
(3000.0, 0.0), | |
(4500.0, 0.0), | |
(6000.0, 0.0), | |
(7500.0, 0.0), | |
(9000.0, 0.0), | |
(0.0, 1500.0), | |
(1500.0, 1500.0), | |
(3000.0, 1500.0), | |
(4500.0, 1500.0), | |
(6000.0, 1500.0), | |
(7500.0, 1500.0), | |
(9000.0, 1500.0)]) | |
# Truss elements (node1, node2, E, A) | |
trussElements = np.array([(1, 2, E, A), | |
(2, 3, E, A), | |
(3, 4, E, A), | |
(4, 5, E, A), | |
(5, 6, E, A), | |
(6, 7, E, A), | |
(8, 9, E, A), | |
(9, 10, E, A), | |
(10, 11, E, A), | |
(11, 12, E, A), | |
(12, 13, E, A), | |
(13, 14, E, A), | |
(1, 8, E, A), | |
(2, 9, E, A), | |
(3, 10, E, A), | |
(4, 11, E, A), | |
(5, 12, E, A), | |
(6, 13, E, A), | |
(7, 14, E, A), | |
(1, 9, E, A), | |
(2, 10, E, A), | |
(3, 11, E, A), | |
(5, 11, E, A), | |
(6, 12, E, A), | |
(7, 13, E, A)]) | |
# Loads (node, value, direction, factor) | |
loads = np.array([(9, -P, 2, 1.0), | |
(10, -P, 2, 1.0), | |
(11, -P, 2, 1.0), | |
(12, -P, 2, 1.0), | |
(13, -P, 2, 1.0)]) | |
# Boundary conditions (node, 0=free, 1=fixed) | |
constraints = np.array([(1, 1, 1, 0), | |
(7, 0, 1, 0)]) | |
# ------------------------------------------------------------------------ | |
# FRAME | |
# ------------------------------------------------------------------------ | |
# Constants | |
P = 300000.0 | |
E = 200000.0 | |
I = 0.5E+9 | |
A = 5000.0 | |
weight = 3000000.0 | |
# Nodes (x, y) | |
nodes = np.array([(0.0, 0.0), | |
(7500.0, 0.0), | |
(15000.0, 0.0), | |
(0.0, 3000.0), | |
(7500.0, 3000.0), | |
(15000.0, 3000.0), | |
(0.0, 6000.0), | |
(7500.0, 6000.0), | |
(15000.0, 6000.0)]) | |
# Frame elements (node1, node2, E, I, A, q, nu, beta) | |
frameElements = np.array([(1, 4, E, I, A), | |
(2, 5, E, I, A), | |
(3, 6, E, I, A), | |
(4, 5, E, I, A), | |
(5, 6, E, I, A), | |
(4, 7, E, I, A), | |
(5, 8, E, I, A), | |
(6, 9, E, I, A), | |
(7, 8, E, I, A), | |
(8, 9, E, I, A)]) | |
# Loads (node, value, direction, factor) | |
loads = np.array([(4, P, 1, 1.0), | |
(7, P, 1, 2.0), | |
(7, -weight, 2, 1.0), | |
(8, -weight, 2, 1.0), | |
(9, -weight, 2, 1.0)]) | |
# Boundary conditions (node, 0=free, 1=fixed) | |
constraints = np.array([(1, 1, 1, 1), | |
(2, 1, 1, 1), | |
(3, 1, 1, 1)]) | |
# ------------------------------------------------------------------------ | |
# QUAD4 CANTILEVER | |
# ------------------------------------------------------------------------ | |
# Constants | |
P = 300000.0 | |
E = 200000.0 | |
nu = 0.3 | |
t = 15.0 | |
ps = 1 | |
# Nodes (x, y) | |
nodes = np.array([(0.0, 0.0), | |
(1500.0, 0.0), | |
(3000.0, 0.0), | |
(4500.0, 0.0), | |
(6000.0, 0.0), | |
(7500.0, 0.0), | |
(9000.0, 0.0), | |
(0.0, 1500.0), | |
(1500.0, 1500.0), | |
(3000.0, 1500.0), | |
(4500.0, 1500.0), | |
(6000.0, 1500.0), | |
(7500.0, 1500.0), | |
(9000.0, 1500.0)]) | |
# Quad4 elements (node1, node2, node3, node3, E, nu, t, ps) | |
quad4Elements = np.array([(1, 2, 9, 8, E, nu, t, ps), | |
(2, 3, 10, 9, E, nu, t, ps), | |
(3, 4, 11, 10, E, nu, t, ps), | |
(4, 5, 12, 11, E, nu, t, ps), | |
(5, 6, 13, 12, E, nu, t, ps), | |
(6, 7, 14, 13, E, nu, t, ps)]) | |
# Loads (node, value, direction, factor) | |
loads = np.array([(9, -P, 2, 1.0), | |
(10, -P, 2, 1.0), | |
(11, -P, 2, 1.0), | |
(12, -P, 2, 1.0), | |
(13, -P, 2, 1.0)]) | |
# Boundary conditions (node, 0=free, 1=fixed) | |
constraints = np.array([(1, 1, 1, 0), | |
(7, 0, 1, 0)]) | |
# ------------------------------------------------------------------------ | |
# PARAMETERIZED QUAD4 CANTILEVER | |
# ------------------------------------------------------------------------ | |
# Constants | |
P = 300000.0 | |
E = 200000.0 | |
nu = 0.3 | |
t = 15.0 | |
ps = 2 | |
# Mesh parameters | |
length = 9000.0 | |
height = 1500.0 | |
nelx = 10 | |
nely = 3 | |
xinterval = length/nelx | |
yinterval = height/nely | |
# Nodes (x, y) | |
nodes = np.zeros(((nelx+1)*(nely+1), 2)) | |
counter = 0 | |
for j in range(nely + 1): | |
for i in range(nelx+1): | |
nodes[counter, 0] = i*xinterval | |
nodes[counter, 1] = j*yinterval | |
counter += 1 | |
# Quad4 elements (node1, node2, node3, node3, E, nu, t, ps) | |
quad4Elements = np.zeros((nelx*nely, 8)) | |
counter = 0 | |
for j in range(nely): | |
for i in range(nelx): | |
quad4Elements[counter, 0] = i + j*(nelx+1) + 1 | |
quad4Elements[counter, 1] = i + j*(nelx+1) + 2 | |
quad4Elements[counter, 2] = i + (j+1)*(nelx+1) + 2 | |
quad4Elements[counter, 3] = i + (j+1)*(nelx+1) + 1 | |
quad4Elements[counter, 4] = E | |
quad4Elements[counter, 5] = nu | |
quad4Elements[counter, 6] = t | |
quad4Elements[counter, 7] = ps | |
counter += 1 | |
# Loads (node, value, direction, factor) | |
loads = np.array([((nelx+1)*(nely+1), -P, 2, 1.0)]) | |
# Boundary conditions (node, 0=free, 1=fixed) | |
constraints = np.zeros((nely+1, 4)) | |
for j in range(nely+1): | |
constraints[j, 0] = j*(nelx+1) + 1 | |
constraints[j, 1] = 1 | |
constraints[j, 2] = 1 | |
# Reference displacement | |
print("Exact displacement:", P*length**3/(3.0*E*t*height**3/12.0)) | |
# ------------------------------------------------------------------------ | |
# SIMPLY SUPPORTED GLULAM BEAM WITH WITH SHEAR DEFORMATION | |
# ------------------------------------------------------------------------ | |
# Constants | |
q = 100.0 | |
E = 13100.0 | |
b = 215.0 | |
h = 46 * 38.0 | |
A = b * h | |
I = b * h**3 / 12.0 | |
L = 8000.0 | |
nu = 0.0 | |
beta = 5.0/6.0 | |
# Nodes (x, y) | |
nodes = np.array([(0.0, 0.0), | |
(L/2.0, 0.0), | |
(L, 0.0)]) | |
# Frame elements (node1, node2, E, I, A, q, nu, beta) | |
frameElements = np.array([(1, 2, E, I, A, q, nu, beta), | |
(2, 3, E, I, A, q, nu, beta)]) | |
# Boundary conditions (node, 0=free, 1=fixed) | |
constraints = np.array([(1, 1, 1, 0), | |
(3, 0, 1, 0)]) | |
# ------------------------------------------------------------------------ | |
# CONTINUOUS BEAM | |
# ------------------------------------------------------------------------ | |
# Constants for European IPE220 steel cross-section [N, mm] | |
E = 200000.0 | |
A = 3340.0 | |
I = 27700000.0 | |
q = 100.0 | |
meter = 1000.0 | |
# Nodes (x, y) | |
nodes = np.array([(0.0, 0.0), | |
(2*meter, 0.0), | |
(4*meter, 0.0), | |
(5*meter, 0.0)]) | |
# Frame elements (node1, node2, E, I, A, q, nu, beta) | |
frameElements = np.array([(1, 2, E, I, A, q), | |
(2, 3, E, I, A, q), | |
(3, 4, E, I, A, q)]) | |
# Boundary conditions (node, 0=free, 1=fixed) | |
constraints = np.array([(1, 1, 1, 0), | |
(3, 0, 1, 0)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment