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_bounce';
0023 path_simul = '';
0024
0025 psin_S = [];
0026 rho_S = [linspace(0,0.2,11),linspace(0.25,1,16)];
0027
0028 id_path = '';
0029 path_path = '';
0030
0031 id_equil_cyl = 'TScyl';
0032 id_equil = 'TScirc_e1';
0033 path_equil = '';
0034
0035 id_dkeparam = 'NONUNIFORM10010020';
0036 path_dkeparam = '';
0037
0038 id_display = 'PARTIAL_VISUAL';
0039 path_display = '';
0040
0041 id_ohm = '';
0042 path_ohm = '';
0043
0044 ids_wave = {''};
0045 paths_wave = {''};
0046
0047 id_transpfaste = '';
0048 path_transpfaste = '';
0049
0050 id_ripple = '';
0051 path_ripple = '';
0052
0053
0054
0055
0056
0057 [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);
0058 [equil_cyl] = load_structures_yp('equil',id_equil_cyl,path_equil);
0059
0060
0061
0062 if exist('dmumpsmex');dkeparam.invproc = -2;end
0063
0064 dkeparam.boundary_mode_f = 0;
0065 dkeparam.norm_mode_f = 1;
0066 dkeparam.tn = 10000;
0067 dkeparam.dtn = 1000;
0068
0069 dkeparam.psin_S = psin_S;
0070 dkeparam.rho_S = rho_S;
0071
0072 epsi = 0.04;
0073 betath = 0.001;
0074
0075 [qe,me,mp,mn,e0,mu0,re,mc2] = pc_dke_yp;
0076
0077 equil.pTe = betath^2*mc2*ones(size(equil.pTe));
0078 equil.pzTi = betath^2*mc2*ones(size(equil.pzTi));
0079
0080
0081 equil_cyl.pTe = betath^2*mc2*ones(size(equil_cyl.pTe));
0082 equil_cyl.pzTi = betath^2*mc2*ones(size(equil_cyl.pzTi));
0083
0084
0085 ohm_cyl = ohm_flat(equil_cyl,epsi);
0086 ohm = ohm_flat(equil,epsi);
0087
0088 dkeparam.np_S = 201;
0089 dkeparam.nmhu_S = 201;
0090 dkeparam.bounce_mode = 1;
0091
0092 [Znorm,Zcurr,ZP0,dke_out,radialDKE,equilDKE,momentumDKE,gridDKE,Zmomcoef,Zbouncecoef,Zmripple,mksa,XXsinksource] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0093 if dke_out.residu_f{end}(end) <= dkeparam.prec0_f,
0094 RR = dke_out.XxRR_fsav(end,:);
0095 else
0096 RR = NaN;
0097 end
0098
0099 dkeparam.bounce_mode = 0;
0100 dkeparam.mhu_S = momentumDKE.mhu_S;
0101 [Znorm_cyl,Zcurr_cyl,ZP0_cyl,dke_out_cyl] = main_dke_yp(id_simul,dkepath,equil_cyl,dkeparam,dkedisplay,ohm_cyl,waves,transpfaste,ripple,[],[]);
0102 if dke_out_cyl.residu_f{end}(end) <= dkeparam.prec0_f,
0103 RR_0 = dke_out_cyl.XxRR_fsav(end,:);
0104 else
0105 RR_0 = NaN;
0106 end
0107
0108
0109
0110 iar = equilDKE.xrho*equilDKE.ap/equilDKE.Rp;
0111 RRn = RR./RR_0;
0112
0113
0114
0115 figure(1),clf
0116
0117 leg = {'LUKE'};
0118 xlim = [0,1];
0119 ylim = 10.^[-4,0];
0120 xlab = 'r/R_p';
0121 ylab = '\Gamma_R/\Gamma_R^{cyl}';
0122 tit = 'Electron bounce averaged runaway rate';
0123 siz = 20+14i;
0124
0125 graph1D_jd(iar,RRn,0,1,xlab,ylab,tit,NaN,xlim,ylim,'-','none','r',2,siz,gca,0.9,0.7,0.7);
0126
0127 set(gca,'xtick',[0:0.2:1])
0128 set(gca,'ytick',[1e-5 1e-4 1e-3 1e-2 1e-1 1])
0129 set(gca,'YMinorGrid','off')
0130 set(gca,'YMinorTick','on')
0131
0132 print_jd(p_opt,'fig_runaway_bounce','./figures',1)
0133
0134
0135
0136 eval(['save ',path_simul,'DKE_RESULTS_',id_equil,'_',id_simul,'.mat']);
0137 info_dke_yp(2,['Data saved in ',path_simul,'DKE_RESULTS_',id_equil,'_',id_simul,'.mat']);
0138
0139
0140