rundke_TS_32299_100_1733

PURPOSE ^

Script for running LUKE

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 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)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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 p_opt = -1;% Figure printing or saving option (-1) none (0) printer (1) printer & file (2) file
0020 %
0021 % remote computing parameters
0022 %
0023 remnum = 0;% remote profile number. Use 0 for local sequential calculations
0024 remtimout = 0;% timeout for remote calculations, in minutes. Use (0) to return later and check results by running this script again
0025 rempause = 1;% pause between job checks (in minutes) (only for remtimout > 0)
0026 remstart = 0;% (1) start new simulation; (0) check older simulation (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 = 1;% (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 = 0;% (1) save fluctuation time steps (0) do not save
0043 opt.waves = 0;% (1) save waves at each time step (0) do not save
0044 %
0045 % *********************** Specify LUKE structures *****************************
0046 %
0047 locid_simul = '';%Simulation ID
0048 path_simul = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0049 %
0050 id_dkepath = '';%For all paths used by DKE solver
0051 path_dkepath = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0052 %
0053 id_equil = [basestr,'_',shotnum,'_',shotime];%For plasma equilibrium
0054 path_equil = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0055 %
0056 id_dkeparam = 'LH_RT';%For DKE code parameters
0057 path_dkeparam = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0058 %
0059 id_dkedisplay = 'NO_DISPLAY';%For output code display
0060 path_dkedisplay = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0061 %
0062 id_ohm = '';%For Ohmic electric contribution
0063 path_ohm = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0064 %
0065 ids_wavestruct = {'C3PO_LH_C3_ne3'};%For RF waves contribution (put all the type of waves needed)
0066 paths_wavestruct = {''};%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0067 %
0068 id_transpfaste = 'ES_0_Dr0_0.2';%For fast electron radial transport
0069 path_transpfaste = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0070 %
0071 id_ripple = '';%For fast electron magnetic ripple losses
0072 path_ripple = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0073 %
0074 %************************************************************************************************************************************
0075 %
0076 [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);
0077 %
0078 %************************************************************************************************************************************
0079 %
0080 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)
0081 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)
0082 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)
0083 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)
0084 %
0085 for iw = 1:length(wavestructs),
0086     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)
0087 end
0088 %
0089 %************************************************************************************************************************************
0090 %
0091 simul.id = make_luke_simulid_jd(equil,ohm,transpfaste,ripple,'',wavestructs,locid_simul);
0092 simul.path = path_simul;
0093 %
0094 %************************************************************************************************************************************
0095 %
0096 % simulation filename
0097 %
0098 filename = [path_simul,'LUKE_RESULTS_',simul.id,'.mat'];
0099 %
0100 % check if current jobs exists to load possible existing jobs
0101 %
0102 if remtimout == 0 && remstart == 0 && exist(filename,'file'),% load existing simulation
0103     %
0104     load(filename,'lukestructs');
0105     %
0106 else% new simulation
0107     %
0108     lukestruct.simul = simul;
0109     lukestruct.equil = equil;
0110     lukestruct.dkeparam = dkeparam;
0111     lukestruct.dkedisplay = dkedisplay;
0112     lukestruct.ohm = ohm;
0113     lukestruct.wavestructs = wavestructs;
0114     lukestruct.transpfaste = transpfaste;
0115     lukestruct.ripple = ripple;
0116     lukestruct.opt = opt;
0117     %
0118     dkepath.remnum = remnum;
0119     dkepath.remtimout = remtimout;
0120     dkepath.rempause = rempause;
0121     dkepath.debugmode = remdebugmode;
0122     dkepath.clean = remclean;
0123     %
0124     lukestructs = run_lukert({lukestruct},dkepath);
0125 end
0126 %
0127 % ---------------------------------------------- Save batch results ----------------------------------------------
0128 %
0129 % Note : opt.save = 0, results or jobs are saved in file LUKE_BATCH_...
0130 %
0131 % To process and save individual LUKE_RESULTS files, use :
0132 % >> completed_jobs = load_batch_jd('LUKE_BATCH_....mat')
0133 %
0134 % If not all jobs are completed, use again with :
0135 % >> completed_jobs = load_batch_jd('LUKE_BATCH_....mat',completed_jobs)
0136 %
0137 if opt.save == 0,
0138     save_batch_jd(lukestructs,dkepath,simul.id)
0139 end
0140 %
0141 if remnum == 0 || remtimout > 0,% results are returned
0142     %
0143     % LUKE results
0144     %
0145     opt.save = 0;
0146     opt.nr_dep = 0;
0147     opt.spec = 0;
0148     opt.peak = 'y';
0149     opt.wave = 'y';
0150     opt.rho = 't'; 
0151     opt.blist = [];
0152     opt.diaryname = ['res_',id_equil,'_',simul.id];
0153     %
0154     if isstruct(lukestructs)
0155         proc_luke_jd(lukestructs.output,0,p_opt,0.1,NaN,'',opt);
0156     else
0157         proc_luke_jd(lukestructs{1}.output,0,p_opt,0.1,NaN,'',opt);
0158     end
0159     %
0160     % HXR results
0161     %
0162     hxr_file = ['HXR_',basestr,'_',shotnum];
0163     exp_file = ['HXREXP_',basestr,'_',shotnum];
0164     %
0165     dtexp = 0.2;%HXR averaging time
0166     texp = str2double(shotime) + [-dtexp/2,dtexp/2];
0167     ic = 22:59;% horizontal camera is 22-59
0168     krange = [50,110];%energy range considered
0169     %
0170     opt.icrej_exp = [24,30,46,47,52,53];% chords to be rejected
0171     opt.icc = 41;%chord number for display
0172     %
0173     if isstruct(lukestructs)
0174         fproc_hxr(basestr,path_simul,lukestructs.output.dke_out.simul.id,hxr_file,exp_file,texp,ic,krange,opt,1,p_opt);
0175     else
0176         fproc_hxr(basestr,path_simul,lukestructs{1}.output.dke_out.simul.id,hxr_file,exp_file,texp,ic,krange,opt,1,p_opt);
0177     end
0178 end
0179 %

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.