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