Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 14

%% 5th Assignment on Fiber Reinforced Composities by Thiruvadi Ragupathy M

(193010032)

clc;clear;close
%% Material Properties

syms U u B b

J = input('Enter [U] to feed Fiber properties or [B] to use built-in High Modulus
Carbon Fiber (HMCF) Properties [U/B]= ','s');

if (strcmpi(J,'U'))
disp(' ')
N = input('Enter the name of the Fiber Properties to be feeded ','s');
disp(' ')
disp(['For ' upper(N) ', Enter the following properties:'])
disp(' ')
E1 = input('Longitudinal Modulus Value in Gpa = ');
E1 = E1*10^9;
disp(' ')
E2 = input('Transverse Modulus Value in Gpa = ');
E2 = E2*10^9;
disp(' ')
g = input('Shear Modulus Value in Gpa = ');
g = g*10^9;
disp(' ')
v = input('Poissons Ratio Value = ');
disp(' ')
tc1 = input('Longitundinal Co-effiecient of Thermal Expansion in (10^-6) = ');
tc1 = tc1*10^-6;
disp(' ')
tc2 = input('Transverse Co-effiecient of Thermal Expansion in (10^-6) = ');
tc2 = tc2*10^-6;
disp(' ')

else

E1 = 175e9; E2 = 8e9; v = 0.3; g = 5e9; tc1=-0.0000003; tc2=-0.000025; % High


Modulus Carbon Fiber (HMCF) Properties
disp(' ')
disp('Properties of High Modulus Carbon Fiber (HMCF)')
disp(' ')
disp('Longitudinal Modulus = 175 Gpa')
disp('Transverse Modulus = 8 Gpa')
disp('Shear Modulus = 5 Gpa')
disp('Poisson ratio = 0.30')
disp('Longitundinal Co-effiecient of Thermal Expansion = -0.3 e-6')
disp('Transverse Co-effiecient of Thermal Expansion = 25 e-6')
disp(' ')

end

%% Laminate Schedule

t=input('please insert the ply thickness (mm) = ');


t=t/1000;
disp(' ')

ls = input('Enter [U] to feed Fiber Laminate Schedule or [B] to use built-in Fiber
Laminate Schedule [U/B] = ','s');

if (strcmpi(ls,'U'))
disp(' ')
K = input('please insert number of plies = ');
orientation = zeros(1,K);
fprintf('\nplease insert the plies orientation from bottom to top \n\n')
LS1 = 1;

for i= 1:K

switch i

case 1
fprintf('Enter the value of %dst',i)
orientation(1,i) = input(' lamina orientation angle = ');
case 2
fprintf('Enter the value of %dnd',i)
orientation(1,i) = input(' lamina orientation angle = ');
case 3
fprintf('Enter the value of %drd',i)
orientation(1,i) = input(' lamina orientation angle = ');
otherwise
fprintf('Enter the value of %dth',i)
orientation(1,i) = input(' lamina orientation angle = ');

end %%% for switch

end %%% for for


tl= num2str(orientation);
else
disp(' ')
disp('Select the Laminate Schedule:')
disp('1. [0(8) / 90(8)] s')
disp('2. [0 / 30 / -30 / 0] s')
disp('3. [45 / -30 / 15 / -5] s')
disp('4. [45 / 45 / 45 / 45 / -45 / -45 / -45 / -45] T')
disp('5. [45 / -45 ] s')
disp('6. All the above four')
disp(' ')
LS1 = input('');

switch LS1

case 1
tl=' [ 0(8) / 90(8) ] S ';
disp(' ')
K = 32;
orientation = zeros(1,K);
orientation(1,1) = 0; orientation(1,2) = 0; orientation(1,3) = 0;
orientation(1,4) = 0; orientation(1,5) = 0;
orientation(1,6) = 0; orientation(1,7) = 0; orientation(1,8) = 0;
orientation(1,9) = 90; orientation(1,10) = 90;
orientation(1,11) = 90; orientation(1,12) = 90; orientation(1,13) = 90;
orientation(1,14) = 90; orientation(1,15) = 90;
orientation(1,16) = 90; orientation(1,17) = 90; orientation(1,18) = 90;
orientation(1,19) = 90; orientation(1,20) = 90;
orientation(1,21) = 90; orientation(1,22) = 90; orientation(1,23) = 90;
orientation(1,24) = 90; orientation(1,25) = 0;
orientation(1,26) = 0; orientation(1,27) = 0; orientation(1,28) = 0;
orientation(1,29) = 0; orientation(1,30) = 0;
orientation(1,31) = 0; orientation(1,32) = 0;

case 2
tl='[ 0 / 30 / -30 / 0 ] S ';
disp(' ')
K = 8;
orientation = zeros(1,K);
orientation(1,1) = 0; orientation(1,2) = 30; orientation(1,3) = -30;
orientation(1,4) = 0; orientation(1,5) = 0;
orientation(1,6) = -30; orientation(1,7) = 30; orientation(1,8) = 0;

case 3
tl=' [ 45 / -30 / 15 / -5 ] S ';
disp(' ')
K = 8;
orientation = zeros(1,K);
orientation(1,1) = 45; orientation(1,2) = -30; orientation(1,3) = 15;
orientation(1,4) = -5; orientation(1,5) = -5;
orientation(1,6) = 15; orientation(1,7) = -30; orientation(1,8) = 45;

case 4
tl=' [ 45 / 45 / 45 / 45 / -45 / -45 / -45 / -45 ] T ';
disp(' ')
K = 8;
orientation = zeros(1,K);
orientation(1,1) = 45; orientation(1,2) = 45; orientation(1,3) = 45;
orientation(1,4) = 45; orientation(1,5) = -45;
orientation(1,6) = -45; orientation(1,7) = -45; orientation(1,8) = -45;

case 5
tl=' [ 45 / -45 ] S ';
disp(' ')
K = 4;
orientation = zeros(1,K);
orientation(1,1) = 45; orientation(1,2) = -45; orientation(1,3) = -45;
orientation(1,4) = 45;

case 6

for All= 1:5

switch All

case 1
tl=' [ 0(8) / 90(8) ] S ';
disp(' ')
disp('For the Laminate Schedule [ 0(8) / 90(8) ] S :')
disp(' ')
K = 32;
orientation = zeros(1,K);
orientation(1,1) = 0; orientation(1,2) = 0;
orientation(1,3) = 0; orientation(1,4) = 0; orientation(1,5) = 0;
orientation(1,6) = 0; orientation(1,7) = 0;
orientation(1,8) = 0; orientation(1,9) = 90; orientation(1,10) = 90;
orientation(1,11) = 90; orientation(1,12) = 90;
orientation(1,13) = 90; orientation(1,14) = 90; orientation(1,15) = 90;
orientation(1,16) = 90; orientation(1,17) = 90;
orientation(1,18) = 90; orientation(1,19) = 90; orientation(1,20) = 90;
orientation(1,21) = 90; orientation(1,22) = 90;
orientation(1,23) = 90; orientation(1,24) = 90; orientation(1,25) = 0;
orientation(1,26) = 0; orientation(1,27) = 0;
orientation(1,28) = 0; orientation(1,29) = 0; orientation(1,30) = 0;
orientation(1,31) = 0; orientation(1,32) = 0;

case 2
tl='[ 0 / 30 / -30 / 0 ] S ';
disp(' ')
disp('For the Laminate Schedule [ 0 / 30 / -30 / 0 ] S :')
disp(' ')
K = 8;
orientation = zeros(1,K);
orientation(1,1) = 0; orientation(1,2) = 30;
orientation(1,3) = -30; orientation(1,4) = 0; orientation(1,5) = 0;
orientation(1,6) = -30; orientation(1,7) = 30;
orientation(1,8) = 0;

case 3
tl=' [ 45 / -30 / 15 / -5 ] S ';
disp(' ')
disp('For the Laminate Schedule [ 45 / -30 / 15 / -5 ]
S :')
disp(' ')
K = 8;
orientation = zeros(1,K);
orientation(1,1) = 45; orientation(1,2) = -30;
orientation(1,3) = 15; orientation(1,4) = -5; orientation(1,5) = -5;
orientation(1,6) = 15; orientation(1,7) = -30;
orientation(1,8) = 45;

case 4
tl=' [ 45 / 45 / 45 / 45 / -45 / -45 / -45 / -45 ] T ';
disp(' ')
disp('For the Laminate Schedule [ 45 / -30 / 15 / -5 ]
S :')
disp(' ')
K = 8;
orientation = zeros(1,K);
orientation(1,1) = 45; orientation(1,2) = 45;
orientation(1,3) = 45; orientation(1,4) = 45; orientation(1,5) = -45;
orientation(1,6) = -45; orientation(1,7) = -45;
orientation(1,8) = -45;

case 5
tl='[ 45 / -45 ] S ';
disp(' ')
disp('For the Laminate Schedule [ 45 / -45 ] S :')
disp(' ')
K = 4;
orientation = zeros(1,K);
orientation(1,1) = 45; orientation(1,2) = -45;
orientation(1,3) = -45; orientation(1,4) = 45;

end %%% for All case switch


%% Force Input

if All == 1
Fo = input('Enter [U] to feed External Forces or [B] to use built-
in External Forces [U/B]= ','s');

if (strcmpi(Fo,'U'))

disp(' ')
Nx=input('Enter the Force along x-direction (N/m) = ');
Ny=input('Enter the Force along y-direction (N/m) = ');
Nxy=input('Enter the Force along xy-direction (N/m) = ');
Mx=input('Enter the Moment along x-direction (Nm/m) = ');
My=input('Enter the Moment along y-direction (Nm/m) = ');
Mxy=input('Enter the Moment along xy-direction (Nm/m) = ');
disp(' ')

else

Nx=10000; Ny=0; Nxy=0; Mx=100; My=0; Mxy=0;


fprintf('Nx = 10000 N/m, Ny = 0 N/m, Nxy = 0 N/m, Mx = 100
Nm/m, My = 0 Nm/m, Mxy = 0 Nm/m')
disp(' ')

end

F=[Nx; Ny; Nxy; Mx; My; Mxy];

%% Thermal Stresses

%%% Temerature Inputs

disp(' ')
Te = input('Enter [U] to feed Temperature or [B] to use built-
in Temperature [U/B]= ','s');
disp(' ')

if (strcmpi(Te,'U'))

disp(' ')
Ter=input('Enter the Reference Temperature (°C) = ');
Tea=input('Enter the Ambient Temperature (°C) = ');
disp(' ')

else

Ter=80; Tea=23;
disp(' ')
disp(['Reference Temprature = ' num2str(Ter) '°C']);
disp(['Ambient Temprature = ' num2str(Tea) '°C']);
disp(' ')

end

%%% Thermal Co-efficient Transformation


alpha_f = [tc1; tc2]; %%% Thermal Co-efficient of Fiber
Orientaiton

end

%% Transformed Stiffness Matrix

TG = cell(K, 1); %% Thermal Co-efficient Transformation Matrix


M = cell(K, 1); %% Stiffness Transformation Matrix

for n= 1:K

c=cosd(orientation(1,n));
s=sind(orientation(1,n));
a11=c.^2; a12=s.^2; a13=2*c*s;
a21=s.^2; a22=c.^2; a23=(-2*c*s);
a31=(-c*s); a32=c*s; a33=c.^2-s.^2;
T = [a11 a12 a13; a21 a22 a23; a31 a32 a33];
sm = [ 1/E1, -v/E2, 0 ; -v/E1, 1/E2, 0 ; 0, 0, 1/g];
r = [1 0 0; 0 1 0; 0 0 2];
S = r*inv(T)*inv(r)*sm*T;
Q_bar = inv(S);
M{n} = Q_bar;

%%% Thermal Stress transformation


t11 = c.^2; t12 = s.^2;
t21 = s.^2; t22 = c.^2;
t31 = s*c; t32 = (-s*c);
Thg = [t11 t12; t21 t22; t31 t32];
alpha_g = Thg*alpha_f;
TG{n} = alpha_g;

end

%% Z-Cordinates

h=K*t;
for j=1:K+1

Z(1,j)=h/2-t*(j-1);

end

%% ABBD Matrix

aa=0;
bb=0;
dd=0;
A=zeros(3,3);
B=zeros(3,3);
D=zeros(3,3);

for yy = 1:3
for zz = 1:3
for xx = 1:K

aa = aa + (M{xx}(yy,zz)) * (Z(1,xx)-Z(1,xx+1));
bb = bb + (M{xx}(yy,zz)) * (Z(1,xx)^2-(Z(1,xx+1))^2);
dd = dd + (M{xx}(yy,zz)) * (Z(1,xx)^3-(Z(1,xx+1))^3);

end %%% for xx

A(zz,yy)=aa;
B(zz,yy)=0.5*bb;
D(zz,yy)=(1/3)*dd;
aa=0;
bb=0;
dd=0;

end %%% for zz


end %%% for yy

%fprintf('Matrix A = \n'); disp (A);


%fprintf('Matrix B = \n'); disp (B);
%fprintf('Matrix D = \n'); disp (D);

ABBD=zeros(6,6);

ABBD=[A(1,1) A(1,2) A(1,3) B(1,1) B(1,2) B(1,3);


A(2,1) A(2,2) A(2,3) B(2,1) B(2,2) B(2,3);
A(3,1) A(3,2) A(3,3) B(3,1) B(3,2) B(3,3);
B(1,1) B(1,2) B(1,3) D(1,1) D(1,2) D(1,3);
B(2,1) B(2,2) B(2,3) D(2,1) D(2,2) D(2,3);
B(3,1) B(3,2) B(3,3) D(3,1) D(3,2) D(3,3)];

%fprintf('Matrix ABBD = \n'); disp (vpa(ABBD));

e=vpa(inv(ABBD)*F);

%% Final Stress Calculation

Si=cell(2*K,1);
for b=1:K

si=M{b} * ([(e(1))+((Z(1,b)-Z(1,b+1))*(e(4)))-(TG{b}
(1,1))*(Tea-Ter) ; (e(2))+((Z(1,b)-Z(1,b+1))*(e(5)))-(TG{b}(2,1))*(Tea-Ter); (e(3))
+((Z(1,b)-Z(1,b+1))*(e(6)))-(TG{b}(3,1))*(Tea-Ter)]);

Si{b}=si;

end

ax=zeros(K,1);
for k=1:K
ax(k,1) = Si{k}(1);
end

f=0;
for i=1:K
if i == K
AX(2*i,1)=ax(i,1);
AX(2*i-1,1)=ax(i,1);
else
AX(f+i,1)=ax(i,1);
AX(f+i+1,1)=ax(i,1);
f=1+f;
end
end

f=0;
for i=1:(K+1)
switch i
case 1
Q(i,1)=Z(1,i);
case K+1
Q((i-1)*2,1)=Z(1,i);
otherwise
Q(f+i,1)=Z(1,i);
Q(f+i+1,1)=Z(1,i);
f=1+f;
end
end

ay=zeros(K,1);
for k=1:K
ay(k,1) = Si{k}(2);
end

f=0;
for i=1:K
if i == K
AY(2*i,1)=ay(i,1);
AY(2*i-1,1)=ay(i,1);
else
AY(f+i,1)=ay(i,1);
AY(f+i+1,1)=ay(i,1);
f=1+f;
end
end

axy=zeros(K,1);
for k=1:K
axy(k,1) = Si{k}(3);
end

f=0;
for i=1:K
if i == K
AXY(2*i,1)=axy(i,1);
AXY(2*i-1,1)=axy(i,1);
else
AXY(f+i,1)=axy(i,1);
AXY(f+i+1,1)=axy(i,1);
f=1+f;
end
end

%% Graph

figure ('Name',tl,'NumberTitle','off')
plot(AX,Q,'r','linewidth',4.5)
hold on
plot(AY,Q,'g','linewidth',3);plot(AXY,Q,'b','linewidth',1.5)
yline(0,'k','linewidth',1.15);xline(0,'k','linewidth',1);
grid on
lg =
legend({'\sigmaxx','\sigmayy','\sigmaxy'},'Location','best');
title(lg,'Stress')
xlabel('Stress (Pa)'); ylabel('Z-Cordinate');
title({'Stress variation for the Laminate Schedule
\color{magenta} ';tl ;'\color{black} including Thermal Strain'})
hold off

clear AX AY AXY Q ax ay axy Z si e A B D ABBD Z K Q_bar S r T s


c M alpha_g TG

end %%% for loop


end %%% for Single Case Switch
end %%% for if

if LS1 == 6
disp(' ')

disp('......END......END......END......END......END............END......END......EN
D............END......END......END......')
else

fprintf('\n The entered Laminate Schedule from bottom to top is \n')


disp(orientation);
disp(' ')
disp('Press any key to continue')
disp(' ')
pause

%% Force Input

Fo = input('Enter [U] to feed External Forces or [B] to use built-in External


Forces [U/B]= ','s');

if (strcmpi(Fo,'U'))

disp(' ')
Nx=input('Enter the Force along x-direction (N/m) = ');
Ny=input('Enter the Force along y-direction (N/m) = ');
Nxy=input('Enter the Force along xy-direction (N/m) = ');
Mx=input('Enter the Moment along x-direction (Nm/m) = ');
My=input('Enter the Moment along y-direction (Nm/m) = ');
Mxy=input('Enter the Moment along xy-direction (Nm/m) = ');
disp(' ')
else

Nx=10000; Ny=0; Nxy=0; Mx=100; My=0; Mxy=0;


fprintf('Nx = 10000 N/m, Ny = 0 N/m, Nxy = 0 N/m, Mx = 100 Nm/m, My = 0 Nm/m,
Mxy = 0 Nm/m')
disp(' ')

end

F=[Nx; Ny; Nxy; Mx; My; Mxy];

%% Thermal Stresses

%%% Temerature Inputs

disp(' ')
Te = input('Enter [U] to feed Temperature or [B] to use built-in Temperature [U/B]=
','s');
disp(' ')

if (strcmpi(Te,'U'))

disp(' ')
Ter=input('Enter the Reference Temperature (°C) = ');
Tea=input('Enter the Ambient Temperature (°C) = ');
disp(' ')

else

Ter=80; Tea=23;
disp(' ')
disp(['Reference Temprature = ' num2str(Ter) '°C']);
disp(['Ambient Temprature = ' num2str(Tea) '°C']);
disp(' ')

end

%%% Thermal Co-efficient Transformation

alpha_f = [tc1; tc2]; %%% Thermal Co-efficient of Fiber Orientaiton

%stf = [tc1*(Tea-Ter); tc2*(Tea-Ter); tc2*(Tea-Ter)]; %%% Thermal Strain in Fiber


Direction

%% Transformed Stiffness Matrix

TG = cell(K, 1); %% Thermal Co-efficient Transformation Matrix


M = cell(K, 1); %% Stiffness Transformation Matrix

for n= 1:K

c=cosd(orientation(1,n));
s=sind(orientation(1,n));
a11=c.^2; a12=s.^2; a13=2*c*s;
a21=s.^2; a22=c.^2; a23=(-2*c*s);
a31=(-c*s); a32=c*s; a33=c.^2-s.^2;
T = [a11 a12 a13; a21 a22 a23; a31 a32 a33];
sm = [ 1/E1, -v/E2, 0 ; -v/E1, 1/E2, 0 ; 0, 0, 1/g];
r = [1 0 0; 0 1 0; 0 0 2];
S = r*inv(T)*inv(r)*sm*T;
Q_bar = inv(S);
M{n} = Q_bar;

%%% Thermal Stress transformation


t11 = c.^2; t12 = s.^2;
t21 = s.^2; t22 = c.^2;
t31 = s*c; t32 = (-s*c);
Thg = [t11 t12; t21 t22; t31 t32];
alpha_g = Thg*alpha_f;
TG{n} = alpha_g;

end

%% Z-Cordinates

h=K*t;
for j=1:K+1

Z(1,j)=h/2-t*(j-1);

end

%% ABBD Matrix

aa=0;
bb=0;
dd=0;
A=zeros(3,3);
B=zeros(3,3);
D=zeros(3,3);

for yy = 1:3
for zz = 1:3
for xx = 1:K

aa = aa + (M{xx}(yy,zz)) * (Z(1,xx)-Z(1,xx+1));
bb = bb + (M{xx}(yy,zz)) * (Z(1,xx)^2-(Z(1,xx+1))^2);
dd = dd + (M{xx}(yy,zz)) * (Z(1,xx)^3-(Z(1,xx+1))^3);

end %%% for xx

A(zz,yy)=aa;
B(zz,yy)=0.5*bb;
D(zz,yy)=(1/3)*dd;
aa=0;
bb=0;
dd=0;

end %%% for zz


end %%% for yy
%fprintf('Matrix A = \n'); disp (A);
%fprintf('Matrix B = \n'); disp (B);
%fprintf('Matrix D = \n'); disp (D);

ABBD=zeros(6,6);

ABBD=[A(1,1) A(1,2) A(1,3) B(1,1) B(1,2) B(1,3);


A(2,1) A(2,2) A(2,3) B(2,1) B(2,2) B(2,3);
A(3,1) A(3,2) A(3,3) B(3,1) B(3,2) B(3,3);
B(1,1) B(1,2) B(1,3) D(1,1) D(1,2) D(1,3);
B(2,1) B(2,2) B(2,3) D(2,1) D(2,2) D(2,3);
B(3,1) B(3,2) B(3,3) D(3,1) D(3,2) D(3,3)];

%fprintf('Matrix ABBD = \n'); disp (vpa(ABBD));

e=vpa(inv(ABBD)*F);

%% Final Stress Calculation

Si=cell(2*K,1);
for b=1:K

%si=M{b}*( [(e(1)) + ((Z(1,b)-Z(1,b+1))*(e(4))) - (TG{b}(1,1))*(Tea-Ter) )


- ; (e(2))+(Z(1,b)-Z(1,b+1))*(e(5)); (e(3))+(Z(1,b)-Z(1,b+1))*(e(6))]);

si=M{b} * ([(e(1))+((Z(1,b)-Z(1,b+1))*(e(4)))-(TG{b}(1,1))*(Tea-Ter) ;
(e(2))+((Z(1,b)-Z(1,b+1))*(e(5)))-(TG{b}(2,1))*(Tea-Ter); (e(3))+((Z(1,b)-
Z(1,b+1))*(e(6)))-(TG{b}(3,1))*(Tea-Ter)]);

Si{b}=si;

end

ax=zeros(K,1);
for k=1:K
ax(k,1) = Si{k}(1);
end

f=0;
for i=1:K
if i == K
AX(2*i,1)=ax(i,1);
AX(2*i-1,1)=ax(i,1);
else
AX(f+i,1)=ax(i,1);
AX(f+i+1,1)=ax(i,1);
f=1+f;
end
end

f=0;
for i=1:(K+1)
switch i
case 1
Q(i,1)=Z(1,i);
case K+1
Q((i-1)*2,1)=Z(1,i);
otherwise
Q(f+i,1)=Z(1,i);
Q(f+i+1,1)=Z(1,i);
f=1+f;
end
end

ay=zeros(K,1);
for k=1:K
ay(k,1) = Si{k}(2);
end

f=0;
for i=1:K
if i == K
AY(2*i,1)=ay(i,1);
AY(2*i-1,1)=ay(i,1);
else
AY(f+i,1)=ay(i,1);
AY(f+i+1,1)=ay(i,1);
f=1+f;
end
end

axy=zeros(K,1);
for k=1:K
axy(k,1) = Si{k}(3);
end

f=0;
for i=1:K
if i == K
AXY(2*i,1)=axy(i,1);
AXY(2*i-1,1)=axy(i,1);
else
AXY(f+i,1)=axy(i,1);
AXY(f+i+1,1)=axy(i,1);
f=1+f;
end
end

%% Thermal Load Calculation

%% Graph

figure ('Name',tl,'NumberTitle','off')
plot(AX,Q,'r','linewidth',4.5)
hold on
plot(AY,Q,'g','linewidth',3);plot(AXY,Q,'b','linewidth',1.5)
yline(0,'k','linewidth',1.15);xline(0,'k','linewidth',1);
grid on
lg = legend({'\sigmaxx','\sigmayy','\sigmaxy'},'Location','best');
title(lg,'Stress')
xlabel('Stress (Pa)'); ylabel('Z-Cordinate');
title({'Stress variation for the Laminate Schedule \color{magenta}
';tl ;'\color{black} including Thermal Strain'})
hold off

disp(' ')
disp('......END......END......END......END......END............END......END......EN
D............END......END......END......')
end

You might also like