script make_wave_test_RT Parameters for test mode ray-tracing calculations This function has a benchmarking purpose only by Y. Peysson (DRFC/DSM/CEA) <yves.peysson@cea.fr> and J. Decker (DRFC/DSM/CEA) <joan.decker@cea.fr>
0001 function [] = make_wave_TRIAM_1M 0002 % 0003 % script make_wave_test_RT 0004 % 0005 % Parameters for test mode ray-tracing calculations 0006 % This function has a benchmarking purpose only 0007 % 0008 % by Y. Peysson (DRFC/DSM/CEA) <yves.peysson@cea.fr> and J. Decker (DRFC/DSM/CEA) <joan.decker@cea.fr> 0009 % 0010 close all 0011 % 0012 id_wave = 'TRIAM_1M'; 0013 % 0014 % Path parameters 0015 % 0016 id_dkepath = '';%For all paths used by DKE solver 0017 path_dkepath = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path 0018 % 0019 % Equilibrium parameters 0020 % 0021 id_equil = 'TRIAM_1M';%For plasma equilibrium 0022 path_equil = '../EQUIL/';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path 0023 % 0024 % Load structures 0025 % 0026 [equil,dkepath] = load_structures_yp('equil',id_equil,path_equil,'dkepath',id_dkepath,path_dkepath); 0027 % 0028 % ========================================================================= 0029 % 0030 % initial ray conditions 0031 % 0032 omega_rf = [2.45]*2*pi*1e9; 0033 % 0034 rho0 = 0.999; 0035 theta0 = 0.0; 0036 phi0 = 0; 0037 % 0038 m0 = 0; 0039 n0 = NaN; 0040 Npar0 = -1.4;%initial index of refraction 0041 % 0042 dNpar0 = NaN; 0043 P0_2piRp = NaN; 0044 % 0045 % C3PO computing parameters 0046 % 0047 mdce_mode_main_C3PO_jd = 0;%MatLab distributed computing environment disabled (0), enabled with the dedicated toolbox (1), enabled with a private method (2)for the function main_C3PO_jd.m (MDC toolbox must be installed for option 1) 0048 % 0049 % Display parameters 0050 % 0051 C3POdisplay.ray = 1; 0052 C3POdisplay.equilibrium = 0; 0053 C3POdisplay.p_opt = 2;%Printing or saving option of the figures 0054 C3POdisplay.mdce = 0;%for distributed computing 0055 % 0056 % Wave parameters 0057 % 0058 waveparam.mmode = -1;%cold plasma mode [1] : (-1) m (1) p, p is the slow mode when kperp > 0 (ex : LH slow wave) 0059 waveparam.kmode = 0;%(0:cold,1:warm,2:hot;3:weak realtivistic,4:full relativistic) 0060 % 0061 %Option parameter for FLR effects and cross-comparison between old FP code: 0062 % - (0): all FLR effects 0063 % - (1): small FLR effects and 1/vpar dependence 0064 % - (2): small FLR effects and no 1/vpar dependence and old grid technique for DQL calculations (Karney, Shoucri) (see rfdiff_dke_jd) 0065 % 0066 waveparam.opt_rf = NaN; 0067 % 0068 waveparam.dsmin = NaN;%minimum size for ray fragments 0069 % 0070 % ------------------------------------------------------------------------- 0071 % 0072 % Global parameters for the vectorial magnetic equilibrium 0073 % 0074 fitparam.mode_equil = 1;%Magnetic equilibrium grid type: (1): (psi-theta), (2): (x-y) 0075 fitparam.nharm = NaN;%Number of harmonics in the magnetic equilibrium interpolation (less than ntheta_equil/2) 0076 fitparam.ngridresample = 1001;%Number of grid points for resampling the radial profile of magnetic equilibrium parameters 0077 % 0078 % Global parameters for the ray-tracing 0079 % 0080 rayparam.testmode = 0; 0081 rayparam.tensortype = waveparam.kmode;%(0:cold,1:warm,2:hot;3:weak realtivistic,4:full relativistic) 0082 rayparam.t0 = 0; 0083 rayparam.tfinal = 10000; 0084 rayparam.dt0 = 1.e-4; 0085 rayparam.dS = 1.e-4; 0086 rayparam.tol = 1e-12;%when tolerance is increased (less accurate calculation of D=0), tfinal must be increased accordingly 0087 rayparam.kmax = 30000; 0088 rayparam.ncyclharm = 3;%number of cyclotron harmonics (just for hot and relativistic dielectric tensors) 0089 rayparam.reflection = 1;%1:Enforce wave reflection at plasma boundary, 0: the code calculates itself if the ray must leave of not the plasma 0090 rayparam.rel_opt = 1;%option for (1) relativistic or (0) non-relativistic calculations 0091 rayparam.nperp = 1000;%number of points in pperp integration for damping calculations 0092 rayparam.pperpmax = 10;%maximum value of pperp in damping calculations 0093 rayparam.tau_lim = 20;%value of optical depth beyond which the wave is considered absorbed 0094 % 0095 % ========================================================================= 0096 % 0097 % C3P0 ray tracing 0098 % 0099 fitparam.method = 'spline';%nearest,spline,pchip 0100 tstart = tic; 0101 equil_fit = fitequil_yp(equil,fitparam.mode_equil,fitparam.method,fitparam.ngridresample,fitparam.nharm);%Build vectorized magnetic equilibrium structure 0102 telapsed = toc(tstart); 0103 % 0104 info_dke_yp(2,['Vectorial form of the magnetic equilibrium ',equil.id,' is calculated with pchip method.']); 0105 if C3POdisplay.equilibrium,testfitequil_yp(equil,equil_fit);end 0106 % 0107 rayinit.omega_rf = omega_rf; 0108 rayinit.yrho0 = rho0;%Initial radial position at launch 0109 rayinit.ytheta0 = theta0;%Initial poloidal position at launch 0110 rayinit.yphi0 = phi0;%Initial axial (toroidal) position at launch 0111 rayinit.ym0 = m0;%Initial poloidal mode number 0112 rayinit.yn0 = n0;%Initial wave vector along the axial (toroidal) direction 0113 rayinit.yNpar0 = Npar0;%Initial index of refraction 0114 rayinit.ydNpar0 = dNpar0;%initial Ray spectral width 0115 rayinit.yP0_2piRp = P0_2piRp;%Lineic initial power density initial power in the ray (W/m) 0116 % 0117 % -------------------------------------------------------------------------- 0118 % 0119 % C3PO computing parameters 0120 % 0121 C3POparam.clustermode.main_C3PO_jd.scheduler.mode = mdce_mode_main_C3PO_jd;%MatLab distributed computing environment 0122 % 0123 % ray-tracing calculations 0124 % 0125 tstart = tic; 0126 wave = main_C3PO_jd(dkepath,id_wave,equil,equil_fit,rayinit,waveparam,[],rayparam,C3POdisplay,C3POparam,[],[],0);clear mex;clear functions 0127 telapsed_ray = toc(tstart); 0128 % 0129 info_dke_yp(2,'Ray trajectories calculated (interpolated magnetic equilibrium with pchip method)'); 0130 % 0131 save_str = ['WAVE_',id_wave,'.mat']; 0132 save(save_str,'id_wave','wave'); 0133 % 0134 info_dke_yp(2,'Wave parameters saved'); 0135 % 0136 % --- display results --- 0137 % 0138 rays = {wave.rays{1}}; 0139 % 0140 legs = {'Numeric - pchip'}; 0141 % 0142 filename = ['Fig_',id_wave]; 0143 % 0144 opt.p_opt = C3POdisplay.p_opt; 0145 opt.ntheta_fit = 65; 0146 opt.nrho_fit = 15; 0147 opt.propvar = 1; 0148 % 0149 graph_comp_RT_jd(rays,legs,equil_fit,filename,opt) 0150 % 0151 diary4cvs_C3PO_yp(id_wave,dkepath,wave);% diary some results for CVS validation 0152 0153