main_launch_toray_jd

PURPOSE ^

SYNOPSIS ^

function launch = main_launch_toray_jd(filename,omega_rf,P0,method);

DESCRIPTION ^

 This function creates the launch structure based on TORAY input file "filename"

 OUTPUTS:

   -structure launch:
       - omega_rf : wave angular frequency (rad/s)
       - yR_L : major radius position of launching (m)
       - yZ_L : vertical position of launching (m)
       - yphi_L : toroidal angle position of launching (rad), (R,Z,phi) right handed
       - yalpha_L : horizontal angle with respect to R (rad)
       - ybeta_L : vertical angle with respect to Z (rad) 
       - yP_L : power launched in the ray (W)

 by J. Decker (RLE/MIT) <jodecker@mit.edu> and Y. Peysson (DRFC/DSM/CEA) <yves.peysson@cea.fr>

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function launch = main_launch_toray_jd(filename,omega_rf,P0,method);
0002 %
0003 % This function creates the launch structure based on TORAY input file "filename"
0004 %
0005 % OUTPUTS:
0006 %
0007 %   -structure launch:
0008 %       - omega_rf : wave angular frequency (rad/s)
0009 %       - yR_L : major radius position of launching (m)
0010 %       - yZ_L : vertical position of launching (m)
0011 %       - yphi_L : toroidal angle position of launching (rad), (R,Z,phi) right handed
0012 %       - yalpha_L : horizontal angle with respect to R (rad)
0013 %       - ybeta_L : vertical angle with respect to Z (rad)
0014 %       - yP_L : power launched in the ray (W)
0015 %
0016 % by J. Decker (RLE/MIT) <jodecker@mit.edu> and Y. Peysson (DRFC/DSM/CEA) <yves.peysson@cea.fr>
0017 %
0018 if nargin < 4,
0019     method = 1;
0020 end
0021 %
0022 launch.omega_rf = omega_rf;
0023 %
0024 if method == 1,
0025     %
0026     % method 1
0027     %
0028     [ny] = textread(filename,'%n',1);
0029     [yX_L,yY_L,yZ_L,ybeta_L,yalpha_L] = textread(filename,'%n%n%n%n%n',ny+1);
0030     %
0031     yX_L = yX_L(2:ny+1).'; 
0032     yY_L = yY_L(2:ny+1).';
0033     yZ_L = yZ_L(2:ny+1).';
0034     ybeta_L = ybeta_L(2:ny+1).';
0035     yalpha_L = yalpha_L(2:ny+1).';
0036     %
0037 else
0038     %
0039     % method 2
0040     %
0041     fid = fopen(filename);
0042     ny = fscanf(fid,'%d',1);
0043     for iray = 1:ny,
0044         raydata = fscanf(fid,'%f',5);
0045         yX_L(iray) = raydata(1);
0046         yY_L(iray) = raydata(2);
0047         yZ_L(iray) = raydata(3);
0048         ybeta_L(iray) = raydata(4);
0049         yalpha_L(iray) = raydata(5);
0050     end
0051     fclose(fid);
0052 end
0053 %
0054 % normalization
0055 %
0056 yalpha_L(yalpha_L <= -180) = yalpha_L(yalpha_L <= -180) + 2*180;
0057 yalpha_L(yalpha_L > 180) = yalpha_L(yalpha_L > 180) - 2*180;
0058 %
0059 yX_L = yX_L/1e2;% toroidal X position (cm -> m)
0060 yY_L = yY_L/1e2;% toroidal Y position (cm -> m)
0061 yZ_L = yZ_L/1e2;% toroidal Z position (cm -> m)
0062 ybeta_L = ybeta_L*pi/180;% vertical angle with respect to Z (deg -> rad)
0063 yalpha_L = yalpha_L*pi/180;% horizontal angle with respect to R (deg -> rad)
0064 %
0065 yR_L = sqrt(yX_L.^2 + yY_L.^2);
0066 yX_L(yX_L == 0) = eps;
0067 yphi_L = atan(yY_L./yX_L) + pi*(yX_L < 0 & yY_L > 0) - pi*(yX_L < 0 & yY_L < 0);
0068 %
0069 launch.yR_L = yR_L;
0070 launch.yZ_L = yZ_L;
0071 launch.yphi_L = yphi_L;
0072 launch.yalpha_L = yalpha_L;
0073 launch.ybeta_L = ybeta_L;
0074 %
0075 launch.yP_L = P0/ny*ones(1,ny);
0076 %
0077 
0078 
0079 
0080

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