0001
0002
0003
0004 clear all
0005 clear mex
0006 clear functions
0007 close all
0008 warning off
0009 global nfig
0010
0011 permission = test_permissions_yp;
0012
0013 if ~permission
0014 disp('Please move the script to a local folder where you have write permission before to run it')
0015 return;
0016 end
0017
0018 opt_proc = 1;
0019 nproc_max = 10;
0020
0021 mdceparam.type = 'local';
0022 mdceparam.mode = 2;
0023 mdceparam.enforce = 1;
0024 mdceparam.memory = 7500;
0025
0026 p_opt = 2;
0027
0028
0029
0030 id_simul = 'LH_karney_transp_bounce';
0031 path_simul = '';
0032
0033 psin_S = [];
0034 rho_S = [0:0.025:0.65,0.7:0.1:1];
0035
0036 id_path = '';
0037 path_path = '';
0038
0039 id_equil = 'JETh77';
0040 path_equil = '';
0041
0042 id_dkeparam = 'NONUNIFORM10010020';
0043 path_dkeparam = '';
0044
0045 id_display = 'NO_DISPLAY';
0046 path_display = '';
0047
0048 id_ohm = '';
0049 path_ohm = '';
0050
0051 ids_wave = {''};
0052 paths_wave = {''};
0053
0054 id_transpfaste = 'magneticturbulence';
0055 path_transpfaste = '';
0056
0057 id_ripple = '';
0058 path_ripple = '';
0059
0060
0061
0062
0063
0064 [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);
0065
0066
0067
0068 wavestruct.omega_lh = [4]*2*pi*1e9;
0069
0070
0071
0072 wavestruct.opt_lh = 2;
0073
0074
0075
0076
0077 wavestruct.norm_ref = 1;
0078
0079 wavestruct.yvparmin_lh = [4];
0080 wavestruct.yvparmax_lh = [7];
0081
0082 wavestruct.yNparmin_lh = [NaN];
0083 wavestruct.yNparmax_lh = [NaN];
0084 wavestruct.yNpar_lh = [NaN];
0085 wavestruct.ydNpar_lh = [NaN];
0086
0087
0088 wavestruct.yD0_in_c_lh = [2];
0089
0090 wavestruct.yD0_in_lh_prof = [1];
0091 wavestruct.ypeak_lh = [0.4];
0092 wavestruct.ywidth_lh = [0.1];
0093
0094 wavestruct.ythetab_lh = [0]*pi/180;
0095
0096
0097
0098
0099 if exist('dmumpsmex');dkeparam.invproc = -2;end
0100
0101 dkeparam.boundary_mode_f = 0;
0102 dkeparam.norm_mode_f = 1;
0103 dkeparam.tn = [50000,100000];
0104
0105 dkeparam.psin_S = psin_S;
0106 dkeparam.rho_S = rho_S;
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116 waves{1} = make_idealLHwave_jd(equil,wavestruct);
0117
0118
0119
0120 Dr0_list = [0,0.001,0.01,0.1,0.3,1,3,10,30,100];
0121 Dr0_mask = [1,4,6,8];
0122 iDr0_save = 8;
0123
0124 nDr0 = length(Dr0_list);
0125 nr = length(rho_S) - 1;
0126
0127 for iDr0 = 1:nDr0,
0128 iDr0
0129 [cZcurr{iDr0},cZP0{iDr0},cdke_out{iDr0},cequilDKE{iDr0},cmksa{iDr0}] = loop_rundke(iDr0,Dr0_list,iDr0_save,id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple);
0130 end
0131
0132 j = NaN(nr,nDr0);
0133 P = NaN(nr,nDr0);
0134 tCPU_Dr0 = NaN(1,nDr0);
0135 Itot = NaN(1,nDr0);
0136 Ptot_2piRp = NaN(1,nDr0);
0137
0138 for iDr0 = 1:nDr0,
0139
0140 if cdke_out{iDr0}.residu_f{end}(end) <= dkeparam.prec0_f,
0141 j(:,iDr0) = cZcurr{iDr0}.x_0;
0142
0143 P(:,iDr0) = cZP0{iDr0}.x_rf_fsav;
0144
0145 tCPU_Dr0(iDr0) = cdke_out{iDr0}.time_out;
0146
0147 Itot(iDr0) = sum(cZcurr{iDr0}.x_0.*cequilDKE{iDr0}.xdA_dke*cmksa{iDr0}.j_ref);
0148 Ptot_2piRp(iDr0) = sum(cZP0{iDr0}.x_rf_fsav.'.*cequilDKE{iDr0}.xdV_2piRp_dke*cmksa{iDr0}.P_ref);
0149 end
0150
0151 end
0152
0153 eta = j./P;
0154 Eta = cequilDKE{1}.xne(1)*Itot./Ptot_2piRp/(2*pi)/1e19;
0155
0156
0157
0158 if opt_proc > 0,
0159
0160 transpfaste.Dr0 = 10;
0161
0162 nproc_list = [1:nproc_max];
0163
0164 for inproc = 1:length(nproc_list),
0165
0166 [Znorm,Zcurr,ZP0,dke_out] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0167
0168 tCPU_nproc(inproc) = dke_out.time_out;
0169
0170 end
0171 end
0172
0173
0174
0175 for iDr0 = 1:length(Dr0_mask),
0176 leg{iDr0} = ['D_{\psi\psi} = ',num2str(Dr0_list(Dr0_mask(iDr0))),' m^{2}/s'];
0177 end
0178
0179 figure(1),clf
0180
0181 xlim = [0,1];
0182 ylim = [0,0.0015];
0183 xlab = 'r/a_p';
0184 ylab = 'j';
0185 tit = '';
0186 siz = 20+14i;
0187
0188
0189
0190
0191 graph1D_jd(cequilDKE{1}.xrho,j(:,Dr0_mask),0,0,xlab,ylab,tit,leg,xlim,ylim,'-','none',NaN,2,siz,gca,0.9,0.7,0.7);
0192
0193
0194 set(gca,'ytick',[0:1/3:1]*ylim(2))
0195 set(gca,'xtick',[0:0.2:1]*xlim(2))
0196
0197 figure(2),clf
0198
0199 xlim = [0.01,100];
0200 ylim = [0,200];
0201 xlab = 'D_{\psi\psi} (m^{2}/s)';
0202 ylab = 'CPU time (s)';
0203
0204 graph1D_jd(Dr0_list(2:end),tCPU_Dr0(2:end),1,0,xlab,ylab,tit,NaN,xlim,ylim,'-','none','r',2,siz,gca,0.9,0.7,0.7);
0205
0206 set(gca,'ytick',[0:0.2:1]*ylim(2))
0207 set(gca,'xtick',[0.01,0.1,1,10,100])
0208 set(gca,'XMinorGrid','off')
0209 set(gca,'XMinorTick','on')
0210
0211 figure(3),clf
0212
0213 ylim = [0,0.06];
0214 ylab = 'I (MA)';
0215
0216 graph1D_jd(Dr0_list(2:end),-Itot(2:end),1,0,xlab,ylab,tit,NaN,xlim,ylim,'-','none','r',2,siz,gca,0.9,0.7,0.7);
0217
0218 set(gca,'ytick',[0:0.25:1]*ylim(2))
0219 set(gca,'xtick',[0.01,0.1,1,10,100])
0220 set(gca,'XMinorGrid','off')
0221 set(gca,'XMinorTick','on')
0222
0223 figure(4),clf
0224
0225 ylim = [0,0.004];
0226 ylab = 'P/(2\piR_p) (MW/m)';
0227
0228 graph1D_jd(Dr0_list(2:end),Ptot_2piRp(2:end),1,0,xlab,ylab,tit,NaN,xlim,ylim,'-','none','r',2,siz,gca,0.9,0.7,0.7);
0229
0230 set(gca,'ytick',[0:0.25:1]*ylim(2))
0231 set(gca,'xtick',[0.01,0.1,1,10,100])
0232 set(gca,'XMinorGrid','off')
0233 set(gca,'XMinorTick','on')
0234
0235 figure(5),clf
0236
0237 ylim = [0,6];
0238 ylab = 'n_{19}IR_p/P';
0239
0240 graph1D_jd(Dr0_list(2:end),-Eta(2:end),1,0,xlab,ylab,tit,NaN,xlim,ylim,'-','none','r',2,siz,gca,0.9,0.7,0.7);
0241
0242 set(gca,'ytick',[0:0.25:1]*ylim(2))
0243 set(gca,'xtick',[0.01,0.1,1,10,100])
0244 set(gca,'XMinorGrid','off')
0245 set(gca,'XMinorTick','on')
0246
0247 print_jd(p_opt,'fig_JET_transp_nobounce_j')
0248 print_jd(p_opt,'fig_JET_transp_nobounce_cpu')
0249 print_jd(p_opt,'fig_JET_transp_nobounce_I')
0250 print_jd(p_opt,'fig_JET_transp_nobounce_P')
0251 print_jd(p_opt,'fig_JET_transp_nobounce_Eta')
0252
0253 if opt_proc > 0,
0254
0255 figure(6),clf
0256
0257 xlim = [0,length(nproc_list)+1];
0258 ylim = [0,round(max(tCPU_nproc)*2)];
0259 xlab = 'Number of processors';
0260 ylab = 'CPU time (s)';
0261 tit = 'D_{\psi\psi} = 10 (m^{2}/s)';
0262
0263 graph1D_jd(nproc_list,tCPU_nproc,0,0,xlab,ylab,tit,NaN,xlim,ylim,'-','none','r',2,siz,gca,0.9,0.7,0.7);
0264
0265 print_jd(p_opt,'fig_transp_nobounce_cpu_proc')
0266
0267 end
0268
0269
0270 eval(['save ',path_simul,'DKE_RESULTS_',id_equil,'_',id_simul,'.mat']);
0271 info_dke_yp(2,['Data saved in ',path_simul,'DKE_RESULTS_',id_equil,'_',id_simul,'.mat']);