0001 function [] = testequil_ACCOME_LUKE(filename_equil)
0002
0003 close all
0004
0005 filename_equil = dir('EQUIL_*.mat');
0006 load(filename_equil.name);
0007 load(['test_',filename_equil.name])
0008
0009 disp('***************************************************************************************************************');
0010 disp('WARNING: the sign of the poloidal flux, of BR and BZ in LUKE corresponds to clockwise Ip and Bt. Therefore ');
0011 disp('to compare LUKE data with the ACCOME ones, the signs of the poloidal flux,of BR and BZ for ACCOME have ');
0012 disp('modified. Only the LUKE equilibrium must be considered. The main Npar0 must be negative for driving co-current.');
0013 disp('***************************************************************************************************************');
0014
0015
0016
0017 itheta = find(equil.theta==pi);
0018 R_luke = [flipud(equil.ptx(:,itheta));equil.ptx(2:end,1)]+equil.Rp;
0019 figure(1),graph1D_jd(R_luke,[fliplr(equil.psi_apRp),equil.psi_apRp(2:end)]*equil.Rp/equil.ptx(end,1),0,0,'R','\psi',['COMPASS - ',strrep(equil.id,'_','-'),''],NaN,'','','-','none','r',2);drawnow
0020
0021 iZp = min(find(Z>=Zp));iZm = iZp - 1;
0022 xypsifit = xypsi(:,iZm) + (xypsi(:,iZp) - xypsi(:,iZm))*(Zp - Z(iZm))/(Z(iZp) - Z(iZm));
0023 graph1D_jd(R,xypsifit,0,0,'R','\psi @ Z=Zp',['COMPASS,',strrep(equil.id,'_','-'),', Ip and Bt clockwise'],NaN,'','','none','.','g',2);drawnow
0024 h = line([min(R_luke),max(R_luke)],[psia,psia]);
0025 set(h,'Color','blue','linestyle','--','linewidth',2)
0026 legend('LUKE','ACCOME');
0027
0028
0029
0030 ipis2 = find(equil.theta == pi/2);
0031 ipis3s2 = find(equil.theta == 3*pi/2);
0032 Z_luke = [flipud(equil.pty(:,ipis3s2));equil.pty(2:end,ipis2)]+equil.Zp;
0033 figure(2),graph1D_jd(Z_luke,[fliplr(equil.psi_apRp),equil.psi_apRp(2:end)]*equil.Rp/equil.ptx(end,1),0,0,'Z','\psi',['COMPASS - ',strrep(equil.id,'_','-'),' (\psi -> -\psi)'],NaN,'','','-','none','r',2);drawnow
0034 iRp = min(find(R>=Rp));iRm = iRp - 1;
0035 xypsifit = xypsi(iRm,:) + (xypsi(iRp,:) - xypsi(iRm,:))*(Rp - R(iRm))/(R(iRp) - R(iRm));
0036 graph1D_jd(Z,xypsifit,0,0,'Z','\psi @ R=Rp',['COMPASS,',strrep(equil.id,'_','-'),', Ip and Bt clockwise'],NaN,'','','none','.','g',2);drawnow
0037 h = line([min(Z_luke),max(Z_luke)],[psia,psia]);
0038 set(h,'Color','blue','linestyle','--','linewidth',2)
0039 legend('LUKE','ACCOME');
0040
0041
0042
0043 itheta = find(equil.theta==0);
0044 R_luke = [flipud(equil.ptx(:,itheta));equil.ptx(2:end,1)]+equil.Rp;
0045 figure(3),graph1D_jd(R_luke,[flipud(equil.ptBPHI(:,itheta));equil.ptBPHI(2:end,1)],0,0,'R','B_{\phi}',['COMPASS - ',strrep(equil.id,'_','-'),''],NaN,'','','-','none','r',2);drawnow
0046
0047 iZp = min(find(Z>=Zp));iZm = iZp - 1;
0048 xyBPHIfit = xyBPHI(:,iZm) + (xyBPHI(:,iZp) - xyBPHI(:,iZm))*(Zp - Z(iZm))/(Z(iZp) - Z(iZm));
0049 graph1D_jd(R,xyBPHIfit,0,0,'R','B_{\phi} @ Z=Zp',['COMPASS,',strrep(equil.id,'_','-'),''],NaN,'','','none','.','g',2);drawnow
0050 legend('LUKE','ACCOME');
0051
0052
0053
0054 ipis2 = find(equil.theta == pi/2);
0055 ipis3s2 = find(equil.theta == 3*pi/2);
0056 Z_luke = [flipud(equil.pty(:,ipis3s2));equil.pty(2:end,ipis2)]+equil.Zp;
0057 figure(4),graph1D_jd(Z_luke,[flipud(equil.ptBPHI(:,ipis3s2));equil.ptBPHI(2:end,ipis2)],0,0,'Z','B_{\phi}',['COMPASS - ',strrep(equil.id,'_','-'),''],NaN,'','','-','none','r',2);drawnow
0058
0059 iRp = min(find(R>=Rp));iRm = iRp - 1;
0060 xyBPHIfit = xyBPHI(iRm,:) + (xyBPHI(iRp,:) - xyBPHI(iRm,:))*(Rp - R(iRm))/(R(iRp) - R(iRm));
0061 graph1D_jd(Z,xyBPHIfit,0,0,'Z','B_{\phi} @ R=Rp',['COMPASS,',strrep(equil.id,'_','-'),''],NaN,'','','none','.','g',2);drawnow
0062 legend('LUKE','ACCOME');
0063
0064
0065
0066 itheta = find(equil.theta==pi);
0067 R_luke = [flipud(equil.ptx(:,itheta));equil.ptx(2:end,1)]+equil.Rp;
0068 figure(5),graph1D_jd(R_luke,-[flipud(equil.ptBx(:,itheta));equil.ptBx(2:end,1)],0,0,'R','BR',['COMPASS - ',strrep(equil.id,'_','-'),''],NaN,'','','-','none','r',2);drawnow
0069
0070 [xygradxpsi,xygradypsi] = gradient(xypsi',R(2)-R(1),Z(2)-Z(1));
0071 xyBR1 = -xygradypsi'./(R*ones(1,size(xygradypsi',2)));
0072 iZp = min(find(Z>=Zp));iZm = iZp - 1;
0073 xyBRfit1 = xyBR1(:,iZm) + (xyBR1(:,iZp) - xyBR1(:,iZm))*(Zp - Z(iZm))/(Z(iZp) - Z(iZm));
0074 graph1D_jd(R,-xyBRfit1,0,0,'R','BR',['COMPASS,',strrep(equil.id,'_','-'),''],NaN,'','','none','x','b',2);drawnow
0075
0076 if ~isempty(xyBR) & ~isempty(xyBZ),
0077 xyBRfit = xyBR(:,iZm) + (xyBR(:,iZp) - xyBR(:,iZm))*(Zp - Z(iZm))/(Z(iZp) - Z(iZm));
0078 graph1D_jd(R,-xyBRfit,0,0,'R','BR @ Z=Zp',['COMPASS,',strrep(equil.id,'_','-'),', Ip and Bt clockwise'],NaN,'','','none','.','g',2);drawnow
0079 legend('LUKE','ACCOME-PSI-FIT','ACCOME');
0080 else
0081 legend('LUKE','ACCOME-PSI-FIT');
0082 end
0083
0084
0085
0086 ipis2 = find(equil.theta == pi/2);
0087 ipis3s2 = find(equil.theta == 3*pi/2);
0088 Z_luke = [flipud(equil.pty(:,ipis3s2));equil.pty(2:end,ipis2)]+equil.Zp;
0089 figure(6),graph1D_jd(Z_luke,-[flipud(equil.ptBx(:,ipis3s2));equil.ptBx(2:end,ipis2)],0,0,'Z','',['COMPASS - ',strrep(equil.id,'_','-'),''],NaN,'','','-','none','r',2);drawnow
0090
0091 iRp = min(find(R>=Rp));iRm = iRp - 1;
0092 [xygradxpsi,xygradypsi] = gradient(xypsi',R(2)-R(1),Z(2)-Z(1));
0093 xyBR1 = -xygradypsi'./(R*ones(1,size(xygradypsi',2)));
0094 xyBRfit1 = xyBR1(iRm,:) + (xyBR1(iRp,:) - xyBR1(iRm,:))*(Rp - R(iRm))/(R(iRp) - R(iRm));
0095 graph1D_jd(Z,-xyBRfit1,0,0,'Z','BR',['COMPASS,',strrep(equil.id,'_','-'),''],NaN,'','','none','x','b',2);drawnow
0096
0097 if ~isempty(xyBR) & ~isempty(xyBZ),
0098 xyBRfit = xyBR(iRm,:) + (xyBR(iRp,:) - xyBR(iRm,:))*(Rp - R(iRm))/(R(iRp) - R(iRm));
0099 graph1D_jd(Z,-xyBRfit,0,0,'Z','BR @ R=Rp',['COMPASS,',strrep(equil.id,'_','-'),', Ip and Bt clockwise'],NaN,'','','none','.','g',2);drawnow
0100 legend('LUKE','ACCOME-PSI-FIT','ACCOME');
0101 else
0102 legend('LUKE','ACCOME-PSI-FIT');
0103 end
0104
0105
0106
0107 itheta = find(equil.theta==pi);
0108 R_luke = [flipud(equil.ptx(:,itheta));equil.ptx(2:end,1)]+equil.Rp;
0109 figure(7),graph1D_jd(R_luke,-[flipud(equil.ptBy(:,itheta));equil.ptBy(2:end,1)],0,0,'R','',['COMPASS - ',strrep(equil.id,'_','-'),''],NaN,'','','-','none','r',2);drawnow
0110
0111 [xygradxpsi,xygradypsi] = gradient(xypsi',R(2)-R(1),Z(2)-Z(1));
0112 xyBZ1 = xygradxpsi'./(R*ones(1,size(xygradxpsi',2)));
0113 iZp = min(find(Z>=Zp));iZm = iZp - 1;
0114 xyBZfit1 = xyBZ1(:,iZm) + (xyBZ1(:,iZp) - xyBZ1(:,iZm))*(Zp - Z(iZm))/(Z(iZp) - Z(iZm));
0115 graph1D_jd(R,-xyBZfit1,0,0,'R','BZ',['COMPASS,',strrep(equil.id,'_','-'),''],NaN,'','','none','x','b',2);drawnow
0116
0117 if ~isempty(xyBR) & ~isempty(xyBZ),
0118 xyBZfit = xyBZ(:,iZm) + (xyBZ(:,iZp) - xyBZ(:,iZm))*(Zp - Z(iZm))/(Z(iZp) - Z(iZm));
0119 graph1D_jd(R,-xyBZfit,0,0,'R','BZ @ Z=Zp',['COMPASS,',strrep(equil.id,'_','-'),', Ip and Bt clockwise'],NaN,'','','none','.','g',2);drawnow
0120 legend('LUKE','ACCOME-PSI-FIT','ACCOME');
0121 else
0122 legend('LUKE','ACCOME-PSI-FIT');
0123 end
0124
0125
0126
0127 ipis2 = find(equil.theta == pi/2);
0128 ipis3s2 = find(equil.theta == 3*pi/2);
0129 Z_luke = [flipud(equil.pty(:,ipis3s2));equil.pty(2:end,ipis2)]+equil.Zp;
0130 figure(8),graph1D_jd(Z_luke,-[flipud(equil.ptBy(:,ipis3s2));equil.ptBy(2:end,ipis2)],0,0,'Z','BZ',['COMPASS - ',strrep(equil.id,'_','-'),''],NaN,'','','-','none','r',2);drawnow
0131
0132 iRp = min(find(R>=Rp));iRm = iRp - 1;
0133 [xygradxpsi,xygradypsi] = gradient(xypsi',R(2)-R(1),Z(2)-Z(1));
0134 xyBZ1 = xygradxpsi'./(R*ones(1,size(xygradxpsi',2)));
0135 xyBZfit1 = xyBZ1(iRm,:) + (xyBZ1(iRp,:) - xyBZ1(iRm,:))*(Rp - R(iRm))/(R(iRp) - R(iRm));
0136 graph1D_jd(Z,-xyBZfit1,0,0,'Z','BZ',['COMPASS,',strrep(equil.id,'_','-'),''],NaN,'','','none','x','b',2);drawnow
0137
0138 if ~isempty(xyBR) & ~isempty(xyBZ),
0139 xyBZfit = xyBZ(iRm,:) + (xyBZ(iRp,:) - xyBZ(iRm,:))*(Rp - R(iRm))/(R(iRp) - R(iRm));
0140 graph1D_jd(Z,-xyBZfit,0,0,'Z','BZ @ R=Rp',['COMPASS,',strrep(equil.id,'_','-'),', Ip and Bt clockwise'],NaN,'','','none','.','g',2);drawnow
0141 legend('LUKE','ACCOME-PSI-FIT','ACCOME');
0142 else
0143 legend('LUKE','ACCOME-PSI-FIT');
0144 end