0001 function equil = fmake_equil_EAST_yp(workdir,shotnum,shotime)
0002
0003 if nargin < 3,error('Not enough input arguments in fmake_equil_EAST_yp.m');end
0004
0005 external = load_externaldata_EAST(workdir,shotnum,shotime,'','',0,'');
0006
0007 display_mode = 0;
0008 p_opt = -1;
0009 basestr = 'EAST';
0010
0011 equil_id = [basestr,'_',shotnum,'_',shotime];
0012 dispname = [basestr,' #',shotnum,'; t = ',shotime,' s'];
0013 savename = equil_id;
0014
0015
0016
0017 [equil_magnetic,prho1,pspsin1,pspsinT1] = equil_magnetic_EFIT_jd(external.equil.magnetic.eqdsk,display_mode,p_opt,dispname,savename);
0018
0019
0020
0021 if strcmp(external.equil.jbdirections.Ip,'clockwise')
0022 signs.Ip = 1;
0023 else
0024 signs.Ip = -1;
0025 end
0026
0027 if strcmp(external.equil.jbdirections.Bt,'clockwise')
0028 signs.Bt = 1;
0029 else
0030 signs.Bt = -1;
0031 end
0032
0033 if signs.Ip*equil_magnetic.psi_apRp(end) < 0,
0034 equil_magnetic.psi_apRp = -equil_magnetic.psi_apRp;
0035 equil_magnetic.ptBx = -equil_magnetic.ptBx;
0036 equil_magnetic.ptBy = -equil_magnetic.ptBy;
0037 end
0038
0039 if signs.Bt*equil_magnetic.ptBPHI(1,1) < 0,
0040 equil_magnetic.ptBPHI = -equil_magnetic.ptBPHI;
0041 end
0042
0043
0044
0045 Zeff = external.equil.prof.species.Zeff;
0046 TeTi = external.equil.prof.TeTi;
0047 frac_H = external.equil.prof.species.frac_H;
0048 frac_D = external.equil.prof.species.frac_D;
0049 Zimp = external.equil.prof.species.Zimp;
0050 Aimp = external.equil.prof.species.Aimp;
0051
0052 if isfield(external.equil,'thomson') == 1 & isfield(external.equil.prof,'rho') == 1,
0053 thomson_mode = input_dke_yp('Do you want to calculate Te and ne profiles from raw Thomson scattering measurements','n',{'y','n'},'',[1,1],'y');
0054 elseif isfield(external.equil,'thomson') == 1 & isfield(external.equil.prof,'rho') == 0,
0055 thomson_mode = 1;
0056 elseif isfield(external.equil,'thomson') == 0 & isfield(external.equil.prof,'rho') == 1,
0057 thomson_mode = 0;
0058 end
0059
0060 if thomson_mode == 1
0061
0062 R_hcn = 1.9;
0063 [equil_magnetic_nete,ne_lav] = EAST_thomson_scattering_Tene_fit(equil_magnetic,external.equil.thomson.R_ts,external.equil.thomson.Z_ts,external.equil.thomson.Te_ts,external.equil.thomson.dTe_ts,external.equil.thomson.ne_ts,external.equil.thomson.dne_ts,R_hcn,0);
0064
0065 prho = prho1;
0066 pTe = equil_magnetic_nete.pTe;
0067 pne = equil_magnetic_nete.pne;
0068
0069 else
0070 ne_lav = '';
0071 prho = external.equil.prof.rho;
0072 pne = external.equil.prof.ne;
0073 pTe = external.equil.prof.Te;
0074 end
0075
0076 pTi = pTe/TeTi;
0077
0078 save([savename,'.prof'],'prho','pne','pTe','pTi','frac_H','frac_D','Zimp','Aimp','Zeff','ne_lav','-mat');
0079
0080 equil_prof = equil_prof_jd([savename,'.prof'],1.4,prho1,pspsin1,pspsinT1,display_mode,p_opt,dispname,savename,Zeff);
0081 equil_prof.ne_lav = ne_lav;
0082
0083 delete([savename,'.prof']);
0084
0085 equil = conc_struct_jd(equil_magnetic,equil_prof);
0086
0087 equil.id = savename;
0088
0089 equil = equilconsistency_yp(equil,'',1);
0090
0091 save(['EQUIL_',savename,'.mat'],'equil');
0092
0093
0094
0095
0096