0001
0002
0003
0004
0005
0006 clear all
0007 clear mex
0008 clear functions
0009 close all
0010 warning('off','all')
0011 pause(1)
0012
0013 p_opt = -1;
0014
0015
0016
0017 id_simul = '';
0018 path_simul = '';
0019
0020 psin_S = [];
0021 rho_S = [0:0.1:0.6,0.61:0.01:0.79,0.80:0.05:1];
0022
0023 id_dkepath = '';
0024 path_dkepath = '';
0025
0026 id_equil = 'ITER_Scen2_200103121816_430_129';
0027 path_equil = 'EQUIL/';
0028
0029 id_fluct = 'ne_sigma0p1_delta0p01';
0030 path_fluct = 'FLUCT/';
0031
0032 id_dkeparam = 'EC_RT';
0033 path_dkeparam = '';
0034
0035 id_dkedisplay = 'NO_DISPLAY';
0036 path_dkedisplay = '';
0037
0038 id_ohm = '';
0039 path_ohm = '';
0040
0041 ids_wave = {''};
0042 paths_wave = {''};
0043
0044 id_transpfaste = '';
0045 path_transpfaste = '';
0046
0047 id_ripple = '';
0048 path_ripple = '';
0049
0050
0051
0052
0053
0054 id = 'NTM_32_fluctn';
0055 freq_GHz = 170;
0056 mmode = -1;
0057
0058 R_L = 6.4848;
0059 Z_L = 4.110;
0060 P_L = 20;
0061
0062 cone_div = 1.08;
0063 cone_ori = -0.5;
0064
0065 z_L = 0.35;
0066
0067 alpha_prater = -63.5;
0068 beta_prater = 22;
0069
0070 ns = 1000;
0071 method = 'cubic';
0072
0073
0074
0075 mdce_mode_main_C3PO_jd = 0;
0076
0077
0078
0079 C3POdisplay.ray = 0;
0080 C3POdisplay.equilibrium = 0;
0081 C3POdisplay.p_opt = -1;
0082
0083
0084
0085 waveparam.mmode = mmode;
0086 waveparam.kmode = 0;
0087
0088
0089
0090
0091
0092
0093 waveparam.opt_rf = 1;
0094
0095 waveparam.dsmin = 0;
0096
0097 waveparam.nd = 1;
0098 waveparam.nchi = 1;
0099
0100 waveparam.n_rf_list = 1:2;
0101 waveparam.ns = 1;
0102
0103
0104
0105
0106
0107
0108
0109 fitparam.mode_equil = 1;
0110 fitparam.method = 'spline';
0111 fitparam.nharm = NaN;
0112 fitparam.ngridresample = 1001;
0113 fitparam.opt_load = 0;
0114
0115
0116
0117 rayparam.testmode = 0;
0118 rayparam.tensortype = 0;
0119 rayparam.t0 = 0;
0120 rayparam.tfinal = 50000;
0121 rayparam.dt0 = 0.0001;
0122 rayparam.dS = 0.001;
0123 rayparam.tol = 1e-8;
0124 rayparam.kmax = 50000;
0125 rayparam.ncyclharm = 3;
0126 rayparam.reflection = 0;
0127 rayparam.rel_opt = 1;
0128 rayparam.nperp =1000;
0129 rayparam.pperpmax = 10;
0130 rayparam.tau_lim = 20;
0131 rayparam.kextra = 1000;
0132
0133
0134
0135 [dkepath,equil,dkeparam,dkedisplay,ohm,waves,transpfaste,ripple,fluct] = load_structures_yp('dkepath',id_dkepath,path_dkepath,'equil',id_equil,path_equil,'dkeparam',id_dkeparam,path_dkeparam,'dkedisplay',id_dkedisplay,path_dkedisplay,'ohm',id_ohm,path_ohm,'waves',ids_wave,paths_wave,'transpfaste',id_transpfaste,path_transpfaste,'ripple',id_ripple,path_ripple,'fluct',id_fluct,path_fluct);
0136
0137
0138
0139 C3POparam.clustermode.main_C3PO_jd.scheduler.mode = mdce_mode_main_C3PO_jd;
0140
0141
0142
0143 launch.id = id;
0144 launch.type = 'EC';
0145 launch.omega_rf = [freq_GHz]*2*pi*1e9;
0146
0147 launch.yR_L = R_L;
0148 launch.yZ_L = Z_L;
0149 launch.yphi_L = 0;
0150 launch.yalpha_L = sign(beta_prater)*pi - atan(tand(beta_prater)/cosd(alpha_prater));
0151 launch.ybeta_L = acos(cosd(beta_prater)*sind(alpha_prater));
0152 launch.yP_L = P_L*1e6;
0153 launch.dNpar0 = NaN;
0154 launch.ns = ns;
0155 launch.method = method;
0156
0157 launch.w0 = 0.3/(freq_GHz*pi*cone_div*pi/180);
0158 launch.z_L = z_L;
0159
0160
0161
0162 wavestruct.wavesolver = 'C3PO';
0163 wavestruct.launch = launch;
0164 wavestruct.id = [wavestruct.wavesolver,'_',launch.id];
0165 wavestruct.waveparam = waveparam;
0166 wavestruct.rayparam = rayparam;
0167 wavestruct.fitequilparam = fitparam;
0168 wavestruct.raydisplay = C3POdisplay;
0169 wavestruct.C3POparam = C3POparam;
0170
0171 id_simul = [id_equil,'_',wavestruct.id,'_',id_fluct];
0172
0173 fluct_fitparam.method = 'pchip';
0174 fluct_fitparam.nharm = 32;
0175 fluct_fitparam.ngridresample = 201;
0176
0177
0178
0179 dkeparam.rt_mode = 1;
0180 dkeparam.dtn = 1i;
0181 dkeparam.tn = 20i;
0182 dkeparam.Nfluct = 1.052872583699049;
0183
0184 dkedisplay.display_mode = 1;
0185 dkedisplay.display_time_mode = 1;
0186
0187 opt_save = 1;
0188
0189 equil.fluct = fluct;
0190 equil.fluct.fitparam = fluct_fitparam;
0191
0192 if exist('dmumpsmex','file');
0193 dkeparam.invproc = -2;
0194 end
0195
0196
0197
0198 [Znorm,Zcurr,ZP0,dke_out,radialDKE,equilDKE,momentumDKE,gridDKE,Zmomcoef,Zbouncecoef,Zmripple,mksa,XXsinksource] = run_lukert(id_simul,{wavestruct},[],psin_S,rho_S,dkepath,equil,dkeparam,dkedisplay,ohm,transpfaste,ripple,[],[],opt_save);
0199
0200
0201
0202 filename = [path_simul,'LUKE_RESULTS_',id_simul,'.mat'];
0203 save(filename);
0204 info_dke_yp(2,['LUKE Results saved in ',filename]);
0205
0206
0207
0208 p_opt = 2;
0209 path_simul = pwd;
0210 [tn,tn_all,fluctres] = fluctanalysis_yp(equilDKE,ZP0,Zcurr,dkeparam,mksa,0);
0211
0212 info_dke_yp(2,['Total co-current : ',num2str(fluctres.I.Itotm*fluctres.I.scocurr),' +/- ',num2str(abs(fluctres.I.Itots)*fluctres.I.scocurr),' MA, relative unbiased accuracy: ',num2str(abs(fluctres.I.Itotr))]);
0213 info_dke_yp(2,['Total RF power : ',num2str(fluctres.P.Ptotm),' +/- ',num2str(abs(fluctres.P.Ptots)),' MW, relative unbiased accuracy: ',num2str(abs(fluctres.P.Ptotr))]);
0214 disp(['Rejected simulations (Pin not equal to Pabs within error bars): ',int2str(fluctres.P.iPtotr(:)')]);
0215
0216 figure('Name','Time evolution EC current (fluctuation)')
0217
0218 if ~isscalar(fluctres.I.xJs),
0219 graph1D_jd(fluctres.I.tnI,fluctres.I.tI*fluctres.I.scocurr,0,0,'t\nu_{coll}','I_{lh} co-current (MA)',[],NaN,'','','-','none','r',2,20,gca,1,NaN);
0220 graph1D_jd(fluctres.I.tnI,fluctres.I.tI*fluctres.I.scocurr,0,0,'t\nu_{coll}','I_{lh} co-current (MA)',[],NaN,'','','-','none','r',2,20,gca,1,NaN);
0221 graph1D_jd(fluctres.I.tnI(fluctres.I.iItot),fluctres.I.tI(fluctres.I.iItot)*fluctres.I.scocurr,0,0,'t\nu_{coll}','I_{lh} co-current (MA)',[],NaN,'','','none','+','r',2,20,gca,1,NaN);
0222 graph1D_jd(fluctres.I.tnI(fluctres.I.iItot),fluctres.I.Itotm*fluctres.I.scocurr*ones(1,length(tn(fluctres.I.iItot))),0,0,'t\nu_{coll}','I_{lh} (MA)',['I_{tot} = ',num2str(fluctres.I.Itotm),'\pm',num2str(fluctres.I.Itots*fluctres.I.scocurr),' (MA)'],NaN,'','','--','none','r',1,20,gca,1,NaN);
0223 graph1D_jd(fluctres.I.tnI(fluctres.I.iItot),fluctres.I.Itotm*fluctres.I.scocurr*ones(1,length(fluctres.I.iItot)),0,0,'t\nu_{coll}','I_{lh} co-current (MA)',['I_{tot} = ',num2str(fluctres.I.Itotm),'\pm',num2str(fluctres.I.Itots*fluctres.I.scocurr),' (MA)'],NaN,[min(tn),max(tn)],'','none','+','r',1,20,gca,1,NaN,NaN,fluctres.I.Itots*ones(1,length(fluctres.I.iItot)),fluctres.I.Itots*ones(1,length(fluctres.I.iItot)));
0224
0225
0226 print_jd(p_opt,[id_simul,'_IEC_time'],path_simul);
0227 end
0228
0229 figure('Name','Time evolution EC power (fluctuation)')
0230
0231 if ~isscalar(fluctres.P.xPs),
0232 graph1D_jd(tn,fluctres.P.tP,0,0,'t*\nu_{coll}','P_{lh} (MW)',['P_{tot} = ',num2str(fluctres.P.Ptotm),'\pm',num2str(fluctres.P.Ptots),' (MW)'],NaN,[min(tn),max(tn)],[fluctres.P.Ptotm-10*abs(fluctres.P.Ptots),fluctres.P.Ptotm+10*abs(fluctres.P.Ptots)],'-','none','b',2,20,gca,1,NaN);
0233 graph1D_jd(tn(fluctres.P.iPtot),fluctres.P.tP(fluctres.P.iPtot),0,0,'t\nu_{coll}','P_{lh} (MW)',['P_{tot} = ',num2str(fluctres.P.Ptotm),'\pm',num2str(fluctres.P.Ptots),' (MW)'],NaN,[min(tn),max(tn)],[fluctres.P.Ptotm-10*abs(fluctres.P.Ptots),fluctres.P.Ptotm+10*abs(fluctres.P.Ptots)],'+','none','b',2,20,gca,1,NaN);
0234 graph1D_jd(tn,fluctres.P.Ptotm*ones(1,length(tn)),0,0,'t\nu_{coll}','P_{lh} (MW)',['P_{tot} = ',num2str(fluctres.P.Ptotm),'\pm',num2str(fluctres.P.Ptots),' (MW)'],NaN,[min(tn),max(tn)],'','--','none','b',1,20,gca,1,NaN);
0235 graph1D_jd(tn(fluctres.P.iPtot),fluctres.P.Ptotm*ones(1,length(fluctres.P.iPtot)),0,0,'t\nu_{coll}','P_{lh} (MW)',['P_{tot} = ',num2str(fluctres.P.Ptotm),'\pm',num2str(fluctres.P.Ptots),' (MW)'],NaN,[min(tn),max(tn)],'','none','+','b',1,20,gca,1,NaN,NaN,fluctres.P.Ptots*ones(1,length(fluctres.P.iPtot)),fluctres.P.Ptots*ones(1,length(fluctres.P.iPtot)));
0236
0237 print_jd(p_opt,[id_simul,'_PEC_time'],path_simul);
0238 end
0239
0240 figure('Name','Mean co-current profile (fluctuation)')
0241
0242 index = find(fluctres.I.xJm*fluctres.I.scocurr > 1e-5*max(fluctres.I.xJm*fluctres.I.scocurr))
0243 [curve, goodness] = fit(equilDKE.xrho(index)',log(abs(fluctres.I.xJm(index)*fluctres.I.scocurr))','poly2');
0244 fitmax = max(exp(curve.p1*equilDKE.xrho(index).^2 + curve.p2*equilDKE.xrho(index) + curve.p3));
0245 xJmmax = max(fluctres.I.xJm*fluctres.I.scocurr);
0246 rhomax = equilDKE.xrho(fluctres.I.xJm*fluctres.I.scocurr == xJmmax);
0247 delta_Jm = 2*sqrt(-log(2)/curve.p1);
0248
0249 if isscalar(fluctres.I.xJs),
0250 graph1D_jd(equilDKE.xrho,fluctres.I.xJm*fluctres.I.scocurr,0,0,'\rho','J_{lh} co-current (MA/m^2)',['I_{lh} (co-current) = ',num2str(fluctres.I.Itotm*fluctres.I.scocurr),'\pm',num2str(abs(fluctres.I.Itots)*fluctres.I.scocurr),' (MA)'],NaN,'','','-','none','r',2,20,gca,1,NaN);
0251 else
0252 graph1D_jd(equilDKE.xrho,fluctres.I.xJm*fluctres.I.scocurr,0,0,'\rho','J_{lh} co-current (MA/m^2)',['I_{lh} (co-current) = ',num2str(fluctres.I.Itotm*fluctres.I.scocurr),'\pm',num2str(abs(fluctres.I.Itots)*fluctres.I.scocurr),' (MA)'],NaN,'','','-','none','r',1,20,gca,1,NaN,NaN,fluctres.I.xJs*fluctres.I.scocurr,fluctres.I.xJs*fluctres.I.scocurr);
0253 graph1D_jd(equilDKE.xrho,fluctres.I.xJm*fluctres.I.scocurr,0,0,'\rho','J_{lh} co-current (MA/m^2)',['I_{lh} (co-current) = ',num2str(fluctres.I.Itotm*fluctres.I.scocurr),'\pm',num2str(abs(fluctres.I.Itots)*fluctres.I.scocurr),' (MA)'],NaN,'','','-','none','r',2,20,gca,1,NaN);
0254 graph1D_jd(equilDKE.xrho(index),xJmmax*exp(curve.p1*equilDKE.xrho(index).^2 + curve.p2*equilDKE.xrho(index) + curve.p3)/fitmax,0,0,'\rho','J_{lh} co-current (MA/m^2)',['I_{lh} (co-current) = ',num2str(fluctres.I.Itotm*fluctres.I.scocurr),'\pm',num2str(abs(fluctres.I.Itots)*fluctres.I.scocurr),' (MA)'],NaN,'','','--','none','k',1,20,gca,1,NaN);
0255 end
0256
0257 disp(['FWHM of the current density profile = ',num2str(delta_Jm)]);
0258 disp(['Position of the current density profile = ',num2str(rhomax)]);
0259
0260 print_jd(p_opt,[id_simul,'_jcocurr_EC_profile'],path_simul);
0261
0262 figure('Name','Mean EC power absorption profile (fluctuation)')
0263
0264 if isscalar(fluctres.P.xPs),
0265 graph1D_jd(equilDKE.xrho,fluctres.P.xPm,0,0,'\rho','P_{tot} (MW/m^3)',['P_{tot} = ',num2str(fluctres.P.Ptotm),'\pm',num2str(fluctres.P.Ptots),' (MW)'],NaN,'','','-','none','b',2,20,gca,1,NaN);
0266 else
0267 graph1D_jd(equilDKE.xrho,fluctres.P.xPm,0,0,'\rho','P_{tot} (MW/m^3)',['P_{tot} = ',num2str(fluctres.P.Ptotm),'\pm',num2str(fluctres.P.Ptots),' (MW)'],NaN,'','','-','none','b',1,20,gca,1,NaN,NaN,fluctres.P.xPs,fluctres.P.xPs);
0268 graph1D_jd(equilDKE.xrho,fluctres.P.xPm,0,0,'\rho','P_{tot} (MW/m^3)',['P_{tot} = ',num2str(fluctres.P.Ptotm),'\pm',num2str(fluctres.P.Ptots),' (MW)'],NaN,'','','-','none','b',2,20,gca,1,NaN);
0269 end
0270 print_jd(p_opt,[id_simul,'_p_EC_profile'],path_simul);