equil_prof_ACCOME_yp

PURPOSE ^

SYNOPSIS ^

function equil_prof = equil_prof_ACCOME_yp(filename,type,prho,psin,display_mode,p_opt,dispname,savename,Zeff)

DESCRIPTION ^

 This function reads the equilibrium profile data from ACCOME

    INPUTS:

        - filename: equilibrium data and save name
        - type: profile data type:(0) for ascii; (1) for .mat
        - display_mode: option for figure display
        - p_opt: option for printing

 by Y.PEYSSON (CEA-DRFC, yves.peysson@cea.fr)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function equil_prof = equil_prof_ACCOME_yp(filename,type,prho,psin,display_mode,p_opt,dispname,savename,Zeff)
0002 %
0003 % This function reads the equilibrium profile data from ACCOME
0004 %
0005 %    INPUTS:
0006 %
0007 %        - filename: equilibrium data and save name
0008 %        - type: profile data type:(0) for ascii; (1) for .mat
0009 %        - display_mode: option for figure display
0010 %        - p_opt: option for printing
0011 %
0012 % by Y.PEYSSON (CEA-DRFC, yves.peysson@cea.fr)
0013 %
0014 if nargin < 10,% & type == 3
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';%'linear';
0033 %
0034 % Reads profile T and n data
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];%Hydrogen + Deuterium plasma (no tritium)
0071 yTe = yTe/1000;%keV
0072 yTi = yTi/1000;%keV
0073 yzTi = [1;1;0;1]*yTi;
0074 yzni = [ynh;ynd;ynt;ynimp];
0075 %
0076 if ~isempty(prho),% profiles given on rho grid
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),% profiles given on poloidal flux based grid
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 % equil structure
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 %

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