make_wave_JETh77flucttest

PURPOSE ^

script make_wave_test_RT

SYNOPSIS ^

function [] = make_wave_JET77flucttest

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_JET77flucttest
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 format long
0010 %
0011 id_wave = 'JETh772p0_flucttest';
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 = 'JETh77';%For plasma equilibrium
0021 path_equil = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0022 fitparam.equil.mode_equil = 1;%Magnetic equilibrium grid type: (1): (psi-theta), (2): (x-y)
0023 %
0024 % Density and magnetic field fluctuation
0025 %
0026 id_fluct = 'test';%For density and magnetic field fluctuation
0027 path_fluct = '../FLUCT/';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0028 fitparam.fluct.mode_fluct = 1;%Magnetic equilibrium grid type: (1): (psi-theta), (2): (x-y)
0029 %
0030 % initial ray conditions
0031 %
0032 omega_rf = [3.7]*2*pi*1e9;
0033 %
0034 rho0 = 0.968;
0035 theta0 = pi/12;
0036 phi0 = 3*pi/18/4;%between two toroidal magnetic field coils (phi = 0 corresponds to a coil position)
0037 %
0038 m0 = 0;
0039 n0 = NaN;
0040 Npar0 = -2.0;%initial index of refraction
0041 %
0042 dNpar0 = NaN;
0043 P0_2piRp = NaN;
0044 %
0045 % C3PO computing parameters
0046 %
0047 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)
0048 %
0049 % Display parameters
0050 %
0051 C3POdisplay.ray = 1;
0052 C3POdisplay.equilibrium = 0;
0053 C3POdisplay.fluctuations = 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 and the plasma fluctuations (if calculated)
0073 %
0074 fitparam.equil.method = 'spline';%nearest,spline,pchip
0075 fitparam.equil.nharm = NaN;%Number of harmonics in the magnetic equilibrium interpolation (less than ntheta_equil/2)
0076 fitparam.equil.ngridresample = 1001;%Number of grid points for resampling the radial profile of magnetic equilibrium parameters
0077 fitparam.equil.mode_equil = 1;%(rho,theta) -> 0, (x,y) -> 1
0078 %
0079 fitparam.fluct.method = 'pchip';%nearest,spline,pchip
0080 fitparam.fluct.nharm = 32;%Number of harmonics in the plasma fluctuations interpolation (less than ntheta_equil/2)
0081 fitparam.fluct.ngridresample = 201;%Number of grid points for resampling the radial profile of plasma fluctuations parameters (very slow if too big !!)
0082 %
0083 % Global parameters for the ray-tracing
0084 %
0085 rayparam.testmode = 0;
0086 rayparam.tensortype = waveparam.kmode;%(0:cold,1:warm,2:hot;3:weak relativistic,4:full relativistic)
0087 rayparam.t0 = 0;
0088 rayparam.tfinal = 20000;
0089 rayparam.dt0 = 1.e-4;
0090 rayparam.dS = 1.e-4;
0091 rayparam.tol = 1e-12;%when tolerance is increased (less accurate calculation of D=0), tfinal must be increased accordingly
0092 rayparam.kmax = 60000;
0093 rayparam.ncyclharm = 3;%number of cyclotron harmonics (just for hot and relativistic dielectric tensors)
0094 rayparam.reflection = 1;%1:Enforce wave reflection at plasma boundary, 0: the code calculates itself if the ray must leave of not the plasma
0095 rayparam.rel_opt = 1;%option for (1) relativistic or (0) non-relativistic calculations
0096 rayparam.nperp = 10000;%number of points in pperp integration for damping calculations
0097 rayparam.pperpmax = 10;%maximum value of pperp in damping calculations
0098 rayparam.tau_lim = Inf;%value of optical depth beyond which the wave is considered absorbed (usually 20. Otherwise Inf)
0099 rayparam.kextra = 1000;%number of calculations performed beyond the full linear absorption (for quasilinear calculations which may require more points)
0100 %
0101 % -------------------------------------------------------------------------
0102 %
0103 % Load structures
0104 %
0105 [equil,dkepath,fluct] = load_structures_yp('equil',id_equil,path_equil,'dkepath',id_dkepath,path_dkepath,'fluct',id_fluct,path_fluct);
0106 %
0107 % =========================================================================
0108 %
0109 % C3P0 ray tracing
0110 %
0111 % Vectorial description of the magnetic equilibrium
0112 %
0113 equil_fit = fitequil_yp(equil,fitparam.equil.mode_equil,fitparam.equil.method,fitparam.equil.ngridresample,fitparam.equil.nharm);%Build vectorized magnetic equilibrium structure
0114 info_dke_yp(2,['Vectorial form of the magnetic equilibrium ',equil.id,' is calculated.']);
0115 if C3POdisplay.equilibrium,testfitequil_yp(equil,equil_fit);end
0116 %
0117 % Vectorial description of the plasma fluctuations
0118 %
0119 if ~isempty(fluct),
0120    fluct = fluctphase_yp(fluct);
0121    [fluct_fit] = fitfluct_yp(fluct,fitparam.equil.mode_equil,fitparam.fluct.method,fitparam.fluct.ngridresample,fitparam.fluct.nharm);%Build vectorized plasma fluctuation structure
0122    info_dke_yp(2,['Vectorial form of the plasma fluctuations ',equil.id,'_',fluct.id,' is calculated.']);
0123    if C3POdisplay.fluctuations,testfitfluct_yp(equil_fit,fluct,fluct_fit);end
0124 end
0125 %
0126 rayinit.omega_rf = omega_rf;
0127 rayinit.yrho0 = rho0;%Initial radial position at launch
0128 rayinit.ytheta0 = theta0;%Initial poloidal position at launch
0129 rayinit.yphi0 = phi0;%Initial toroidal position at launch
0130 rayinit.ym0 = m0;%Initial poloidal mode number
0131 rayinit.yn0 = n0;%Initial toroidal mode number
0132 rayinit.yNpar0 = Npar0;%Initial index of refraction
0133 rayinit.ydNpar0 = dNpar0;%initial Ray spectral width
0134 rayinit.yP0_2piRp = P0_2piRp;%Lineic initial power density initial power in the ray (W/m)
0135 %
0136 % -------------------------------------------------------------------------
0137 %
0138 % C3PO computing parameters
0139 %
0140 C3POparam.clustermode.main_C3PO_jd.scheduler.mode = mdce_mode_main_C3PO_jd;%MatLab distributed computing environment
0141 %
0142 % Ray-tracing calculations
0143 %
0144 wave_nofluct = main_C3PO_jd(dkepath,[id_wave,'_numeric'],equil,equil_fit,rayinit,waveparam,[],rayparam,C3POdisplay,C3POparam,[],[],0);clear mex;clear functions
0145 %
0146 info_dke_yp(2,'Ray trajectories calculated (interpolated magnetic equilibrium with no plasma fluctuations)');
0147 %
0148 fluct = fluctphase_yp(fluct);%Set the phase (fixed for magnetic ripple, random for fluctuations)
0149 wave_fluct = main_C3PO_jd(dkepath,[id_wave,'_analytic'],equil,equil_fit,rayinit,waveparam,[],rayparam,C3POdisplay,C3POparam,[],fluct_fit,0);
0150 %
0151 info_dke_yp(2,'Ray trajectories calculated (interpolated magnetic equilibrium with plasma fluctuations)');
0152 %
0153 save_str = ['WAVE_',id_wave,'.mat'];
0154 save(save_str,'id_wave','wave_fluct','wave_nofluct','equil_fit','fluct');
0155 %
0156 info_dke_yp(2,'Wave parameters saved');
0157 %
0158 % --- display results ---
0159 %
0160 rays = {wave_nofluct.rays{1},wave_fluct.rays{1}};
0161 %
0162 legs = {'No fluct.','With fluct.';...
0163        'nofluct','fluct'};
0164 %
0165 filename = ['Fig_',id_wave];
0166 %
0167 opt.p_opt = C3POdisplay.p_opt;
0168 opt.ntheta_fit = 65;
0169 opt.nrho_fit = 15;
0170 opt.propvar = 1;   
0171 %
0172 graph_comp_RT_jd(rays,legs,equil_fit,filename,opt)
0173 %

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