make_wave_JETlikeECflucttest

PURPOSE ^

script make_wave_test_RT

SYNOPSIS ^

function [] = make_wave_JETlikeECflucttest

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_JETlikeECflucttest
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 = 'JETlikeECflucttest';
0012 %
0013 % Path parameters
0014 %
0015 id_dkepath = '';%For all paths used by DKE solver
0016 path_dkepath = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0017 %
0018 % Equilibrium parameters
0019 %
0020 id_equil = 'JETliketest';%For plasma equilibrium
0021 path_equil = '../EQUIL/';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0022 %
0023 % Density and magnetic field fluctuation
0024 %
0025 id_fluct = 'noripple';%For density and magnetic field fluctuation
0026 path_fluct = '../FLUCT/';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0027 %
0028 % Load structures
0029 %
0030 [equil,dkepath,fluct] = load_structures_yp('equil',id_equil,path_equil,'dkepath',id_dkepath,path_dkepath,'fluct',id_fluct,path_fluct);
0031 %
0032 % =========================================================================
0033 %
0034 % initial ray conditions
0035 %
0036 freq_GHz = 100;
0037 %
0038 R_L = 5.6;
0039 Z_L = 0.1;
0040 %
0041 P_L = 1e-6;% [MW]
0042 %
0043 cone_div = 1.08;% equivalent exp(-2) power cone divergence
0044 cone_ori = -0.5;% equivalent cone origin
0045 %
0046 z_L = 0.0;% focal point
0047 %
0048 alpha_prater = -10;% angle between N_P and horizontal plane
0049 beta_prater = 22;% angle between N and poloidal plane
0050 %
0051 % C3PO computing parameters
0052 %
0053 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)
0054 %
0055 % Display parameters
0056 %
0057 C3POdisplay.ray = 0;
0058 C3POdisplay.equilibrium = 0;
0059 C3POdisplay.fluctuations = 0;
0060 C3POdisplay.p_opt = 2;%Printing or saving option of the figures
0061 C3POdisplay.mdce = 1;%for distributed computing
0062 %
0063 % Wave parameters
0064 %
0065 waveparam.mmode = -1;%cold plasma mode [1] : (-1) m (1) p, p is the slow mode when kperp > 0 (ex : LH slow wave)
0066 waveparam.kmode = 0;%(0:cold,1:warm,2:hot;3:weak realtivistic,4:full relativistic)
0067 %
0068 %Option parameter for FLR effects and cross-comparison between old FP code:
0069 %    - (0): all FLR effects
0070 %    - (1): small FLR effects and 1/vpar dependence
0071 %    - (2): small FLR effects and no 1/vpar dependence and old grid technique for DQL calculations (Karney, Shoucri) (see rfdiff_dke_jd)
0072 %
0073 waveparam.opt_rf = 1;
0074 %
0075 waveparam.dsmin = 0;%minimum size for ray fragments
0076 %
0077 waveparam.nd = 1;%Number of transverse distance positions for beamlets
0078 waveparam.nchi = 1;%Number of angular positions for beamlets
0079 %
0080 waveparam.n_rf_list = 1:2;
0081 waveparam.ns = 1;%ray smoothing parameter
0082 %
0083 waveparam.dsmin = NaN;%minimum size for ray fragments
0084 %
0085 % -----------------------------------------------------------------------------------------------
0086 %
0087 % Global parameters for the vectorial magnetic equilibrium and the plasma fluctuations (if calculated)
0088 %
0089 fitparam.equil.method = 'spline';%nearest,spline,pchip
0090 fitparam.equil.nharm = NaN;%Number of harmonics in the magnetic equilibrium interpolation (NaN, Inf or empty, nharm = ntheta-1)
0091 fitparam.equil.ngridresample = 1001;%Number of grid points for resampling the radial profile of magnetic equilibrium parameters
0092 fitparam.equil.mode_equil = 1;%(rho,theta) -> 0, (x,y) -> 1
0093 %
0094 fitparam.fluct.mode_equil = fitparam.equil.mode_equil;%Magnetic equilibrium grid type: (1): (psi-theta), (2): (x-y)
0095 fitparam.fluct.method = 'pchip';%nearest,spline,pchip
0096 fitparam.fluct.nharm = 32;%Number of harmonics in the plasma fluctuations interpolation (less than ntheta_equil/2)
0097 fitparam.fluct.ngridresample = 201;%Number of grid points for resampling the radial profile of plasma fluctuations parameters (very slow if too big !!)
0098 %
0099 % Global parameters for the ray-tracing
0100 %
0101 rayparam.testmode = 0;
0102 rayparam.tensortype = 0;%(0:cold,1:warm,2:hot;3:weak realtivistic,4:full relativistic)
0103 rayparam.t0 = 0;
0104 rayparam.tfinal = 50000;
0105 rayparam.dt0 = 1.e-4;
0106 rayparam.dS = 1.e-4;
0107 rayparam.tol = 1e-12;%when tolerance is increased (less accurate calculation of D=0), tfinal must be increased accordingly
0108 rayparam.kmax = 50000;
0109 rayparam.ncyclharm = 3;%number of cyclotron harmonics (just for hot and relativistic dielectric tensors)
0110 rayparam.reflection = 0;%1:Enforce wave reflection at plasma boundary, 0: the code calculates itself if the ray must leave of not the plasma
0111 rayparam.rel_opt = 1;%option for (1) relativistic or (0) non-relativistic calculations
0112 rayparam.nperp = 1000;%number of points in pperp integration for damping calculations
0113 rayparam.pperpmax = 10;%maximum value of pperp in damping calculations
0114 rayparam.tau_lim = 20;%value of optical depth beyond which the wave is considered absorbed
0115 rayparam.kextra = 50;%
0116 %
0117 % launch structure
0118 %
0119 launch.id = id_wave;
0120 launch.type = 'EC';
0121 launch.omega_rf = [freq_GHz]*2*pi*1e9;%wave angular frequency (rad/s)
0122 %
0123 launch.yR_L = R_L;
0124 launch.yZ_L = Z_L;
0125 launch.yphi_L = 0;
0126 launch.yalpha_L = sign(beta_prater)*pi - atan(tand(beta_prater)/cosd(alpha_prater));
0127 launch.ybeta_L = acos(cosd(beta_prater)*sind(alpha_prater));
0128 launch.yP_L = P_L*1e6;
0129 launch.dNpar0 = NaN;
0130 launch.ns = 1;%ns;
0131 launch.method = 'spline';
0132 %
0133 launch.w0 = 0.3/(freq_GHz*pi*cone_div*pi/180);
0134 launch.z_L = z_L;
0135 %
0136 % -------------------------------------------------------------------------
0137 %
0138 % C3P0 ray tracing
0139 %
0140 % Vectorial description of the magnetic equilibrium
0141 %
0142 equil_fit = fitequil_yp(equil,fitparam.equil.mode_equil,fitparam.equil.method,fitparam.equil.ngridresample,fitparam.equil.nharm);%Build vectorized magnetic equilibrium structure
0143 info_dke_yp(2,['Vectorial form of the magnetic equilibrium ',equil.id,' is calculated.']);
0144 if C3POdisplay.equilibrium,testfitequil_yp(equil,equil_fit);end
0145 %
0146 % Vectorial description of the plasma fluctuations
0147 %
0148 if ~isempty(fluct),
0149    fluct = fluctphase_yp(fluct);
0150    [fluct_fit] = fitfluct_yp(fluct,fitparam.equil.mode_equil,fitparam.fluct.method,fitparam.fluct.ngridresample,fitparam.fluct.nharm);%Build vectorized plasma fluctuation structure
0151    info_dke_yp(2,['Vectorial form of the plasma fluctuations ',equil.id,'_',fluct.id,' is calculated.']);
0152    if C3POdisplay.fluctuations,testfitfluct_yp(equil_fit,fluct,fluct_fit);end
0153 end
0154 %
0155 % -------------------------------------------------------------------------
0156 %
0157 % C3PO computing parameters
0158 %
0159 C3POparam.clustermode.main_C3PO_jd.scheduler.mode = mdce_mode_main_C3PO_jd;%MatLab distributed computing environment
0160 %
0161 % ray-tracing calculations
0162 %
0163 rayinit = main_rayinit_launch_jd(equil,launch);
0164 wave_nofluct = main_C3PO_jd(dkepath,[id_wave,'_nofluct'],equil,equil_fit,rayinit,waveparam,[],rayparam,C3POdisplay,C3POparam,[],[],0);clear mex;clear functions
0165 %
0166 info_dke_yp(2,'Ray trajectories calculated (interpolated magnetic equilibrium with no plasma fluctuations)');
0167 %
0168 rayinit = main_rayinit_launch_jd(equil,launch);
0169 [wave_fluct] = main_C3PO_jd(dkepath,[id_wave,'_fluct'],equil,equil_fit,rayinit,waveparam,[],rayparam,C3POdisplay,C3POparam,[],fluct_fit,0);
0170 %
0171 info_dke_yp(2,'Ray trajectories calculated (interpolated magnetic equilibrium with plasma fluctuations)');
0172 %
0173 save_str = ['WAVE_',id_wave,'.mat'];
0174 save(save_str,'id_wave','wave_fluct','wave_nofluct','equil_fit','fluct');
0175 %
0176 info_dke_yp(2,'Wave parameters saved');
0177 %
0178 % --- display results ---
0179 %
0180 waves = {wave_nofluct,wave_fluct};
0181 rays = {wave_nofluct.rays{1},wave_fluct.rays{1}};
0182 %
0183 legs = {'No fluct.','With fluct.';...
0184        'nofluct','fluct'};
0185 %
0186 filename = ['Fig_',id_wave];
0187 %
0188 opt.p_opt = C3POdisplay.p_opt;
0189 opt.ntheta_fit = 65;
0190 opt.nrho_fit = 15;
0191 opt.propvar = 1;   
0192 %
0193 graph_comp_RT_jd(rays,legs,equil_fit,filename,opt)
0194 %
0195 diary4cvs_C3PO_yp(id_wave,dkepath,waves);% diary some results for CVS validation
0196 
0197

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