From: Matt on
hi all,

i am attempting to sim the earth's magnetic field on a rectangle, but the results are disappointing.

a quick explanation of my understanding:

B= del x A
B = (dAz/dy) i - (dAz/dx) j
if the field is in the Bi direction, the neumann boundary conditions
_____2____
| |
1| | 3
|____4____|

for 1 and 3, q = 0, g = 1;
for 2 and 4, q = 0, g = 0;

the PDE region uses u = 1 and J = 0

if plotting the flux lines, shouldn't they enter and exit the rectangle as straight lines? the generated m-code follows to run, and it is clearly askew.

a final question: why, in a simple rectangle, does the mesh tool not create symmetrical triangles?

thanks


function pdemodel
[pde_fig,ax]=pdeinit;
pdetool('appl_cb',6);
set(ax,'DataAspectRatio',[1 2 1]);
set(ax,'PlotBoxAspectRatio',[1 0.66666666666666663 1.6666666666666665]);
set(ax,'XLim',[-0.10000000000000001 1.1000000000000001]);
set(ax,'YLim',[-0.10000000000000001 1.5]);
set(ax,'XTickMode','auto');
set(ax,'YTickMode','auto');

% Geometry description:
pderect([0 1 0 1],'R1');
set(findobj(get(pde_fig,'Children'),'Tag','PDEEval'),'String','R1')

% Boundary conditions:
pdetool('changemode',0)
pdesetbd(4,...
'neu',...
1,...
'0',...
'1')
pdesetbd(3,...
'neu',...
1,...
'0',...
'0')
pdesetbd(2,...
'neu',...
1,...
'0',...
'1')
pdesetbd(1,...
'neu',...
1,...
'0',...
'0')

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

% PDE coefficients:
pdeseteq(1,...
'1./(10)',...
'0.0',...
'0',...
'1.0',...
'0:10',...
'0.0',...
'0.0',...
'[0 100]')
setappdata(pde_fig,'currparam',...
['10';...
'0 '])

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

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

% Solve PDE:
pdetool('solve')
 | 
Pages: 1
Prev: fminsearch theory
Next: Matlab memory error