comp_metis

PURPOSE ^

SYNOPSIS ^

function [post_ref,tts] = comp_metis(post,post_ref,fieldlist_time,fieldlist_prof,tmin,tmax,tprof)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [post_ref,tts] = comp_metis(post,post_ref,fieldlist_time,fieldlist_prof,tmin,tmax,tprof)
0002 %
0003 %
0004 %
0005 close all
0006 %
0007 if nargin == 0,
0008     disp('Not enough input arguments for comp_metis.m ');
0009     return;
0010 end
0011 %
0012 if ~isfield(post(1).zerod,'temps'),
0013     disp('ERROR: the post structure does not correspond to a simulated discharge. Run METIS first.');
0014     return;
0015 end
0016 %
0017 if nargin == 1,
0018     post_ref = post;
0019     fieldlist_time = '';
0020     fieldlist_prof = '';
0021     tmin = -Inf;
0022     tmax = +Inf;
0023     tprof = '';
0024 end
0025 %
0026 if nargin == 2
0027     fieldlist_time = '';
0028     fieldlist_prof = '';
0029     tmin = -Inf;
0030     tmax = +Inf;
0031     tprof = '';
0032 end
0033 %
0034 if nargin == 3,
0035     fieldlist_prof = '';
0036     tmin = -Inf;
0037     tmax = +Inf;
0038     tprof = '';
0039 end
0040 %
0041 if nargin == 4,
0042     tmax = +Inf;
0043     tprof = '';
0044 end
0045 %
0046 if ~isempty(post_ref) && nargin > 1,
0047     post_ref = [post_ref,post];
0048     %%%%%comment
0049 else 
0050     post_ref = post;
0051     %%%%%comment
0052 end
0053 %
0054 if isempty(fieldlist_time), 
0055     fieldlist_time = {'pohm','iohm','plh','vloop'};%default field list (time evolution)
0056 end
0057 if isempty(fieldlist_prof), 
0058     fieldlist_prof = {'pohm','plh','jlh'};%default field list (radial profile)
0059 end
0060 %
0061 flag = 1;
0062 %
0063 tts = '';
0064 %
0065 for ii = 1:length(fieldlist_time),
0066     %
0067     fhandle = figure('Name',fieldlist_time{ii});
0068     %
0069     leg = '';
0070     %
0071     ttmin = [];
0072     ttmax = [];
0073     vvmin = [];
0074     vvmax = [];
0075     %
0076     for jj = length(post_ref):-1:1,
0077         %
0078         tt = post_ref(jj).zerod.temps;
0079         vv = post_ref(jj).zerod.(fieldlist_time{ii});
0080         %
0081         imin = max(find(tmin>tt));
0082         imax = min(find(tmax<tt));
0083         %
0084         if isempty(imin), imin = 1;end
0085         if isempty(imax), imax = length(tt);end
0086         %
0087         [cplot,lplot,wplot,splot] = graphclws_yp('clws',jj);
0088         %
0089         leg = [leg;[post_ref(jj).z0dinput.machine,', #',int2str(post_ref(jj).z0dinput.shot)]];
0090         ghandle = graph1D_jd(tt,vv,0,0,'time (s)',fieldlist_time{ii},[post_ref(jj).z0dinput.zsinfo.(fieldlist_time{ii})],leg,[tt(imin),tt(imax)],'',lplot,splot,cplot,wplot,20,gca,1,NaN);        
0091         %
0092         if isempty(ttmin) & isempty(ttmax)
0093             ttmin = tt(imin);
0094             ttmax = tt(imax);
0095             vvmin = min(vv);
0096             vvmax = max(vv);
0097         else
0098             ttmin = min([ttmin,tt(imin)]);
0099             ttmax = max([ttmax,tt(imax)]);
0100             vvmin = min([vvmin,min(vv)]);
0101             vvmax = max([vvmax,max(vv)]);
0102         end
0103         %
0104     end
0105     %
0106     if flag == 1,
0107         %
0108         disp(flag);
0109         [tts,vvs] = ginput(1);%set one point for radial display
0110         %
0111         if (ttmin < tts) & (tts < ttmax),
0112             disp(['Time ',num2str(tts),' (s) selected.'])
0113             flag = 0;
0114         else
0115             tts = '';
0116             disp('No time not selected.');
0117         end
0118     end
0119     %
0120     if ~isempty(tts),%plot reference time
0121         ax = gca;    
0122         line([tts,tts],ax.YLim,'LineStyle','--','Color','k')
0123     end
0124 end
0125 %
0126 profinfo = z0dprofinfo;%get prof definitions
0127 %
0128 for ii = 1:length(fieldlist_prof),
0129     %
0130     
0131     fhandle = figure('Name',[fieldlist_prof{ii},' prof']);
0132     %
0133     leg = '';
0134     %
0135     for jj = length(post_ref):-1:1,
0136     %
0137         xli = post_ref(jj).profil0d.xli;
0138         iref = max(find(post_ref(jj).profil0d.temps < tts));
0139         %
0140         vvr = post_ref(jj).profil0d.(fieldlist_prof{ii})(iref,:);
0141         ttr = post_ref(jj).profil0d.temps(iref);
0142         %
0143         [cplot,lplot,wplot,splot] = graphclws_yp('clws',jj);
0144         %
0145         leg = [leg;[post_ref(jj).z0dinput.machine,', #',int2str(post_ref(jj).z0dinput.shot),', @ ',num2str(ttr),' (s)']];
0146         ghandle = graph1D_jd(xli,vvr,0,0,'r/a (Li coordinates)',fieldlist_prof{ii},[profinfo.(fieldlist_prof{ii})],leg,[0,1],'',lplot,splot,cplot,wplot,20,gca,1,NaN);
0147         %
0148     end
0149     %
0150     dtt = max(gradient(post_ref(jj).profil0d.temps));
0151     %
0152     set(fhandle,'Units','pixels');
0153     windowSize = get(fhandle,'Position');
0154     %
0155     shandle = uicontrol('Style','slider','Min',ttmin,'Max',ttmax,'Value',ttr,'SliderStep',[dtt dtt*2],'Position', [20 10 windowSize(3)-40 20]);
0156     addlistener(shandle,'ContinuousValueChange',{@myupdatefcn,ghandle,post_ref,fieldlist_prof{ii}});
0157    
0158 end
0159

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