From 8febe8ee8aad1d3bb46c2280140cd4e40f9366b0 Mon Sep 17 00:00:00 2001 From: Olivier Sauter <olivier.sauter@epfl.ch> Date: Thu, 16 May 2019 09:18:38 +0000 Subject: [PATCH] add write eqdsk as default and add IDA source in fit nete_rho git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@11903 d63d8f72-b253-0410-a779-e742ad2e26cf --- crpptbx/AUG/gdat_aug.m | 56 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/crpptbx/AUG/gdat_aug.m b/crpptbx/AUG/gdat_aug.m index ea2f8b14..c281799c 100644 --- a/crpptbx/AUG/gdat_aug.m +++ b/crpptbx/AUG/gdat_aug.m @@ -955,13 +955,13 @@ elseif strcmp(mapping_for_aug.method,'switchcase') gdat_data.gdat_params.zshift = zshift; end gdat_data.gdat_params.zshift = zshift; - zwrite = 0.; + dowrite = 1; if isfield(gdat_data.gdat_params,'write') && ~isempty(gdat_data.gdat_params.write) - zwrite = gdat_data.gdat_params.write; + dowrite = gdat_data.gdat_params.write; else - gdat_data.gdat_params.write = zwrite; + gdat_data.gdat_params.write = dowrite; end - gdat_data.gdat_params.write = zwrite; + gdat_data.gdat_params.write = dowrite; params_equil = gdat_data.gdat_params; params_equil.data_request = 'equil'; [equil,params_equil,error_status] = gdat_aug(shot,params_equil); @@ -1332,6 +1332,9 @@ elseif strcmp(mapping_for_aug.method,'switchcase') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% case {'ne_rho', 'te_rho', 'nete_rho'} sources_available = {'VTA','IDA','TRA'}; % TRA to be included + if ~isfield(gdat_data.gdat_params,'source') || isempty(gdat_data.gdat_params.source) + gdat_data.gdat_params.source = 'VTA'; % default source + end gdat_data.gdat_params.source = upper(gdat_data.gdat_params.source); if strcmp(gdat_data.gdat_params.source(1:2),'EQ'); warning('set equilibrium choice in ''equil'' parameter and not source, moved to equil') @@ -1341,20 +1344,20 @@ elseif strcmp(mapping_for_aug.method,'switchcase') if ~isempty(intersect({'THOMSON'},gdat_data.gdat_params.source)); gdat_data.gdat_params.source = 'VTA'; end if ~isempty(intersect({'TRANSP'},gdat_data.gdat_params.source)); gdat_data.gdat_params.source = 'TRA'; end if ~isempty(intersect({'IDE'},gdat_data.gdat_params.source)); gdat_data.gdat_params.source = 'IDA'; end - if ~isfield(gdat_data.gdat_params,'source') || isempty(gdat_data.gdat_params.source) - gdat_data.gdat_params.source = 'VTA'; % default source - elseif isempty(intersect(sources_available,upper(gdat_data.gdat_params.source))) + if isempty(intersect(sources_available,gdat_data.gdat_params.source)) error(['available source choices: ' sources_available{:} char(10) ' source: ' gdat_data.gdat_params.source ... ' not implemented, ask O. Sauter' char(10)]); - elseif ~strcmp(upper(gdat_data.gdat_params.source),'VTA') + elseif ~strcmp(gdat_data.gdat_params.source,'VTA') disp(['At this stage .te, .ne, .fit refer to VTA projected on given equil choice. ' char(10) ... 'IDA or TRA profiles are added in .ida or .transp respectively']); end if ~isfield(gdat_data.gdat_params,'fit') || isempty(gdat_data.gdat_params.fit) || ~isnumeric(gdat_data.gdat_params.fit) - if strcmp(upper(gdat_data.gdat_params.source),'VTA') + if strcmp(gdat_data.gdat_params.source,'VTA') gdat_data.gdat_params.fit = 1; % default do fit (only with VTA source requested) else + % fit profiles filled in by IDA, TRA, ... profiles gdat_data.gdat_params.fit = 0; + end end % params_eff = gdat_data.gdat_params; @@ -1522,7 +1525,7 @@ elseif strcmp(mapping_for_aug.method,'switchcase') gdat_data.gdat_params.fit_nb_rho_points = fit_nb_rho_points; % if gdat_data.gdat_params.fit==1 - % add fits + % add "manual" fits gdat_data.fit.t = gdat_data.t; rhotornormfit = linspace(0,1,fit_nb_rho_points)'; gdat_data.fit.rhotornorm = rhotornormfit; @@ -1629,6 +1632,39 @@ elseif strcmp(mapping_for_aug.method,'switchcase') end end end + % add other profiles in fit (without raw data part) + switch gdat_data.gdat_params.source + case 'IDA' + gdat_data.fit.full_path = 'from IDA: Te, Te_unc, ne, ne_unc, rhop and rhot'; + params_eff.data_request={'IDA','','','area-base:rhop'}; + [gdat_data_ida_rhop,params_kin,error_status]=gdat_aug(shot,params_eff); + gdat_data.fit.rhopolnorm = gdat_data_ida_rhop.data; + params_eff.data_request={'IDA','rhot'}; % it is actually rhotor_norm + [gdat_data_te_ida_rhot,params_kin,error_status]=gdat_aug(shot,params_eff); + gdat_data.fit.rhotornorm = gdat_data_te_ida_rhot.data; + if strcmp(data_request_eff(1:4),'nete') || strcmp(data_request_eff(1:2),'te') + % Te + params_eff.data_request={'IDA','Te'}; + [gdat_data_te_ida,params_kin,error_status]=gdat_aug(shot,params_eff); + gdat_data.fit.te.data = gdat_data_te_ida.data; + gdat_data.fit.t = gdat_data_te_ida.t; + params_eff.data_request={'IDA','Te_unc'}; + [gdat_data_te_ida_err,params_kin,error_status]=gdat_aug(shot,params_eff); + gdat_data.fit.te.error_bar = gdat_data_te_ida_err.data; + end + if strcmp(data_request_eff(1:4),'nete') || strcmp(data_request_eff(1:2),'ne') + % ne + params_eff.data_request={'IDA','ne'}; + [gdat_data_ne_ida,params_kin,error_status]=gdat_aug(shot,params_eff); + gdat_data.fit.ne.data = gdat_data_ne_ida.data; + gdat_data.fit.t = gdat_data_ne_ida.t; + params_eff.data_request={'IDA','ne_unc'}; + [gdat_data_ne_ida_err,params_kin,error_status]=gdat_aug(shot,params_eff); + gdat_data.fit.ne.error_bar = gdat_data_ne_ida_err.data; % time as 2nd dim + end + case 'TRA' + otherwise + end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% case {'pgyro'} -- GitLab