make_wave_JETh77fluctscan

PURPOSE ^

SYNOPSIS ^

function [] = make_wave_JET77fluctscan

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_JET77fluctscan
0002 %
0003 % script make_wave_test_RT
0004 %
0005 % Parameters for test mode ray-tracing calculations
0006 % This function has a benchmarking purpose only
0007 %
0008 % by Y. Peysson (DRFC/DSM/CEA) <yves.peysson@cea.fr> and J. Decker (DRFC/DSM/CEA) <joan.decker@cea.fr>
0009 %
0010 format long
0011 %
0012 id_wave = 'JETh772p0_fluctscan';
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 = 'JETh77';%For plasma equilibrium
0022 path_equil = '';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0023 fitparam.equil.mode_equil = 1;%Magnetic equilibrium grid type: (1): (psi-theta), (2): (x-y)
0024 %
0025 % Density and magnetic field fluctuation
0026 %
0027 id_fluct = 'test';%For density and magnetic field fluctuation
0028 path_fluct = '../FLUCT/';%if nothing is specified, the working directory is first used and then MatLab is looking in all the path
0029 fitparam.fluct.mode_fluct = 1;%Magnetic equilibrium grid type: (1): (psi-theta), (2): (x-y)
0030 %
0031 % initial ray conditions
0032 %
0033 omega_rf = [3.7]*2*pi*1e9;
0034 %
0035 rho0 = 0.968;
0036 theta0 = 0;
0037 phi0 = 0;%between two toroidal magnetic field coils (phi = 0 corresponds to a coil position)
0038 %
0039 m0 = 0;
0040 n0 = NaN;
0041 Npar0 = -2.0;%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 = 0;
0053 C3POdisplay.equilibrium = 0;
0054 C3POdisplay.fluctuations = 0;
0055 C3POdisplay.p_opt = 2;%Printing or saving option of the figures
0056 %
0057 % Wave parameters
0058 %
0059 waveparam.mmode = -1;%cold plasma mode [1] : (-1) m (1) p, p is the slow mode when kperp > 0 (ex : LH slow wave)
0060 waveparam.kmode = 0;%(0:cold,1:warm,2:hot;3:weak realtivistic,4:full relativistic)
0061 %
0062 %Option parameter for FLR effects and cross-comparison between old FP code:
0063 %    - (0): all FLR effects
0064 %    - (1): small FLR effects and 1/vpar dependence
0065 %    - (2): small FLR effects and no 1/vpar dependence and old grid technique for DQL calculations (Karney, Shoucri) (see rfdiff_dke_jd)
0066 %
0067 waveparam.opt_rf = NaN;
0068 %
0069 waveparam.dsmin = NaN;%minimum size for ray fragments
0070 %
0071 % -----------------------------------------------------------------------------------------------
0072 %
0073 % Global parameters for the vectorial magnetic equilibrium and the plasma fluctuations (if calculated)
0074 %
0075 fitparam.equil.method = 'spline';%nearest,spline,pchip
0076 fitparam.equil.nharm = NaN;%Number of harmonics in the magnetic equilibrium interpolation (less than ntheta_equil/2)
0077 fitparam.equil.ngridresample = 1001;%Number of grid points for resampling the radial profile of magnetic equilibrium parameters
0078 fitparam.equil.mode_equil = 1;%(rho,theta) -> 0, (x,y) -> 1
0079 %
0080 fitparam.fluct.method = 'pchip';%nearest,spline,pchip
0081 fitparam.fluct.nharm = 32;%Number of harmonics in the plasma fluctuations interpolation (less than ntheta_equil/2)
0082 fitparam.fluct.ngridresample = 201;%Number of grid points for resampling the radial profile of plasma fluctuations parameters (very slow if too big !!)
0083 %
0084 % Global parameters for the ray-tracing
0085 %
0086 rayparam.testmode = 0;
0087 rayparam.tensortype = waveparam.kmode;%(0:cold,1:warm,2:hot;3:weak relativistic,4:full relativistic)
0088 rayparam.t0 = 0;
0089 rayparam.tfinal = 5000;
0090 rayparam.dt0 = 1.e-4;
0091 rayparam.dS = 1.e-4;
0092 rayparam.tol = 1e-12;%when tolerance is increased (less accurate calculation of D=0), tfinal must be increased accordingly
0093 rayparam.kmax = 60000;
0094 rayparam.ncyclharm = 3;%number of cyclotron harmonics (just for hot and relativistic dielectric tensors)
0095 rayparam.reflection = 1;%1:Enforce wave reflection at plasma boundary, 0: the code calculates itself if the ray must leave of not the plasma
0096 rayparam.rel_opt = 1;%option for (1) relativistic or (0) non-relativistic calculations
0097 rayparam.nperp = 10000;%number of points in pperp integration for damping calculations
0098 rayparam.pperpmax = 10;%maximum value of pperp in damping calculations
0099 rayparam.tau_lim = Inf;%value of optical depth beyond which the wave is considered absorbed (usually 20. Otherwise Inf)
0100 rayparam.kextra = 1000;%number of calculations performed beyond the full linear absorption (for quasilinear calculations which may require more points)
0101 %
0102 % -------------------------------------------------------------------------
0103 %
0104 % Load structures
0105 %
0106 [equil,dkepath,fluct] = load_structures_yp('equil',id_equil,path_equil,'dkepath',id_dkepath,path_dkepath,'fluct',id_fluct,path_fluct);
0107 %
0108 % =========================================================================
0109 %
0110 % C3P0 ray tracing
0111 %
0112 % Vectorial description of the magnetic equilibrium
0113 %
0114 equil_fit = fitequil_yp(equil,fitparam.equil.mode_equil,fitparam.equil.method,fitparam.equil.ngridresample,fitparam.equil.nharm);%Build vectorized magnetic equilibrium structure
0115 info_dke_yp(2,['Vectorial form of the magnetic equilibrium ',equil.id,' is calculated.']);
0116 if C3POdisplay.equilibrium,testfitequil_yp(equil,equil_fit);end
0117 %
0118 % Vectorial description of the plasma fluctuations
0119 %
0120 if ~isempty(fluct),
0121    fluct = fluctphase_yp(fluct);
0122    [fluct_fit] = fitfluct_yp(fluct,fitparam.equil.mode_equil,fitparam.fluct.method,fitparam.fluct.ngridresample,fitparam.fluct.nharm);%Build vectorized plasma fluctuation structure
0123    info_dke_yp(2,['Vectorial form of the plasma fluctuations ',equil.id,'_',fluct.id,' is calculated.']);
0124    if C3POdisplay.fluctuations,testfitfluct_yp(equil_fit,fluct,fluct_fit);end
0125 end
0126 %
0127 rayinit.omega_rf = omega_rf;
0128 rayinit.yrho0 = rho0;%Initial radial position at launch
0129 rayinit.ytheta0 = theta0;%Initial poloidal position at launch
0130 rayinit.yphi0 = phi0;%Initial toroidal position at launch
0131 rayinit.ym0 = m0;%Initial poloidal mode number
0132 rayinit.yn0 = n0;%Initial toroidal mode number
0133 rayinit.yNpar0 = Npar0;%Initial index of refraction
0134 rayinit.ydNpar0 = dNpar0;%initial Ray spectral width
0135 rayinit.yP0_2piRp = P0_2piRp;%Lineic initial power density initial power in the ray (W/m)
0136 %
0137 Nfluct = 100;
0138 %
0139 % -------------------------------------------------------------------------
0140 %
0141 % C3PO computing parameters
0142 %
0143 C3POparam.clustermode.main_C3PO_jd.scheduler.mode = mdce_mode_main_C3PO_jd;%MatLab distributed computing environment
0144 %
0145 % Ray-tracing calculations
0146 %
0147 waves{1} = main_C3PO_jd(dkepath,id_wave,equil,equil_fit,rayinit,waveparam,[],rayparam,C3POdisplay,C3POparam,[],[],0);clear mex;clear functions
0148 %
0149 info_dke_yp(2,'Ray trajectories calculated (interpolated magnetic equilibrium with no plasma fluctuations)');
0150 %
0151 for ifluct = 1:Nfluct,
0152     waves{ifluct+1} = main_C3PO_jd(dkepath,id_wave,equil,equil_fit,rayinit,waveparam,[],rayparam,C3POdisplay,C3POparam,[],fluct_fit,0);
0153     fluct_fit.phase_unlocked = 1;
0154     fluct_fit = fluctphase_yp(fluct_fit);%Set the phase (fixed for magnetic ripple, random for fluctuations)
0155 end
0156 %
0157 rayevolution_yp(equil_fit,waves);
0158 %
0159 info_dke_yp(2,'Ray trajectories calculated (interpolated magnetic equilibrium with plasma fluctuations)');
0160 %
0161 save_str = ['WAVE_',id_wave,'.mat'];
0162 eval(['save ',save_str,' waves']);
0163 %
0164 info_dke_yp(2,'Wave parameters saved');
0165 %

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