Code covered by the BSD License  

Highlights from
Accelerating Finite Element Analysis (FEA) in MATLAB

image thumbnail

Accelerating Finite Element Analysis (FEA) in MATLAB

by

 

Accelerate computationally intensive part of FEA by using Parallel computing.

pdemodel
function pdemodel
[pde_fig,ax]=pdeinit;
pdetool('appl_cb',5);
pdetool('snapon','on');
set(ax,'DataAspectRatio',[1 0.1621621621621622 1]);
set(ax,'PlotBoxAspectRatio',[9.2499999999999982 6.1666666666666652 49999.999999999993]);
set(ax,'XLim',[-0.000185 0.000185]);
set(ax,'YLim',[-2.0000000000000002e-005 2.0000000000000002e-005]);
set(ax,'XTick',[ -0.000185,...
 -0.000175,...
 -0.000165,...
 -0.000155,...
 -0.000145,...
 -0.000135,...
 -0.000125,...
 -0.00011499999999999999,...
 -0.00010499999999999999,...
 -9.4999999999999992e-005,...
 -8.4999999999999993e-005,...
 -7.4999999999999993e-005,...
 -6.4999999999999981e-005,...
 -5.4999999999999982e-005,...
 -4.4999999999999983e-005,...
 -3.4999999999999983e-005,...
 -2.4999999999999984e-005,...
 -1.4999999999999985e-005,...
 -4.999999999999986e-006,...
 4.999999999999986e-006,...
 1.4999999999999985e-005,...
 2.4999999999999984e-005,...
 3.4999999999999983e-005,...
 4.4999999999999983e-005,...
 5.4999999999999982e-005,...
 6.4999999999999981e-005,...
 7.4999999999999993e-005,...
 8.4999999999999993e-005,...
 9.4999999999999992e-005,...
 0.00010499999999999999,...
 0.00011499999999999999,...
 0.000125,...
 0.000135,...
 0.000145,...
 0.000155,...
 0.000165,...
 0.000175,...
 0.000185,...
]);
set(ax,'YTick',[ -2.0000000000000002e-005,...
 -1.9000000000000001e-005,...
 -1.8e-005,...
 -1.7e-005,...
 -1.6000000000000003e-005,...
 -1.5000000000000002e-005,...
 -1.4000000000000001e-005,...
 -1.3000000000000001e-005,...
 -1.2000000000000002e-005,...
 -1.1000000000000001e-005,...
 -1.0000000000000003e-005,...
 -9.0000000000000019e-006,...
 -8.0000000000000013e-006,...
 -7.0000000000000024e-006,...
 -6.0000000000000018e-006,...
 -5.000000000000003e-006,...
 -4.0000000000000024e-006,...
 -3.0000000000000018e-006,...
 -2.0000000000000012e-006,...
 -1.000000000000004e-006,...
 0,...
 1.000000000000004e-006,...
 2.0000000000000012e-006,...
 3.0000000000000018e-006,...
 4.0000000000000024e-006,...
 5.000000000000003e-006,...
 6.0000000000000018e-006,...
 7.0000000000000024e-006,...
 8.0000000000000013e-006,...
 9.0000000000000019e-006,...
 1.0000000000000003e-005,...
 1.1000000000000001e-005,...
 1.2000000000000002e-005,...
 1.3000000000000001e-005,...
 1.4000000000000001e-005,...
 1.5000000000000002e-005,...
 1.6000000000000003e-005,...
 1.7e-005,...
 1.8e-005,...
 1.9000000000000001e-005,...
 2.0000000000000002e-005,...
]);
pdetool('gridon','on');

% Geometry description:
pderect([-0.000175 0.000175 -1.7e-005 1.3000000000000004e-005],'R1');
pderect([-7.4999999999999993e-005 7.4999999999999993e-005 3.9999999999999998e-006 1.9999999999999999e-006],'R2');
pderect([2.5000000000000001e-005 7.5000000000000007e-005 0 -1.9999999999999999e-006],'R3');
set(findobj(get(pde_fig,'Children'),'Tag','PDEEval'),'String','R1-(R2+R3)')

% Boundary conditions:
pdetool('changemode',0)
pdesetbd(12,...
'dir',...
1,...
'1',...
'20')
pdesetbd(11,...
'dir',...
1,...
'1',...
'20')
pdesetbd(10,...
'dir',...
1,...
'1',...
'0')
pdesetbd(9,...
'dir',...
1,...
'1',...
'0')
pdesetbd(8,...
'dir',...
1,...
'1',...
'20')
pdesetbd(7,...
'dir',...
1,...
'1',...
'0')
pdesetbd(6,...
'dir',...
1,...
'1',...
'0')
pdesetbd(5,...
'dir',...
1,...
'1',...
'20')
pdesetbd(4,...
'dir',...
1,...
'1',...
'0')
pdesetbd(3,...
'dir',...
1,...
'1',...
'0')
pdesetbd(2,...
'dir',...
1,...
'1',...
'0')
pdesetbd(1,...
'dir',...
1,...
'1',...
'0')

% Mesh generation:
setappdata(pde_fig,'Hgrad',1.3);
setappdata(pde_fig,'refinemethod','regular');
setappdata(pde_fig,'jiggle',char('on','mean',''));
pdetool('initmesh')

% PDE coefficients:
pdeseteq(1,...
'1',...
'0.0',...
'0',...
'1.0',...
'0:10',...
'0.0',...
'0.0',...
'[0 100]')

Contact us