-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restructured the directory, also slipped minor updates to READMEs and…
… INSTALL
- Loading branch information
1 parent
c60a489
commit 9c65aa4
Showing
126 changed files
with
2,255 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
Binary file added
BIN
+4.83 MB
...inantly solid-void three-dimensional topology optimisation using open source software.pdf
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Documents | ||
|
||
The docs folder currently only contains my master's dissertation since | ||
ToPy was part of it. The maths behind topology optimization is explained in it. | ||
There is also quite a bit about ToPy in it, but now a little outdated. | ||
The persistent URL for the dissertation is: http://hdl.handle.net/10019.1/2648 | ||
|
||
Other useful documentation pertaining to ToPy and/or topology optimisation | ||
can be added to this folder. | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" | ||
# ============================================================================== | ||
# ToPy -- Topology optimization with Python. | ||
# Copyright (C) 2012, 2015, 2016 William Hunter. | ||
# ============================================================================== | ||
""" | ||
|
||
from topology import * | ||
from visualisation import * | ||
from elements import * | ||
|
||
__version__ = "0.2.2" | ||
__author__ = "William Hunter <whunter.za at gmail dot com>" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
""" | ||
# ============================================================================= | ||
# Write the stiffness matrix of finite element to file. The created file name | ||
# is equal to the string between the underscores of *this* file's name, plus a | ||
# 'K' extension, e.g., | ||
# | ||
# python ELEM_K.py | ||
# | ||
# gives a file named ELEM.K in the same directory. | ||
# | ||
# Author: William Hunter | ||
# Copyright (C) 2008, 2015, William Hunter. | ||
# ============================================================================= | ||
""" | ||
|
||
from __future__ import division | ||
|
||
from sympy import symbols, Matrix, diff, integrate, zeros, eye | ||
|
||
from numpy import abs, array, transpose, dot | ||
from numpy.linalg import inv | ||
|
||
from matlcons import * | ||
|
||
# Get file name: | ||
fname = __file__.split('_')[0] + '.K' | ||
|
||
try: | ||
f = open(fname) | ||
print fname ,'(stiffness matrix) exists!' | ||
f.close() | ||
except IOError: | ||
# SymPy symbols: | ||
a, b, c, x, y, z = symbols('a b c x y z') | ||
N1, N2, N3, N4 = symbols('N1 N2 N3 N4') | ||
N5, N6, N7, N8 = symbols('N5 N6 N7 N8') | ||
E, nu, g, G = symbols('E nu g G') | ||
o = symbols('o') # dummy symbol | ||
xlist = [x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x] | ||
ylist = [y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y] | ||
zlist = [z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z] | ||
yxlist = [y, x, o, y, x, o, y, x, o, y, x, o, y, x, o, y, x, o, y, x, o, y, x, o] | ||
zylist = [o, z, y, o, z, y, o, z, y, o, z, y, o, z, y, o, z, y, o, z, y, o, z, y] | ||
zxlist = [z, o, x, z, o, x, z, o, x, z, o, x, z, o, x, z, o, x, z, o, x, z, o, x] | ||
|
||
# Shape functions: | ||
N1 = (a - x) * (b - y) * (c - z) / (8 * a * b * c) | ||
N2 = (a + x) * (b - y) * (c - z) / (8 * a * b * c) | ||
N3 = (a + x) * (b + y) * (c - z) / (8 * a * b * c) | ||
N4 = (a - x) * (b + y) * (c - z) / (8 * a * b * c) | ||
N5 = (a - x) * (b - y) * (c + z) / (8 * a * b * c) | ||
N6 = (a + x) * (b - y) * (c + z) / (8 * a * b * c) | ||
N7 = (a + x) * (b + y) * (c + z) / (8 * a * b * c) | ||
N8 = (a - x) * (b + y) * (c + z) / (8 * a * b * c) | ||
|
||
# Create strain-displacement matrix B: | ||
B0 = map(diff, [N1, 0, 0, N2, 0, 0, N3, 0, 0, N4, 0, 0,\ | ||
N5, 0, 0, N6, 0, 0, N7, 0, 0, N8, 0, 0], xlist) | ||
B1 = map(diff, [0, N1, 0, 0, N2, 0, 0, N3, 0, 0, N4, 0,\ | ||
0, N5, 0, 0, N6, 0, 0, N7, 0, 0, N8, 0], ylist) | ||
B2 = map(diff, [0, 0, N1, 0, 0, N2, 0, 0, N3, 0, 0, N4,\ | ||
0, 0, N5, 0, 0, N6, 0, 0, N7, 0, 0, N8], zlist) | ||
B3 = map(diff, [N1, N1, N1, N2, N2, N2, N3, N3, N3, N4, N4, N4,\ | ||
N5, N5, N5, N6, N6, N6, N7, N7, N7, N8, N8, N8], yxlist) | ||
B4 = map(diff, [N1, N1, N1, N2, N2, N2, N3, N3, N3, N4, N4, N4,\ | ||
N5, N5, N5, N6, N6, N6, N7, N7, N7, N8, N8, N8], zylist) | ||
B5 = map(diff, [N1, N1, N1, N2, N2, N2, N3, N3, N3, N4, N4, N4,\ | ||
N5, N5, N5, N6, N6, N6, N7, N7, N7, N8, N8, N8], zxlist) | ||
B = Matrix([B0, B1, B2, B3, B4, B5]) | ||
|
||
# Create constitutive (material property) matrix: | ||
C = Matrix([[(1 - nu) * g, nu * g, nu * g, 0, 0, 0], | ||
[nu * g, (1 - nu) * g, nu * g, 0, 0, 0], | ||
[nu * g, nu * g, (1 - nu) * g, 0, 0, 0], | ||
[0, 0, 0, G, 0, 0], | ||
[0, 0, 0, 0, G, 0], | ||
[0, 0, 0, 0, 0, G]]) | ||
|
||
PI = eye(6) | ||
PH3 = Matrix([\ | ||
[y/b, z/c, (y*z)/(b*c), 0, 0, 0, 0, 0, 0, 0, 0, 0],\ | ||
[0, 0, 0, x/a, z/c, (x*z)/(a*c), 0, 0, 0, 0, 0, 0],\ | ||
[0, 0, 0, 0, 0, 0, x/a, y/b, (x*y)/(a*b), 0, 0, 0],\ | ||
[0, 0, 0, 0, 0, 0, 0, 0, 0, z/c, 0, 0],\ | ||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, x/a, 0],\ | ||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, y/b]]) | ||
P = PI.row_join(PH3) | ||
tP = P.transpose() | ||
dJ = tP * B | ||
dH = tP * C.inv() * P | ||
|
||
# Integration: | ||
print 'SymPy is integrating: K for H18B...' | ||
J = dJ.integrate((x, -a, a),(y, -b, b),(z, -c, c)) | ||
J = J.subs({a:_a, b:_b, c:_c, E:_E, nu:_nu, g:_g, G:_G}) | ||
H = dH.integrate((x, -a, a),(y, -b, b),(z, -c, c)) | ||
H = H.subs({a:_a, b:_b, c:_c, E:_E, nu:_nu, g:_g, G:_G}) | ||
|
||
# Convert SymPy Matrix to NumPy array: | ||
J = array(J).astype('double') | ||
iH = inv(array(H).astype('double')) | ||
|
||
# Convert SymPy Matrix to NumPy array: | ||
# NOTE: | ||
# sympy.Matrix() * sympy.Matrix == numpy.dot(numpy.array(), numpy.array()) | ||
K = dot(dot(J.transpose(), iH), J) # use NumPy's dot for arrays, NOT '*' | ||
|
||
# Set small (<< 0) values equal to zero: | ||
K[abs(K) < 1e-6] = 0 | ||
|
||
# Create file: | ||
K.dump(fname) | ||
print 'Created', fname, '(stiffness matrix).' | ||
|
||
# EOF H18B_K.py |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
""" | ||
# ============================================================================= | ||
# Write the stiffness matrix of finite element to file. The created file name | ||
# is equal to the string between the underscores of *this* file's name, plus a | ||
# 'K' extension, e.g., | ||
# | ||
# python ELEM_K.py | ||
# | ||
# gives a file named ELEM.K in the same directory. | ||
# | ||
# Author: William Hunter | ||
# Copyright (C) 2008, 2015, William Hunter. | ||
# ============================================================================= | ||
""" | ||
|
||
from __future__ import division | ||
|
||
from sympy import symbols, Matrix, diff, integrate, zeros | ||
|
||
from numpy import abs, array | ||
|
||
from matlcons import * | ||
|
||
# Get file name: | ||
fname = __file__.split('_')[0] + '.K' | ||
|
||
try: | ||
f = open(fname) | ||
print fname ,'(stiffness matrix) exists!' | ||
f.close() | ||
except IOError: | ||
# SymPy symbols: | ||
a, b, c, x, y, z = symbols('a b c x y z') | ||
N1, N2, N3, N4 = symbols('N1 N2 N3 N4') | ||
N5, N6, N7, N8 = symbols('N5 N6 N7 N8') | ||
k = symbols('k') | ||
xlist = [x, x, x, x, x, x, x, x] | ||
ylist = [y, y, y, y, y, y, y, y] | ||
zlist = [z, z, z, z, z, z, z, z] | ||
|
||
# Shape functions: | ||
N1 = (a - x) * (b - y) * (c - z) / (8 * a * b * c) | ||
N2 = (a + x) * (b - y) * (c - z) / (8 * a * b * c) | ||
N3 = (a + x) * (b + y) * (c - z) / (8 * a * b * c) | ||
N4 = (a - x) * (b + y) * (c - z) / (8 * a * b * c) | ||
N5 = (a - x) * (b - y) * (c + z) / (8 * a * b * c) | ||
N6 = (a + x) * (b - y) * (c + z) / (8 * a * b * c) | ||
N7 = (a + x) * (b + y) * (c + z) / (8 * a * b * c) | ||
N8 = (a - x) * (b + y) * (c + z) / (8 * a * b * c) | ||
|
||
# Create strain-displacement matrix B: | ||
B0 = map(diff, [N1, N2, N3, N4, N5, N6, N7, N8], xlist) | ||
B1 = map(diff, [N1, N2, N3, N4, N5, N6, N7, N8], ylist) | ||
B2 = map(diff, [N1, N2, N3, N4, N5, N6, N7, N8], zlist) | ||
B = Matrix([B0, B1, B2]) | ||
|
||
# Create conductivity matrix: | ||
C = Matrix([[k, 0, 0], | ||
[0, k, 0], | ||
[0, 0, k]]) | ||
|
||
dK = B.T * C * B | ||
|
||
# Integration: | ||
print 'SymPy is integrating: K for H8T...' | ||
K = dK.integrate((x, -a, a),(y, -b, b),(z, -c, c)) | ||
|
||
# Convert SymPy Matrix to NumPy array: | ||
K = array(K.subs({a:_a, b:_b, c:_c, k:_k})).astype('double') | ||
|
||
# Set small (<< 0) values equal to zero: | ||
K[abs(K) < 1e-6] = 0 | ||
|
||
# Create file: | ||
K.dump(fname) | ||
print 'Created', fname, '(stiffness matrix).' | ||
|
||
# EOF H8T_K.py |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
""" | ||
# ============================================================================= | ||
# Write the stiffness matrix of finite element to file. The created file name | ||
# is equal to the string between the underscores of *this* file's name, plus a | ||
# 'K' extension, e.g., | ||
# | ||
# python ELEM_K.py | ||
# | ||
# gives a file named ELEM.K in the same directory. | ||
# | ||
# Author: William Hunter | ||
# Copyright (C) 2008, 2015, William Hunter. | ||
# ============================================================================= | ||
""" | ||
|
||
from __future__ import division | ||
|
||
from sympy import symbols, Matrix, diff, integrate, zeros | ||
|
||
from numpy import abs, array | ||
|
||
from matlcons import * | ||
|
||
# Get file name: | ||
fname = __file__.split('_')[0] + '.K' | ||
|
||
try: | ||
f = open(fname) | ||
print fname ,'(stiffness matrix) exists!' | ||
f.close() | ||
except IOError: | ||
# SymPy symbols: | ||
a, b, c, x, y, z = symbols('a b c x y z') | ||
N1, N2, N3, N4 = symbols('N1 N2 N3 N4') | ||
N5, N6, N7, N8 = symbols('N5 N6 N7 N8') | ||
E, nu, g, G = symbols('E nu g G') | ||
o = symbols('o') # dummy symbol | ||
xlist = [x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x] | ||
ylist = [y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y, y] | ||
zlist = [z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z] | ||
yxlist = [y, x, o, y, x, o, y, x, o, y, x, o, y, x, o, y, x, o, y, x, o, y, x, o] | ||
zylist = [o, z, y, o, z, y, o, z, y, o, z, y, o, z, y, o, z, y, o, z, y, o, z, y] | ||
zxlist = [z, o, x, z, o, x, z, o, x, z, o, x, z, o, x, z, o, x, z, o, x, z, o, x] | ||
|
||
# Shape functions: | ||
N1 = (a - x) * (b - y) * (c - z) / (8 * a * b * c) | ||
N2 = (a + x) * (b - y) * (c - z) / (8 * a * b * c) | ||
N3 = (a + x) * (b + y) * (c - z) / (8 * a * b * c) | ||
N4 = (a - x) * (b + y) * (c - z) / (8 * a * b * c) | ||
N5 = (a - x) * (b - y) * (c + z) / (8 * a * b * c) | ||
N6 = (a + x) * (b - y) * (c + z) / (8 * a * b * c) | ||
N7 = (a + x) * (b + y) * (c + z) / (8 * a * b * c) | ||
N8 = (a - x) * (b + y) * (c + z) / (8 * a * b * c) | ||
|
||
# Create strain-displacement matrix B: | ||
B0 = map(diff, [N1, 0, 0, N2, 0, 0, N3, 0, 0, N4, 0, 0,\ | ||
N5, 0, 0, N6, 0, 0, N7, 0, 0, N8, 0, 0], xlist) | ||
B1 = map(diff, [0, N1, 0, 0, N2, 0, 0, N3, 0, 0, N4, 0,\ | ||
0, N5, 0, 0, N6, 0, 0, N7, 0, 0, N8, 0], ylist) | ||
B2 = map(diff, [0, 0, N1, 0, 0, N2, 0, 0, N3, 0, 0, N4,\ | ||
0, 0, N5, 0, 0, N6, 0, 0, N7, 0, 0, N8], zlist) | ||
B3 = map(diff, [N1, N1, N1, N2, N2, N2, N3, N3, N3, N4, N4, N4,\ | ||
N5, N5, N5, N6, N6, N6, N7, N7, N7, N8, N8, N8], yxlist) | ||
B4 = map(diff, [N1, N1, N1, N2, N2, N2, N3, N3, N3, N4, N4, N4,\ | ||
N5, N5, N5, N6, N6, N6, N7, N7, N7, N8, N8, N8], zylist) | ||
B5 = map(diff, [N1, N1, N1, N2, N2, N2, N3, N3, N3, N4, N4, N4,\ | ||
N5, N5, N5, N6, N6, N6, N7, N7, N7, N8, N8, N8], zxlist) | ||
B = Matrix([B0, B1, B2, B3, B4, B5]) | ||
|
||
# Create constitutive (material property) matrix: | ||
C = Matrix([[(1 - nu) * g, nu * g, nu * g, 0, 0, 0], | ||
[nu * g, (1 - nu) * g, nu * g, 0, 0, 0], | ||
[nu * g, nu * g, (1 - nu) * g, 0, 0, 0], | ||
[0, 0, 0, G, 0, 0], | ||
[0, 0, 0, 0, G, 0], | ||
[0, 0, 0, 0, 0, G]]) | ||
|
||
dK = B.T * C * B | ||
|
||
# Integration: | ||
print 'SymPy is integrating: K for H8...' | ||
K = dK.integrate((x, -a, a),(y, -b, b),(z, -c, c)) | ||
|
||
# Convert SymPy Matrix to NumPy array: | ||
K = array(K.subs({a:_a, b:_b, c:_c, E:_E, nu:_nu, g:_g, G:_G})).astype('double') | ||
|
||
# Set small (<< 0) values equal to zero: | ||
K[abs(K) < 1e-6] = 0 | ||
|
||
# Create file: | ||
K.dump(fname) | ||
print 'Created', fname, '(stiffness matrix).' | ||
|
||
# EOF H8_K.py |
Oops, something went wrong.