0001 function extract_metisdata_for_luke(post)
0002
0003 time = post.profil0d.temps;
0004 nt = length(time);
0005 tmask = NaN(1,nt);
0006 for it = 1:nt,
0007 tmask(it) = find(abs((post.zerod.temps - time(it))/(time(it)+eps)) < 10*eps,1,'first');
0008 end
0009
0010 figure,clf
0011
0012 figtit = 'METIS time grid';
0013
0014 set(gcf,'name',figtit)
0015
0016 xlab = 'METIS time';
0017 ylab = 'LUKE time';
0018 xlim = [0,ceil(max(time))];
0019 ylim = xlim;
0020 tit = 'Select LUKE times and click outside the graphs to exit';
0021 leg = NaN;
0022
0023 plhdisp = post.zerod.plh(tmask)*0.9*ylim(2)/max(post.zerod.plh);
0024 tdisp = zeros(1,nt);
0025
0026 graph1D_jd(time,plhdisp,0,0,'','','',NaN,xlim,ylim,'-','none','g',0.5,20+14i);
0027 graph1D_jd(time,tdisp,0,0,xlab,ylab,tit,leg,xlim,ylim,'none','+','b',2,20+14i,gca,0.9,0.5,0.5);
0028
0029 [t,dummy] = ginput(1);
0030
0031 itsel = [];
0032
0033 while t >= xlim(1) && t <= xlim(2),
0034
0035 it = find(abs(time - t) == min(abs(time - t)),1,'first');
0036 tdisp(it) = time(it);
0037 itsel = tdisp > 0;
0038
0039 clf,
0040
0041 graph1D_jd(time,plhdisp,0,0,'','','',NaN,xlim,ylim,'-','none','g',0.5,20+14i);
0042 graph1D_jd(time(itsel),tdisp(itsel),0,0,'','','',NaN,xlim,ylim,'none','o','r',2,20+14i);
0043 graph1D_jd(time(~itsel),tdisp(~itsel),0,0,xlab,ylab,tit,leg,xlim,ylim,'none','+','b',2,20+14i,gca,0.9,0.5,0.5);
0044
0045 [t,dummy] = ginput(1);
0046
0047 end
0048
0049 tsel2 = input_dke_yp('You can enter additional times for LUKE calculations',[],[xlim(1);xlim(2)]);
0050 nt2 = length(tsel2);
0051 itsel2 = NaN(1,nt2);
0052 for it = 1:nt2,
0053 it2 = find(abs(time - tsel2(it)) == min(abs(time - tsel2(it))),1,'first');
0054 itsel2(it) = it2;
0055 end
0056
0057 itsel = unique([find(itsel),itsel2]);
0058
0059 post.z0dinput.option.luke_mode = 2;
0060
0061 post.z0dinput.option.luke_helena = input_dke_yp('You you want to \n (0) use metis equilibrium\n (1) use helena to recalculate the equilibrium\n (2) load an existing equilibrium\n ?',0,0:2);
0062 post.z0dinput.option.bsigne = input_dke_yp('Direction of the toroidal magnetic field viewed from top\n (1) clockwise\n (-1) anti-clockwise\n ',1,[-1,1]);
0063
0064 for it = itsel,
0065 metis2luke(post,it,1);
0066 end
0067
0068
0069
0070
0071