From c790f1eb8b8296cea2df1c3e7431bcb31746bf81 Mon Sep 17 00:00:00 2001 From: Antonia Frank <antonia.frank@epfl.ch> Date: Tue, 26 Mar 2024 11:37:28 +0100 Subject: [PATCH] Add ec_inputs structure to ec_data call, launching write_pgyro --- matlab/TCV/gdat_tcv.m | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m index 0478fbc4..8aea44db 100644 --- a/matlab/TCV/gdat_tcv.m +++ b/matlab/TCV/gdat_tcv.m @@ -1493,7 +1493,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - case {'ec_data', 'aux', 'h_cd', 'nbi_data', 'ic_data', 'lh_data','ohm_data', 'bs_data'} + case {'ec_data','aux', 'h_cd', 'nbi_data', 'ic_data', 'lh_data','ohm_data', 'bs_data'} % note: same time array for all at main.data level, then individual at .ec, .nbi levels % At this stage fill just eccd, later add nbi sources_avail = {'ec','nbi','ohm','bs'}; % can be set in parameter source @@ -1571,18 +1571,42 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') data_fullpath = ''; ec_help = ''; % EC + + % fill ec_inputs from write_pgyro + [~,time,pgyro,pgyro_ecrh,gyro2launcher,freq2launcher,~,~] = write_pgyro(shot,'doplots',0); + + ec_inputs.pgyro.data = pgyro; + ec_inputs.pgyro.t = time; + ec_inputs.pgyro.units = 'W'; + ec_inputs.pgyro.label = 'Power injected per launcher ; last index is total'; + ec_inputs.pgyro.x = 1:numel(pgyro(1,:)); + ec_inputs.pgyro.dim = {ec_inputs.pgyro.x, ec_inputs.pgyro.t}; + ec_inputs.pgyro.dimunits = {'launcher #1-9/11, total', 's'}; + + ec_inputs.launchers_active = zeros(numel(pgyro_ecrh),1); + for ii =1:numel(pgyro_ecrh) + if ~isempty(pgyro_ecrh{ii}.data); ec_inputs.launchers_active(ii) = 1; end + end + ec_inputs.gyro2launcher.data = gyro2launcher; + ec_inputs.gyro2launcher.label = 'gyrotron connected to launcher'; + + ec_inputs.freq2launcher.data = freq2launcher; + ec_inputs.freq2launcher.label = 'Frequency in launcher'; + ec_inputs.freq2launcher.units = 'Hz'; + + gdat_data.ec.ec_inputs = ec_inputs; + + % fill ec_data from TORAY via astra_tcv_exp outputs if strcmp(lower(source_icd.ec),'toray') if isempty(gdat_data.gdat_params.trialindx) % centralized function for toray nodes [pabs_gyro,icdtot,pow_dens,currentdrive_dens,rho_dep_pow,drho_pow,... - pmax,icdmax,currentdrive_dens_w2,rho_dep_icd,drho_icd,... - ~,power_integrated,currentdrive_integrated] = ... + pmax,icdmax,currentdrive_dens_w2,rho_dep_icd,drho_icd,~,power_integrated,currentdrive_integrated] = ... astra_tcv_EC_exp(shot,[],[],[],[],[],[],1); else % centralized function for toray nodes [pabs_gyro,icdtot,pow_dens,currentdrive_dens,rho_dep_pow,drho_pow,... - pmax,icdmax,currentdrive_dens_w2,rho_dep_icd,drho_icd,... - ~,power_integrated,currentdrive_integrated] = ... + pmax,icdmax,currentdrive_dens_w2,rho_dep_icd,drho_icd,~,power_integrated,currentdrive_integrated] = ... astra_tcv_EC_exp(shot,[],[],[],[],[],gdat_data.gdat_params.trialindx,1); end if gdat_data.mapping_for.tcv.gdat_timedim ==2 -- GitLab