From 470ccdad394c5277d793b50dcdc443c5065e41ce Mon Sep 17 00:00:00 2001 From: Olivier Sauter <olivier.sauter@epfl.ch> Date: Wed, 19 Mar 2014 07:36:09 +0000 Subject: [PATCH] start adding a geteqdskAUG in AUG git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@4326 d63d8f72-b253-0410-a779-e742ad2e26cf --- crpptbx/AUG/geteqdskAUG.m | 96 +++++++++++++++++++++++++++++++++++++++ crpptbx/AUG/loadAUGdata.m | 21 +++++++-- 2 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 crpptbx/AUG/geteqdskAUG.m diff --git a/crpptbx/AUG/geteqdskAUG.m b/crpptbx/AUG/geteqdskAUG.m new file mode 100644 index 00000000..3ae8968f --- /dev/null +++ b/crpptbx/AUG/geteqdskAUG.m @@ -0,0 +1,96 @@ +function [eqdskAUG]=geteqdskAUG(shot,time,NR,NZ,savedir,deltaz,varargin); +% +% + + +if ~exist('time'); + time_eff = 2.0; +else + time_eff = time; +end + +if ~exist('savedir') + savedir_eff = '.'; +else + savedir_eff = savedir; +end + +if ~exist('deltaz') + deltaz_eff = NaN; % no shift +else + deltaz_eff = deltaz; +end + +equil=gdat(shot,'equil_cliste'); + +[zz it]=min(abs(equil.t-time_eff)); + +eqdsk.cocos=13; +eqdsk.nr = size(equil.Rmesh,1); +eqdsk.nz = size(equil.Zmesh,1); +eqdsk.rmesh = equil.Rmesh(:,it); +eqdsk.zmesh = equil.Zmesh(:,it); +eqdsk.p = equil.pressure(:,it); +eqdsk.pprime = equil.dpressuredpsi(:,it); +eqdsk.FFprime = equil.ffprime(:,it); +eqdsk.q = equil.qvalue(:,it); +eqdsk.psimesh = equil.psi(:,it); +eqdsk.rhopsi = equil.rhopolnorm(:,it); +eqdsk.psi = equil.psi2D(:,:,it); +eqdsk.psirz = equil.psi2D(:,:,it); +eqdsk.rboxlen = equil.Rmesh(end,it) - equil.Rmesh(1,it) ; +eqdsk.rboxleft=eqdsk.rmesh(1); +eqdsk.zboxlen = equil.Zmesh(end,it) - equil.Zmesh(1,it) ; +eqdsk.zmid = 0.5*(equil.Zmesh(end,it) + equil.Zmesh(1,it)) ; +eqdsk.psiaxis = equil.psi_axis(it); +eqdsk.psiedge = equil.psi_lcfs(it); +eqdsk.ip = equil.Ip(it); +eqdsk.stitle=['AUGD equil_cliste t=' num2str(time_eff)]; +eqdsk.ind1=1; + +psisign = sign(eqdsk.psimesh(end)-eqdsk.psimesh(1)); +[dum1,dum2,dum3,F2_05]=interpos(psisign.*eqdsk.psimesh,eqdsk.FFprime,-0.1); + +b0=gdat(shot,'b0'); +[zz itb0]=min(abs(b0.t-time_eff)); +eqdsk.b0 = b0.data(itb0); +eqdsk.r0 = 1.65; +fedge=eqdsk.r0.*eqdsk.b0; +F2 = psisign.*2.*F2_05 + fedge.^2; +eqdsk.F = sqrt(F2); + +rmag=gdat(shot,'rmag'); +[zz itrmag]=min(abs(rmag.t-time_eff)); +eqdsk.raxis = rmag.data(itrmag); +zmag=gdat(shot,'zmag'); +eqdsk.zaxis = zmag.data(itrmag); + +% get plasma boundary +figure +contour(eqdsk.rmesh,eqdsk.zmesh,eqdsk.psi',100) +hold +[hh1 hh2]=contour(eqdsk.rmesh,eqdsk.zmesh,eqdsk.psi',[eqdsk.psiedge eqdsk.psiedge],'k'); +ij=1; +ij_prev = 0; +nbhh1(ij)=hh1(2,ij_prev+1); +Rbnd{ij}=hh1(1,2:1+nbhh1(ij)); +Zbnd{ij}=hh1(2,2:1+nbhh1(ij)); +ij_prev = ij_prev+1+nbhh1(ij); +while (ij_prev+1<size(hh1,2)) + % next + ij=ij + 1; + nbhh1(ij)=hh1(2,ij_prev+1); + Rbnd{ij}=hh1(1,ij_prev+2:ij_prev+1+nbhh1(ij)); + Zbnd{ij}=hh1(2,ij_prev+2:ij_prev+1+nbhh1(ij)); + ij_prev = ij_prev+1+nbhh1(ij); +end +% assume LCFS with most points +[zzz irz]=max(nbhh1); +eqdsk.nbbound = nbhh1(irz); +eqdsk.rplas = Rbnd{irz}; +eqdsk.zplas = Zbnd{irz}; +eqdsk.nblim=5; +eqdsk.rlim=[eqdsk.rmesh(1) eqdsk.rmesh(end) eqdsk.rmesh(end) eqdsk.rmesh(1) eqdsk.rmesh(1)]; +eqdsk.zlim=[eqdsk.zmesh(1) eqdsk.zmesh(1) eqdsk.zmesh(end) eqdsk.zmesh(end) eqdsk.zmesh(1)]; + +eqdskAUG = eqdsk; diff --git a/crpptbx/AUG/loadAUGdata.m b/crpptbx/AUG/loadAUGdata.m index 9e535de1..02b09036 100644 --- a/crpptbx/AUG/loadAUGdata.m +++ b/crpptbx/AUG/loadAUGdata.m @@ -68,7 +68,7 @@ if size(data_type_eff,1)==1 % assumes given a la 'AUGD/MAG/Ipi' or 'ECED/RMP/Trad-A' data_type_eff=[{data_type(i(1)+1:i(2)-1)} ; {data_type(i(2)+1:end)}]; shotfile_exp = data_type(1:i(1)-1); - else + elseif length(i)>2 disp(['more / than expected in tracename: length(i)= ' num2str(length(i))]) data_type end @@ -82,6 +82,9 @@ if size(data_type_eff,1)==1 if ~isempty(strmatch(data_type_eff_noext,[{'ip'} {'i_p'} {'xip'}],'exact')) data_type_eff_noext='Ip'; end + if ~isempty(strmatch(data_type_eff_noext,[{'b0'} {'B0'}],'exact')) + data_type_eff_noext='b0'; + end if ~isempty(strmatch(data_type_eff_noext,[{'Te'} {'t_e'} {'TE'} {'T_e'}],'exact')) data_type_eff_noext='te'; end @@ -124,9 +127,15 @@ if size(data_type_eff,1)==1 if ~isempty(strmatch(data_type_eff_noext,[{'Rmag'}],'exact')) data_type_eff_noext='rmag'; end + if ~isempty(strmatch(data_type_eff_noext,[{'Rgeo'}],'exact')) + data_type_eff_noext='rgeo'; + end if ~isempty(strmatch(data_type_eff_noext,[{'Zmag'}],'exact')) data_type_eff_noext='zmag'; end + if ~isempty(strmatch(data_type_eff_noext,[{'Zgeo'}],'exact')) + data_type_eff_noext='zgeo'; + end if ~isempty(strmatch(data_type_eff_noext,[{'Rcont'}],'exact')) data_type_eff_noext='rcont'; end @@ -143,13 +152,16 @@ else end % all keywords and corresponding case to run below -AUGkeywrdall=[{'Ip'} {'zmag'} {'rmag'} {'rcont'} {'zcont'} {'vol'} {'qrho'} {'qrho_cliste'} {'q95'} {'kappa'} ... +AUGkeywrdall=[{'Ip'} {'b0'} {'zmag'} {'rmag'} {'rgeo'} {'zgeo'} {'rcont'} {'zcont'} {'vol'} {'qrho'} {'qrho_cliste'} {'q95'} {'kappa'} ... {'delta'} {'deltatop'} {'deltabot'} {'neint'} ... {'ne'} {'te'} {'nerho'} {'terho'} {'equil'} {'equil_cliste'} ... {'sxr'} {'sxR'} {'sxb'} {'ece'} {'eced'} {'Halpha'}]; AUGsig.iip=strmatch('Ip',AUGkeywrdall,'exact'); +AUGsig.ib0=strmatch('b0',AUGkeywrdall,'exact'); AUGsig.izmag=strmatch('zmag',AUGkeywrdall,'exact'); AUGsig.irmag=strmatch('rmag',AUGkeywrdall,'exact'); +AUGsig.irgeo=strmatch('rgeo',AUGkeywrdall,'exact'); +AUGsig.izgeo=strmatch('zgeo',AUGkeywrdall,'exact'); AUGsig.ircont=strmatch('rcont',AUGkeywrdall,'exact'); AUGsig.izcont=strmatch('zcont',AUGkeywrdall,'exact'); AUGsig.ivol=strmatch('vol',AUGkeywrdall,'exact'); @@ -201,12 +213,15 @@ AUGsigtimeindx=ones(size(AUGkeywrdall)); AUGsiglocation=cell(2,size(AUGkeywrdall,2)); AUGsiglocation(:)={''}; AUGsiglocation(:,AUGsig.iip)={'MAG'; 'Ipa'}; +AUGsiglocation(:,AUGsig.ib0)={'FPC'; 'BTF'}; % at 1.65m (?) AUGsiglocation(:,AUGsig.izmag)={'FPG'; 'Zmag'}; AUGsiglocation(:,AUGsig.irmag)={'FPG'; 'Rmag'}; +AUGsiglocation(:,AUGsig.irgeo)={'FPG'; 'Rgeo'}; +AUGsiglocation(:,AUGsig.izgeo)={'FPG'; 'Zgeo'}; AUGsiglocation(:,AUGsig.ircont)={'' ; ''}; AUGsigtimeindx(AUGsig.ircont)=2; AUGsiglocation(:,AUGsig.izcont)={'' ; ''}; AUGsigtimeindx(AUGsig.izcont)=2; AUGsiglocation(:,AUGsig.ivol)={''; ''}; -AUGsiglocation(:,AUGsig.iq95)={''; ''}; +AUGsiglocation(:,AUGsig.iq95)={'FPG'; 'q95'}; AUGsiglocation(:,AUGsig.ikappa)={''; ''}; AUGsiglocation(:,AUGsig.ideltatop)={''; ''}; AUGsiglocation(:,AUGsig.ideltabot)={''; ''}; -- GitLab