0001
0002
0003
0004
0005
0006 clear all
0007 clear mex
0008 clear functions
0009 close all
0010 warning('off')
0011
0012 [qe,me,~,~,e0,~,~,mc2] = pc_dke_yp;
0013
0014 permission = test_permissions_yp;
0015
0016 if ~permission
0017 disp('Please move the script to a local folder where you have write permission before to run it')
0018 return;
0019 end
0020
0021
0022
0023 scanstr = 'zi';
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 grid.opt = 1;
0034
0035
0036
0037 mdce_mode = -1;
0038 remnum = 0;
0039 returnmode = 0;
0040 transpmode = true;
0041 nproc_enforce = 4;
0042
0043
0044
0045 switch scanstr,
0046 case 'dtn'
0047
0048 scanvar = 'opt.dtn';
0049 scanval = 1 + 8*[1:4,8:4:40];
0050 scanlab = '\Deltat/\tau_c';
0051 graph.xlim = [0,350];
0052 graph.xlog = 0;
0053 graph.xtick = 0:50:350;
0054 graph.ylim_norm = 10.^[-5,-3];
0055 graph.ytick_norm = 10.^(-5:-3);
0056 graph.ylim_gamma = 10.^[-20,-15];
0057 graph.ytick_gamma = 10.^(-20:-15);
0058 graph.iscandisp = [1,2,4,8,13];
0059
0060 case 'np_tail'
0061
0062 scanvar = 'grid.np_tail';
0063 scanval = (988-28)./2.^(0:6);
0064 scanlab = 'n_p (tail)';
0065 graph.xlim = (988-28)./2.^[7,-1];
0066 graph.xlog = 1;
0067 graph.xtick = fliplr(scanval);
0068 graph.ylim_norm = 10.^[-5,-2];
0069 graph.ytick_norm = 10.^(-5:-3);
0070 graph.ylim_gamma = 10.^[-20,-10];
0071 graph.ytick_gamma = 10.^(-20:2:-10);
0072 graph.iscandisp = [1,3,5,7];
0073
0074 case 'pnmax_S'
0075
0076 scanvar = 'grid.pnmax_S';
0077 scanval = 7:7:70;
0078 scanlab = 'p_{max}/p_T (fine grid)';
0079 graph.xlim = [0,77];
0080 graph.xlog = 0;
0081 graph.xtick = scanval(2:2:end);
0082 graph.ylim_norm = 10.^[-5,-2];
0083 graph.ytick_norm = 10.^(-5:-3);
0084 graph.ylim_gamma = 10.^[-20,-10];
0085 graph.ytick_gamma = 10.^(-20:2:-10);
0086 graph.iscandisp = [2:2:10];
0087
0088 case 'sfac1'
0089
0090 scanvar = 'grid.sfac1';
0091 scanval = [1,2,4,6,10,20,40,60,100];
0092 scanlab = '\Delta\xi_{fine}/\Delta\xi_0';
0093 graph.xlim = [0.5,200];
0094 graph.xlog = 1;
0095 graph.xtick = scanval;
0096 graph.ylim_norm = 10.^[-5,-2];
0097 graph.ytick_norm = 10.^(-5:-3);
0098 graph.ylim_gamma = 10.^[-20,-10];
0099 graph.ytick_gamma = 10.^(-20:2:-10);
0100 graph.iscandisp = [1:2:9];
0101
0102 case 'alpha'
0103
0104 scanvar = 'alpha';
0105 scanval = (1.5:0.25:4);
0106 scanlab = 'E_{||}';
0107 scanind = 2;
0108 graph.xmask = 1:8;
0109 graph.xlim = [1.25,3.5];
0110 graph.xlog = 0;
0111 graph.xtick = scanval(1:2:11);
0112 graph.ylim_norm = 10.^[-11,1];
0113 graph.ytick_norm = 10.^(-10:2:0);
0114 graph.ylim_gamma = 10.^[-30,0];
0115 graph.ytick_gamma = 10.^(-30:5:0);
0116 graph.iscandisp = [1:2:7,8];
0117
0118 case 'betath2'
0119
0120 scanvar = 'betath2';
0121 scanval = 10.^(-3:0.25:-1);
0122 scanlab = 'T_e';
0123 scanind = 3;
0124 graph.scanformat = '%10.1f';
0125 graph.scanunits = 'keV';
0126 graph.xmask = 3:7;
0127 graph.x = mc2*scanval;
0128 graph.xlim = [1,30];
0129 graph.xlog = 1;
0130 graph.xtick = [1,3,10,30];
0131 graph.ylim_norm = 10.^[-11,1];
0132 graph.ytick_norm = 10.^(-10:2:0);
0133 graph.ylim_gamma = 10.^[-70,0];
0134 graph.ytick_gamma = 10.^(-60:20:0);
0135 graph.iscandisp = [3:7];
0136
0137 case 'taurinv'
0138
0139 scanvar = 'taurinv';
0140 scanval = 0.3:0.1:1.6;
0141 scanlab = '\sigma_r';
0142 graph.xmask = 2:14;
0143 graph.xlim = [0,1.8];
0144 graph.xlog = 0;
0145 graph.xtick = 0:0.3:1.8;
0146 graph.ylim_norm = 10.^[-11,1];
0147 graph.ytick_norm = 10.^(-10:2:0);
0148 graph.ylim_gamma = 10.^[-30,0];
0149 graph.ytick_gamma = 10.^(-30:5:0);
0150 graph.iscandisp = [2,4,6:4:14];
0151
0152 case 'zi'
0153
0154 scanvar = 'Zi';
0155 scanval = 1:0.25:4;
0156 scanlab = 'Z_{eff}';'Z_i';
0157 scanind = 5;
0158 graph.xlim = [0.5,4.5];
0159 graph.xlog = 0;
0160 graph.xtick = 0.5:0.5:4.5;
0161 graph.ylim_norm = 10.^[-11,1];
0162 graph.ytick_norm = 10.^(-10:2:0);
0163 graph.ylim_gamma = 10.^[-30,0];
0164 graph.ytick_gamma = 10.^(-30:5:0);
0165 graph.iscandisp = [1:4:13];
0166
0167 otherwise
0168 error('Scan variable not implemented')
0169 end
0170
0171 graph.re = false;
0172 graph.xlog_f = 1;
0173 graph.xlim_f = [1e-3,1e2];
0174 graph.xtick_f = 10.^(-3:2);
0175 graph.ylim_f = [1e-20,1e0];
0176 graph.ytick_f = 10.^(-20:4:0);
0177
0178
0179
0180 id_simul0 = 'Runaway_scan';
0181 p_opt = -1;
0182
0183
0184
0185 opt.timevol = 1;
0186
0187
0188
0189 alpha = 3;
0190
0191
0192
0193
0194 betath2 = 0.01;
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213 taurinv = 0.6;
0214
0215 opt.synchro_mode = 1;
0216
0217
0218
0219 Zi = 1;
0220
0221 Emin = NaN;
0222
0223
0224
0225
0226
0227
0228
0229 opt.coll_mode = 0;
0230 opt.bounce_mode = 0;
0231 opt.boundary_mode_f = 0;
0232
0233
0234
0235
0236
0237
0238 opt.norm_mode_f = +1i;
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255 opt.tnmin = 1;
0256 opt.tn = [1e7,1e8];
0257 opt.dtn = [141,90];
0258
0259
0260
0261
0262
0263 grid.nmhu_S = 141;
0264 grid.sfac1 = 80;
0265 grid.snmhu1 = 5;
0266
0267 grid.np_S = 141;
0268 grid.pnmax_S = 28;
0269 grid.np_tail = 4i;
0270 grid.pnmax_S_tail = 1967;
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293 opt.avalanche_mode = false;
0294 opt.pnmin0_KO = NaN;
0295 opt.pnmax1_KO = 0;
0296 opt.pnmin2_KO = 1i;
0297 opt.pnmax2_KO = NaN;
0298
0299 path_simul = '';
0300
0301 if opt.bounce_mode == 0,
0302 id_equil = 'TScyl';
0303 else
0304 id_equil = 'TScirc_e1';
0305 end
0306 id_wave = '';
0307
0308 rho_S = 0.5;
0309
0310 opt.heavyions = true;
0311 opt.adjustB = true;
0312
0313
0314
0315 nscan = length(scanval);
0316 id_simul_scan = [id_simul0,'_',scanstr];
0317
0318 RR = cell(1,nscan);
0319 mksa = cell(1,nscan);
0320 Ec = cell(1,nscan);
0321 f = cell(1,nscan);
0322 tn = cell(1,nscan);
0323 tRR = cell(1,nscan);
0324 tnorm = cell(1,nscan);
0325 fgrid = cell(1,nscan);
0326
0327 dp_bulk = grid.pnmax_S/(grid.np_S - 1);
0328 dp_fine = (grid.pnmax_S_tail - grid.pnmax_S)/grid.np_tail;
0329 pfac = imag(grid.np_tail);
0330
0331
0332
0333
0334 if any(strcmp(scanstr,{'taurinv','sfac1','pnmax_S','np_tail','dtn'}))...
0335 || (strcmp(scanstr,'betath2') && ~isnan(Emin)),
0336
0337 for iscan = 1:nscan,
0338 evalstr = [scanvar,' = ',num2str(scanval(iscan)),';'];
0339 disp(['Scan ',num2str(iscan),'/',num2str(nscan),' : ',evalstr])
0340 eval(evalstr);
0341
0342 if grid.opt == 1,
0343 grid.np_S = 1 + round(grid.pnmax_S/dp_bulk);
0344 if pfac == 0,
0345 grid.np_tail = round((grid.pnmax_S_tail - grid.pnmax_S)/dp_fine);
0346 else
0347 grid.np_tail = round((grid.np_S - 1)*pfac*((grid.pnmax_S_tail/grid.pnmax_S)^(1/pfac) - 1));
0348 grid.opt = pfac;
0349 end
0350 end
0351
0352 id_simul = [id_simul_scan,'_',num2str(scanval(iscan))];
0353
0354 opt.pnmin_S = sqrt(((1 + Emin*1e3/mc2)^2 - 1)/betath2);
0355 wpr = -taurinv*1i;
0356
0357
0358
0359 [RR{iscan},mksa{iscan},Ec{iscan},f{iscan},tn{iscan},tRR{iscan},tnorm{iscan},fgrid{iscan}] = frundke_runaway(id_simul,alpha,betath2,wpr,Zi,opt,grid,id_equil,id_wave,rho_S);
0360
0361 end
0362 else
0363
0364 if grid.opt == 1,
0365 grid.np_S = 1 + round(grid.pnmax_S/dp_bulk);
0366 if pfac == 0,
0367 grid.np_tail = round((grid.pnmax_S_tail - grid.pnmax_S)/dp_fine);
0368 else
0369 grid.np_tail = round((grid.np_S - 1)*pfac*((grid.pnmax_S_tail/grid.pnmax_S)^(1/pfac) - 1));
0370 grid.opt = pfac;
0371 end
0372 end
0373
0374 opt.pnmin_S = sqrt(((1 + Emin*1e3/mc2)^2 - 1)/betath2);
0375 wpr = -taurinv*1i;
0376
0377
0378
0379 dkepath = lukeschedulerparam('',mdce_mode,remnum,returnmode,transpmode);
0380
0381 if ~isnan(nproc_enforce),
0382 for irem = 1:length(dkepath.remote),
0383 dkepath.remote(irem).nproc = nproc_enforce;
0384 end
0385 end
0386
0387 dkecluster = clustermode_luke('','run_lukert',dkepath);
0388
0389 [flag,RR(:),mksa(:),Ec(:),f(:),tn(:),tRR(:),tnorm(:),fgrid(:)] = ...
0390 mdce_run('frundke_runaway',{id_simul_scan,alpha,betath2,wpr,Zi,opt,grid,id_equil,id_wave,rho_S},scanind,scanval,dkecluster);
0391 end
0392
0393
0394
0395
0396
0397 fproc_runaway_scan(scanvar,scanval,scanstr,scanlab,RR,mksa,Ec,f,tn,tRR,tnorm,fgrid,alpha,betath2,wpr,Zi,opt,grid,id_equil,rho_S,graph,p_opt,id_simul_scan);
0398
0399
0400
0401 if p_opt > 0,
0402
0403 for iscan = 1:nscan,
0404 f{iscan} = f{iscan}(end);
0405 end
0406
0407 filename = [path_simul,'DKE_RESULTS_',id_simul_scan,'.mat'];
0408 save(filename);
0409 info_dke_yp(2,['Data saved in ',filename]);
0410 end