imake_launch_LH_jd

PURPOSE ^

SYNOPSIS ^

function launch = imake_launch_LH_jd(basestr,signs,data,opt_gui,select)

DESCRIPTION ^

 This function builts the launch structure for LH waves from external data and/or user-specified data

 - The data structure is assumed to have a standard form here. 

 - Processing of original data structures (ex : external) is done upstream, for example
   in imake_launch_jd.

 - The data structure may also be originally loaded from the output of 
   spectrum codes or files.

   - INPUTS : 
       - basestr           : tokamak name [string]

       - signs (optional)  : signs [struct]
           o ip : sign of current seen from top. (1) if clockwise, (-1) otherwise
           o b0 : sign of toroidal field seen from top. (1) if clockwise, (-1) otherwise

       - data (optional)   : [struct] data structure with the following optional fields :
           o id : antenna identification, could exist in get_launchs_* file [string}
           o type : must be 'LH'
           o omega_rf :  wave angular frequency (rad/s) [1,1]
           o rZ0 :  vertical launching positions (m) [1,m_pol]
           o phi0 : toroidal angle position [1,1]
           o LFS : (-1) high field side launching, (1) low field side launching [1,1]
           o spectrum : spectrum structure with the following fields
               - param_tor : parameters structure for toroidal direction :
                   o nlobes : number of lobes selected
                   o dir : sort peaks according to : 
                       (0) P     + preserve repartition and total power 
                       (1) P/N^2 + preserve directivity and repartition 
                       (2) P/N^2 + preserve directivity and total power (treating positive and negative spectra as blocks. Warning : some transfer of P/N^2 across N=0 necessary in this case)
                       (3) P/N^2 + preserve repartition and total power 
                   o mode : process mode :
                       (0) select a number of Gaussian peaks left unchanged (WARNING : total power less than Pin)
                       (1) assemble peaks fixing Pmax and N, allowing dN to change
                       (2) assemble peaks allowing Pmax, N and dN to change
               - param_pol : parameters structure for poloidal direction :
                   o same as param_tor
                   o opt_ny : treat poloidal direction in (0) real space with multiple vertical positions, or (1) with poloidal spectral lobes

       - opt_gui (optional): (false, defaut) use of command line (true) use of an independent GUI, (handle) GUI used within handle (ex : iluke) [boolean or handle]

       - select (optional) : structure containing the following optional fields :
           o style [struct] (style properties for GUI. See iselect_jd and graph1D_jd for specific properties 
           o inter : interactive mode (1) or not (0)
           o tail : tail model with (1) 5 lobes, or (0) disabled : 0 lobes
           o mode : display (0) none (1) text only (2) text and figures (default : 0)
           o axs (optional) : use axs to plot spectrum (iluke only)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function launch = imake_launch_LH_jd(basestr,signs,data,opt_gui,select)
0002 %
0003 % This function builts the launch structure for LH waves from external data and/or user-specified data
0004 %
0005 % - The data structure is assumed to have a standard form here.
0006 %
0007 % - Processing of original data structures (ex : external) is done upstream, for example
0008 %   in imake_launch_jd.
0009 %
0010 % - The data structure may also be originally loaded from the output of
0011 %   spectrum codes or files.
0012 %
0013 %   - INPUTS :
0014 %       - basestr           : tokamak name [string]
0015 %
0016 %       - signs (optional)  : signs [struct]
0017 %           o ip : sign of current seen from top. (1) if clockwise, (-1) otherwise
0018 %           o b0 : sign of toroidal field seen from top. (1) if clockwise, (-1) otherwise
0019 %
0020 %       - data (optional)   : [struct] data structure with the following optional fields :
0021 %           o id : antenna identification, could exist in get_launchs_* file [string}
0022 %           o type : must be 'LH'
0023 %           o omega_rf :  wave angular frequency (rad/s) [1,1]
0024 %           o rZ0 :  vertical launching positions (m) [1,m_pol]
0025 %           o phi0 : toroidal angle position [1,1]
0026 %           o LFS : (-1) high field side launching, (1) low field side launching [1,1]
0027 %           o spectrum : spectrum structure with the following fields
0028 %               - param_tor : parameters structure for toroidal direction :
0029 %                   o nlobes : number of lobes selected
0030 %                   o dir : sort peaks according to :
0031 %                       (0) P     + preserve repartition and total power
0032 %                       (1) P/N^2 + preserve directivity and repartition
0033 %                       (2) P/N^2 + preserve directivity and total power (treating positive and negative spectra as blocks. Warning : some transfer of P/N^2 across N=0 necessary in this case)
0034 %                       (3) P/N^2 + preserve repartition and total power
0035 %                   o mode : process mode :
0036 %                       (0) select a number of Gaussian peaks left unchanged (WARNING : total power less than Pin)
0037 %                       (1) assemble peaks fixing Pmax and N, allowing dN to change
0038 %                       (2) assemble peaks allowing Pmax, N and dN to change
0039 %               - param_pol : parameters structure for poloidal direction :
0040 %                   o same as param_tor
0041 %                   o opt_ny : treat poloidal direction in (0) real space with multiple vertical positions, or (1) with poloidal spectral lobes
0042 %
0043 %       - opt_gui (optional): (false, defaut) use of command line (true) use of an independent GUI, (handle) GUI used within handle (ex : iluke) [boolean or handle]
0044 %
0045 %       - select (optional) : structure containing the following optional fields :
0046 %           o style [struct] (style properties for GUI. See iselect_jd and graph1D_jd for specific properties
0047 %           o inter : interactive mode (1) or not (0)
0048 %           o tail : tail model with (1) 5 lobes, or (0) disabled : 0 lobes
0049 %           o mode : display (0) none (1) text only (2) text and figures (default : 0)
0050 %           o axs (optional) : use axs to plot spectrum (iluke only)
0051 %
0052 if nargin < 5,
0053     select = struct;
0054 end
0055 if nargin < 4,
0056     opt_gui = false;
0057 end
0058 if nargin < 3,
0059     data = struct;
0060 end
0061 if nargin < 2,
0062     signs = struct;
0063 end
0064 if nargin < 1,
0065     basestr = 'default';
0066 end
0067 %
0068 if ~isfield(select,'style'),
0069     select.style = struct;
0070 end
0071 %
0072 if ~isfield(signs,'ip'),
0073     signs.ip = 1;
0074 end
0075 if ~isfield(signs,'b0'),
0076     signs.b0 = -1;% to keep default npar positive for co-current
0077 end
0078 %
0079 % ********** FIXED ANTENNA PARAMETERS **********
0080 %
0081 % default launch structure
0082 %
0083 launchs_default = get_launchs_default;
0084 launch_default = launchs_default{1};
0085 %
0086 % select main antenna properties from get_launchs_* file
0087 %
0088 launchsfile = ['get_launchs_',basestr];
0089 %
0090 if exist(launchsfile,'file'),% antennas for this tokamak are registered in this file
0091     launchs = feval(launchsfile);
0092 else
0093     launchs = {};
0094 end
0095 %
0096 nlaunchs = length(launchs);
0097 %
0098 s = cell(1,nlaunchs);
0099 for ilaunch = 1:nlaunchs,
0100     s{ilaunch} = launchs{ilaunch}.id;
0101 end
0102 %
0103 % see whether antenna is pre-selected in data or not
0104 %
0105 if isfield(data,'id'),% Antenna id specified in data structure
0106     ilaunch = find(strcmp(s,data.id),1,'first');
0107     %
0108     if isempty(ilaunch),% antenna id not found in get_launchs_* file
0109         disp(['Antenna id ',data.id,' not found in ',launchsfile,'. Default parameters used for missing fields'])
0110     end
0111     %
0112 elseif nlaunchs > 0,% select antenna from list
0113     %
0114     if nlaunchs == 1,
0115         ilaunch = 1;
0116     else
0117         titletext = ['Select antenna for tokamak ',basestr,' :'];      
0118         %
0119         ilaunch = iselect_jd(s,titletext,opt_gui,select.style,1);
0120         %
0121     end
0122     %
0123     disp(['Antenna selected from ',launchsfile,' : ',launchs{ilaunch}.id]);
0124     %
0125 else
0126     %
0127     ilaunch = [];
0128     %
0129     disp('Default Antenna selected. Default parameters used for missing fields');
0130     %
0131 end
0132 %
0133 if isempty(ilaunch),% default launch parameters overriden by data
0134     %
0135     launch = conc_struct_jd(launch_default,selectfields_jd(data,{'id','type','omega_rf','rZ0','phi0','LFS'},false));    
0136     %
0137 else% launch parameters from antenna
0138     %
0139     launch = launchs{ilaunch};
0140     %
0141     if isfield(data,'omega_rf') && data.omega_rf ~= launch.omega_rf,
0142         disp(['WARNING : the frequency was changed from ',num2str(launch.omega_rf/(2*pi*1e9)),' to ',num2str(data.omega_rf/(2*pi*1e9)),' GHz.']);
0143         launch.omega_rf = data.omega_rf;
0144     end
0145     %
0146     if isfield(data,'rZ0') && (any(size(data.rZ0) ~= size(launch.rZ0)) || any(data.rZ0 ~= launch.rZ0)),
0147         disp(['WARNING : the vertical positions were changed from ',num2str(launch.rZ0),' to ',num2str(data.rZ0),' m.']);
0148         launch.rZ0 = data.rZ0;
0149     end
0150     %
0151     if isfield(data,'phi0') && data.phi0 ~= launch.phi0,
0152         disp(['WARNING : the toroidal launching position was changed from ',num2str(launch.phi0*180/pi),' to ',num2str(data.phi0*180/pi),'°.']);
0153         launch.phi0 = data.phi0;
0154     end
0155     %
0156     if isfield(data,'LFS') && data.LFS ~= launch.LFS,
0157         str = {'HFS','LFS'};
0158         disp(['WARNING : the position was changed from ',str{1+(launch.LFS == 1)},' to ',str{1+(launch.LFS == 1)},'.']);
0159         launch.LFS = data.LFS;
0160     end
0161     %
0162 end
0163 %
0164 % ********** SPECTRAL PARAMETERS **********
0165 %
0166 launch = rmfield(conc_struct_jd(launch,launch.default),'default');% create default missing fields
0167 %
0168 launch.bNpar0 = - launch.bNpar0*signs.ip*signs.b0;% default bNpar0 adjusted for co-current
0169 %
0170 if isfield(data,'spectrum'),% spectral parameters specified by data - to be processed by proc_aloha_spec_jd
0171     %
0172     if ~isfield(data.spectrum,'param_tor'),
0173         % Default toroidal spectrum treatment is :
0174         % - to keep main lobes unchanged
0175         % - select them by order of decreasing P/N^2
0176         %
0177         data.spectrum.param_tor.nlobes = length(launch.bNpar0); 
0178         data.spectrum.param_tor.dir = 1;
0179         data.spectrum.param_tor.mode = 0;
0180     end
0181     %
0182     if ~isfield(data.spectrum,'param_pol'),
0183         %
0184         % Default poloidal spectrum treatment is :
0185         % - treat poloidal direction in real space with multiple vertical positions,
0186         % otherwise
0187         % - to keep 2 main lobes unchanged
0188         % - select them by order of decreasing power
0189         %
0190         data.spectrum.param_pol.opt_ny = 0;
0191         %
0192         data.spectrum.param_pol.nlobes = 2; 
0193         data.spectrum.param_pol.dir = 0;
0194         data.spectrum.param_pol.mode = 0;
0195     end
0196     %
0197     launch.spectrum = data.spectrum;
0198     %
0199     select.opt_gui = opt_gui;
0200     %
0201     [launch.bNpar0,launch.bdNpar0,launch.bPlhtot,launch.spectrum.param_tor,launch.spectrum.param_pol] = iproc_spectrum_jd(data.spectrum,select,signs);
0202     %
0203 else% spectral parameters directly specified - no spectrum to process
0204     %
0205     launch = conc_struct_jd(launch,selectfields_jd(data,{'bNpar0','bdNpar0','bPlhtot','m0','i_ref','mmode'},false));% replace default values by prescription from data
0206     %
0207     plot_spectrum_from_launch_jd(launch,NaN,-1,select);
0208     %
0209 end
0210 %
0211 if ~isfield(select,'tail'),
0212     if isfield(select,'inter') && select.inter,% interactive mode
0213         select.tail = iselect_jd({'No','Yes'},'Include spectral tail model with 5 tail lobes?',opt_gui,select.style,1) - 1;
0214     else
0215         select.tail = 0;
0216     end
0217 end
0218 %
0219 if ~isfield(select,'tail_struct)'),
0220     tail_struct = struct;
0221     tail_struct.dtn = Inf;
0222     tail_struct.mode = 3;% mode for tail spectrum : (0) no tail model, (1)  Gaussian, (2) Linear, (3) calc_tail_jd
0223     tail_struct.bNparmax_tail = 0;%npar0 extend from npar_antenna to Nparmax_tail. If Nparmax_tail is NaN or empty, it is calculated by the code in main_rayinit_launch_jd.m -> 6.5/sqrt(Te0)
0224     if select.tail,
0225         tail_struct.bn_tail = 5;%number of lobes to describe the tail. If n_tail = 0, no tail up to Nparmax_tail (no used if linear_tail is chosen)
0226     else
0227         tail_struct.bn_tail = 0;%number of lobes to describe the tail. If n_tail = 0, no tail up to Nparmax_tail (no used if linear_tail is chosen)
0228     end
0229     tail_struct.bP_tail = 0.5;%Power fraction in the tail. If NaN, it is calculated from n_tail and opt_tail (no used if linear_tail is chosen)
0230     tail_struct.bopt_tail = 0 + 1i;%Final power fraction of the tail @ Nparmax_tail (+1i) Adjust initial dNpar0 such that initial and tail lobes have the same width
0231     %
0232 else
0233     tail_struct = select.tail_struct;
0234 end
0235 %
0236 launch.tail = tail_struct;
0237 %
0238 if isfield(launch,'tail')
0239     if launch.tail.bn_tail > 0 && (launch.tail.bP_tail > 0 || isnan(launch.tail.bP_tail)),
0240         launch.id = [launch.id,'_TAIL_',make_tail_simulid_jd(launch.tail)];
0241     end
0242 end
0243 %
0244 return
0245 %
0246 
0247 if ~isempty(external),
0248     %
0249     if isfield(external,'plasma') && isfield(external,'antenna'),% spectrum from ALOHA type structure
0250     elseif strcmp(basestr,'TS'),
0251         %
0252         % !!!! Warning : older antenna configurations not yet operational
0253         %
0254         %if str2num(shotnum) > 0,% !!!! to be specified
0255             %
0256             config = 'MIXTE';
0257             %
0258         %end
0259         %
0260         disp(['-----> The antenna configuration is : ',config]);
0261         %
0262         Plh(1) = 1e6*external.Plh_C2;
0263         Plh(2) = 1e6*external.Plh_C3;
0264         npar(1) = external.npar_C2;
0265         npar(2) = external.npar_C3;
0266         %             l_opt = input_dke_yp('Directivity of the wave',1,[0;1],'',[1,1]);
0267         l_opt = input_dke_yp('Do you want to include the negative lobe [y/n]','n',{'y','n'},'',[1,1]);
0268         %
0269         if strcmp(l_opt,'y'),
0270             lob = 'Yes';
0271         else 
0272             lob = 'No';
0273         end
0274         %
0275     elseif strcmp(basestr,'EAST') || strcmp(basestr,'HL2A'),
0276         %
0277         fexternal = fieldnames(external);
0278         %
0279         if isfield(select,'a_opt'),
0280             a_opt = select.a_opt;
0281         else
0282             %
0283             s = fexternal;
0284             for iw = 1:length(s),
0285                 s{iw} = [s{iw},' ; Injected LH power : ',num2str(external.(fexternal{iw}).total_launched_power.power/1e6),' MW'];
0286             end
0287             a_opt = fexternal{iselect_jd(s,'Please select an antenna :',opt_gui,select.style,1)};
0288         end
0289         %
0290         omega_rf = 2*pi*1e9*external.(a_opt).frequency.flh;
0291         if isfield(launch,'omega_rf') && launch.omega_rf ~= omega_rf,
0292             disp(['WARNING : the frequency was changed from ',num2str(launch.omega_rf/(2*pi*1e9)),' to ',num2str(omega_rf/(2*pi*1e9)),' GHz.']);
0293         end
0294         launch.omega_rf = omega_rf;
0295         %
0296         rZ0 = external.(a_opt).position.Z;
0297         if isfield(launch,'rZ0') && launch.rZ0 ~= rZ0,
0298             disp(['WARNING : the vertical positions were changed from ',num2str(launch.rZ0),' to ',num2str(rZ0),' m.']);
0299         end
0300         launch.rZ0 = rZ0;
0301         %
0302         launch.id = a_opt;
0303         launch.phi0 = 0;
0304         
0305         launch.LFS = 1;
0306         launch.m0 = 0;
0307         %
0308         disp(['----> The LH antenna has ',int2str(length(position.Z)), ' poloidal rows.']);
0309         %
0310         if isfield(select,'position_rZ0_opt'),
0311             position_rZ0_opt = select.position_rZ0_opt;
0312         else
0313             position_rZ0_opt = input_dke_yp('Do you want to consider all poloidal rows [y]','y',{'y','n'},'',[1,1]);
0314         end
0315         %
0316         if strcmp(position_rZ0_opt,'y'),
0317             launch.rZ0 = position.Z;
0318         else 
0319             launch.rZ0 = sum(position.Z);
0320             disp(['----> The averaged poloidal position of the LH antenna at the vertical position Zant = ',num2str(launch.rZ0), ' (m).']);
0321         end
0322         %
0323         if ~isfield(power_spectrum,'dn_par'),
0324             %
0325             zdP_in = power_spectrum.power;
0326             zN_in = power_spectrum.n_par;
0327             %
0328             zN_in(find(diff(zdP_in)==0)) = [];%remove points with equal power density (for proc_aloha_spec_jd)
0329             zdP_in(find(diff(zdP_in)==0)) = [];%remove points with equal power density (for proc_aloha_spec_jd)
0330             %
0331             [bNpar0,bdNpar0,bPlhtot] = proc_aloha_spec_jd(zN_in,NaN,zdP_in,Plh(a_opt));%ALOHA like spectra
0332             %
0333             launch.bPlhtot = bPlhtot;  
0334             launch.bdNpar0 = bdNpar0;  
0335             launch.bNpar0 = bNpar0;
0336             %
0337         else
0338             %
0339             launch.bPlhtot = power_spectrum.power*1e6;  
0340             launch.bdNpar0 = power_spectrum.dn_par;  
0341             launch.bNpar0 = power_spectrum.n_par;
0342             %
0343         end
0344     else
0345         %
0346         error(['-----> wave data not yet implemented for :',basestr]);
0347         %
0348     end
0349     %
0350 else
0351     %
0352     % default spectrum values for the antenna specified
0353     %
0354     launch = rmfield(conc_struct_jd(launch,launch.default),'default');
0355     %
0356     launch.bNpar0 = - launch.bNpar0*signe.ip*signe.b0;
0357     %
0358 end
0359 %
0360 % if strcmp(basestr,'TS') || strcmp(basestr,'JET'),% default values from make_wavelaunchs_cronos_lh
0361 %     %
0362 %     cons = Plh.*exp(i*npar);
0363 %     %
0364 %     cons_spec = NaN;
0365 %     %
0366 %     launchs = make_wavelaunchs_cronos_lh('','',cons,signe,config,lob);
0367 %     %
0368 %     a_str = '';
0369 %     for iw = 1:length(launchs),
0370 %         a_str = [a_str,' (',num2str(iw),') ',launchs{iw}.id,','];
0371 %     end
0372 %     %
0373 %     if iw > 1,
0374 %         %
0375 %         a_opt = input_dke_yp(['Please select an antenna :',a_str],1,1:iw,'',[1,1]);
0376 %         %
0377 %     else
0378 %         a_opt = 1;
0379 %     end
0380 %     %
0381 %     launch = launchs{a_opt};
0382 %     %
0383 % elseif strcmp(basestr,'EAST') || strcmp(basestr,'HL2A'),
0384 %
0385 % else % default values
0386 %     %
0387 %     launch.omega_rf = 2*pi*1e9*4.6;
0388 %     launch.LFS = 1;
0389 %     launch.m0 = 0;
0390 %     %
0391 %     if isnan(launch.m0),
0392 %         launch.n0 = 0;
0393 %     else
0394 %         launch.n0 = NaN;
0395 %     end
0396 %     %
0397 %     launch.phi0 = 0;
0398 %     launch.bPlhtot = Plh(1);
0399 %     launch.bNpar0 = npar(1);
0400 %     launch.bdNpar0 = 0.2;
0401 %     launch.rZ0 = 0;
0402 %     launch.id = '';
0403 %     %
0404 % end
0405 %
0406 
0407 %
0408 % Introduction of the tail model for the npar0 fluctuations
0409 %
0410 % Note : The tail spectrum can be described either in a static mode (if
0411 % dtn_fluct_correlation_npar0_lh = Inf) or in a fluctuating mode (if
0412 % dtn_fluct_correlation_npar0_lh < Inf).
0413 %
0414 if isfield(select,'tail') && select.tail,% add default tail model
0415     if ~isfield(select,'tail_struct)'),
0416         tail_struct.dtn = Inf;
0417         tail_struct.mode = 3;% mode for tail spectrum : (0) no tail model, (1)  Gaussian, (2) Linear, (3) calc_tail_jd
0418         tail_struct.bNparmax_tail = 0;%npar0 extend from npar_antenna to Nparmax_tail. If Nparmax_tail is NaN or empty, it is calculated by the code in main_rayinit_launch_jd.m -> 6.5/sqrt(Te0)
0419         tail_struct.bn_tail = 0;%number of lobes to describe the tail. If n_tail = 0, no tail up to Nparmax_tail (no used if linear_tail is chosen)
0420         tail_struct.bP_tail = 0.5;%Power fraction in the tail. If NaN, it is calculated from n_tail and opt_tail (no used if linear_tail is chosen)
0421         tail_struct.bopt_tail = 1 + 1i;%Final power fraction of the tail @ Nparmax_tail (+1i) Adjust initial dNpar0 such that initial and tail lobes have the same width
0422     else
0423         tail_struct = select.tail_struct;
0424     end
0425     launch.tail = tail_struct;
0426     %
0427 elseif length(launch.bNpar0) <= 2,%only if one may main lobe in one or two directions
0428     %
0429     tail_opt = input_dke_yp('Do you want to describe the launched power spectrum with the tail model (npar0 fluctuations) [y/n]','n',{'y','n'},'',[1,1]);
0430     %
0431     if strcmp(tail_opt,'y'),
0432     
0433         if ~isfield(select,'tail_struct)'),
0434             dtn_fluct_correlation_npar0_lh = Inf;
0435             tail_mode = 3;% mode for tail spectrum : (0) no tail model, (1)  Gaussian, (2) Linear, (3) calc_tail_jd
0436             Nparmax_tail = 0;%npar0 extend from npar_antenna to Nparmax_tail. If Nparmax_tail is 0, it is calculated by the code in main_rayinit_launch_jd.m -> 6.5/sqrt(Te0)
0437             opt_tail_0 = 0;%Final power fraction of the tail @ Nparmax_tail.
0438             n_tail = 5;%number of lobes to describe the tail. If n_tail = 0, no tail up to Nparmax_tail (tail_mode = 3 only).
0439             P_tail = 0.5;%Power fraction in the tail. If NaN, it is calculated from n_tail and opt_tail (tail_mode = 3 only).
0440             dnpar0_tail = 1;% Adjust (1) or not (0) the initial dNpar0 such that intial and tail lobes have the same width (tail_mode = 3 only).
0441             %
0442 
0443 
0444             tail_struct.dtn = dtn_fluct_correlation_npar0_lh;
0445             tail_struct.mode = tail_mode;% mode for tail spectrum : (0)  Gaussian, (1) Linear, (2) calc_tail_jd
0446             tail_struct.bNparmax_tail = Nparmax_tail;%npar0 extend from npar_antenna to Nparmax_tail. If Nparmax_tail is NaN or empty, it is calculated by the code in main_rayinit_launch_jd.m -> 6.5/sqrt(Te0)
0447             tail_struct.bn_tail = n_tail;%number of lobes to describe the tail. If n_tail = 0, no tail up to Nparmax_tail (no used if linear_tail is chosen)
0448             tail_struct.bP_tail = P_tail;%Power fraction in the tail. If NaN, it is calculated from n_tail and opt_tail (no used if linear_tail is chosen)
0449             tail_struct.bopt_tail = opt_tail_0 + dnpar0_tail*1i;%Final power fraction of the tail @ Nparmax_tail (+1i) Adjust initial dNpar0 such that initial and tail lobes have the same width
0450             %
0451         else
0452             tail_struct = select.tail_struct;
0453         end
0454         %
0455         if tail_mode > 0,
0456             locid_tail = make_tail_simulid_jd(tail_struct);
0457         else
0458             locid_tail = '';
0459         end    
0460         %
0461         launch.tail = tail_struct;
0462         %
0463     end   
0464 end
0465 %
0466 % launch.id = make_launchid_jd(launch);
0467 %
0468 if ~isempty(external),
0469     %
0470     return
0471     %
0472 end
0473 %
0474 % launch.i_ref = -1;%index of the flux surface where the rays are launched
0475 % %
0476 % launch.frequency_GHz = launch.omega_rf/(2*pi*1e9);
0477 % launch.phi0_deg = launch.phi0*180/pi;
0478 % launch.bPlhtot_MW = launch.bPlhtot/1e6;
0479 % launch = rmfield(launch,{'omega_rf','phi0','bPlhtot'});
0480 % %
0481 % launch = imod_struct_jd(launch,'launch',1,opt_gui);
0482 % %
0483 % launch.omega_rf = launch.frequency_GHz*(2*pi*1e9);
0484 % launch.phi0 = launch.phi0_deg*pi/180;
0485 % launch.bPlhtot = launch.bPlhtot_MW*1e6;
0486 % launch = rmfield(launch,{'frequency_GHz','phi0_deg','bPlhtot_MW'});
0487 % %
0488

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