make_wave_RTtest_straight

PURPOSE ^

script make_wave_test_RT

SYNOPSIS ^

function [] = make_wave_RTtest_straight

DESCRIPTION ^

 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>

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [] = make_wave_RTtest_straight
0002 % script make_wave_test_RT
0003 %
0004 % Parameters for test mode ray-tracing calculations
0005 % This function has a benchmarking purpose only
0006 %
0007 % by Y. Peysson (DRFC/DSM/CEA) <yves.peysson@cea.fr> and J. Decker (DRFC/DSM/CEA) <joan.decker@cea.fr>
0008 %
0009 close all
0010 %
0011 id_wave = 'RTtest_straight';
0012 flag_analytic = -1;
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 = 'RTtest_vacuum';%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 % initial ray conditions
0025 %
0026 omega_rf = [5.3015e-2*10000]*2*pi*1e9;%GHz (clum_norm = 1 for f_rf = 5.3015e-2, but limitation in m values)
0027 %
0028 rho0 = 0.98;
0029 theta0 = pi/4;
0030 phi0 = 0.0;
0031 %
0032 m0 = -0.3*10000;
0033 n0 = NaN;
0034 Npar0 = 0.5;%initial index of refraction
0035 %
0036 dNpar0 = NaN;
0037 P0_2piRp = NaN;
0038 %
0039 % C3PO computing parameters
0040 %
0041 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)
0042 %
0043 % Display parameters
0044 %
0045 C3POdisplay.ray = 1;
0046 C3POdisplay.equilibrium = 0;
0047 C3POdisplay.p_opt = 2;%Printing or saving option of the figures
0048 %
0049 % Wave parameters
0050 %
0051 waveparam.mmode = -1;%cold plasma mode [1] : (-1) m (1) p, p is the slow mode when kperp > 0 (ex : LH slow wave)
0052 waveparam.kmode = 0;%(0:cold,1:warm,2:hot;3:weak realtivistic,4:full relativistic)
0053 %
0054 %Option parameter for FLR effects and cross-comparison between old FP code:
0055 %    - (0): all FLR effects
0056 %    - (1): small FLR effects and 1/vpar dependence
0057 %    - (2): small FLR effects and no 1/vpar dependence and old grid technique for DQL calculations (Karney, Shoucri) (see rfdiff_dke_jd)
0058 %
0059 waveparam.opt_rf = NaN;
0060 %
0061 waveparam.dsmin = NaN;%minimum size for ray fragments
0062 %
0063 % -------------------------------------------------------------------------
0064 %
0065 % Global parameters for the vectorial magnetic equilibrium
0066 %
0067 fitparam.mode_equil = 1;%Magnetic equilibrium grid type: (1): (psi-theta), (2): (x-y)
0068 fitparam.method = 'spline';%nearest,spline,pchip,cubic
0069 fitparam.nharm = NaN;%Number of harmonics in the magnetic equilibrium interpolation (NaN, Inf or empty, nharm = ntheta-1)
0070 fitparam.ngridresample = 1001;%Number of grid points for resampling the radial profile of magnetic equilibrium parameters
0071 %
0072 % Global parameters for the ray-tracing
0073 %
0074 rayparam.testmode = 0;
0075 rayparam.tensortype = waveparam.kmode;%(0:cold,1:warm,2:hot;3:weak realtivistic,4:full relativistic)
0076 rayparam.t0 = 0;
0077 rayparam.tfinal = 100000;
0078 rayparam.dt0 = 1.e-4;
0079 rayparam.dS = 0;
0080 rayparam.tol = 1e-12;%when tolerance is increased (less accurate calculation of D=0), tfinal must be increased accordingly
0081 rayparam.kmax = 60000;
0082 rayparam.ncyclharm = 3;%number of cyclotron harmonics (just for hot and relativistic dielectric tensors)
0083 rayparam.reflection = 1;%1:Enforce wave reflection at plasma boundary, 0: the code calculates itself if the ray must leave of not the plasma
0084 rayparam.rel_opt = 1;%option for (1) relativistic or (0) non-relativistic calculations
0085 rayparam.nperp = 1000;%number of points in pperp integration for damping calculations
0086 rayparam.pperpmax = 10;%maximum value of pperp in damping calculations
0087 rayparam.tau_lim = Inf;%value of optical depth beyond which the wave is considered absorbed
0088 %
0089 % -------------------------------------------------------------------------
0090 %
0091 % Load structures
0092 %
0093 [equil,dkepath] = load_structures_yp('equil',id_equil,path_equil,'dkepath',id_dkepath,path_dkepath);
0094 %
0095 % =========================================================================
0096 %
0097 % C3P0 ray tracing
0098 %
0099 % Vectorial description of the magnetic equilibrium
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,equil_fit,rayinit,waveparam,fitparam,rayparam,C3POdisplay,C3POparam,[],[],0);
0124 %
0125 info_dke_yp(2,'Ray trajectories calculated (interpolated magnetic equilibrium)');
0126 %
0127 rayparam.tfinal = 65000;
0128 rayparam.kmax = 60000;
0129 wave_analytic = main_C3PO_jd(dkepath,[id_wave,'_analytic'],equil,equil_fit,rayinit,waveparam,fitparam,rayparam,C3POdisplay,C3POparam,[],[],flag_analytic);
0130 %
0131 info_dke_yp(2,'Ray trajectories calculated (analytic magnetic equilibrium)');
0132 %
0133 save_str = ['WAVE_',id_wave,'.mat'];
0134 save(save_str,'id_wave','wave_numeric','wave_analytic');
0135 %
0136 info_dke_yp(2,'Wave parameters saved');
0137 %
0138 % --- display results ---
0139 %
0140 waves = {wave_numeric,wave_analytic};
0141 rays = {wave_numeric.rays{1},wave_analytic.rays{1}};
0142 %
0143 legs = {'Numeric','Analytic'};
0144 %
0145 filename = ['Fig_',id_wave];
0146 %
0147 opt.p_opt = C3POdisplay.p_opt;
0148 opt.ntheta_fit = 65;
0149 opt.nrho_fit = 15;
0150 opt.propvar = 1;   
0151 %
0152 graph_comp_RT_jd(rays,legs,'',filename,opt)
0153 %
0154 diary4cvs_C3PO_yp(id_wave,dkepath,waves);% diary some results for CVS validation

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