loop_cronos_C3PO_yp

PURPOSE ^

SYNOPSIS ^

function [timeid,jobid,dkeparam,dkepath,Znorm,Zcurr,ZP0,dke_out,radialDKE,equilDKE,momentumDKE,gridDKE,Zmomcoef,Zbouncecoef,Zmripple,mksa,XXsinksource] = loop_cronos_C3PO_yp(opts,id_simul,root_dir,Nfluct,tn,dtn,fluctuations,display_mode,Npar_p,Npar_m,XXfinit)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [timeid,jobid,dkeparam,dkepath,Znorm,Zcurr,ZP0,dke_out,radialDKE,equilDKE,momentumDKE,gridDKE,Zmomcoef,Zbouncecoef,Zmripple,mksa,XXsinksource] = loop_cronos_C3PO_yp(opts,id_simul,root_dir,Nfluct,tn,dtn,fluctuations,display_mode,Npar_p,Npar_m,XXfinit)
0002 %
0003 timeid = []; 
0004 jobid = [];
0005 %
0006 load ('before_luke@TS_32299_100.0117.mat','dkeparam','dkedisplay','transpfaste','ohm','ripple','wavestructs','equil');%data file from cronos
0007 %
0008 if strfind(id_simul,'ALOHA'),
0009     aloha_file = 'TS32299_C3_ne03e17.mat';
0010     aloha_path = 'ALOHA_C3_nefluct_TS32299/';
0011     param = 1i;%2i;%Number of lobes selected (0 < param < 1: lobes whose fraction is larger than param are considerered, param >=1: number of lobes considered in the spectrum)
0012     nlobes = 0;%number of lobes to keep (all if 0);
0013     %
0014     id_launch = [aloha_file(1:strfind(aloha_file,'.')-1),'_param_',num2str(param),'_nlobes_',num2str(nlobes)];
0015     load_str = ['LAUNCH_',id_launch,'.mat'];
0016     load([aloha_path,load_str],'launch');
0017     %
0018     wavestructs = {wavestructs{1}};
0019     wavestructs{1}.launch = launch;
0020     %
0021     wavestructs{1}.launch.i_ref = 100;
0022     wavestructs{1}.launch.mmode = -1;
0023     wavestructs{1}.launch.nparp = 0;
0024     wavestructs{1}.launch.a_sdNpar = 0;
0025     wavestructs{1}.launch.w0 = NaN;
0026     wavestructs{1}.launch.z_L = NaN;
0027     %
0028     wavestructs{1}.id = wavestructs{1}.launch.id;
0029 end
0030 %
0031 id_dkepath = '';%For all paths used by DKE solver
0032 path_dkepath = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0033 %
0034 [dkepath] = load_structures_yp('dkepath',id_dkepath,path_dkepath);
0035 %
0036 % --------------------------------------------------------------------------------------------
0037 %
0038 if ~isempty(fluctuations),
0039     equil.fluct = fluctstruct_yp(equil,'',fluctuations);%Fluctuations models
0040 end
0041 %
0042 if ~isempty(Npar_p),
0043     if strfind(id_simul,'ALOHA'),
0044         wavestructs{1}.launch.bNpar0(1) = Npar_p;        
0045     else
0046         wavestructs{1}.launch.bNpar0(1) = Npar_p;
0047         wavestructs{2}.launch.bNpar0(1) = Npar_p;
0048     end
0049 end
0050 %
0051 if ~isempty(Npar_m),
0052     if strfind(id_simul,'ALOHA'),
0053         wavestructs{1}.launch.bNpar0(2) = Npar_m;
0054     else
0055         wavestructs{1}.launch.bNpar0(2) = Npar_m;
0056         wavestructs{2}.launch.bNpar0(2) = Npar_m;
0057     end
0058 end
0059 %
0060 if strfind(id_simul,'ALOHA'),
0061     wavestructs{1}.rayparam.tfinal = 20000;
0062     wavestructs{1}.rayparam.tau_lim = 20;%value of optical depth beyond which the wave is considered absorbed
0063     wavestructs{1}.rayparam.kextra = 3000;
0064     wavestructs{1}.raydisplay.ray = 0;    
0065 else
0066     wavestructs{1}.rayparam.tfinal = 20000;
0067     wavestructs{2}.rayparam.tfinal = 20000;
0068     wavestructs{1}.rayparam.tau_lim = 20;%value of optical depth beyond which the wave is considered absorbed
0069     wavestructs{2}.rayparam.tau_lim = 20;%value of optical depth beyond which the wave is considered absorbed
0070     wavestructs{1}.rayparam.kextra = 3000;
0071     wavestructs{2}.rayparam.kextra = 3000;
0072     wavestructs{1}.raydisplay.ray = 0;
0073     wavestructs{2}.raydisplay.ray = 0;
0074 end
0075 %
0076 % Parallel computing parameters
0077 %
0078 dkeparam = rmfield(dkeparam,'clustermode');%remove old structure for backward compatibility
0079 %
0080 if strfind(id_simul,'ALOHA'),
0081     wavestructs{1}.C3POparam.clustermode.main_C3PO_jd.scheduler.mode = 0;
0082     wavestructs{1}.C3POparam.clustermode.main_C3PO_jd.scheduler.memory = 500;
0083 else
0084     wavestructs{1}.C3POparam.clustermode.main_C3PO_jd.scheduler.mode = 0;
0085     wavestructs{1}.C3POparam.clustermode.main_C3PO_jd.scheduler.memory = 500;
0086     wavestructs{2}.C3POparam.clustermode.main_C3PO_jd.scheduler.mode = 0;
0087     wavestructs{2}.C3POparam.clustermode.main_C3PO_jd.scheduler.memory = 500;
0088 end
0089 %
0090 dkeparam.clustermode.wave_solver_yp.scheduler.mode = opt_dist;%MatLab distributed computing environment
0091 dkeparam.clustermode.wave_solver_yp.scheduler.memory = 500;
0092 %
0093 dkeparam.psin_S = [];%Normalized poloidal flux grid where calculations are performed (0 < psin_S < 1) (If one value: local calculation only, not used if empty)
0094 dkeparam.rho_S = 25;%dkeparam.rho_S;%Normalized radial flux grid where calculations are performed (0 < rho_S < 1) (If one value: local calculation only, not used if empty)
0095 %
0096 % ---------------------------------------------- Run LUKE + RT ----------------------------------------------
0097 %
0098 if exist('dmumpsmex','file');
0099     dkeparam.invproc = -2;%MUMPSMEX
0100 end
0101 %
0102 if ~exist('XXfinit');
0103     XXfinit = [];
0104 end
0105 %
0106 %
0107 if isempty(opt_save);
0108     opt_save = 1;%In case of crash, to restart simulation from an intermediate step stored in a *.mat file (<0 for launching simulation from backup, 0 no backup, >0 for performing backup)
0109 end
0110 %
0111 dkeparam.rt_mode = 1;
0112 %
0113 if length(display_mode) == 3,
0114     if strfind(id_simul,'ALOHA'),
0115         wavestructs{1}.raydisplay.ray = display_mode(1);       
0116     else
0117         wavestructs{1}.raydisplay.ray = display_mode(1);
0118         wavestructs{2}.raydisplay.ray = display_mode(1);
0119     end
0120     %
0121     dkedisplay.display_mode = display_mode(2);
0122     %
0123     dkedisplay.display_time_mode = display_mode(3);
0124 elseif length(display_mode) == 2,
0125     if strfind(id_simul,'ALOHA'),
0126         wavestructs{1}.raydisplay.ray = 0;
0127     else
0128         wavestructs{1}.raydisplay.ray = 0;
0129         wavestructs{2}.raydisplay.ray = 0;
0130     end
0131     %
0132     dkedisplay.display_mode = display_mode(1);
0133     dkedisplay.display_time_mode = display_mode(2);
0134 elseif length(display_mode) == 1,
0135     if strfind(id_simul,'ALOHA'),
0136         wavestructs{1}.raydisplay.ray = 0;        
0137     else
0138         wavestructs{1}.raydisplay.ray = 0;
0139         wavestructs{2}.raydisplay.ray = 0;
0140     end
0141     %
0142     dkedisplay.display_mode = 0;
0143     dkedisplay.display_time_mode = display_mode(1);
0144 else
0145     if strfind(id_simul,'ALOHA'),
0146         wavestructs{1}.raydisplay.ray = 0;
0147     else
0148         wavestructs{1}.raydisplay.ray = 0;
0149         wavestructs{2}.raydisplay.ray = 0;
0150     end
0151     %
0152     dkedisplay.display_mode = 0;
0153     dkedisplay.display_time_mode = 0;    
0154 end
0155 %
0156 if ~isempty(Nfluct) && ~isnan(Nfluct),
0157     dkeparam.Nfluct = Nfluct;
0158 end
0159 %
0160 dkeparam.tn = tn;%LUKE internal evolution time
0161 dkeparam.dtn = dtn;%LUKE internal time step
0162 dkeparam.finitabs = 0;%the initial distribution is used to first estimate the ray absorption (1) otherwise (0)
0163 %
0164 if opt_dist == 0,%local calculations
0165     %
0166     if strcmp(computer,'GLNXA64'),%Overwrite root directory when local calculations are done on cephee
0167         root_dir = '/local/peysson/Simulations/Yves/DKE/FLUCT/';%cephee
0168     end
0169     %
0170     dkeparam.path_simul = [root_dir,id_simul,'/'];%Local directory
0171     %
0172     
0173     
0174     Zi = Zi_list(iZi);
0175     equil.zZi = [1,1,1,Zi];
0176     equil.pzni = [0;0;0;1/Zi]*equil.pne;
0177     %
0178     waves{1} = make_idealLHwave_jd(equil,wavestruct);
0179     %
0180     dkeparam.coll_mode = coll_mode_list(icoll);% Relativistic Maxwellian background
0181     %
0182     % generate initial luke_inputs structure
0183     %
0184     lukestructs{icoll,iZi}.simul.path = path_simul;
0185     lukestructs{icoll,iZi}.simul.locid = [id_simul,'_coll_',num2str(coll_mode_list(icoll)),'_Zi_',num2str(Zi)];
0186     lukestructs{icoll,iZi}.equil = equil;
0187     lukestructs{icoll,iZi}.dkeparam = dkeparam;
0188     lukestructs{icoll,iZi}.dkedisplay = dkedisplay;
0189     lukestructs{icoll,iZi}.waves = waves;
0190     lukestructs{icoll,iZi}.opt = opt;
0191     
0192     
0193     id_simul,wavestructs,[],dkeparam.psin_S,dkeparam.rho_S,dkepath,equil,dkeparam,dkedisplay,ohm,transpfaste,ripple,XXfinit,[],opt_save
0194     
0195     lukestructs = run_lukert(lukestructs,dkepath);
0196     
0197     
0198     
0199     [Znorm,Zcurr,ZP0,dke_out,radialDKE,equilDKE,momentumDKE,gridDKE,Zmomcoef,Zbouncecoef,Zmripple,mksa,XXsinksource] = run_lukert();
0200     %
0201     dkeparam = dke_out.dkeparam;
0202     %
0203 else,%remote calculations
0204     %
0205     if opt_dist == 2,%cephee
0206         root_dir = '/local/peysson/Simulations/Yves/DKE/FLUCT/';%cephee
0207     elseif opt_dist == 3,%saturne
0208         root_dir = '';%saturne
0209     end     
0210     %
0211     dkeparam.path_simul = [root_dir,id_simul,'/'];%Local directory
0212     %
0213     remote = dkepath.remote(opt_dist);
0214     %
0215     luke_input.id_simul = id_simul;
0216     luke_input.dkeparam = dkeparam;
0217     luke_input.dkedisplay = dkedisplay;
0218     luke_input.equil = equil;
0219     luke_input.waves = '';
0220     luke_input.wavestructs = wavestructs;
0221     luke_input.ohm = ohm;
0222     luke_input.transpfaste = transpfaste;
0223     luke_input.ripple = ripple;
0224     luke_input.Zf0_interp = XXfinit;
0225     luke_input.XXsinksource = '';
0226     luke_input.opt_save = opt_save;
0227     %
0228     [timeid,jobid] = runluke_remote_jd(luke_input,remote);%Job submission
0229 end
0230 
0231

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