clear all

filename0 = 'Fig02';

load('ehtable','whitejet','greyjet','redblue', 'color7');
set(groot,'defaultAxesColorOrder',color7)

load('Rec_Boundary_in_lcfs_DIIID', 'rvec','zvec');
load('Rec_Bnorm', 'cdata'); B0 = cdata;

%%

ne11 = [1, 2, 3.];
ne0  = 1.0e19 ;
npsi = 0.8:0.002:1.2;

for ii=1:length(ne11)
    ne1 = ne11(ii)*1e18;
    d_sol = 0.01;
    Ne(ii,1:length(npsi))=(tanh((-(npsi-1)./d_sol)+1)./2+0.5).*(ne0-ne1)+ne1;
end


%%

hh=figure(1);
hh.Position = [100 100 550 300];
set(gcf,'color','w');

%%

subplot(121)

imagesc(rvec, zvec, B0)
h=colorbar;
axis equal
set(gca, 'xlim', [min(rvec), max(rvec)])
set(gca, 'ylim', [min(zvec), max(zvec)])
set(gca, 'fontsize', 13)
set(gca, 'position', [0.1,0.15,0.3, 0.72])
xlabel('r (m)', 'fontsize', 16)
ylabel('z (m)', 'fontsize', 16)
title('(a) |B_0| (T)', 'fontsize', 16)
set(gca, 'linewidth', 1.2)


%%

subplot(122)
colormap(whitejet)
plot(npsi, Ne, 'linewidth', 1.5)
xlabel('\rho_{pol} (m)', 'fontsize', 16)
ylabel('n_e (m^{-3})', 'fontsize', 16)
title('(b) n_e', 'fontsize', 17)
set(gca, 'fontsize', 13)
set(gca, 'ylim', [0.5e18, 10.5e18])
set(gca, 'position', [0.6,0.15,0.3, 0.72])
set(gca, 'linewidth', 1.2)
text(1.1, 3.7e18, 'n_{ant}', 'fontsize', 14, 'color', color7(3,:))

%%

saveas(gca, filename0,'epsc')
saveas(gca, filename0,'png')

 