Script for running LUKE This script is automatically generated by irunluke_jd. by J. Decker (joan.decker@cea.fr) and Y. Peysson (yves.peysson@cea.fr)
0001 % Script for running LUKE 0002 % 0003 % This script is automatically generated by irunluke_jd. 0004 % by J. Decker (joan.decker@cea.fr) and Y. Peysson (yves.peysson@cea.fr) 0005 % 0006 clear all 0007 clear mex 0008 clear functions 0009 close all 0010 warning('off','all') 0011 pause(1) 0012 % 0013 % simulation 0014 % 0015 basestr = 'TS'; 0016 shotnum = '32299'; 0017 shotime = '100.1733'; 0018 % 0019 scenario = 'fluct_Npar0_lh';% for batch savename 0020 p_opt = -1;% Figure printing or saving option (-1) none (0) printer (1) printer & file (2) file 0021 % 0022 % remote computing parameters 0023 % 0024 remnum = 0;% remote profile number. Use 0 for local sequential calculations 0025 remtimout = 0;% timeout for remote calculations, in minutes. Use (0) to return later and check results by running this script again 0026 rempause = 1;% pause between job checks (in minutes) (only for remtimout > 0) 0027 remdebugmode = 0;% debug mode (0) off (1) on 0028 remclean = 2;% clean job files/folders : both on remote and local (2), only on remote (1) or not at all (0) 0029 % 0030 % distributed computing parameters 0031 % 0032 mdce_mode_coll_dke_jd = 0;% mdce mode for wave_solver_yp : (0) none (1) jobs (2) dcluke (3) parfor (-remnum) remote on profile remnum 0033 mdce_mode_eecoll_dke_yp = 0;% mdce mode for wave_solver_yp : (0) none (1) jobs (2) dcluke (3) parfor (-remnum) remote on profile remnum 0034 mdce_mode_rfdiff_dke_jd = 0;% mdce mode for rfdiff_dke_jd : (0) none (1) jobs (2) dcluke (3) parfor (-remnum) remote on profile remnum 0035 mdce_mode_wave_solver_yp = 0;% mdce mode for wave_solver_yp : (0) none (1) jobs (2) dcluke (3) parfor (-remnum) remote on profile remnum 0036 mdce_mode_main_C3PO_jd = 0;% mdce mode for main_C3PO_jd : (0) none (1) jobs (2) dcluke (3) parfor (-remnum) remote on profile remnum 0037 % 0038 % backup & save options 0039 % 0040 opt.save = 0;% (1): save LUKE_RESULTS or return error (0): return results or error 0041 opt.fields = NaN;% selected fields in returned lukestructs. Use NaN for all fields 0042 opt.backup = -1;% (1) save fluctuation time steps (0) do not save 0043 opt.waves = 1;% (1) save waves at each time step (0) do not save 0044 % 0045 % N//0 Fluctuation model 0046 % 0047 % Note : The tail spectrum can be described either in a static mode (if 0048 % dtn_fluct_correlation_npar0_lh = Inf) or in a fluctuating mode (if 0049 % dtn_fluct_correlation_npar0_lh < Inf). 0050 % 0051 dtn_fluct_correlation_npar0_lh = 10;% statistical autocorrelation time (normalized to the electron collision time) 0052 tail_mode = 3;% mode for tail spectrum : (0) no tail model, (1) Gaussian, (2) Linear, (3) calc_tail_jd 0053 % 0054 fwhm = 0.4;% Gaussian model. If fwhm_npar0 is 0 the width is dnpar_antenna. (tail_mode = 1 only) 0055 % 0056 Nparmax_tail = 2.5;% npar0 extend from npar_antenna to Nparmax_tail. If Nparmax_tail is 0, it is calculated by the code in main_rayinit_launch_jd.m -> 6.5/sqrt(Te0) 0057 opt_tail_0 = 0;% Final power fraction of the tail @ Nparmax_tail. 0058 n_tail = 5;% number of lobes to describe the tail. If n_tail = 0, no tail up to Nparmax_tail (tail_mode = 3 only). 0059 P_tail = NaN;% Power fraction in the tail. If NaN, it is calculated from n_tail and opt_tail (tail_mode = 3 only). 0060 % 0061 dnpar0_tail = 1;% Adjust (1) or not (0) the initial dNpar0 such that intial and tail lobes have the same width (tail_mode = 3 only). 0062 % 0063 % Note : tn is adjusted for a direct comparison with the fluctuation case 0064 % o imaginary tn and dtn are defined with respect to fluctuation times : 0065 % - tn = 100i -> 100 fluctuation phase changes 0066 % - dtn = 1i -> one internal main_dke_yp iteration between two phase changes 0067 % o real tn and dtn are defined with respect to collision times 0068 % 0069 tn = 100i;%Total normalized integration time. As an imaginary number, dkeparam.tn prescribes the number of fluctuation iterations 0070 Nfluct = 1;%ratio of LUKE internal evolution time to fluctuation time (set to 1 to adjust LUKE time step to fluctuation time step) 0071 dtn = 1i;% LUKE internal time step. As an imaginary number, dkeparam.dtn prescribes the number of internal time steps 0072 % 0073 % *********************** Specify LUKE structures ***************************** 0074 % 0075 locid_simul = '';%Simulation ID 0076 path_simul = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path 0077 % 0078 id_dkepath = '';%For all paths used by DKE solver 0079 path_dkepath = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path 0080 % 0081 id_equil = [basestr,'_',shotnum,'_',shotime];%For plasma equilibrium 0082 path_equil = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path 0083 % 0084 id_dkeparam = 'LH_RT';%For DKE code parameters 0085 path_dkeparam = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path 0086 % 0087 id_dkedisplay = 'NO_DISPLAY';%For output code display 0088 path_dkedisplay = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path 0089 % 0090 id_ohm = '';%For Ohmic electric contribution 0091 path_ohm = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path 0092 % 0093 ids_wavestruct = {'C3PO_LH_C3_ne3'};%For RF waves contribution (put all the type of waves needed) 0094 paths_wavestruct = {''};%if nothing is specified, the working directory is first used and then MatLab is looking in all the path 0095 % 0096 id_transpfaste = 'ES_0_Dr0_0.2';%For fast electron radial transport 0097 path_transpfaste = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path 0098 % 0099 id_ripple = '';%For fast electron magnetic ripple losses 0100 path_ripple = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path 0101 % 0102 %************************************************************************************************************************************ 0103 % 0104 [dkepath,equil,dkeparam,dkedisplay,ohm,wavestructs,transpfaste,ripple] = 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,'wavestructs',ids_wavestruct,paths_wavestruct,'transpfaste',id_transpfaste,path_transpfaste,'ripple',id_ripple,path_ripple); 0105 % 0106 %************************************************************************************************************************************ 0107 % 0108 dkeparam.timevol = 1;%to calculate time evolution of moments 0109 dkeparam.opt_struct = 1;% (0) select only main fields from structures (not compatible with fluctuations); (1) select all fields; (2) also select ZXYD_rf 0110 dkeparam.tn = tn;% as an imaginary number, dkeparam.tn prescribes the number of fluctuation iterations 0111 dkeparam.dtn = dtn;% internal LUKE time step. As an imaginary number, dkeparam.dtn prescribes the number of internal time steps 0112 dkeparam.Nfluct = Nfluct;%ratio of LUKE internal evolution time to fluctuation time (set to 1 to adjust LUKE time step to fluctuation time step) 0113 % 0114 dkeparam.clustermode.coll_dke_jd.scheduler.mode = mdce_mode_coll_dke_jd;%MatLab distributed computing environment disabled (0), enabled with the dedicated toolbox (1), enabled with a private method (2) for the function coll_dke_jd.m (MDC toolbox must be installed for option 1) 0115 dkeparam.clustermode.eecoll_dke_yp.scheduler.mode = mdce_mode_eecoll_dke_yp;%MatLab distributed computing environment disabled (0), enabled with the dedicated toolbox (1), enabled with a private method (2) for the function coll_dke_jd.m (MDC toolbox must be installed for option 1) 0116 dkeparam.clustermode.wave_solver_yp.scheduler.mode = mdce_mode_wave_solver_yp;%MatLab distributed computing environment disabled (0), enabled with the dedicated toolbox (1), enabled with a private method (2) for the function coll_dke_jd.m (MDC toolbox must be installed for option 1) 0117 dkeparam.clustermode.rfdiff_dke_jd.scheduler.mode = mdce_mode_rfdiff_dke_jd;%MatLab distributed computing environment disabled (0), enabled with the dedicated toolbox (1), enabled with a private method (2) for the function coll_dke_jd.m (MDC toolbox must be installed for option 1) 0118 % 0119 % Perturbation of the launched npar for the LH wave only (simulate possible diffraction of the LH wave in the SOL by edge density fluctuations) 0120 % 0121 tail.dtn = dtn_fluct_correlation_npar0_lh;% Note : from Gaussian time correlation model - see calc_dtn_fluct_jd - dtn_fluct_npar0_lh = 2.14*dtn_fluct_correlation_npar0_lh (if dtn_fluct_npar0_lh is Inf, no fluctuations) 0122 tail.mode = tail_mode;% mode for tail spectrum : (0) Gaussian, (1) Linear, (2) calc_tail_jd 0123 % 0124 tail.bfwhm = fwhm;%Gaussian distribution for npar0 around npar_antenna given in the launch structure. If bfwhm is 0, the width is dnpar_antenna. 0125 % 0126 tail.bNparmax_tail = Nparmax_tail;%npar0 extend from npar_antenna to Nparmax_tail. If Nparmax_tail is NaN or empty, it is calculated by the code in main_rayinit_launch_jd.m -> 6.5/sqrt(Te0) 0127 tail.bn_tail = n_tail;%number of lobes to describe the tail. If n_tail = 0, no tail up to Nparmax_tail (no used if linear_tail is chosen) 0128 tail.bP_tail = P_tail;%Power fraction in the tail. If NaN, it is calculated from n_tail and opt_tail (no used if linear_tail is chosen) 0129 tail.bopt_tail = opt_tail_0 + dnpar0_tail*1i;%Final power fraction of the tail @ Nparmax_tail (+1i) Adjust initial dNpar0 such that initial and tail lobes have the same width 0130 % 0131 if ~isempty(locid_simul), 0132 locid_simul_tail = [make_tail_simulid_jd(tail),'_',locid_simul]; 0133 else 0134 locid_simul_tail = make_tail_simulid_jd(tail); 0135 end 0136 % 0137 for iw = 1:length(wavestructs), 0138 wavestructs{iw}.launch.tail = tail; 0139 wavestructs{iw}.C3POparam.clustermode.main_C3PO_jd.scheduler.mode = mdce_mode_main_C3PO_jd;%MatLab distributed computing environment disabled (0), enabled with the dedicated toolbox (1), enabled with a private method (2) for the function coll_dke_jd.m (MDC toolbox must be installed for option 1) 0140 end 0141 % 0142 lukestruct.simul.locid = locid_simul_tail; 0143 lukestruct.equil = equil; 0144 lukestruct.dkeparam = dkeparam; 0145 lukestruct.dkedisplay = dkedisplay; 0146 lukestruct.ohm = ohm; 0147 lukestruct.waves = ''; 0148 lukestruct.wavestructs = wavestructs; 0149 lukestruct.transpfaste = transpfaste; 0150 lukestruct.ripple = ripple; 0151 lukestruct.opt = opt; 0152 % 0153 dkepath.remnum = remnum; 0154 dkepath.remtimout = remtimout; 0155 dkepath.rempause = rempause; 0156 dkepath.debugmode = remdebugmode; 0157 dkepath.clean = remclean; 0158 % 0159 lukestructs = run_lukert({lukestruct},dkepath); 0160 % 0161 % ---------------------------------------------- Save batch results ---------------------------------------------- 0162 % 0163 % Note : opt.save = 0, results or jobs are saved in file LUKE_BATCH_... 0164 % 0165 % To process and save individual LUKE_RESULTS files, use : 0166 % >> completed_jobs = load_batch_jd('LUKE_BATCH_....mat') 0167 % 0168 % If not all jobs are completed, use again with : 0169 % >> completed_jobs = load_batch_jd('LUKE_BATCH_....mat',completed_jobs) 0170 % 0171 if opt.save == 0, 0172 save_batch_jd(lukestructs,dkepath,scenario) 0173 end 0174 %