diff --git a/crpptbx/AUG/gdat_aug.m b/crpptbx/AUG/gdat_aug.m index 71e6e2685ea86c8c20660594776aa7fcf45797e3..2756caf13787418bf202ebb8d92e8636a03ce7a5 100644 --- a/crpptbx/AUG/gdat_aug.m +++ b/crpptbx/AUG/gdat_aug.m @@ -68,7 +68,6 @@ default_machine = 'aug'; gdat_params.machine=default_machine; gdat_params.doplot = 0; gdat_params.exp_name = 'AUGD'; -gdat_params.equil = 'EQI'; gdat_params.nverbose = 1; % construct list of keywords from global set of keywords and specific AUG set @@ -198,6 +197,10 @@ if (nargin>=ivarargin_first_char) end end data_request_eff = gdat_params.data_request; % in case was defined in pairs +% default equil: +if ~isfield(gdat_params,'equil'); gdat_params.equil = 'EQI'; end +if isfield(gdat_params,'source') && (strcmp(lower(gdat_params.source),'ide') || strcmp(lower(gdat_params.source),'idg') ... + || strcmp(lower(gdat_params.source),'ida')); gdat_params.equil = 'IDE'; end % if it is a request_keyword can obtain description: if ischar(data_request_eff) || length(data_request_eff)==1 @@ -259,6 +262,16 @@ if strcmp(mapping_for_aug.method,'signal') disp(['expects at least 2 cells in expression, mapping_for_aug.expression = ' mapping_for_aug.expression]); return end + % allow changing main source with simple signals, 'source' parameter relates to mapping_for_aug.expression{1} + if ~isfield(gdat_data.gdat_params,'source') || isempty(gdat_data.gdat_params.source) || ~ischar(gdat_data.gdat_params.source) + gdat_data.gdat_params.source = mapping_for_aug.expression{1}; + else + % special case for IDE instead of IDG when FPG is present value + if strcmp(lower(gdat_data.gdat_params.source),'ide') && strcmp(lower(mapping_for_aug.expression{1}),'fpg') + gdat_data.gdat_params.source = 'IDG'; + end + mapping_for_aug.expression{1} = gdat_data.gdat_params.source; + end gdat_data.gdat_params.exp_name = exp_location; [aatmp,error_status]=rdaAUG_eff(shot,mapping_for_aug.expression{1},mapping_for_aug.expression{2},exp_location); if error_status~=0 @@ -765,7 +778,7 @@ elseif strcmp(mapping_for_aug.method,'switchcase') for itime=1:length(time_eqdsks) time_eff = time_eqdsks(itime); % use read_results updated to effectively obtain an eqdsk with sign correct with COCOS=2 - [eqdskAUG, equil_all_t, equil_t_index]=geteqdskAUG(equil,time_eff,gdat_data.gdat_params.zshift); + [eqdskAUG, equil_all_t, equil_t_index]=geteqdskAUG(equil,time_eff,gdat_data.gdat_params.zshift,'source',gdat_data.gdat_params.equil); eqdskAUG.fnamefull = fullfile(['/tmp/' getenv('USER')],['EQDSK_' num2str(shot) 't' num2str(time_eff,'%.4f')]); cocos_out = equil.cocos; if isfield(gdat_data.gdat_params,'cocos') && ~isempty(gdat_data.gdat_params.cocos) @@ -838,7 +851,7 @@ elseif strcmp(mapping_for_aug.method,'switchcase') Ri=adapt_rda(Ri,NTIME,M_Rmesh,itotransposeback); [Zj,e]=rdaAUG_eff(shot,DIAG,'Zj',exp_name_eff); Zj=adapt_rda(Zj,NTIME,N_Zmesh,itotransposeback); - [PFM_tree,e]=rdaAUG_eff(shot,DIAG,'PFM',exp_name_eff); + [PFM_tree,e]=rdaAUG_eff(shot,DIAG,'PFM','-raw','-exp',exp_name_eff); % -raw necessary for IDE PFM_tree=adaptPFM_rda(PFM_tree,M_Rmesh,N_Zmesh,NTIME); [Pres,e]=rdaAUG_eff(shot,DIAG,'Pres',exp_name_eff); Pres=adapt_rda(Pres,NTIME,2*ndimrho,itotransposeback); @@ -850,7 +863,7 @@ elseif strcmp(mapping_for_aug.method,'switchcase') else FFP.value=NaN*ones(NTIME,max(Lpf1_t)); end - if strcmp(DIAG,'EQI') || strcmp(DIAG,'EQH') + if strcmp(DIAG,'EQI') || strcmp(DIAG,'EQH') || strcmp(DIAG,'IDE') [Rinv,e]=rdaAUG_eff(shot,DIAG,'Rinv',exp_name_eff); Rinv=adapt_rda(Rinv,NTIME,ndimrho,itotransposeback); [R2inv,e]=rdaAUG_eff(shot,DIAG,'R2inv',exp_name_eff); @@ -859,8 +872,12 @@ elseif strcmp(mapping_for_aug.method,'switchcase') Bave=adapt_rda(Bave,NTIME,ndimrho,itotransposeback); [B2ave,e]=rdaAUG_eff(shot,DIAG,'B2ave',exp_name_eff); B2ave=adapt_rda(B2ave,NTIME,ndimrho,itotransposeback); - [FTRA,e]=rdaAUG_eff(shot,DIAG,'FTRA',exp_name_eff); - FTRA=adapt_rda(FTRA,NTIME,ndimrho,itotransposeback); + if strcmp(DIAG,'IDE') + FTRA.value=[]; + else + [FTRA,e]=rdaAUG_eff(shot,DIAG,'FTRA',exp_name_eff); + FTRA=adapt_rda(FTRA,NTIME,ndimrho,itotransposeback); + end else Rinv.value=[]; R2inv.value=[]; Bave.value=[]; B2ave.value=[]; FTRA.value=[]; end @@ -1058,7 +1075,7 @@ elseif strcmp(mapping_for_aug.method,'switchcase') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% case {'ne_rho', 'te_rho', 'nete_rho'} if ~isfield(gdat_data.gdat_params,'fit') || isempty(gdat_data.gdat_params.fit) || ~isnumeric(gdat_data.gdat_params.fit) - gdat_data.gdat_params.fit = 0; + gdat_data.gdat_params.fit = 1; % default do fit end params_eff = gdat_data.gdat_params; params_eff.data_request=data_request_eff(1:2); % start with ne if nete_rho diff --git a/crpptbx/AUG/geteqdskAUG.m b/crpptbx/AUG/geteqdskAUG.m index ac5731f4e3467e54dbbae693620b132033df0051..83dd2d242e8f0a021d4f3e9a4710d13bc49f119c 100644 --- a/crpptbx/AUG/geteqdskAUG.m +++ b/crpptbx/AUG/geteqdskAUG.m @@ -4,6 +4,11 @@ function [eqdskAUG, equil_all_t, equil_t_index]=geteqdskAUG(shot,time,zshift,var % % if shot is a structure assumes obtained from gdat(shot,'equil',...); % +% varargin{1:2}: 'source','EQI' (default) or 'source','IDE' (used in gdat(...,'equil') ) +% +% [eqdskAUG, equil_all_t, equil_t_index]=geteqdskAUG(shot,time); +% [eqdskAUG, equil_all_t, equil_t_index]=geteqdskAUG(shot,time,[],'source','IDE'); +% % you can then do: % write_eqdsk('fname',eqdskAUG,17); % EQI is COCOS=17 by default % write_eqdsk('fname',eqdskAUG,[17 11]); % if you want an ITER version with COCOS=11 @@ -21,14 +26,27 @@ else time_eff = time; end -if ~exist('zshift') +if ~exist('zshift') || isempty(zshift) || ~isnumeric(zshift) zshift_eff = 0.; % no shift else zshift_eff = zshift; end +if nargin >= 5 && ~isempty(varargin{1}) + if ~isempty(varargin{2}) + equil_source = varargin{2} + else + disp(['Warning source for equil in geteqdskAUG not defined']); + return; + end +else + equil_source = 'EQI'; +end +equilpar_source = 'FPG'; +if strcmp(lower(equil_source),'ide'); equilpar_source = 'IDG'; end + if isnumeric(shot) - equil=gdat(shot,'equil'); + equil=gdat(shot,'equil','equil',equil_source); else equil = shot; shot = equil.shot; @@ -78,10 +96,10 @@ fedge=eqdsk.r0.*eqdsk.b0; F2 = psisign.*2.*F2_05 + fedge.^2; eqdsk.F = sqrt(F2)*sign(eqdsk.b0); -rmag=gdat(shot,'rmag'); +rmag=gdat(shot,'rmag','source',equilpar_source); [zz itrmag]=min(abs(rmag.t-time_eff)); eqdsk.raxis = rmag.data(itrmag); -zmag=gdat(shot,'zmag'); +zmag=gdat(shot,'zmag','source',equilpar_source); eqdsk.zaxis = zmag.data(itrmag) - eqdsk.zshift; % get plasma boundary