import numpy as np
def CLT(myE1,myE2,myG12,myNu12,myLaminate,myLaminateThickness,myPlyNumber):
#--------------------------------------------------------------------------
#
# This function calculates the ABD Composite Stiffness Matrix Components
# Classical Lamination Theory (CLT)
#
#--------------------------------------------------------------------------
i=0
myThickness = myPlyNumber*myLaminateThickness
Z = []
Z.append(-myThickness/2.0)
for j in range(1,myPlyNumber+1,1):
Z.append(Z[j-1]+myLaminateThickness)
# Calcuate Reduced Stiffnesses
myQ11 = []
myQ12 = []
myQ16 = []
myQ22 = []
myQ26 = []
myQ66 = []
myQ11_S = []
myQ12_S = []
myQ16_S = []
myQ22_S = []
myQ26_S = []
myQ66_S = []
for i in range(0,1,1):
myQ11.append((myE1**2)/(myE1-myNu12**2*myE2))
myQ12.append((myNu12*myE1*myE2)/(myE1-myNu12**2*myE2))
myQ16.append(0)
myQ22.append((myE1*myE2)/(myE1-myNu12**2*myE2))
myQ26.append(0)
myQ66.append(myG12)
i=0
for j in range(0,myPlyNumber,1):
myQ11_S.append(myQ11[i]*np.cos(myLaminate[j]*np.pi/180.0)**4 + 2*(myQ12[i]+2*myQ66[i])*(np.cos(myLaminate[j]*np.pi/180.0))**2*(np.sin(myLaminate[j]*np.pi/180.0))**2 + myQ22[i]*(np.sin(myLaminate[j]*np.pi/180.0))**4)
myQ12_S.append(myQ12[i]*((np.cos(myLaminate[j]*np.pi/180.0)**4)+(np.sin(myLaminate[j]*np.pi/180.0)**4))+ (myQ11[i]+myQ22[i]-4*myQ66[i])*np.cos(myLaminate[j]*np.pi/180.0)**2*np.sin(myLaminate[j]*np.pi/180.0)**2)
myQ16_S.append((myQ11[i]-myQ12[i]-2*myQ66[i])*np.cos(myLaminate[j]*np.pi/180.0)**3*np.sin(myLaminate[j]*np.pi/180.0) - (myQ22[i] - myQ12[i] - 2*myQ66[i])*np.cos(myLaminate[j]*np.pi/180.0)*np.sin(myLaminate[j]*np.pi/180.0)**3)
myQ22_S.append(myQ11[i]*np.sin(myLaminate[j]*np.pi/180.0)**4 + 2*(myQ12[i]+2*myQ66[i])*(np.cos(myLaminate[j]*np.pi/180.0))**2*(np.sin(myLaminate[j]*np.pi/180.0))**2 + myQ22[i]*(np.cos(myLaminate[j]*np.pi/180.0))**4)
myQ26_S.append((myQ11[i]-myQ12[i]-2*myQ66[i])*np.cos(myLaminate[j]*np.pi/180.0)*np.sin(myLaminate[j]*np.pi/180.0)**3 - (myQ22[i] - myQ12[i] - 2*myQ66[i])*np.cos(myLaminate[j]*np.pi/180.0)**3*np.sin(myLaminate[j]*np.pi/180.0))
myQ66_S.append((myQ11[i] + myQ22[i] - 2*myQ12[i] - 2*myQ66[i])*np.cos(myLaminate[j]*np.pi/180.0)**2*np.sin(myLaminate[j]*np.pi/180.0)**2 + myQ66[i]*(np.cos(myLaminate[j]*np.pi/180.0)**4+np.sin(myLaminate[j]*np.pi/180.0)**4))
# Calcualte A Matrix
#-------------
A11_v = []
A12_v = []
A16_v = []
A22_v = []
A26_v = []
A66_v = []
i = 1
for j in range(0,myPlyNumber,1):
A11_v.append(myQ11_S[j]*(Z[i]-Z[i-1]))
A12_v.append(myQ12_S[j]*(Z[i]-Z[i-1]))
A16_v.append(myQ16_S[j]*(Z[i]-Z[i-1]))
A22_v.append(myQ22_S[j]*(Z[i]-Z[i-1]))
A26_v.append(myQ26_S[j]*(Z[i]-Z[i-1]))
A66_v.append(myQ66_S[j]*(Z[i]-Z[i-1]))
i = i+1
A11 = sum(A11_v)
A12 = sum(A12_v)
A16 = sum(A16_v)
A22 = sum(A22_v)
A26 = sum(A26_v)
A66 = sum(A66_v)
# Calcualte B Matrix
#-------------
B11_v = []
B12_v = []
B16_v = []
B22_v = []
B26_v = []
B66_v = []
i = 1
for j in range(0,myPlyNumber,1):
B11_v.append(0.5*myQ11_S[j]*(Z[i]**2-Z[i-1]**2))
B12_v.append(0.5*myQ12_S[j]*(Z[i]**2-Z[i-1]**2))
B16_v.append(0.5*myQ16_S[j]*(Z[i]**2-Z[i-1]**2))
B22_v.append(0.5*myQ22_S[j]*(Z[i]**2-Z[i-1]**2))
B26_v.append(0.5*myQ26_S[j]*(Z[i]**2-Z[i-1]**2))
B66_v.append(0.5*myQ66_S[j]*(Z[i]**2-Z[i-1]**2))
i = i+1
B11 = sum(B11_v)
B12 = sum(B12_v)
B16 = sum(B16_v)
B22 = sum(B22_v)
B26 = sum(B26_v)
B66 = sum(B66_v)
# Calcualte D Matrix
#-------------
D11_v = []
D12_v = []
D16_v = []
D22_v = []
D26_v = []
D66_v = []
i = 1
for j in range(0,myPlyNumber,1):
D11_v.append((1/3.0)*myQ11_S[j]*(Z[i]**3-Z[i-1]**3))
D12_v.append((1/3.0)*myQ12_S[j]*(Z[i]**3-Z[i-1]**3))
D16_v.append((1/3.0)*myQ16_S[j]*(Z[i]**3-Z[i-1]**3))
D22_v.append((1/3.0)*myQ22_S[j]*(Z[i]**3-Z[i-1]**3))
D26_v.append((1/3.0)*myQ26_S[j]*(Z[i]**3-Z[i-1]**3))
D66_v.append((1/3.0)*myQ66_S[j]*(Z[i]**3-Z[i-1]**3))
i = i+1
D11 = sum(D11_v)
D12 = sum(D12_v)
D16 = sum(D16_v)
D22 = sum(D22_v)
D26 = sum(D26_v)
D66 = sum(D66_v)
return A11,A12,A16,A22,A26,A66,B11,B12,B16,B22,B26,B66,D11,D12,D16,D22,D26,D66
#-----------------------------------------------------------------------------------------------
# def CLT(myE11,myE22,myG12,myNu12,myLaminate,myLaminateThickness,myPlyNumber):
# ANY VALUES OF FIBER MATERIAL CAN BE ADDED HERE
myE1 = 141 # Laminate E1 [Gpa]
myE2 = 6.7 # Laminate E2 [Gpa]
myNu12 = 0.33 # Laminate nu12 [-]
myG12 = 3.2 # Laminate G12 [Gpa]
myLaminate = [90,0,90,0,0,90,0,90]
myPlyNumber = len(myLaminate)
myLaminateThickness = 0.001
A11,A12,A16,A22,A26,A66,B11,B12,B16,B22,B26,B66,D11,D12,D16,D22,D26,D66 = CLT(myE1,myE2,myG12,myNu12,myLaminate,myLaminateThickness,myPly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pbiByYW5nZSgwLDEsMSk6CiAgICAgICAgbXlRMTEuYXBwZW5kKChteUUxKioyKS8obXlFMS1teU51MTIqKjIqbXlFMikpCiAgICAgICAgbXlRMTIuYXBwZW5kKChteU51MTIqbXlFMSpteUUyKS8obXlFMS1teU51MTIqKjIqbXlFMikpCiAgICAgICAgbXlRMTYuYXBwZW5kKDApCiAgICAgICAgbXlRMjIuYXBwZW5kKChteUUxKm15RTIpLyhteUUxLW15TnUxMioqMipteUUyKSkKICAgICAgICBteVEyNi5hcHBlbmQoMCkKICAgICAgICBteVE2Ni5hcHBlbmQobXlHMTIpCiAgICAKICAgIGk9MCAgICAKICAgIGZvciBqIGluIHJhbmdlKDAsbXlQbHlOdW1iZXIsMSk6CiAgICAgICAgbXlRMTFfUy5hcHBlbmQobXlRMTFbaV0qbnAuY29zKG15TGFtaW5hdGVbal0qbnAucGkvMTgwLjApKio0ICsgMioobXlRMTJbaV0rMipteVE2NltpXSkqKG5wLmNvcyhteUxhbWluYXRlW2pdKm5wLnBpLzE4MC4wKSkqKjIqKG5wLnNpbihteUxhbWluYXRlW2pdKm5wLnBpLzE4MC4wKSkqKjIgKyBteVEyMltpXSoobnAuc2luKG15TGFtaW5hdGVbal0qbnAucGkvMTgwLjApKSoqNCkKICAgICAgICBteVExMl9TLmFwcGVuZChteVExMltpXSooKG5wLmNvcyhteUxhbWluYXRlW2pdKm5wLnBpLzE4MC4wKSoqNCkrKG5wLnNpbihteUxhbWluYXRlW2pdKm5wLnBpLzE4MC4wKSoqNCkpKyAobXlRMTFbaV0rbXlRMjJbaV0tNCpteVE2NltpXSkqbnAuY29zKG15TGFtaW5hdGVbal0qbnAucGkvMTgwLjApKioyKm5wLnNpbihteUxhbWluYXRlW2pdKm5wLnBpLzE4MC4wKSoqMikKICAgICAgICBteVExNl9TLmFwcGVuZCgobXlRMTFbaV0tbXlRMTJbaV0tMipteVE2NltpXSkqbnAuY29zKG15TGFtaW5hdGVbal0qbnAucGkvMTgwLjApKiozKm5wLnNpbihteUxhbWluYXRlW2pdKm5wLnBpLzE4MC4wKSAtIChteVEyMltpXSAtIG15UTEyW2ldIC0gMipteVE2NltpXSkqbnAuY29zKG15TGFtaW5hdGVbal0qbnAucGkvMTgwLjApKm5wLnNpbihteUxhbWluYXRlW2pdKm5wLnBpLzE4MC4wKSoqMykKICAgICAgICBteVEyMl9TLmFwcGVuZChteVExMVtpXSpucC5zaW4obXlMYW1pbmF0ZVtqXSpucC5waS8xODAuMCkqKjQgKyAyKihteVExMltpXSsyKm15UTY2W2ldKSoobnAuY29zKG15TGFtaW5hdGVbal0qbnAucGkvMTgwLjApKSoqMioobnAuc2luKG15TGFtaW5hdGVbal0qbnAucGkvMTgwLjApKSoqMiArIG15UTIyW2ldKihucC5jb3MobXlMYW1pbmF0ZVtqXSpucC5waS8xODAuMCkpKio0KQogICAgICAgIG15UTI2X1MuYXBwZW5kKChteVExMVtpXS1teVExMltpXS0yKm15UTY2W2ldKSpucC5jb3MobXlMYW1pbmF0ZVtqXSpucC5waS8xODAuMCkqbnAuc2luKG15TGFtaW5hdGVbal0qbnAucGkvMTgwLjApKiozIC0gKG15UTIyW2ldIC0gbXlRMTJbaV0gLSAyKm15UTY2W2ldKSpucC5jb3MobXlMYW1pbmF0ZVtqXSpucC5waS8xODAuMCkqKjMqbnAuc2luKG15TGFtaW5hdGVbal0qbnAucGkvMTgwLjApKQogICAgICAgIG15UTY2X1MuYXBwZW5kKChteVExMVtpXSArIG15UTIyW2ldIC0gMipteVExMltpXSAtIDIqbXlRNjZbaV0pKm5wLmNvcyhteUxhbWluYXRlW2pdKm5wLnBpLzE4MC4wKSoqMipucC5zaW4obXlMYW1pbmF0ZVtqXSpucC5waS8xODAuMCkqKjIgKyBteVE2NltpXSoobnAuY29zKG15TGFtaW5hdGVbal0qbnAucGkvMTgwLjApKio0K25wLnNpbihteUxhbWluYXRlW2pdKm5wLnBpLzE4MC4wKSoqNCkpCiAgICAKICAgIAogICAgCiAgICAjIENhbGN1YWx0ZSBBIE1hdHJpeAogICAgIy0tLS0tLS0tLS0tLS0KICAgICAgICAgICAgCiAgICBBMTFfdiA9IFtdCiAgICBBMTJfdiA9IFtdCiAgICBBMTZfdiA9IFtdCiAgICBBMjJfdiA9IFtdCiAgICBBMjZfdiA9IFtdCiAgICBBNjZfdiA9IFtdCiAgICBpID0gMQogICAgZm9yIGogaW4gcmFuZ2UoMCxteVBseU51bWJlciwxKToKICAgICAgICBBMTFfdi5hcHBlbmQobXlRMTFfU1tqXSooWltpXS1aW2ktMV0pKQogICAgICAgIEExMl92LmFwcGVuZChteVExMl9TW2pdKihaW2ldLVpbaS0xXSkpCiAgICAgICAgQTE2X3YuYXBwZW5kKG15UTE2X1Nbal0qKFpbaV0tWltpLTFdKSkKICAgICAgICBBMjJfdi5hcHBlbmQobXlRMjJfU1tqXSooWltpXS1aW2ktMV0pKQogICAgICAgIEEyNl92LmFwcGVuZChteVEyNl9TW2pdKihaW2ldLVpbaS0xXSkpCiAgICAgICAgQTY2X3YuYXBwZW5kKG15UTY2X1Nbal0qKFpbaV0tWltpLTFdKSkKICAgICAgICBpID0gaSsxCiAgICAKICAgIEExMSA9IHN1bShBMTFfdikKICAgIEExMiA9IHN1bShBMTJfdikKICAgIEExNiA9IHN1bShBMTZfdikKICAgIEEyMiA9IHN1bShBMjJfdikKICAgIEEyNiA9IHN1bShBMjZfdikKICAgIEE2NiA9IHN1bShBNjZfdikKICAgIAogICAgIyBDYWxjdWFsdGUgQiBNYXRyaXgKICAgICMtLS0tLS0tLS0tLS0tCiAgICAgICAgICAgIAogICAgQjExX3YgPSBbXQogICAgQjEyX3YgPSBbXQogICAgQjE2X3YgPSBbXQogICAgQjIyX3YgPSBbXQogICAgQjI2X3YgPSBbXQogICAgQjY2X3YgPSBbXQogICAgaSA9IDEKICAgIGZvciBqIGluIHJhbmdlKDAsbXlQbHlOdW1iZXIsMSk6CiAgICAgICAgQjExX3YuYXBwZW5kKDAuNSpteVExMV9TW2pdKihaW2ldKioyLVpbaS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