0001 function equil_prof = equil_prof_ACCOME_yp(filename,type,prho,psin,display_mode,p_opt,dispname,savename,Zeff)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 if nargin < 10,
0015 Zeff = NaN;
0016 end
0017 if nargin < 9,
0018 savename = filename;
0019 end
0020 if nargin < 8,
0021 dispname = filename;
0022 end
0023
0024 if nargin < 7,
0025 p_opt = -1;
0026 end
0027
0028 if nargin < 6,
0029 display_mode = 0;
0030 end
0031
0032 method = 'spline';
0033
0034
0035
0036 profname = [filename,'.params'];
0037
0038 if ~exist(profname,'file'),
0039 disp(' ---> Unknown profile file.');
0040 equil_prof = struct();
0041 return;
0042 end
0043
0044 fid = fopen(profname);
0045
0046 npsi = fscanf(fid,'%d',1);
0047 Zimp = fscanf(fid,'%f',1);
0048 mimp = fscanf(fid,'%f',1);
0049
0050 fscanf(fid,'%s',11);
0051 for ipsin=1:npsi,
0052 fscanf(fid,'%d',1);
0053 ypsin(ipsin) = fscanf(fid,'%f',1);
0054 yne(ipsin) = fscanf(fid,'%f',1);
0055 ynh(ipsin) = fscanf(fid,'%f',1);
0056 ynd(ipsin) = fscanf(fid,'%f',1);
0057 ynt(ipsin) = 0.0;
0058 ynimp(ipsin) = fscanf(fid,'%f',1);
0059 fscanf(fid,'%f',1);
0060 yTe(ipsin) = fscanf(fid,'%f',1);
0061 yTi(ipsin) = fscanf(fid,'%f',1);
0062 yZeff(ipsin) = fscanf(fid,'%f',1);
0063 ynisne(ipsin) = fscanf(fid,'%f',1);
0064 end
0065
0066 fclose(fid);
0067
0068 zZi = [1,1,1,Zimp];
0069 zmi = [1,2,3,mimp];
0070 fi = [1,1,0];
0071 yTe = yTe/1000;
0072 yTi = yTi/1000;
0073 yzTi = [1;1;0;1]*yTi;
0074 yzni = [ynh;ynd;ynt;ynimp];
0075
0076 if ~isempty(prho),
0077 pTe = interp1(yrho,yTe,prho,method);
0078 pne = interp1(yrho,yne,prho,method);
0079 pzTi = interp1(yrho,yzTi.',prho,method).';
0080 pzni = interp1(yrho,yzni.',prho,method).';
0081
0082 elseif ~isempty(psin),
0083 pTe = interp1(ypsin,yTe,psin,method);
0084 pne = interp1(ypsin,yne,psin,method);
0085 pzTi = interp1(ypsin,yzTi.',psin,method).';
0086 pzni = interp1(ypsin,yzni.',psin,method).';
0087 end
0088
0089
0090
0091 equil_prof.zZi = zZi;
0092 equil_prof.zmi = zmi;
0093 equil_prof.pTe = pTe;
0094 equil_prof.pne = pne;
0095 equil_prof.pzTi = pzTi;
0096 equil_prof.pzni = pzni;
0097