0001
0002
0003
0004 clear all
0005 clear mex
0006 clear functions
0007 close all
0008 warning off
0009 global nfig
0010
0011 p_opt = 2;
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 id_simul = 'Runaway_time';
0023 path_simul = '';
0024
0025 psin_S = [];
0026 rho_S = [0.5];
0027
0028 id_path = '';
0029 path_path = '';
0030
0031 id_equil = 'TScyl';
0032 path_equil = '';
0033
0034 id_dkeparam = 'UNIFORM10010020';
0035 path_dkeparam = '';
0036
0037 id_display = 'NO_DISPLAY';
0038 path_display = '';
0039
0040 id_ohm = '';
0041 path_ohm = '';
0042
0043 ids_wave = {''};
0044 paths_wave = {''};
0045
0046 id_transpfaste = '';
0047 path_transpfaste = '';
0048
0049 id_ripple = '';
0050 path_ripple = '';
0051
0052
0053
0054
0055
0056 [dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple] = load_structures_yp('dkepath',id_path,path_path,'equil',id_equil,path_equil,'dkeparam',id_dkeparam,path_dkeparam,'dkedisplay',id_display,path_display,'ohm',id_ohm,path_ohm,'waves',ids_wave,paths_wave,'transpfaste',id_transpfaste,path_transpfaste,'ripple',id_ripple,path_ripple);
0057
0058
0059
0060 if exist('dmumpsmex');dkeparam.invproc = -2;end
0061
0062 betath = 0.001;
0063 epsi = 0.04;
0064
0065 [qe,me,mp,mn,e0,mu0,re,mc2] = pc_dke_yp;
0066
0067 equil.pTe = betath^2*mc2*ones(size(equil.pTe));
0068 equil.pzTi = ones(length(equil.zZi),1)*equil.pTe;
0069
0070 ohm = ohm_flat(equil,epsi);
0071
0072 RR_kulsrud = 1.914*1e-6;
0073
0074 dkeparam.timevol = 1;
0075
0076 tn = logspace(0,5,101);
0077 nit = length(tn);
0078 dtn = diff([0,tn]);
0079
0080 dkeparam.dtn = NaN;
0081 dkeparam.tn = tn;
0082
0083 dkeparam.psin_S = psin_S;
0084 dkeparam.rho_S = rho_S;
0085
0086 dkeparam.coll_mode = 0;
0087
0088 dkeparam.boundary_mode_f = 0;
0089 dkeparam.norm_mode_f = 0;
0090
0091 [dummy,dummy,dummy,dke_out_0] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0092
0093 xRRv_0 = NaN(1,nit);
0094 xRRs_0 = NaN(1,nit);
0095 for it=1:nit,
0096 xRRv_0(it) = (dke_out_0.normf0{it}(1) - dke_out_0.normf0{it}(end))/dtn(it);
0097 xRRs_0(it) = dke_out_0.XxRR_fsav{it}(end,:);
0098 end
0099
0100 dkeparam.boundary_mode_f = 1;
0101 dkeparam.norm_mode_f = 0;
0102
0103 [dummy,dummy,dummy,dke_out_1] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0104
0105 xRRv_1 = NaN(1,nit);
0106 xRRs_1 = NaN(1,nit);
0107 for it=1:nit,
0108 xRRv_1(it) = (dke_out_1.normf0{it}(1) - dke_out_1.normf0{it}(end))/dtn(it);
0109 xRRs_1(it) = dke_out_1.XxRR_fsav{it}(end,:);
0110 end
0111
0112 dkeparam.boundary_mode_f = 0;
0113 dkeparam.norm_mode_f = 1;
0114
0115 [dummy,dummy,dummy,dke_out_2] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0116
0117 xRRv_2 = NaN(1,nit);
0118 xRRs_2 = NaN(1,nit);
0119 for it=1:nit,
0120 xRRv_2(it) = (dke_out_2.normf0{it}(1) - dke_out_2.normf0{it}(end))/dtn(it);
0121 xRRs_2(it) = dke_out_2.XxRR_fsav{it}(end,:);
0122 end
0123
0124 dkeparam.coll_mode = 1;
0125
0126 [dummy,dummy,dummy,dke_out_2_1] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0127
0128 xRRv_2_1 = NaN(1,nit);
0129 xRRs_2_1 = NaN(1,nit);
0130 for it=1:nit,
0131 xRRv_2_1(it) = (dke_out_2_1.normf0{it}(1) - dke_out_2_1.normf0{it}(end))/dtn(it);
0132 xRRs_2_1(it) = dke_out_2_1.XxRR_fsav{it}(end,:);
0133 end
0134
0135 dkeparam.coll_mode = 2;
0136
0137 [dummy,dummy,dummy,dke_out_2_2] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0138
0139 xresidue_2_2 = NaN(1,nit);
0140 xRRv_2_2 = NaN(1,nit);
0141 xRRs_2_2 = NaN(1,nit);
0142 for it=1:nit,
0143 xresidue_2_2(it) = dke_out_2_2.residu_f{it}(end);
0144 xRRv_2_2(it) = (dke_out_2_2.normf0{it}(1) - dke_out_2_2.normf0{it}(end))/dtn(it);
0145 xRRs_2_2(it) = dke_out_2_2.XxRR_fsav{it}(end,:);
0146 end
0147 xRRv_2_2(xresidue_2_2 > dkeparam.prec0_f) = NaN;
0148 xRRs_2_2(xresidue_2_2 > dkeparam.prec0_f) = NaN;
0149
0150
0151
0152 figure(1),clf
0153
0154 leg = {'Free Mode','Fixed point','Normalization','Kulsrud'};
0155 xlim = 10.^[2,5];
0156 ylim = 10.^[-7,-5];
0157 xlab = 't/\tau_c';
0158 ylab = '\Gamma_R\tau_c';
0159 tit = '';
0160 siz = 20+14i;
0161
0162 graph1D_jd(tn,xRRs_0,1,1,xlab,ylab,tit,NaN,xlim,ylim,'-','none','r',2,siz,gca,0.9,0.7,0.7);
0163 graph1D_jd(tn,xRRs_1,1,1,'','','',NaN,xlim,ylim,'-','none','b',2,siz,gca);
0164 graph1D_jd(tn,xRRs_2,1,1,'','','',NaN,xlim,ylim,'-','none','g',2,siz,gca);
0165 graph1D_jd(xlim,[RR_kulsrud,RR_kulsrud],1,1,'','','',leg,xlim,ylim,'--','none','k',2,siz,gca);
0166
0167 set(gca,'xtick',10.^[2:5])
0168 set(gca,'ytick',10.^[-7:-5])
0169 set(gca,'XMinorGrid','off')
0170 set(gca,'XMinorTick','on')
0171 set(gca,'YMinorGrid','off')
0172 set(gca,'YMinorTick','on')
0173
0174 figure(2),clf
0175
0176 leg = {'Linearized','High v limit','Maxwellian'};
0177
0178 graph1D_jd(tn,xRRs_2_2,1,1,xlab,ylab,tit,NaN,xlim,ylim,'-','none','r',2,siz,gca,0.9,0.7,0.7);
0179 graph1D_jd(tn,xRRs_2_1,1,1,'','','',NaN,xlim,ylim,'-','none','b',2,siz,gca);
0180 graph1D_jd(tn,xRRs_2,1,1,'','','',leg,xlim,ylim,'-','none','g',2,siz,gca);
0181
0182 set(gca,'xtick',10.^[2:5])
0183 set(gca,'ytick',10.^[-7:-5])
0184 set(gca,'XMinorGrid','off')
0185 set(gca,'XMinorTick','on')
0186 set(gca,'YMinorGrid','off')
0187 set(gca,'YMinorTick','on')
0188
0189 figure(3),clf
0190 xlim = 10.^[0,5];
0191 ylim = 10.^[-8,-4.99];
0192
0193 mask = xRRv_0 > 0;
0194
0195 leg = {'Volumic losses','Boundary losses','Runaway rate'};
0196
0197 graph1D_jd(tn(mask),xRRv_0(mask),1,1,xlab,ylab,tit,NaN,xlim,ylim,'-','none','r',2,siz,gca,0.9,0.7,0.7);
0198 graph1D_jd(tn,xRRs_0,1,1,'','','',NaN,xlim,ylim,'-','none','b',2,siz,gca);
0199 graph1D_jd(xlim,[RR_kulsrud,RR_kulsrud],1,1,'','','',leg,xlim,ylim,'--','none','k',2,siz,gca);
0200 graph1D_jd(tn(~mask),-xRRv_0(~mask),1,1,xlab,ylab,tit,NaN,xlim,ylim,'--','none','r',2,siz,gca);
0201
0202 set(gca,'ytick',[1e-010 1e-09 1e-08 1e-07 1e-06 1e-05])
0203 set(gca,'xtick',[1 10 100 1000 10000 100000])
0204 set(gca,'XMinorGrid','off')
0205 set(gca,'XMinorTick','on')
0206 set(gca,'YMinorGrid','off')
0207 set(gca,'YMinorTick','on')
0208
0209 print_jd(p_opt,'fig_runaway_time_vs','./figures',1)
0210 print_jd(p_opt,'fig_runaway_time_coll','./figures',2)
0211 print_jd(p_opt,'fig_runaway_time_mode','./figures',3)
0212
0213
0214
0215 eval(['save ',path_simul,'DKE_RESULTS_',id_equil,'_',id_simul,'.mat']);
0216 info_dke_yp(2,['Data saved in ',path_simul,'DKE_RESULTS_',id_equil,'_',id_simul,'.mat']);