make_wave_PLTtest

PURPOSE ^

function [] = make_wave_PLTtest

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

function [] = make_wave_PLTtest
 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_PLTtest
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 = 'PLTtest';
0012 flag_analytic = 4;
0013 p_opt = -1;
0014 %
0015 % Path parameters
0016 %
0017 id_dkepath = '';%For all paths used by DKE solver
0018 path_dkepath = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0019 %
0020 % Equilibrium parameters
0021 %
0022 id_equil = 'PLTtest';%For plasma equilibrium
0023 path_equil = '../EQUIL/';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0024 %
0025 % -------------------------------------------------------------------------
0026 %
0027 % Load structures
0028 %
0029 [equil,dkepath] = load_structures_yp('equil',id_equil,path_equil,'dkepath',id_dkepath,path_dkepath);
0030 %
0031 % initial ray conditions
0032 %
0033 omega_rf = [0.8]*2*pi*1e9;
0034 %
0035 rho0 = 0.99;
0036 theta0 = 0.0;
0037 phi0 = 0.0;
0038 %
0039 m0 = 20;
0040 n0 = NaN;
0041 Npar0 = 1.33;%initial index of refraction
0042 %
0043 dNpar0 = NaN;
0044 P0_2piRp = NaN;
0045 %
0046 % C3PO computing parameters
0047 %
0048 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)
0049 %
0050 % Display parameters
0051 %
0052 C3POdisplay.ray = 1;
0053 C3POdisplay.equilibrium = 0;
0054 C3POdisplay.p_opt = 2;%Printing or saving option of the figures
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.method = 'spline';%nearest,spline,pchip
0076 fitparam.nharm = NaN;%Number of harmonics in the magnetic equilibrium interpolation (less than ntheta_equil/2)
0077 fitparam.ngridresample = 1001;%Number of grid points for resampling the radial profile of magnetic equilibrium parameters
0078 %
0079 % Global parameters for the ray-tracing
0080 %
0081 rayparam.testmode = 0;
0082 rayparam.tensortype = waveparam.kmode;%(0:cold,1:warm,2:hot;3:weak realtivistic,4:full relativistic)
0083 rayparam.t0 = 0;
0084 rayparam.tfinal = 10000;
0085 rayparam.dt0 = 1.e-4;
0086 rayparam.dS = 1.e-4;
0087 rayparam.tol = 1e-12;%when tolerance is increased (less accurate calculation of D=0), tfinal must be increased accordingly
0088 rayparam.kmax = 60000;
0089 rayparam.ncyclharm = 3;%number of cyclotron harmonics (just for hot and relativistic dielectric tensors)
0090 rayparam.reflection = 1;%1:Enforce wave reflection at plasma boundary, 0: the code calculates itself if the ray must leave of not the plasma
0091 rayparam.rel_opt = 1;%option for (1) relativistic or (0) non-relativistic calculations
0092 rayparam.nperp = 1000;%number of points in pperp integration for damping calculations
0093 rayparam.pperpmax = 10;%maximum value of pperp in damping calculations
0094 rayparam.tau_lim = 20;%value of optical depth beyond which the wave is considered absorbed
0095 %
0096 rayparam.metricmode = 1;% 1 : Only curvilinear metric (analytic or numeric); 2 : Both curvilinear and cartesian metric
0097 rayparam.rhoswitch = 0.1;% Radial position at which the switch occurs when metricmode = 2 (default value)
0098 rayparam.deltaswitch = 0.001;% Delta  switch between (rho,theta) <-> (X,Y) to avoid oscillations between modes (default value)
0099 rayparam.substitution_method = 7;%Method of substitution : 1->dichotomy1D, 2->dichotomy2D, 3->newton_numeric1D, 4->newton_numeric2D, 5->newton_analytic1D, 6->newton_analytic2D, 7->newton_mix2D (default value)
0100 %
0101 % =========================================================================
0102 %
0103 % C3P0 ray tracing
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 equil_fit = fitequil_yp(equil,fitparam.mode_equil,fitparam.method,fitparam.ngridresample,fitparam.nharm);%Build vectorized magnetic equilibrium structure
0124 %
0125 wave_numeric = main_C3PO_jd(dkepath,[id_wave,'_numeric'],equil,equil_fit,rayinit,waveparam,fitparam,rayparam,C3POdisplay,C3POparam,[],[],0);
0126 %
0127 info_dke_yp(2,'Ray trajectories calculated (interpolated magnetic equilibrium)');
0128 %
0129 if rayparam.metricmode == 1,
0130     %
0131     rayparam.tfinal = 6000;
0132     rayparam.kmax = 6000;
0133     %
0134     wave_analytic = main_C3PO_jd(dkepath,[id_wave,'_analytic'],equil,'',rayinit,waveparam,fitparam,rayparam,C3POdisplay,C3POparam,[],[],flag_analytic);
0135     %
0136     info_dke_yp(2,'Ray trajectories calculated (analytic magnetic equilibrium)');
0137     %
0138     save_str = ['WAVE_',id_wave,'.mat'];
0139     save(save_str,'id_wave','wave_numeric','wave_analytic');
0140     %
0141     info_dke_yp(2,'Wave parameters saved');
0142     %
0143     % --- display results ---
0144     %
0145     waves = {wave_numeric,wave_analytic};
0146     rays = {wave_numeric.rays{1},wave_analytic.rays{1}};
0147     %
0148     legs = {'Numeric','Analytic'};
0149     %
0150     filename = ['Fig_',id_wave];
0151     %
0152     opt.p_opt = C3POdisplay.p_opt;
0153     opt.ntheta_fit = 65;
0154     opt.nrho_fit = 15;
0155     opt.propvar = 1;   
0156     %
0157     graph_comp_RT_jd(rays,legs,'',filename,opt)
0158     %
0159     diary4cvs_C3PO_yp(id_wave,dkepath,waves);% diary some results for Git validation
0160     %
0161 else
0162     %
0163     save_str = ['WAVE_',id_wave,'.mat'];
0164     save(save_str,'id_wave','wave_numeric');
0165     %
0166     %
0167     info_dke_yp(2,'Wave parameters saved');
0168     %
0169     % --- display results ---
0170     %
0171     waves = {wave_numeric};
0172     rays = {wave_numeric.rays{1}};
0173     %
0174     legs = {'Numeric'};
0175     %
0176     filename = ['Fig_',id_wave];
0177     %
0178     opt.p_opt = C3POdisplay.p_opt;
0179     opt.ntheta_fit = 65;
0180     opt.nrho_fit = 15;
0181     opt.propvar = 1;   
0182     %
0183     graph_comp_RT_jd(rays,legs,'',filename,opt)
0184     %
0185     diary4cvs_C3PO_yp(id_wave,dkepath,waves);% diary some results for Git validation
0186     %
0187 end

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