0001 function [equil_magnetic,prho_out,pspsin_out,pspsinT_out,pp_out] = make_helmex77(shotnum,shotime,t1,t2,basestr,savename)
0002
0003
0004
0005
0006
0007
0008
0009 npsi = 101;
0010 ntheta = 65;
0011
0012 if strcmp(basestr,'TS'),
0013
0014 xpoint(1) = 1;
0015 xpoint(2) = 0;
0016 xpoint(3) = 0;
0017 xpoint(4) = 0;
0018 xpoint(5) = 1;
0019 xpoint(6) = 0;
0020 xpoint(7) = 0;
0021 xpoint(8) = 0;
0022
0023 while 1,
0024 certif = input_dke_yp('Enter a certification for ''tprof'' data: (-1) exit, 0 (no certification), 1, 2, 3, 4',0,{-1,0,1,2,3,4},'Invalid selection');
0025 if certif == -1,
0026 return
0027 end
0028
0029 [flag,ap,Rp,Zp,Bt,Ip,qmin,eq,qopt,Zi,mi,fi,Te0,Tea,eTe1,eTe2,ne0,nea,ene1,ene2,Ti0,Tia,eTi1,eTi2,Zeff0,Zeffa,eZeff,xZeff,vloop] = load_tprof_tsbase_yp(shotnum,certif,str2num(shotime),t1,t2,basestr);
0030 if isempty(ap),
0031 disp(['WARNING: No ''tprof'' data do not exist for shot #',shotnum,' and certification ',int2str(certif),'. Please try another certification or exit.']);
0032 disp('WARNING: Contact T. Aniel or the CDIV for creating missing tprof data');
0033 else
0034 break
0035 end
0036 end
0037
0038 while 1,
0039 certif = input_dke_yp('Enter a certification for ''thyb'' data: (-1) exit, 0 (no certification), 1, 2, 3, 4',0,{-1,0,1,2,3,4},'Invalid selection');
0040 if certif == -1,
0041 clear('LH');
0042 break
0043 end
0044
0045 [flag_LH,LH] = load_LH_tsbase_yp(shotnum,certif,str2num(shotime),t1,t2,basestr);
0046 if isempty(LH),
0047 disp(['WARNING: No ''thyb'' data do not exist for shot #',shotnum,' and certification ',int2str(certif),'. Please try another certification or exit.']);
0048 else
0049 break
0050 end
0051 end
0052
0053 while 1,
0054 certif = input_dke_yp('Enter a certification for ''tfce'' data: (-1) exit, 0 (no certification), 1, 2, 3, 4',0,{-1,0,1,2,3,4},'Invalid selection');
0055 if certif == -1,
0056 clear('EC');
0057 break
0058 end
0059
0060 [flag_EC,EC] = load_EC_tsbase_yp(shotnum,certif,str2num(shotime),t1,t2,basestr);
0061 if isempty(EC),
0062 disp(['WARNING: No ''tfce'' data do not exist for shot #',shotnum,' and certification ',int2str(certif),'. Please try another certification or exit.']);
0063 else
0064 break
0065 end
0066 end
0067
0068 else
0069 disp('The use of HELENA (helmex77) is not yet implemented for this machine experimental database.');
0070 return
0071 end
0072
0073
0074
0075 [prho,pTe,pne,pzTi,pzni,zZi,zmi,fi,pkin] = idealprof_yp(Zi,mi,fi,Te0,Tea,eTe1,eTe2,ne0,nea,ene1,ene2,Ti0,Tia,eTi1,eTi2,Zeff0,Zeffa,eZeff,xZeff,npsi);
0076
0077 [ppsin,ppsi_apRp,theta,x,y,Bx,By,BPHI,pBpp,pq_Rpap,pj,pmag,Ip_test] = idealequilcyl_yp(ap,Rp,Zp,Bt,Ip,qmin*Rp/ap,eq,qopt,npsi,ntheta);
0078
0079 pj_min = min(pj);
0080 if pj_min < 0,pj = pj - pj_min;end,
0081 [equil_magnetic,prho_out,pspsin_out,pspsinT_out,pp_out] = equil_magnetic_helmex77_yp(ap,Rp,Zp,xpoint,Bt,Ip,ppsi_apRp*Rp/ap,pj,pkin,ntheta,1);
0082
0083
0084
0085 prho = prho_out;
0086 if flag_LH & flag_EC,
0087 save(savename,'prho','pne','pTe','pzTi','pzni','zZi','zmi','fi','vloop','LH','EC');
0088 elseif flag_LH & ~flag_EC,
0089 save(savename,'prho','pne','pTe','pzTi','pzni','zZi','zmi','fi','vloop','LH');
0090 elseif ~flag_LH & flag_EC,
0091 save(savename,'prho','pne','pTe','pzTi','pzni','zZi','zmi','fi','vloop','EC');
0092 else
0093 save(savename,'prho','pne','pTe','pzTi','pzni','zZi','zmi','fi','vloop');
0094 end
0095
0096