magtet/m3d/test/pipeline/plot_contour.m
2021-07-28 07:54:12 +08:00

109 lines
2.3 KiB
Matlab
Executable File

clear all;
%% load closed-form from prism
xyz = load('xyz.dat');
x = xyz(:,1);
y = xyz(:,2);
%% solution
V = load('V.dat');
B = load('B.dat');
T = load('T.dat');
lsize=1.5;
fsize=14;
msize= 6;
%% plot potential
figure('Position',[0 0 400 300]);
[X,Y,Z0] = xyz2XYZ(x, y, V);
contourf(X,Y,Z0);
hcb= colorbar;
xlabel('x(m)','fontsize',fsize);
ylabel('y(m)','fontsize',fsize);
set(gca, 'FontSize', fsize);
title(hcb,'NA^{-1}m^{-3}','fontsize',fsize);
colormap(jet)
title('V','fontsize',fsize);
%% plot field
figure('Position',[0 0 900 200 ]);
for i=1:3
subplot(1,3,i);
[X,Y,Z0] = xyz2XYZ(x, y, B(:,i));
contourf(X,Y,Z0);
hcb=colorbar;
xlabel('x(m)','fontsize',fsize);
set(gca, 'FontSize', fsize);
title(hcb,'nT','fontsize',fsize);
if(i==1)
title('B_{x}','fontsize',fsize);
ylabel('y(m)','fontsize',fsize);
end
if(i==2)
title('B_{y}','fontsize',fsize);
end
if(i==3)
title('B_{z}','fontsize',fsize);
end
colormap(jet);
caxis([-60, 60])
end
%% (xx,xy,xz,yx,yy,yz,zx,zy,zz)
%% plot tensor
figure('Position',[0 0 900 600]);
for i=1:9
if (i==1||i==2||i==3||i==5||i==6||i==9)
subplot(3,3,i);
[X,Y,Z0] = xyz2XYZ(x, y, T(:,i));
contourf(X,Y,Z0);
hcb=colorbar;
title(hcb,'nT/m','fontsize',fsize);
colormap(jet);
caxis([-50, 50])
end
if(i==1)
xlabel('x(m)','fontsize',fsize);
ylabel('y(m)','fontsize',fsize);
set(gca, 'FontSize', fsize);
title('T_{xx}','fontsize',fsize);
end
if(i==2)
set(gca, 'FontSize', fsize);
title('T_{xy}','fontsize',fsize);
end
if(i==3)
set(gca, 'FontSize', fsize);
title('T_{xz}','fontsize',fsize);
end
if(i==5)
xlabel('x(m)','fontsize',fsize);
ylabel('y(m)','fontsize',fsize);
set(gca, 'FontSize', fsize);
title('T_{yy}','fontsize',fsize);
end
if(i==6)
set(gca, 'FontSize', fsize);
title('T_{yz}','fontsize',fsize);
end
if(i==9)
xlabel('x(m)','fontsize',fsize);
ylabel('y(m)','fontsize',fsize);
set(gca, 'FontSize', fsize);
title('T_{zz}','fontsize',fsize);
end
end