imake_wave_ART_jd

PURPOSE ^

SYNOPSIS ^

function wave = imake_wave_ART_jd(workdir,equil,opt_gui)

DESCRIPTION ^

 This function makes the WAVE file from ART ray-tracing output

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function wave = imake_wave_ART_jd(workdir,equil,opt_gui)
0002 %
0003 % This function makes the WAVE file from ART ray-tracing output
0004 %
0005 wave = '';
0006 [qe,me,mp,mn,e0,mu0,re,mc2,clum] = pc_dke_yp;%Universal physics constants
0007 %
0008 [ART_file,ART_path] = igetfile_jd(opt_gui,'*.*',['Please select the ART output file'],workdir);
0009 %
0010 if ART_file == 0,
0011     return
0012 end
0013 load([ART_path,ART_file],'ARTsimdat');
0014 %
0015 P0 = input('Wave power (kW) :');
0016 if isempty(P0) | ~isnumeric(P0),
0017     disp('-----> Invalid Wave power');
0018     return
0019 end
0020 %
0021 freq = input('Wave frequency (GHz) [82.7]:');
0022 if isempty(freq),
0023     freq = 82.7;
0024 end
0025 if ~isnumeric(freq),
0026     disp('-----> Invalid Wave frequency');
0027     return
0028 end
0029 %
0030 dNpar = input('Spectral width [0.2]:');
0031 if isempty(dNpar),
0032     dNpar = 0.2;
0033 end
0034 if ~isnumeric(dNpar),
0035     disp('-----> Invalid Spectral width');
0036     return
0037 end
0038 %
0039 kmode = input('Plasma model for wave propagation : (0:cold, 1:kinetic) [1] :');
0040 if isempty(kmode),
0041     kmode = 1;
0042 end
0043 if ~isnumeric(kmode) | ~any(kmode == [0:4]),
0044     disp('-----> Invalid plasma model option');
0045     return
0046 end
0047 %
0048 opt_rf = input('FLR effects : (0:all, 1:small) [0] :');
0049 if isempty(opt_rf),
0050     opt_rf = 0;
0051 end
0052 if ~isnumeric(opt_rf) | ~any(opt_rf == [0:1]),
0053     disp('-----> Invalid FLR effects option');
0054     return
0055 end
0056 %
0057 wave_id_o = ['ART'];
0058 %
0059 wave_id = input(['Please provide an id for the wave [',wave_id_o,'] : '],'s');
0060 if isempty(wave_id),
0061     wave_id = wave_id_o;
0062 end
0063 %
0064 omega_rf = 2*pi*freq*1e9;
0065 %
0066 smask = [1;1+find((diff(ARTsimdat.R.data) ~= 0) | (diff(ARTsimdat.Phi.data) ~= 0) | (diff(ARTsimdat.z.data) ~= 0))];
0067 %
0068 ray.P0_2piRp = 1e3*P0/(2*pi*equil.Rp);% Power launched in the ray (W) [1,1]
0069 %
0070 ray.sx = ARTsimdat.R.data(smask).'*1e-2 - equil.Rp;% Ray location (major radius) along the propagation [1,ns]
0071 %ray.sphi = - ARTsimdat.Phi.data(smask).'*pi/180;% Ray location (toroidal angle) along the propagation [1,ns]
0072 ray.sphi = ARTsimdat.Phi.data(smask).'*pi/180;% Ray location (toroidal angle) along the propagation [1,ns]
0073 ray.sy = ARTsimdat.z.data(smask).'*1e-2;% Ray location (vertical) along the propagation [1,ns]
0074 %
0075 ray.ss = [];% Ray propagation distance parameter for each ray (put to NaN once the ray is absorbed) [1,ns]
0076 ray.spsin = [];% Ray location (normalized magnetic flux) along the propagation [1,ns]
0077 ray.stheta = [];% Ray location (poloidal angle) along the propagation [1,ns]
0078 %
0079 %- sign necessary to match Npars. Check in ART
0080 %
0081 %ray.skx = - ARTsimdat.NR.data(smask).'*omega_rf/clum;% Ray wave vector (major radius) along the propagation [1,ns]
0082 %ray.sn = - ARTsimdat.Nphi.data(smask).'.*ARTsimdat.R.data(smask).'*1e-2*omega_rf/clum;% Ray wave number (toroidal) along the propagation [1,ns]
0083 %ray.sky = - ARTsimdat.Nz.data(smask).'*omega_rf/clum;% Ray wave vector (vertical) along the propagation [1,ns]
0084 %
0085 % - sign not necessary any more
0086 %
0087 disp('Sign changed in imake_wave_ART_jd.m ter');
0088 ray.skx = ARTsimdat.NR.data(smask).'*omega_rf/clum;% Ray wave vector (major radius) along the propagation [1,ns]
0089 ray.sn = ARTsimdat.Nphi.data(smask).'.*ARTsimdat.R.data(smask).'*1e-2*omega_rf/clum;% Ray wave number (toroidal) along the propagation [1,ns]
0090 ray.sky = ARTsimdat.Nz.data(smask).'*omega_rf/clum;% Ray wave vector (vertical) along the propagation [1,ns]
0091 %
0092 ray.sNpar_comp = ARTsimdat.Npar.data(smask).';% Ray parallel wave number [1,ns]
0093 ray.sNpar = [];% Ray parallel wave number [1,ns]
0094 ray.sNperp = [];% Ray perpendicular wave number [1,ns]
0095 ray.sdNpar = dNpar*ones(1,length(smask));% Ray spectral width in Npar [1,ns]
0096 %       if sdNpar is real -> gaussian spectrum, if sdNpar is imag. -> square spectrum (centered on sNpar)
0097 %
0098 ray.sepol_pmz = [];% polarization vector [3,ns] complex
0099 ray.sphi_xyz = [];% normalized power flow [3,ns]
0100 %
0101 rays{1} = ray;
0102 %
0103 wave.id = wave_id;
0104 wave.omega_rf = omega_rf;
0105 wave.opt_rf = opt_rf;%option for FLR calculations [1,1]
0106 wave.opt_disp = 1 + kmode;  % option for solving the wave equation, which gives (ray.sepol_pmz, ray.sphi, ray.sNperp)
0107 wave.equil_id = equil.id;
0108 wave.kextra = 0;
0109 wave.rays = rays;
0110 %
0111 wave.info.type = 'RT';
0112 wave.info.RT = 'ART';
0113 wave.info.rays = [ART_path,ART_file];
0114 %

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