make_helmex77

PURPOSE ^

LUKE - Create a magnetic equilibrium structure for C3PO/LUKE using HELENA code using the Tore Supra database

SYNOPSIS ^

function [equil_magnetic,prho_out,pspsin_out,pspsinT_out,pp_out] = make_helmex77(shotnum,shotime,t1,t2,basestr,savename)

DESCRIPTION ^

 LUKE - Create a magnetic equilibrium structure for C3PO/LUKE using HELENA code using the Tore Supra database

   Create a magnetic equilibrium structure for C3PO/LUKE using HELENA code
   using the Tore Supra database (mex file version)

   by Y. Peysson (CEA/DSM/IRFM,yves.peysson@cea.fr) and J. Decker (CEA/DSM/IRFM,joan.decker@cea.fr)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [equil_magnetic,prho_out,pspsin_out,pspsinT_out,pp_out] = make_helmex77(shotnum,shotime,t1,t2,basestr,savename)
0002 % LUKE - Create a magnetic equilibrium structure for C3PO/LUKE using HELENA code using the Tore Supra database
0003 %
0004 %   Create a magnetic equilibrium structure for C3PO/LUKE using HELENA code
0005 %   using the Tore Supra database (mex file version)
0006 %
0007 %   by Y. Peysson (CEA/DSM/IRFM,yves.peysson@cea.fr) and J. Decker (CEA/DSM/IRFM,joan.decker@cea.fr)
0008 %
0009 npsi = 101;%ONLY 101 radial profile grid points for HELMEX77
0010 ntheta = 65;%ONLY 65 poloidal grid points for HELMEX77
0011 %
0012 if strcmp(basestr,'TS'),
0013     %
0014     xpoint(1) = 1;%Vertical position of the top X point
0015     xpoint(2) = 0;%Horizontal position of the top X point
0016     xpoint(3) = 0;%Angle between the separatrix and the horizontal plane for the top X point (degree)
0017     xpoint(4) = 0;%Angle between the separatrix and the horizontal plane for the top X point (degree)
0018     xpoint(5) = 1;%Vertical position of the bottom X point (always positive value)
0019     xpoint(6) = 0;%Horizontal position of the bottom X point
0020     xpoint(7) = 0;%Angle between the separatrix and the horizontal plane for the bottom X point (degree)
0021     xpoint(8) = 0;%Angle between the separatrix and the horizontal plane for the bottom X point (degree)
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),%tprof data are not documented for this shot and this certification
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),%thyb data are not documented for this shot and this certification
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),%tfce data are not documented for this shot and this certification
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 % Create guess magnetic equilibrium
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);%Profiles
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);%Cylindrical magnetic equilibrium
0078 %
0079 pj_min = min(pj); 
0080 if pj_min < 0,pj = pj - pj_min;end,%pj must be non-negative. Only the shape is considered and Ip for the total plasma current
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 % Data saving for imake_equil_jd and the consistency with other machines
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 %

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