% Rowin Andruscavage
% MAE 470
% Homework 4  Stress concentration factors with iFEM

x = linspace (0,1,100);
y = 3 - 3.13.*x + 3.66.*x.^2 - 1.53.*x.^3;

plot(x,y)
axis([0 1 0 3])

% Max von Mises stress data [N/m^2] from nodal contour values :
% 								d/W			0.1		0.5		0.9
%                               -------------------------------
% Circular hole Tri3 mesh : 			1890		4391		17537
% Circular hole Tri6 mesh : 			2294		4443		21243
% Circular hole Quad4 mesh : 			2555		4236		17916
% Circular hole Quad8 mesh : 			2620		4347		20154
% 
% Square hole Tri3 mesh :				1362		3925		10965
% Square hole Quad4 mesh :				2554		8366		23472
%

dW = [0.1 0.5 0.9];
tri3meshc = [ 1.7 2.2 1.75 ];
tri6meshc = [ 2.07 2.22 2.12 ];
quad4meshc = [ 2.3 2.12 1.8 ];
quad8meshc = [ 2.36 2.17 2.01 ];

tri3meshs = [ 1.23 1.96 1.1 ];
quad4meshs = [ 2.3 4.18 2.35 ];

hold on

plot (dW, tri3meshc, '^')
plot (dW, tri6meshc, 'v')
plot (dW, quad4meshc, 's')
plot (dW, quad8meshc, 'd')

plot (dW, tri3meshs, 'x')
plot (dW, quad4meshs, '*')
legend ('theory', 'Circular hole Triangular 3 mesh', ...
						'Circular hole Triangular 6 mesh', ...
                  'Circular hole Quad 4 mesh', ...
                  'Circular hole Quad 8 mesh', ...
                  'Square hole Triangular 3 mesh', ...
                	'Square hole Quad 4 mesh', 0)
xlabel('d/W')
ylabel('k')
title('Stress Concentration Factor')


hold off