Repository navigation
Expand file tree
/
Copy pathFrame.py
More file actions
76 lines (61 loc) · 1.5 KB
/
Copy pathFrame.py
File metadata and controls
76 lines (61 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import StructPy.structural_classes as sc
import StructPy.cross_sections as xs
import StructPy.materials as ma
import numpy as np
class FrameNode(sc.Node):
DoFNames= ['x', 'y', 'θz']
fixities = { # x, y, θ
'free' : (1.0, 1.0, 1.0),
'fixed' : (0.0, 0.0, 0.0),
'pin' : (0.0, 0.0, 1.0),
'roller' : (1.0, 0.0, 1.0),
'yroller': (0.0, 1.0, 1.0),
'slide' : (0.0, 1.0, 0.0)
}
@property
def deformation_dict(self):
return {
'x': self.deformation[0],
'y': self.deformation[1],
'θz': self.deformation[2]
}
class FrameMember(sc.Member):
nDoFPerNode = 3
@property
def k(self):
"""Local member stiffness matrix"""
L = self.length
E = self.material.E
A = self.cross.A
I = self.cross.Ix
a = (A*E)/L
b = (E*I)/L
c = (E*I)/L**2
d = (E*I)/L**3
return np.array([
[ a, 0, 0, -a, 0, 0 ],
[ 0, 12*d, 6*c, 0, -12*d, 6*c ],
[ 0, 6*c, 4*b, 0, -6*c, 2*b ],
[ -a, 0, 0, a, 0, 0 ],
[ 0, -12*d, -6*c, 0, 12*d, -6*c ],
[ 0, 6*c, 2*b, 0, -6*c, 4*b ]
])
@property
def T(self):
"""Local to global transformation matrix"""
l = self.unVec[0]
m = self.unVec[1]
return np.array([
[l, m, 0, 0, 0, 0],
[-m, l, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0],
[0, 0, 0, l, m, 0],
[0, 0, 0, -m, l, 0],
[0, 0, 0, 0, 0, 1]
])
class Frame(sc.Structure, sc.Planar):
"""Frame class"""
whatDoF = ['x', 'y', 'θz']
nDoFPerNode = len(whatDoF)
MemberType = FrameMember
NodeType = FrameNode