Вы находитесь на странице: 1из 8

FRC Assignment_6

Q1)
We find that the optimum value for Ex = 35.99GPa at theta = 36 deg.

Code1:

import numpy as np
import pylab as py
import math as m

#set Z values at ply interface


z=[-2,-1,0,1,2]

#Enter Compliance data and compute the stiffness matrix


S= np.matrix('0.0078125,-0.00234375,0;-0.002343755,0.07692307692307693,0;0,0,.15625')
Q= S.getI()
C=np.matrix('1,0,0;0,1,0;0,0,2')
CinV=C.getI()

#Lists for storing data


Theta=[]
Ex=[]
Gxy=[]
vxy=[]

#Optimum values of Ex and the ply orientation


Eopt = 0
Theta_opt=0

#iteration over defined range of angles


for theta in range(0,90,1):
Angle = [theta,-1*theta,-1*theta,theta]
for i in range(4):
Q_bar=np.zeros((4,3,3))
c=m.cos(np.multiply(Angle[i],m.pi/180))
s=m.sin(np.multiply(Angle[i],m.pi/180))
T=np.matrix([[c**2,s**2,2*c*s],[s**2,c**2,-2*c*s],[-c*s,c*s,c**2-s**2]])
T_i = T.getI()
Q_bar[i,] = Q_bar[i,] + (T_i*Q*C*T)*CinV

#initializing A
A=np.zeros((3,3))
#iteration for calculating A matrix
for j in range(3):
for k in range(3):
for i in range(4):
if i < 4:
A[j,k] = A[j,k] + (Q_bar[i,j,k]*(z[i+1]-z[i]))
i = i+1

#calculating required constants at given angle


E= (((A[0,0]*A[1,1])-(A[0,1])**2)/(A[1,1]))
G= A[2,2]
v= A[0,1]/A[1,1]

Ex.append(E)
Theta.append(theta)
Gxy.append(G)
vxy.append(v)

#iteration for finding max value of Ex


if v <= 1 and G >= 25 and E>Eopt:
Eopt = E
Theta_opt= theta
else:
continue

#plotting the curves


py.figure,ax=py.subplots()
L1=ax.plot(Theta,Ex,'r',label='Ex')
L2=ax.plot(Theta,Gxy,'b',label='Gxy')
ax.set_xlabel('Angle(deg)')
ax.set_ylabel('Ex,Gxy(GPa)')

ax1=ax.twinx()
L3=ax1.plot(Theta,vxy,'g',label='vxy')
ax1.set_ylabel('vxy')
ax.legend(loc=1)
ax1.legend(loc=7)
print(Eopt)
print(Theta_opt)

Output:
The max Ex value that can be obtained with the given constraint is: 35.9920822368 Gpa
The optium ply orientation for the said Ex is: 36 deg

Assignment Q2)

Code2: The code is inefficient in the fact that the it is predicting the integral stress values at which
each ply is already failed rather than the exact stress for failure.

import numpy as np
import math as m

z= [-.375,-.25,-.125,0,.125,.25,.375]
S=np.matrix('0.0071428,-.0021428,0;-.0021428,0.1,0;0,0,.2')
Q=S.getI()
Theta=[0,45,90,90,45,0]
C=np.matrix('1,0,0;0,1,0;0,0,2')
CinV=C.getI()
maxIndex= []

def lamina(Theta,Q):
Q2 = []
for i in range(6):
c=m.cos(Theta[i])
s=m.sin(Theta[i])
T=np.array([[c**2,s**2,2*c*s],[s**2,c**2,-2*c*s],[-c*s,c*s,c**2-s**2]])
T_i = np.linalg.inv(T)
Q2.append(np.linalg.multi_dot([T_i,Q,C,T,CinV]))

return Q2

Q1= lamina(Theta,Q)

Q_bar=np.reshape(Q1,(6,3,3))

while len(maxIndex) < 6:


#if max !=0 :

A=np.zeros((3,3))

for j in range(3):
for k in range(3):
for i in range(6):
if i < 6:
A[j,k] = A[j,k] + (Q_bar[i,j,k]*(z[i+1]-z[i]))
i = i+1

for i in range(0,10000,1):
Nmax=0
N=np.array([[Nmax+i],[0],[0]])

ex = np.linalg.multi_dot([np.linalg.inv(A),N])
e=np.zeros((6,3,1))
sigma=np.zeros((6,3,1))
for i in range(6):

c=m.cos(np.multiply(Theta[i],m.pi/180))
s=m.sin(np.multiply(Theta[i],m.pi/180))
T = np.array([[c**2,s**2,2*c*s],[s**2,c**2,-2*c*s],[-c*s,c*s,c**2-s**2]])
e[i,] = e[i,] + np.linalg.multi_dot([T,ex])
for l in range(len(maxIndex)):
e[maxIndex[l],]=np.zeros((3,1))

sigma[i,] = Q*e[i,]

Sigma= np.reshape(sigma,(6,3))

Stress_Ratio= np.zeros((6,3))
for i in range(0,6,1):
if Sigma[i,0]<0:
Stress_Ratio[i,0]=Stress_Ratio[i,0]+abs(Sigma[i,0])/1200
else:
Stress_Ratio[i,0]=Stress_Ratio[i,0]+Sigma[i,0]/1500

if Sigma[i,1]<0:
Stress_Ratio[i,1]=Stress_Ratio[i,1]+abs(Sigma[i,1])/250
else:
Stress_Ratio[i,1]=Stress_Ratio[i,1] +Sigma[i,1]/50

Stress_Ratio[i,2]=abs(Sigma[i,2])/70

SRmax=np.amax(Stress_Ratio,axis=1)

if np.amax(SRmax) < 1:
continue
else:
Nmax = N
break
print('Failure Load=',Nmax[0])

max=[]
for i in range(len(SRmax)):
if SRmax[i] >= 1:
max.append(SRmax[i])
maxIndex.append(i)
Fail_PlyIndex = maxIndex+np.ones_like(maxIndex)

print('Failed Ply:',Fail_PlyIndex)
for l in range(len(maxIndex)):
Q_bar[maxIndex[l],]=np.zeros((3,3))

Output:

Failure Load= [221]


Failed Ply: [3 4]
Failure Load= [326]
Failed Ply: [3 4 2 5]
Failure Load= [375]
Failed Ply: [3 4 2 5 1 6]

Вам также может понравиться