0001
0002
0003
0004
0005
0006 clear all
0007 clear mex
0008 clear functions
0009 close all
0010 warning('off')
0011 for irho =10,
0012
0013 permission = test_permissions_yp;
0014
0015 if ~permission
0016 disp('Please move the script to a local folder where you have write permission before to run it')
0017 return;
0018 end
0019
0020
0021
0022 f_pmin = 1;
0023 pnmax_S = 87;
0024 np_S = 301;
0025 nmhu_S = 201;
0026 f_pmax = 1;
0027
0028 mfactor = 100;
0029
0030
0031
0032
0033
0034
0035
0036 betath2 = 0.001;
0037
0038 alpha = 50;
0039 epsi = alpha*betath2;
0040
0041 pnmin_S = NaN;
0042
0043
0044
0045 Zi = 1;
0046
0047
0048
0049
0050
0051
0052 coll_mode = 0;
0053
0054 id_simul = 'Runaway';
0055
0056
0057
0058
0059
0060
0061 psin_S = [];
0062 rho_S = 0.05*irho;
0063
0064 id_path = '';
0065 path_path = '';
0066
0067 id_equil = 'TScirc';
0068
0069 path_equil = '';
0070
0071 id_dkeparam = 'UNIFORM10010020';
0072 path_dkeparam = '';
0073
0074 id_display = 'PARTIAL_VISUAL';
0075 path_display = '';
0076
0077
0078
0079
0080
0081 [dkepath,equil,dkeparam,dkedisplay] = load_structures_yp('dkepath',id_path,path_path,'equil',id_equil,path_equil,'dkeparam',id_dkeparam,path_dkeparam,'dkedisplay',id_display,path_display);
0082
0083
0084
0085
0086 if exist('dmumpsmex','file') == 3,
0087 dkeparam.invproc = -2;
0088 end
0089
0090 dkeparam.pnmin_S = pnmin_S;
0091 dkeparam.f_pmax = f_pmax;
0092 dkeparam.f_pmin = f_pmin;
0093 dkeparam.pnmax_S = pnmax_S;
0094 dkeparam.boundary_mode_f = 0;
0095 dkeparam.norm_mode_f = 0;
0096 dkeparam.timevol = 1;
0097
0098 dkeparam.tn = 40000;
0099 dkeparam.dtn = 1000;
0100 dkeparam.coll_mode = coll_mode;
0101 dkeparam.bounce_mode = 1;
0102 dkeparam.avalanche_mode = 1;
0103
0104 options_fzero = optimset('fzero');
0105 options_fzero.Display = 'iter';
0106 options_fzero.TolX = 1e-10;
0107 dkeparam.options_fzero = options_fzero;
0108
0109 equil.pzTi = 1e-10*ones(size(equil.pzTi));
0110
0111 [qe,me,dummy,dummy,e0,dummy,dummy,mc2,clum] = pc_dke_yp;
0112
0113 equil.pTe = betath2*mc2*ones(size(equil.pTe));
0114
0115 equil.zZi = [1,1,1,Zi];
0116 equil.pzni = [0;0;0;1/Zi]*equil.pne;
0117
0118 epsi = alpha*betath2;
0119
0120 xnre_init = 0;
0121
0122 ohm = ohm_flat(equil,epsi);
0123
0124 ohm.xnre_init = xnre_init;
0125
0126 dkeparam.pn_S = linspace(0,pnmax_S,np_S);
0127 dkeparam.nmhu_S = nmhu_S;
0128 dkeparam.psin_S = psin_S;
0129 dkeparam.rho_S = rho_S;
0130 dkeparam.mfactor = mfactor;
0131
0132
0133
0134 fitparam.mode_equil = 1;
0135 fitparam.nharm = NaN;
0136 fitparam.ngridresample = 1001;
0137 fitparam.method = 'spline';
0138
0139 equil.equil_fit = fitequil_yp(equil,fitparam.mode_equil,fitparam.method,fitparam.ngridresample,fitparam.nharm);
0140
0141 [Znorm,Zcurr,ZP0,dke_out,radialDKE,equilDKE,momentumDKE,gridDKE,Zmomcoef,Zbouncecoef,Zmripple,mksa,XXsinksource,dke_warnings] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,'','','',[],[]);
0142
0143
0144
0145
0146 Rfrac = Znorm(end).x_Rfrac_0_fsav;
0147
0148 xnre = cell2mat(dke_out.xnorm_rep);
0149
0150 RRAint = Znorm(1,end).xRRAint./xnre(end-1);
0151 RRAinttot = Znorm(1,end).xRRAtot./xnre(end-1);
0152 RR = dke_out.XxRR_fsav{end};
0153 RR = RR(end,:);
0154
0155
0156 for it = 1:(length(xnre)-1)
0157 gr(it) = (xnre(it+1) - xnre(it))/xnre(it)/dkeparam.dtn;
0158 end
0159 figure;graph1D_jd(1:(length(xnre)-1),gr,0,0,'iteration','growth rate (s^-1)','Numerical growth rate',NaN,NaN,NaN,'-','o','b',1)
0160 hold on
0161
0162
0163
0164 if dkeparam.avalanche_mode == 1
0165 pnext = pnmax_S*f_pmax;
0166 gamma_max = sqrt((pnmax_S*mksa.betath_ref)^2+1);
0167 gamma_ext = sqrt((pnext*mksa.betath_ref)^2+1);
0168
0169
0170
0171
0172 dtn_min = me*clum*(sqrt(gamma_ext^2-1)-sqrt(gamma_max^2-1))/(qe*mksa.Edreicer_ref*epsi)*mksa.nhu_ref;
0173
0174
0175 gam = gamma_max:0.01:(gamma_max+10);
0176 dt_acc = me*clum*(sqrt(gam.^2-1)-sqrt(gamma_max^2-1))/(qe*mksa.Edreicer_ref*epsi)*mksa.nhu_ref;
0177 titl=['(ro): gamma @ p_{max} = ',num2str(pnmax_S),'p_{th}'];
0178 figure;graph1D_jd(gam,dt_acc,0,0,'gamma','dt_n Dreicer',titl,NaN,NaN,NaN,'-','none','b',2)
0179 hold on
0180 graph1D_jd(gamma_ext,dtn_min,0,0,'','','',NaN, NaN,NaN,'none','o','r',3);
0181 hold off
0182 disp([' Mininmum time step dtn for dreicer acc from rest to gamma(p_max) = : ',num2str(gamma_max),' is tau*nhu_ref = ',num2str(dtn_min)])
0183 end
0184
0185 if length(rho_S) == 1
0186
0187 [logXf0_cyl_ref,ppar_cyl_ref,dppar_cyl_ref,pperp_cyl_ref,dpperp_cyl_ref] = s2c_dke_yp(log(dke_out.XXf0{end}),momentumDKE.pn,momentumDKE.mhu,0.1);
0188 Xf0_cyl_ref = exp(logXf0_cyl_ref);
0189
0190 logXfinit_cyl_ref = s2c_dke_yp(log(dke_out.XXfinit),momentumDKE.pn,momentumDKE.mhu,0.1);
0191 Xfinit_cyl_ref = exp(logXfinit_cyl_ref);
0192
0193 Xppar_cyl_ref = ones(length(pperp_cyl_ref),1)*ppar_cyl_ref(:)';
0194 Xpperp_cyl_ref = pperp_cyl_ref(:)*ones(1,length(ppar_cyl_ref));
0195 Xp_cyl_ref = sqrt(Xppar_cyl_ref.*Xppar_cyl_ref + Xpperp_cyl_ref.*Xpperp_cyl_ref);
0196
0197 Xf0_cyl_ref = Xf0_cyl_ref.*(Xf0_cyl_ref>0);
0198 Xf0_cyl_ref = Xf0_cyl_ref.*(Xp_cyl_ref<=max(ppar_cyl_ref));
0199 Xf0_cyl_ref(isnan(Xf0_cyl_ref)) = 0;
0200
0201 Xfinit_cyl_ref = Xfinit_cyl_ref.*(Xfinit_cyl_ref>0);
0202 Xfinit_cyl_ref = Xfinit_cyl_ref.*(Xp_cyl_ref<=max(ppar_cyl_ref));
0203 Xfinit_cyl_ref(isnan(Xfinit_cyl_ref)) = 0;
0204
0205
0206
0207 Xmask = abs(Xf0_cyl_ref) < eps;
0208
0209 pnmax = max(momentumDKE.pn_S);
0210 pnmax_0 = min(min(Xp_cyl_ref(Xmask)));
0211
0212 Xmask = Xp_cyl_ref >= pnmax;
0213
0214 Xf0_cyl_ref(Xmask) = 0;
0215 Xfinit_cyl_ref(Xmask) = 0;
0216
0217 figure(1),clf
0218
0219 x1 = ppar_cyl_ref;
0220 xlab1 = 'p_{||}/p_{Te}';
0221 xlim1 = [-pnmax,pnmax];
0222
0223 x2 = pperp_cyl_ref;
0224 xlab2 = 'p_{\perp}/p_{Te}';
0225 xlim2 = [0,pnmax];
0226
0227 leg = {'f_M','f'};
0228
0229 y1 = Xfinit_cyl_ref;
0230 y2 = Xf0_cyl_ref;
0231
0232 y9 = sqrt(pnmax^2 - x1.^2);
0233
0234 figure;
0235 graph2D_jd(x1,x2,y1','','','',xlim1,xlim2,0,mksa.betath_ref,[0:0.5:pnmax],0,'-','b',0.5,20+14i,1,max(max(y1)));
0236 hold on
0237 graph2D_jd(x1,x2,y2','','','',xlim1,xlim2,0,mksa.betath_ref,[0:0.5:pnmax],0,'-','r',2,20+14i,1,max(max(y1)));
0238 hold off
0239
0240 graph1D_jd(x1,y9,0,0,xlab1,xlab2,'',NaN,xlim1,xlim2,'-','none','k',2,20+14i,gca,0.9,0.7,0.7);
0241
0242 axis('equal');axis([xlim1,xlim2]);
0243 legend(leg);
0244 end
0245
0246 disp('Simulation parameters : ')
0247 disp(['coll_mode = ',num2str(coll_mode),' ; Te/mc2 = ',num2str(betath2),' ; E/Ec = ',num2str(alpha),' ; E/ED = ',num2str(alpha*betath2),' ; Zi = ',num2str(Zi)])
0248 disp(['NR limit : pc/pT = ',num2str(1/sqrt(alpha*betath2)),' ; pmax/pc = ',num2str(pnmax_S*sqrt(alpha*betath2))])
0249 disp(['Relativ. : pc/pT = ',num2str(1/sqrt((alpha - 1)*betath2)),' ; pmax/pc = ',num2str(pnmax_S*sqrt((alpha - 1)*betath2))])
0250 disp(' ')
0251 disp(['--> LUKE RR (normalized to ne and tauc) : ',num2str(RR)])
0252 disp('----------------------')
0253
0254
0255
0256 diary off
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267 figure
0268 graph1D_jd((1:dkeparam.dtn:dkeparam.tn),xnre(:),0,0,'t_n','n_{re}/n_{tot}','',NaN,NaN,NaN,'-','none','b',2)
0269 figure
0270 grDA = diff(xnre(:))'./dkeparam.dtn./(1-xnre(1:(end-1)));
0271 graph1D_jd(xnre(1:(end-1)),grDA,0,0,'n_r','1/(1-n_r)dn_r/dt_n','',NaN,NaN,NaN,'-','none','b',2)
0272 grA = (grDA(end)-grDA(end-20))/(xnre(end)-xnre(end-20));
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286 end