0001 function [] = bremlocaldisplay_dke_yp(dkeparam,display,equilDKE,momentumDKE,Zmomcoef,radialDKE,dke_out,mksa,Zbremchord,Zbremplasma,r_display,t_display,k_display,p_opt,filename);
0002
0003
0004
0005
0006
0007
0008 if nargin < 13, error('Not enough input argument in bremlocaldisplay_dke_yp');end
0009 if nargin == 13,
0010 p_opt = 2;
0011 filename = '';
0012 end
0013 if nargin == 14,
0014 filename = '';
0015 end
0016
0017 dp_cyl = display.dp_cyl;
0018 nlevel = display.nlevel;
0019
0020 [qe,me,mp,mn,e0,mu0,re,mc2,clum,alpha] = pc_dke_yp;
0021
0022 ne_ref = mksa.ne_ref;
0023 betath_ref = mksa.betath_ref;
0024 Ec = Zmomcoef.Ec_ref;
0025
0026 dmhu = momentumDKE.dmhu;
0027 mhu = momentumDKE.mhu;
0028 dpn = momentumDKE.dpn;
0029 pn = momentumDKE.pn;
0030
0031 r_dke = radialDKE.r_dke;
0032
0033 pnmax_S = dkeparam.pnmax_S;
0034 bounce_mode = dkeparam.bounce_mode;
0035
0036 kphot = Zbremplasma.kphot;
0037 theta_hxr = Zbremplasma.theta_hxr(1,:);
0038 mhubounce2_hxr = Zbremplasma.mhubounce2_hxr;
0039
0040 if iscell(dke_out.XXfinit)
0041 XXfinit = dke_out.XXfinit{1}(:,:,r_dke);
0042 else
0043 XXfinit = dke_out.XXfinit(:,:,r_dke);
0044 end
0045 if iscell(dke_out.XXf0)
0046 XXf0 = dke_out.XXf0{1}(:,:,r_dke);
0047 else
0048 XXf0 = dke_out.XXf0(:,:,r_dke);
0049 end
0050
0051 Rp = equilDKE.Rp;
0052 Zp = equilDKE.Zp;
0053 ap = equilDKE.Xx(end,1);
0054
0055 theta = equilDKE.mtheta;
0056 xpsin = equilDKE.xpsin;
0057 psia_apRp = equilDKE.psia_apRp;
0058 XR = equilDKE.Xx + Rp;
0059 XZ = equilDKE.Xy + Zp;
0060 XBR = equilDKE.XBx;
0061 XBZ = equilDKE.XBy;
0062 XBphi = equilDKE.XBphi;
0063 xB0 = equilDKE.xB0;
0064 xR0 = equilDKE.xx0 + Rp;
0065 xBT0 = equilDKE.xBT0;
0066 xBp0 = equilDKE.xBp0;
0067 xrho = equilDKE.xrho;
0068 xTe = equilDKE.xTe;
0069 xne = equilDKE.xne;
0070 xzTi = equilDKE.xzTi;
0071 xzni = equilDKE.xzni;
0072 zZi = equilDKE.zZi;
0073 zmi = equilDKE.zmi;
0074 xZeff = equilDKE.xZeff;
0075 Rp = equilDKE.Rp;
0076 Zp = equilDKE.Zp;
0077 ap = equilDKE.ap;
0078 xmhu0T2 = equilDKE.xmhu0T2;
0079 xdV_dke = equilDKE.xdV_2piRp_dke*2*pi*Rp;
0080 xdA_dke = equilDKE.xdA_dke;
0081 xzni_norm = xzni(:,r_dke)/ne_ref;
0082 xne_norm = xne(r_dke)/ne_ref;
0083 xrho = xrho(r_dke);
0084
0085 pn2 = pn.*pn;
0086 gamma = sqrt(1 + pn2*betath_ref^2);
0087
0088 i_test = find(abs(xrho - r_display) == min(abs(xrho - r_display)),1,'first');
0089 j_test = find(abs(theta_hxr - t_display*pi/180) == min(abs(theta_hxr- t_display*pi/180)),1,'first');
0090 k_test = find(kphot == k_display,1);
0091
0092 rho_out = xrho(i_test);
0093 theta_out = theta_hxr(j_test);
0094
0095
0096
0097 figure('Name','Distribution function @ p_{\perp} = 0');
0098
0099 ylab = 'f_{0}/n_{e0}';
0100 tit = 'Distribution function @ p_{\perp} = 0';
0101
0102 graph1D_jd(pn,Zbremplasma.ZXf0_i{i_test,j_test}(:,size(Zbremplasma.ZXf0_i{i_test,j_test},2)),0,1,'','','',NaN,'','','-','non','b',2);
0103 hold on
0104 graph1D_jd(pn,Zbremplasma.ZXf0_i1{i_test,j_test}(:,size(Zbremplasma.ZXf0_i{i_test,j_test},2)),0,1,'','','',NaN,'','','--','non','r',2);
0105 graph1D_jd(pn,Zbremplasma.ZXf0_i{i_test,j_test}(:,1),0,1,'','','',NaN,'','','-','non','c',2);
0106 graph1D_jd(pn,Zbremplasma.ZXf0_i1{i_test,j_test}(:,1),0,1,'p_{||}/p_{Te}^{ref}',ylab,tit,NaN,'','','--','non','k',2);
0107 grid on,zoom on
0108 legend('Forward DKE','Forward Legendre','Backward DKE','Backward Legendre','Location','NorthEast')
0109 xxlimit = xlim;yylimit = ylim;
0110 ht = text(xxlimit(1)+1,yylimit(1)*6,['\rho = ',num2str(rho_out),' and \theta_{pol} = ',num2str(theta_out*180/pi),' (Deg)']);set(ht,'fontsize',20);
0111 print_jd(p_opt,[filename,'_DistributionFunction']);
0112
0113
0114
0115 [logXfinit_cyl,ppar_cyl,dppar_cyl,pperp_cyl,dpperp_cyl] = s2c_dke_yp(log(XXfinit(:,:,i_test)),pn,mhu,dp_cyl);
0116 [logXf0_cyl,ppar_cyl,dppar_cyl,pperp_cyl,dpperp_cyl] = s2c_dke_yp(log(XXf0(:,:,i_test)),pn,mhu,dp_cyl);
0117 [logXf_hxr_cyl,ppar_cyl,dppar_cyl,pperp_cyl,dpperp_cyl] = s2c_dke_yp(log(Zbremplasma.ZXf0_hxr{i_test,j_test}),pn,Zbremplasma.mhu_hxr{i_test,j_test},dp_cyl);
0118
0119 Xppar_cyl = ones(length(pperp_cyl),1)*ppar_cyl(:)';
0120 Xpperp_cyl = pperp_cyl(:)*ones(1,length(ppar_cyl));
0121 Xp_cyl2 = Xppar_cyl.*Xppar_cyl + Xpperp_cyl.*Xpperp_cyl;
0122 Xp_cyl = sqrt(Xp_cyl2);
0123
0124 Xf0_cyl = exp(logXf0_cyl);
0125 Xf0_cyl = Xf0_cyl.*(Xf0_cyl>0);
0126 Xf0_cyl = Xf0_cyl.*(Xp_cyl<max(ppar_cyl));
0127 Xf0_cyl(isnan(Xf0_cyl)) = 0;
0128 Xf0_cyl = Xf0_cyl.*(abs(Xf0_cyl)>eps);
0129
0130 Xfinit_cyl = exp(logXfinit_cyl);
0131 Xfinit_cyl = Xfinit_cyl.*(Xfinit_cyl>0);
0132 Xfinit_cyl = Xfinit_cyl.*(Xp_cyl<max(ppar_cyl));
0133 Xfinit_cyl(isnan(Xfinit_cyl)) = 0;
0134 Xfinit_cyl = Xfinit_cyl.*(abs(Xfinit_cyl)>eps);
0135
0136 Xf_hxr_cyl = exp(logXf_hxr_cyl);
0137 Xf_hxr_cyl = Xf_hxr_cyl.*(Xf_hxr_cyl>0);
0138 Xf_hxr_cyl = Xf_hxr_cyl.*(Xp_cyl<max(ppar_cyl));
0139 Xf_hxr_cyl(isnan(Xf_hxr_cyl)) = 0;
0140 Xf_hxr_cyl = Xf_hxr_cyl.*(abs(Xf_hxr_cyl)>eps);
0141
0142
0143
0144
0145
0146 Ec_cyl = (sqrt(Xp_cyl2*(betath_ref).^2 + 1) - 1)*mc2;
0147 mask_cyl_hxr = 1.0*(Ec_cyl < kphot(k_test));
0148 mask_cyl_hxr(mask_cyl_hxr==0) = Inf*mask_cyl_hxr(mask_cyl_hxr==0);
0149
0150 xlim1 = [-pnmax_S,pnmax_S];xlim2 = [0,pnmax_S];
0151 siz = 20;red = 0.95;
0152
0153 figure('Name','Distribution function contour at B=Bmin');
0154 graph2D_jd(ppar_cyl,pperp_cyl,Xfinit_cyl','','','',xlim1,xlim2,0,betath_ref,[0:0.5:pnmax_S],0,'-','b',0.5,siz,red,max(max(Xf0_cyl)));
0155 graph2D_jd(ppar_cyl,pperp_cyl,Xfinit_cyl'.*mask_cyl_hxr','p_{||}/p_{Te}^{ref}','p_{\perp}/p_{Te}^{ref}','Distribution function',xlim1,xlim2,0,betath_ref,[0:0.5:pnmax_S],0,'-','k',2,siz,red,max(max(Xfinit_cyl)));
0156 graph2D_jd(ppar_cyl,pperp_cyl,Xf0_cyl','p_{||}/p_{Te}^{ref}','p_{\perp}/p_{Te}^{ref}','Distribution function',xlim1,xlim2,0,betath_ref,[0:0.5:pnmax_S],0,'-','r',2,siz,red,max(max(Xfinit_cyl)));
0157 axis('equal');
0158 xxlimit = xlim;yylimit = ylim;
0159 ht = text(xxlimit(1)+1,yylimit(1),['\rho = ',num2str(rho_out),' and \theta_{pol} = 0 (Deg)']);set(ht,'fontsize',20);
0160
0161 if bounce_mode >= 1,
0162 mhubounce2_0 = xmhu0T2(i_test);
0163 line([0,pnmax_S*sqrt(mhubounce2_0)],[0,pnmax_S*sqrt(1 - mhubounce2_0)],'color','k');
0164 line([0,-pnmax_S*sqrt(mhubounce2_0)],[0,pnmax_S*sqrt(1 - mhubounce2_0)],'color','k');
0165 end
0166 print_jd(p_opt,[filename,'_DistributionFunctionBmin']);
0167
0168 figure('Name','Distribution function contour');
0169 graph2D_jd(ppar_cyl,pperp_cyl,Xfinit_cyl','','','',xlim1,xlim2,0,betath_ref,[0:0.5:pnmax_S],0,'-','b',0.5,siz,red,max(max(Xf_hxr_cyl)));
0170 graph2D_jd(ppar_cyl,pperp_cyl,Xfinit_cyl'.*mask_cyl_hxr','p_{||}/p_{Te}^{ref}','p_{\perp}/p_{Te}^{ref}','Distribution function',xlim1,xlim2,0,betath_ref,[0:0.5:pnmax_S],0,'-','k',2,siz,red,max(max(Xfinit_cyl)));
0171 graph2D_jd(ppar_cyl,pperp_cyl,Xf_hxr_cyl','p_{||}/p_{Te}^{ref}','p_{\perp}/p_{Te}^{ref}','Distribution function',xlim1,xlim2,0,betath_ref,[0:0.5:pnmax_S],0,'-','r',2,siz,red,max(max(Xfinit_cyl)));
0172 axis('equal');
0173 xxlimit = xlim;yylimit = ylim;
0174 ht = text(xxlimit(1)+1,yylimit(1),['\rho = ',num2str(rho_out),' and \theta_{pol} = ',num2str(theta_out*180/pi),' (Deg)']);set(ht,'fontsize',20);
0175
0176 if bounce_mode >= 1,
0177 mhubounce2 = mhubounce2_hxr(i_test,j_test);
0178 line([0,pnmax_S*sqrt(mhubounce2)],[0,pnmax_S*sqrt(1 - mhubounce2)],'color','k');
0179 line([0,-pnmax_S*sqrt(mhubounce2)],[0,pnmax_S*sqrt(1 - mhubounce2)],'color','k');
0180 end
0181 print_jd(p_opt,[filename,'_DistributionFunctionB']);
0182
0183
0184
0185 figure('Name','Local bremshrahlung forward - perp - backward');
0186 graph1D_jd(kphot,Zbremplasma.brem_forward{i_test,j_test},0,1,'','','',NaN,'','','-','non','r',2);
0187 graph1D_jd(kphot,Zbremplasma.brem_backward{i_test,j_test},0,1,'','','',NaN,'','','-','non','b',2);
0188 graph1D_jd(kphot,Zbremplasma.brem_4pi{i_test,j_test},0,1,'','','',NaN,[0,200],'','-.','non','g',2);
0189 graph1D_jd(kphot,Zbremplasma.brem_perp{i_test,j_test},0,1,'Photon energy (keV)','Photon density (s-1*m-3*keV-1*str-1)','Bremsstrahlung emission',NaN,'','','-','non','k',2);
0190 legend('Forward','Backward','Mean 4{\pi}','Perp.')
0191 xxlimit = xlim;yylimit = ylim;
0192 ht = text(xxlimit(1)+1,yylimit(1)*7,['\rho = ',num2str(rho_out),' and \theta_{pol} = ',num2str(theta_out*180/pi),' (Deg)']);set(ht,'fontsize',20);
0193 grid on
0194 print_jd(p_opt,[filename,'_LocalBremsstrahlung']);
0195