0001 function [wavestruct,mod] = iluke_launchmodify(wavestruct,style)
0002
0003 launch = wavestruct.launch;
0004
0005 if isfield(launch,'orig'),
0006 orig = launch.orig;
0007 launch = rmfield(launch,'orig');
0008 else
0009 orig = launch;
0010 end
0011
0012 type = launch.type;
0013 launch = rmfield(launch,'type');
0014
0015 if strcmp(type,'EC'),
0016
0017 launch.frequency_GHz = launch.omega_rf/(2*pi*1e9);
0018 launch.yP_L_kW = launch.yP_L/1e3;
0019 launch.yphi_L_deg = launch.yphi_L*180/pi;
0020 launch.yalpha_L_deg = launch.yalpha_L*180/pi;
0021 launch.ybeta_L_deg = launch.ybeta_L*180/pi;
0022
0023 launch = rmfield(launch,{'omega_rf','yP_L','yphi_L','yalpha_L','ybeta_L'});
0024 if isfield(launch,'angles'),
0025 launch = rmfield(launch,'angles');
0026 end
0027
0028 elseif strcmp(type,'LH'),
0029
0030 launch.frequency_GHz = launch.omega_rf/(2*pi*1e9);
0031 launch.bPlhtot_MW = launch.bPlhtot/1e6;
0032 launch.phi0_deg = launch.phi0*180/pi;
0033 rZ0 = launch.rZ0;
0034 nrZ0 = length(rZ0);
0035 if nrZ0 > 3,
0036 launch.nrZ0 = nrZ0;
0037 if all(rZ0 > 0),
0038 launch.module = 'upper';
0039 elseif all(rZ0 < 0),
0040 launch.module = 'lower';
0041 else
0042 launch.module = 'full antenna';
0043 end
0044 launch = rmfield(launch,'rZ0');
0045 end
0046
0047 if any(imag(launch.bNpar0) ~= 0),
0048 launch.bNy = real(launch.bNpar0);
0049 launch.bNz = imag(launch.bNpar0);
0050 launch = rmfield(launch,'bNpar0');
0051 end
0052
0053 if isfield(launch,'tail') && isfield(launch.tail,'bopt_tail'),
0054 launch.tail.h_tail = real(launch.tail.bopt_tail);
0055 launch.tail.opt_dnpar0 = imag(launch.tail.bopt_tail) == 1;
0056 launch.tail = rmfield(launch.tail,'bopt_tail');
0057 end
0058
0059 launch = rmfield(launch,{'omega_rf','bPlhtot','phi0'});
0060 if isfield(launch,'aloha'),
0061 launch = rmfield(launch,'aloha');
0062 end
0063
0064 end
0065
0066 [launch,mod] = imod_struct_jd(launch,'launch',1,true,struct,style);
0067
0068 if any(mod),
0069
0070 if strcmp(type,'EC'),
0071
0072 launch.omega_rf = launch.frequency_GHz*(2*pi*1e9);
0073 launch.yP_L = launch.yP_L_kW*1e3;
0074 launch.yphi_L = launch.yphi_L_deg*pi/180;
0075 launch.yalpha_L = launch.yalpha_L_deg*pi/180;
0076 launch.ybeta_L = launch.ybeta_L_deg*pi/180;
0077
0078 launch = rmfield(launch,{'frequency_GHz','yP_L_kW','yphi_L_deg','yalpha_L_deg','ybeta_L_deg'});
0079
0080 elseif strcmp(type,'LH'),
0081
0082 if nrZ0 > 3,
0083 mrZ0 = mean(rZ0);
0084 rZ0 = rZ0 - mrZ0;
0085
0086
0087
0088 if rem(nrZ0,2) == 0,
0089 rZ0min = rZ0(nrZ0/2+1) - (rZ0(nrZ0/2+2) - rZ0(nrZ0/2+1))/2;
0090 else
0091 rZ0min = rZ0((nrZ0+1)/2+1) - (rZ0((nrZ0+1)/2+2) - rZ0((nrZ0+1)/2+1))/2;
0092 end
0093
0094 rZ0max = rZ0(nrZ0) + (rZ0(nrZ0) - rZ0(nrZ0-1))/2;
0095
0096 if rem(launch.nrZ0,2) == 0,
0097 rZ0_S = linspace(rZ0min,rZ0max,launch.nrZ0/2 + 1);
0098 rZ0 = (rZ0_S(1:end-1) + rZ0_S(2:end))/2;
0099 rZ0 = [-fliplr(rZ0),rZ0];
0100 else
0101 rZ0_S = linspace(rZ0min,rZ0max,(launch.nrZ0-1)/2 + 1);
0102 rZ0 = (rZ0_S(1:end-1) + rZ0_S(2:end))/2;
0103 rZ0 = [-fliplr(rZ0),0,rZ0];
0104 end
0105
0106 if strcmp(launch.module,'upper'),
0107 rZ0 = rZ0(rZ0 >= 0);
0108 elseif strcmp(launch.module,'lower'),
0109 rZ0 = rZ0(rZ0 <= 0);
0110 end
0111
0112 rZ0 = rZ0 + mrZ0;
0113
0114 launch = rmfield(launch,{'nrZ0','module'});
0115
0116 launch.rZ0 = rZ0;
0117
0118 end
0119
0120 launch.omega_rf = launch.frequency_GHz*(2*pi*1e9);
0121 launch.bPlhtot = launch.bPlhtot_MW*1e6;
0122 launch.phi0 = launch.phi0_deg*pi/180;
0123
0124 launch = rmfield(launch,{'frequency_GHz','bPlhtot_MW','phi0_deg'});
0125
0126 if isfield(launch,'bNy') && isfield(launch,'bNz'),
0127 launch.bNpar0 = launch.bNy + 1i*launch.bNz;
0128 launch = rmfield(launch,{'bNy','bNz'});
0129 end
0130
0131 if isfield(launch,'tail') && isfield(launch.tail,'h_tail') && isfield(launch.tail,'opt_dnpar0'),
0132 launch.tail.bopt_tail = launch.tail.h_tail + 1i*launch.tail.opt_dnpar0;
0133 launch.tail = rmfield(launch.tail,{'h_tail','opt_dnpar0'});
0134 end
0135 end
0136
0137 launch.type = type;
0138 launch.orig = orig;
0139
0140 wavestruct.launch = launch;
0141 wavestruct.id = [wavestruct.wavesolver,'_',wavestruct.launch.id];
0142
0143 end
0144
0145 mod = any(mod);
0146