% MATLAB CODE: Example C-9
% Elasticity: Theory, Applications and Numerics - Elsevier
% M.H. Sadd, University of Rhode Island
% PDE Toolbox Application
% FEA Circular Hole in Plate Under Uniform Tension - Example 16-2
function pdemodel
[pde_fig,ax]=pdeinit;
pdetool('appl_cb',3);
set(ax,'DataAspectRatio',[1 1 1]);
set(ax,'PlotBoxAspectRatio',[1.5 1 1]);
set(ax,'XLim',[-1.5 1.5]);
set(ax,'YLim',[-1 1]);
set(ax,'XTickMode','auto');
set(ax,'YTickMode','auto');

% Geometry description:
pderect([-1.141025641025641 1.1886446886446884 0.74542124542124544 -0.80402930402930406],'R1');
pdecirc(0.009157509157509125,-0.011999880635318538,0.18315018315018339,'C1');
set(findobj(get(pde_fig,'Children'),'Tag','PDEEval'),'String','R1-C1')

% Boundary conditions:
pdetool('changemode',0)
pdesetbd(8,...
'neu',...
2,...
str2mat('0','0','0','0'),...
str2mat('0','0'))
pdesetbd(7,...
'neu',...
2,...
str2mat('0','0','0','0'),...
str2mat('0','0'))
pdesetbd(6,...
'neu',...
2,...
str2mat('0','0','0','0'),...
str2mat('0','0'))
pdesetbd(5,...
'neu',...
2,...
str2mat('0','0','0','0'),...
str2mat('0','0'))
pdesetbd(4,...
'neu',...
2,...
str2mat('0','0','0','0'),...
str2mat('0','0'))
pdesetbd(3,...
'neu',...
2,...
str2mat('0','0','0','0'),...
str2mat('-1','0'))
pdesetbd(2,...
'neu',...
2,...
str2mat('0','0','0','0'),...
str2mat('0','0'))
pdesetbd(1,...
'neu',...
2,...
str2mat('0','0','0','0'),...
str2mat('1','0'))

% Mesh generation:
setuprop(pde_fig,'Hgrad',1.3);
setuprop(pde_fig,'refinemethod','regular');
pdetool('initmesh')
pdetool('refine')
pdetool('refine')

% PDE coefficients:
pdeseteq(1,...
str2mat('2*((1E3)./(2*(1+(0.3))))+(2*((1E3)./(2*(1+(0.3)))).*(0.3)./(1-(0.3)))','0','(1E3)./(2*(1+(0.3)))','0','(1E3)./(2*(1+(0.3)))','2*((1E3)./(2*(1+(0.3)))).*(0.3)./(1-(0.3))','0','(1E3)./(2*(1+(0.3)))','0','2*((1E3)./(2*(1+(0.3))))+(2*((1E3)./(2*(1+(0.3)))).*(0.3)./(1-(0.3)))'),...
str2mat('0.0','0.0','0.0','0.0'),...
str2mat('0.0','0.0'),...
str2mat('1.0','0','0','1.0'),...
'0:10',...
'0.0',...
'0.0',...
'[0 100]')
setuprop(pde_fig,'currparam',...
['1E3';...
'0.3';...
'0.0';...
'0.0';...
'1.0'])

% Solve parameters:
setuprop(pde_fig,'solveparam',...
str2mat('0','5472','10','pdeadworst',...
'0.5','longest','0','1E-4','','fixed','Inf'))

% Plotflags and user data strings:
setuprop(pde_fig,'plotflags',[11 1 1 1 1 1 2 1 0 0 0 1 0 1 0 0 0 1]);
setuprop(pde_fig,'colstring','');
setuprop(pde_fig,'arrowstring','');
setuprop(pde_fig,'deformstring','');
setuprop(pde_fig,'heightstring','');

% Solve PDE:
pdetool('solve')
