imake_launch_EC_jd

PURPOSE ^

SYNOPSIS ^

function launch = imake_launch_EC_jd(basestr,equil,external,opt_gui,select)

DESCRIPTION ^

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function launch = imake_launch_EC_jd(basestr,equil,external,opt_gui,select)
0002 %
0003 % This function builts the launch structure for LH waves from external and/or user-specified data
0004 %
0005 if nargin < 5,
0006     select = struct;
0007 end
0008 if nargin < 4,
0009     opt_gui = false;
0010 end
0011 if nargin < 3,
0012     external = '';
0013 end
0014 %
0015 if nargin < 2,
0016     error('Not enough arguments')
0017 end
0018 %
0019 if ~isempty(external),
0020     %
0021     if strcmp(basestr,'EAST'),
0022         %
0023         Pec = [];
0024         %
0025         if isfield(external,'mirror_140GHz')
0026             Pec = [Pec,external.mirror_140GHz.total_launched_power.power*1e6];
0027         end
0028         %
0029         if isfield(external,'mirror_170GHz')
0030             Pec = [Pec,external.mirror_170GHz.total_launched_power.power*1e6];
0031         end
0032         %
0033         disp(['----> Injected EC power: ',num2str(Pec/1e6),' MW']);
0034         %
0035         fexternal = fieldnames(external);
0036         %
0037         if isfield(select,'a_opt'),
0038             a_opt = select.a_opt;
0039         else
0040             a_str = '';
0041             for iw = 1:length(fexternal),
0042                 a_str = [a_str,' (',num2str(iw),') ',fexternal{iw},','];
0043             end
0044             %
0045             if iw > 1,
0046                 %
0047                 a_opt = input_dke_yp(['Please select a mirror :',a_str],1,1:iw,'',[1,1]);
0048                 %
0049             else
0050                 a_opt = 1;
0051             end
0052         end
0053         %
0054         frequency = external.(fexternal{a_opt}).frequency;
0055         position = external.(fexternal{a_opt}).position;
0056         %
0057         launch.id = fexternal{a_opt};
0058         launch.phi0 = 0;
0059         launch.omega_rf = 2*pi*1e9*frequency.fec;
0060         %
0061         ny = 1;%Number of rays
0062         %
0063         launch.yZ_L = position.Z;  
0064         launch.yR_L = position.R;  
0065         launch.yphi_L = pi/180.*position.phi;  
0066         launch.yalpha_L = pi/180.*position.alpha;
0067         launch.ybeta_L = pi/180.*position.beta;
0068         launch.yP_L = Pec;
0069         %
0070         if length(launch.yP_L) == 1,
0071             launch.yP_L = launch.yP_L*ones(1,ny)/ny;
0072         elseif any(size(launch.yP_L) ~= [1,ny]),
0073             error('Wrong dimension for power array')
0074         end
0075         %
0076         if ny == 1,
0077             launch.w0 = position.beam_width; 
0078             launch.z0 = position.length_focus; 
0079         end
0080         %
0081     else
0082         %
0083         error(['-----> wave data not yet implemented for :',basestr]);
0084         %
0085     end
0086     %
0087 else
0088     %
0089     launch.omega_rf = 2*pi*1e9*input_dke_yp('Wave frequency (GHz)',[],[0;Inf],'',[1,1]);
0090     %
0091     ny = input_dke_yp('Number of rays',1,1:20,'',[1,1]);  
0092     %
0093     launch.yZ_L = input_dke_yp('Vertical position of launching (m)',0*ones(1,ny),[-Inf;Inf],'',[1,ny]);  
0094     launch.yR_L = input_dke_yp('Major radius position of launching \n  (enter ''NaN'' if launching from LCFS on LFS) (m)',NaN*ones(1,ny),[],'',[1,ny]);  
0095     launch.yphi_L = pi/180*input_dke_yp('Toroidal position of launching (deg)',0*ones(1,ny),[-180;180],'',[1,ny]);  
0096     launch.yalpha_L = pi/180*input_dke_yp('Horizontal launching angle (with respect to R axis) (deg)',180*ones(1,ny),[-180;180],'',[1,ny]);  
0097     launch.ybeta_L = pi/180*input_dke_yp('Vertical launching angle (with respect to Z axis) (deg)',90*ones(1,ny),[0;180],'',[1,ny]);  
0098     launch.yP_L = 1e6*input_dke_yp('Power in each ray (MW)\n  (scalar for total power uniform distributed)',1,[0;Inf],'',[1,1]);  
0099     %
0100     if length(launch.yP_L) == 1,
0101         launch.yP_L = launch.yP_L*ones(1,ny)/ny;
0102     elseif any(size(launch.yP_L) ~= [1,ny]),
0103         error('Wrong dimension for power array')
0104     end
0105     %
0106     if ny == 1,
0107         launch.w0 = input_dke_yp('Beam width (m)',[],[0;Inf],'',[1,1]);
0108         launch.z0 = input_dke_yp('Distance to focal point (m)',0,[-Inf;Inf],'',[1,1]);
0109     end
0110     %
0111     launch.id = input_dke_yp('Provide an id for this launching structure','');
0112     %
0113 end
0114 %
0115 
0116

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