contourfp_hxr_yp

PURPOSE ^

SYNOPSIS ^

function [ppar_cyl,pperp_cyl,p_hxr,Xf_hxr_cyl,mc2,betath_ref] = contourfp_hxr_yp(dkeparam,display,equilDKE,momentumDKE,Zmomcoef,radialDKE,dke_out,mksa,Zbremchord,Zbremplasma,Zbremdiag,i_kphot,i_test,j_test,display_mode)

DESCRIPTION ^

Draw countour plot of the electron distribution function with the region that is concerned by fast electron bremsstrahlung above a given photon energy
(see its use in postprocessingTS_hxr.m and postprocessingMST_hxr.m in Simulations directory)

by Y. PEYSSON (CEA/DRFC, yves.peysson@cea.fr) and J. DECKER (CEA/DRFC, joan.decker@cea.fr)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ppar_cyl,pperp_cyl,p_hxr,Xf_hxr_cyl,mc2,betath_ref] = contourfp_hxr_yp(dkeparam,display,equilDKE,momentumDKE,Zmomcoef,radialDKE,dke_out,mksa,Zbremchord,Zbremplasma,Zbremdiag,i_kphot,i_test,j_test,display_mode)
0002 %
0003 %Draw countour plot of the electron distribution function with the region that is concerned by fast electron bremsstrahlung above a given photon energy
0004 %(see its use in postprocessingTS_hxr.m and postprocessingMST_hxr.m in Simulations directory)
0005 %
0006 %by Y. PEYSSON (CEA/DRFC, yves.peysson@cea.fr) and J. DECKER (CEA/DRFC, joan.decker@cea.fr)
0007 %
0008 if nargin < 15,
0009     error('Not enough input arguments in contourfp_hxr_yp');
0010 end
0011 %
0012 if i_test > size(Zbremplasma.ZXf0_hxr,1),
0013     error(['Radial index may not exceed ',int2str(size(Zbremplasma.ZXf0_hxr,1))]);
0014 end
0015 if j_test > size(Zbremplasma.ZXf0_hxr,2),
0016     error(['Poloidal index may not exceed ',int2str(size(Zbremplasma.ZXf0_hxr,2))]);
0017 end
0018 %
0019 if isempty(Zbremplasma.ZXf0_hxr{i_test,j_test}),
0020     error('No chord is crossing the cell. Try another one');
0021 end
0022 %
0023 [qe,me,mp,mn,e0,mu0,re,mc2,clum,alpha] = pc_dke_yp;%Physics constant
0024 %
0025 dp_cyl = display.dp_cyl;
0026 nlevel = display.nlevel;
0027 %
0028 theta_hxr = Zbremchord.theta_hxr;
0029 PSI_hxr = Zbremchord.PSI_hxr;
0030 mask_hxr = Zbremchord.mask_hxr;
0031 %
0032 ne_ref = mksa.ne_ref;
0033 betath_ref = mksa.betath_ref;
0034 Ec = Zmomcoef.Ec_ref;
0035 %
0036 dmhu = momentumDKE.dmhu;
0037 mhu = momentumDKE.mhu;
0038 dpn = momentumDKE.dpn;
0039 pn = momentumDKE.pn;
0040 %
0041 r_dke = radialDKE.r_dke;
0042 %
0043 pnmax_S = dkeparam.pnmax_S;
0044 bounce_mode = dkeparam.bounce_mode;
0045 %
0046 kphot = Zbremdiag.kfit;
0047 %
0048 XXfinit = dke_out.XXfinit(:,:,r_dke);
0049 XXf0 = dke_out.XXf0(:,:,r_dke);
0050 XXf0_tp = dke_out.XXf0_tp(:,:,r_dke);
0051 XXf0_g = dke_out.XXf0_g(:,:,r_dke);
0052 %
0053 Rp = equilDKE.Rp;
0054 Zp = equilDKE.Zp;
0055 ap = equilDKE.Xx(end,1);
0056 %
0057 theta = equilDKE.mtheta;
0058 xpsin = equilDKE.xpsin;
0059 psia_apRp = equilDKE.psia_apRp;
0060 XR = equilDKE.Xx + Rp;
0061 XZ = equilDKE.Xy + Zp;
0062 XBR = equilDKE.XBx;
0063 XBZ = equilDKE.XBy;
0064 XBphi = equilDKE.XBphi;
0065 xB0 = equilDKE.xB0;
0066 xR0 = equilDKE.xx0 + Rp;
0067 xBT0 = equilDKE.xBT0;
0068 xBp0 = equilDKE.xBp0;
0069 xrho = equilDKE.xrho;
0070 xTe = equilDKE.xTe;
0071 xne = equilDKE.xne;
0072 xzTi = equilDKE.xzTi;
0073 xzni = equilDKE.xzni;
0074 zZi = equilDKE.zZi;
0075 zmi = equilDKE.zmi;
0076 xZeff = equilDKE.xZeff;
0077 Rp = equilDKE.Rp;
0078 Zp = equilDKE.Zp;
0079 ap = equilDKE.ap;
0080 xmhu0T2 = equilDKE.xmhu0T2;
0081 xdV_dke = equilDKE.xdV_2piRp_dke*2*pi*Rp;
0082 xdA_dke = equilDKE.xdA_dke;
0083 xzni_norm = xzni(:,r_dke)/ne_ref;
0084 xne_norm = xne(r_dke)/ne_ref;
0085 xrho = xrho(r_dke);
0086 %
0087 pn2 = pn.*pn;
0088 gamma = sqrt(1 + pn2*betath_ref^2);
0089 %
0090 [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);
0091 %
0092 Xppar_cyl = ones(length(pperp_cyl),1)*ppar_cyl(:)';
0093 Xpperp_cyl = pperp_cyl(:)*ones(1,length(ppar_cyl));
0094 Xp_cyl = sqrt(Xppar_cyl.*Xppar_cyl + Xpperp_cyl.*Xpperp_cyl);
0095 %
0096 Ec_cyl = (sqrt((Xp_cyl*betath_ref).^2 + 1) - 1)*mc2;
0097 mask_cyl_hxr = Ec_cyl >= kphot(i_kphot) - Zbremdiag.dkfit(i_kphot)/2;%Photon of energies less than the lower bound of the channel are rejected
0098 p_hxr = min(min(Xp_cyl(mask_cyl_hxr)));%Momentum of the minimum kinetic energies of electrons contributing to the bremsstrahlung
0099 %
0100 Xf_hxr_cyl = exp(logXf_hxr_cyl);%For accurate representation in figures
0101 Xf_hxr_cyl = Xf_hxr_cyl.*(Xf_hxr_cyl>0);%Remove negative values
0102 Xf_hxr_cyl = Xf_hxr_cyl.*(Xp_cyl<max(ppar_cyl));%Remove values above max(ppar)
0103 Xf_hxr_cyl(isnan(Xf_hxr_cyl)) = 0;%Remove NaN values
0104 Xf_hxr_cyl(abs(Xf_hxr_cyl)<=eps) = 0;%Remove value smaller than the numerical accuracy
0105 %
0106 Xppar_cyl = ones(length(pperp_cyl),1)*ppar_cyl(:)';
0107 Xpperp_cyl = pperp_cyl(:)*ones(1,length(ppar_cyl));
0108 %
0109 if display_mode,
0110     xlim1 = [-pnmax_S,pnmax_S];xlim2 = [0,pnmax_S];
0111     siz = 20;red = 0.95;
0112 %
0113     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(Xf_hxr_cyl)));
0114 %
0115     Xf_hxr_cyl_mask = Xf_hxr_cyl'.*~mask_cyl_hxr';
0116     Xf_hxr_cyl_mask(Xf_hxr_cyl_mask == 0) = Xf_hxr_cyl_mask(Xf_hxr_cyl_mask == 0)*NaN;
0117     graph2D_jd(ppar_cyl,pperp_cyl,Xf_hxr_cyl_mask,'p_{||}/p_{Te}^{ref}','p_{\perp}/p_{Te}^{ref}','Distribution function',xlim1,xlim2,0,betath_ref,[0:0.25:pnmax_S],0,'-','k',2,siz,red,max(max(Xf_hxr_cyl)));
0118     graph1D_jd(p_hxr*[-1,mhu,1],p_hxr*sqrt(1-[-1,mhu,1].^2),0,0,'p_{||}/p_{Te}^{ref}','p_{\perp}/p_{Te}^{ref}','Distribution function',NaN,'','','-','none','b',2);
0119     axis('equal');
0120     xxlimit = xlim;yylimit = ylim;
0121     ht = text(xxlimit(1)+1,yylimit(2)*1.2,['\rho = ',num2str(Zbremplasma.xrho(i_test)),', \theta_{pol} = ',num2str(Zbremplasma.theta_hxr(1,j_test)*180/pi),' (Deg)']);set(ht,'fontsize',20);
0122     ht = text(xxlimit(1)+1,yylimit(1)*0.3,['k = ',num2str(kphot(i_kphot)),' (keV), \Deltak = ',num2str(Zbremdiag.dkfit(i_kphot)),' (keV)']);set(ht,'fontsize',20,'Color','red');
0123 %
0124     if bounce_mode >= 1,%Draw bounce domain boundaries
0125            mhubounce2 = 1 - PSI_hxr(i_test,j_test)/max(PSI_hxr(i_test,:));
0126            line([0,pnmax_S*sqrt(mhubounce2)],[0,pnmax_S*sqrt(1 - mhubounce2)],'color','k');
0127            line([0,-pnmax_S*sqrt(mhubounce2)],[0,pnmax_S*sqrt(1 - mhubounce2)],'color','k');
0128     end
0129 end
0130 
0131

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.