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 p_opt = 2;
0019
0020 opt_proc = 1;
0021 nproc_max = 10;
0022
0023
0024
0025 id_simul = 'LH_karney_transp_nobounce';
0026 path_simul = '';
0027
0028 psin_S = [];
0029 rho_S = [0:0.025:0.65,0.7:0.1:1];
0030
0031 id_path = '';
0032 path_path = '';
0033
0034 id_equil = 'TScyl';
0035 path_equil = '';
0036
0037 id_dkeparam = 'UNIFORM10010020';
0038 path_dkeparam = '';
0039
0040 id_display = 'NO_DISPLAY';
0041 path_display = '';
0042
0043 id_ohm = '';
0044 path_ohm = '';
0045
0046 ids_wave = {''};
0047 paths_wave = {''};
0048
0049 id_transpfaste = 'nomagneticturbulence';
0050 path_transpfaste = '';
0051
0052 id_ripple = '';
0053 path_ripple = '';
0054
0055
0056
0057
0058
0059 [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);
0060
0061
0062
0063 wavestruct.omega_lh = [4]*2*pi*1e9;
0064
0065
0066
0067 wavestruct.opt_lh = 2;
0068
0069
0070
0071
0072 wavestruct.norm_ref = 1;
0073
0074 wavestruct.yvparmin_lh = [4];
0075 wavestruct.yvparmax_lh = [7];
0076
0077 wavestruct.yNparmin_lh = [NaN];
0078 wavestruct.yNparmax_lh = [NaN];
0079 wavestruct.yNpar_lh = [NaN];
0080 wavestruct.ydNpar_lh = [NaN];
0081
0082
0083 wavestruct.yD0_in_c_lh = [2];
0084
0085 wavestruct.yD0_in_lh_prof = [1];
0086 wavestruct.ypeak_lh = [0.4];
0087 wavestruct.ywidth_lh = [0.1];
0088
0089 wavestruct.ythetab_lh = [0]*pi/180;
0090
0091
0092
0093
0094 if exist('dmumpsmex');dkeparam.invproc = -2;end
0095
0096 dkeparam.boundary_mode_f = 0;
0097 dkeparam.norm_mode_f = 1;
0098 dkeparam.tn = [50000,100000];
0099
0100 dkeparam.psin_S = psin_S;
0101 dkeparam.rho_S = rho_S;
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111 waves{1} = make_idealLHwave_jd(equil,wavestruct);
0112
0113
0114
0115 Dr0_list = [0,0.001,0.01,0.1,0.3,1,3,10,30,100];
0116 Dr0_mask = [1,4,6,8];
0117
0118 nr = length(rho_S)-1;
0119 nDr0 = length(Dr0_list);
0120
0121 j = NaN(nr,nDr0);
0122 P = NaN(nr,nDr0);
0123
0124 tCPU = NaN(1,nDr0);
0125 memory = NaN(1,nDr0);
0126 tDKE = NaN(1,nDr0);
0127
0128 Itot = NaN(1,nDr0);
0129 Ptot_2piRp = NaN(1,nDr0);
0130
0131 for iDr0 = 1:nDr0,
0132
0133 transpfaste.Dr0 = Dr0_list(iDr0);
0134
0135 [Znorm,Zcurr,ZP0,dke_out,radialDKE,equilDKE,momentumDKE,gridDKE,Zmomcoef,Zbouncecoef,Zmripple,mksa] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0136
0137 if max(dke_out.residu_f{end}(:,end)) <= dkeparam.prec0_f,
0138 j(:,iDr0) = Zcurr.x_0;
0139 P(:,iDr0) = ZP0.x_rf_fsav;
0140
0141 tCPU(iDr0) = dke_out.time_out;
0142 memory(iDr0) = dke_out.memoryLU_f_out;
0143 tDKE(iDr0) = dke_out.time_DKE;
0144
0145 Itot(iDr0) = sum(Zcurr.x_0.*equilDKE.xdA_dke*mksa.j_ref);
0146 Ptot_2piRp(iDr0) = sum(ZP0.x_rf_fsav.'.*equilDKE.xdV_2piRp_dke*mksa.P_ref);
0147 end
0148
0149 end
0150
0151 eta = j./P;
0152 Eta = equilDKE.xne(1)*Itot./Ptot_2piRp/(2*pi)/1e19;
0153
0154
0155
0156 if opt_proc > 0,
0157
0158 transpfaste.Dr0 = 10;
0159 dkeparam.invproc = -2;
0160
0161 nproc_list = [1:nproc_max];
0162
0163 for inproc = 1:length(nproc_list),
0164
0165 [Znorm,Zcurr,ZP0,dke_out] = main_dke_yp(id_simul,dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,[],[]);
0166
0167 tCPU_nproc(inproc) = dke_out.time_out;
0168
0169 end
0170 end
0171
0172
0173
0174 for iDr0 = 1:length(Dr0_mask),
0175 leg{iDr0} = ['D_{\psi\psi} = ',num2str(Dr0_list(Dr0_mask(iDr0))),' m^{2}/s'];
0176 end
0177
0178 figure(1),clf
0179
0180 xlim = [0,1];
0181 ylim = [0,0.004];
0182 xlab = 'r/a_p';
0183 ylab = 'j';
0184 tit = '';
0185 siz = 20+14i;
0186
0187
0188
0189
0190 graph1D_jd(equilDKE.xrho,j(:,Dr0_mask),0,0,xlab,ylab,tit,leg,xlim,ylim,'-','none',NaN,2,siz,gca,0.9,0.7,0.7);
0191 graph1D_jd(equilDKE.xrho,besselj(0,2.4*equilDKE.xrho)*j(1,Dr0_mask(end)),0,0,'','','',NaN,xlim,ylim,'--','none','k',2,siz);
0192
0193 set(gca,'ytick',[0:0.25:1]*ylim(2))
0194 set(gca,'xtick',[0:0.2:1]*xlim(2))
0195
0196 figure(2),clf
0197
0198 xlim = [0.01,100];
0199 ylim = [0,200];
0200 xlab = 'D_{\psi\psi} (m^{2}/s)';
0201 ylab = 'CPU time (s)';
0202
0203 graph1D_jd(Dr0_list(2:end),tCPU(2:end),1,0,xlab,ylab,tit,NaN,xlim,ylim,'-','none','r',2,siz,gca,0.9,0.7,0.7);
0204
0205 set(gca,'ytick',[0:0.2:1]*ylim(2))
0206 set(gca,'xtick',[0.01,0.1,1,10,100])
0207 set(gca,'XMinorGrid','off')
0208 set(gca,'XMinorTick','on')
0209
0210 figure(3),clf
0211
0212 ylim = [0,200];
0213 ylab = 'FPE calculation time (s)';
0214 tit = '';
0215
0216 graph1D_jd(Dr0_list(2:end),tDKE(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.2: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 = NaN;
0226 ylab = 'LU matrix size (MBytes)';
0227
0228 graph1D_jd(Dr0_list(2:end),memory(2:end),1,0,xlab,ylab,tit,NaN,xlim,ylim,'-','none','r',2,siz,gca,0.9,0.7,0.7);
0229
0230
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,0.06];
0238 ylab = 'I (MA)';
0239
0240 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);
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 figure(6),clf
0248
0249 ylim = [0,0.004];
0250 ylab = 'P/(2\piR_p) (MW/m)';
0251
0252 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);
0253
0254 set(gca,'ytick',[0:0.25:1]*ylim(2))
0255 set(gca,'xtick',[0.01,0.1,1,10,100])
0256 set(gca,'XMinorGrid','off')
0257 set(gca,'XMinorTick','on')
0258
0259 figure(7),clf
0260
0261 ylim = [0,6];
0262 ylab = 'n_{19}IR_p/P';
0263
0264 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);
0265
0266 set(gca,'ytick',[0:0.25:1]*ylim(2))
0267 set(gca,'xtick',[0.01,0.1,1,10,100])
0268 set(gca,'XMinorGrid','off')
0269 set(gca,'XMinorTick','on')
0270
0271 print_jd(p_opt,'fig_transp_nobounce_j','./figures',1)
0272 print_jd(p_opt,'fig_transp_nobounce_cpu','./figures',2)
0273 print_jd(p_opt,'fig_transp_nobounce_fpe','./figures',3)
0274 print_jd(p_opt,'fig_transp_nobounce_memory','./figures',4)
0275 print_jd(p_opt,'fig_transp_nobounce_I','./figures',5)
0276 print_jd(p_opt,'fig_transp_nobounce_P','./figures',6)
0277 print_jd(p_opt,'fig_transp_nobounce_Eta','./figures',7)
0278
0279 if opt_proc > 0,
0280
0281 figure(8),clf
0282
0283 xlim = [0,length(nproc_list)+1];
0284 ylim = [0,round(max(tCPU_nproc)*2)];
0285 xlab = 'Number of processors';
0286 ylab = 'CPU time (s)';
0287 tit = 'D_{\psi\psi} = 10 (m^{2}/s)';
0288
0289 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);
0290
0291 print_jd(p_opt,'fig_transp_nobounce_cpu_proc','./figures',8)
0292
0293 end
0294
0295
0296 eval(['save ',path_simul,'DKE_RESULTS_',id_equil,'_',id_simul,'.mat']);
0297 info_dke_yp(2,['Data saved in ',path_simul,'DKE_RESULTS_',id_equil,'_',id_simul,'.mat']);