forked from waterloo-rocketry/Composites-Calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ABD_matrices.py
39 lines (30 loc) · 1.1 KB
/
ABD_matrices.py
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
import numpy as np
from Q_and_Qbar import transform_Q
# Calculate A, B, D matrices by integrating transformed stiffness matrix over all plies based on laminate
# constitutive equations
# Units for A, B, D matrices respectively are hN/m, hN, hNm
def ABD_triple(Q0, stack, height):
A = np.zeros([3, 3])
B = np.zeros([3, 3])
D = np.zeros([3, 3])
for i in range(len(Q0)):
for j in range(len(Q0[0])):
for k in range(len(stack)):
Qbar = transform_Q(Q0, stack[k])
ply_kA = height[k+1]-height[k]
ply_kB = (height[k+1]**2-height[k]**2)/2
ply_kD = (height[k+1]**3-height[k]**3)/3
A[i, j] += ply_kA*Qbar[i, j]
B[i, j] += ply_kB*Qbar[i, j]
D[i, j] += ply_kD*Qbar[i, j]
return (A, B, D)
# Set ABD matrix
# I think I made a mistake here. The extension-twisting coupling matrix should be B transpose
def ABD_matrix(A, B, D):
return np.concatenate(
(
np.concatenate((A, B), axis=0),
np.concatenate((B, D), axis=0)
),
axis=1
)