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_JETlikeECtest 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 = 'JETlikeECtest'; 0012 flag_analytic = 2; 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 = 'JETliketest';%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 freq_GHz = 110; 0033 % 0034 R_L = 5.0; 0035 Z_L = 0.01; 0036 phi_L = 0; 0037 % 0038 P_L = 1e-6;% [MW] 0039 % 0040 alpha_L = 165;% With respect to R axis 0041 beta_L = 90;% With respect to Z axis 0042 % 0043 dNpar0 = 0.05;%spectral width 0044 ns = 1000;%discretization parameter for free space propagation 0045 method = 'linear';%interpolation method for ray separatrix crossing 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 = -1;%Printing or saving option of the figures 0056 C3POdisplay.mdce = 1;%for distributed computing 0057 % 0058 % Wave parameters 0059 % 0060 waveparam.mmode = -1;%cold plasma mode [1] : (-1) O mode (1) X mode 0061 waveparam.kmode = 0;%(0:cold,1:warm,2:hot;3:weak realtivistic,4:full relativistic) 0062 % 0063 %Option parameter for FLR effects and cross-comparison between old FP code: 0064 % - (0): all FLR effects 0065 % - (1): small FLR effects and 1/vpar dependence 0066 % - (2): small FLR effects and no 1/vpar dependence and old grid technique for DQL calculations (Karney, Shoucri) (see rfdiff_dke_jd) 0067 % 0068 waveparam.opt_rf = 1; 0069 % 0070 waveparam.dsmin = 0;%minimum size for ray fragments 0071 % 0072 waveparam.nd = 1;%Number of transverse distance positions for beamlets 0073 waveparam.nchi = 1;%Number of angular positions for beamlets 0074 % 0075 waveparam.n_rf_list = 1:2; 0076 waveparam.ns = 1;%ray smoothing parameter 0077 % 0078 waveparam.dsmin = NaN;%minimum size for ray fragments 0079 % 0080 % ------------------------------------------------------------------------- 0081 % 0082 % Global parameters for the vectorial magnetic equilibrium 0083 % 0084 fitparam.equil.mode_equil = 1;%Magnetic equilibrium grid type: (1): (psi-theta), (2): (x-y) 0085 fitparam.equil.method = 'pchip';%nearest,spline,pchip 0086 fitparam.equil.nharm = NaN;%Number of harmonics in the magnetic equilibrium interpolation (NaN, Inf or empty, nharm = ntheta-1) 0087 fitparam.equil.ngridresample = 1001;%Number of grid points for resampling the radial profile of magnetic equilibrium parameters 0088 % 0089 % Global parameters for the ray-tracing 0090 % 0091 rayparam.testmode = 0; 0092 rayparam.tensortype = 0;%(0:cold,1:warm,2:hot;3:weak realtivistic,4:full relativistic) 0093 rayparam.t0 = 0; 0094 rayparam.tfinal = 3000; 0095 rayparam.dt0 = 1.e-4; 0096 rayparam.dS = 1.e-12; 0097 rayparam.tol = 1e-9;%when tolerance is increased (less accurate calculation of D=0), tfinal must be increased accordingly 0098 rayparam.kmax = 3000; 0099 rayparam.ncyclharm = 3;%number of cyclotron harmonics (just for hot and relativistic dielectric tensors) 0100 rayparam.reflection = 0;%1:Enforce wave reflection at plasma boundary, 0: the code calculates itself if the ray must leave of not the plasma 0101 rayparam.rel_opt = 1;%option for (1) relativistic or (0) non-relativistic calculations 0102 rayparam.nperp = 1000;%number of points in pperp integration for damping calculations 0103 rayparam.pperpmax = 10;%maximum value of pperp in damping calculations 0104 rayparam.tau_lim = 20;%value of optical depth beyond which the wave is considered absorbed 0105 rayparam.kextra = 50; 0106 rayparam.metricmode = 2;% 1 : Only curvilinear metric; 2 : Both curvilinear and cartesian metric 0107 rayparam.rhoswitch = 0.05;% Radial position at which the switch occurs when metricmode = 2 0108 rayparam.deltaswitch = 0.01;% Delta switch between (rho,theta) <-> (X,Y) to avoid oscillations between modes 0109 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 0110 % 0111 % launch structure 0112 % 0113 launch.id = id_wave; 0114 launch.type = 'EC'; 0115 launch.omega_rf = [freq_GHz]*2*pi*1e9;%wave angular frequency (rad/s) 0116 % 0117 launch.yR_L = R_L; 0118 launch.yZ_L = Z_L; 0119 launch.yphi_L = phi_L; 0120 % 0121 launch.yalpha_L = alpha_L*pi/180; 0122 launch.ybeta_L = beta_L*pi/180; 0123 % 0124 launch.yP_L = P_L*1e6; 0125 % 0126 launch.dNpar0 = dNpar0; 0127 % 0128 launch.ns = ns; 0129 launch.method = method; 0130 % 0131 launch.w0 = NaN; 0132 launch.z_L = NaN; 0133 % 0134 % ========================================================================= 0135 % 0136 % C3P0 ray tracing 0137 % 0138 equil_fit = fitequil_yp(equil,fitparam.equil.mode_equil,fitparam.equil.method,fitparam.equil.ngridresample,fitparam.equil.nharm);%Build vectorized magnetic equilibrium structure 0139 % 0140 info_dke_yp(2,['Vectorial form of the magnetic equilibrium ',equil.id,' is calculated.']); 0141 if C3POdisplay.equilibrium,testfitequil_yp(equil,equil_fit);end 0142 % 0143 % Ray init calculation from launch 0144 % 0145 rayinit = main_rayinit_launch_jd(equil,launch); 0146 % 0147 % -------------------------------------------------------------------------- 0148 % 0149 % C3PO computing parameters 0150 % 0151 C3POparam.clustermode.main_C3PO_jd.scheduler.mode = mdce_mode_main_C3PO_jd;%MatLab distributed computing environment 0152 % 0153 % ray-tracing calculations 0154 % 0155 tstart = tic; 0156 wave = main_C3PO_jd(dkepath,[id_wave],equil,equil_fit,rayinit,waveparam,[],rayparam,C3POdisplay,C3POparam,[],[],0);clear mex;clear functions 0157 telapsed_ray = toc(tstart); 0158 % 0159 info_dke_yp(2,'Ray trajectories calculated (interpolated magnetic equilibrium)'); 0160 % 0161 save_str = ['WAVE_',id_wave,'.mat']; 0162 save(save_str,'id_wave','wave'); 0163 % 0164 info_dke_yp(2,'Wave parameters saved'); 0165 % 0166 disp(['Elapsed time (s):',num2str(telapsed_ray),' for ray calculations (PCHIP interp. technique)']); 0167 % 0168 diary4cvs_C3PO_yp(id_wave,dkepath,wave);% diary some results for CVS validation 0169