From 76d351b682514b1922958f32b58156b7d5523ca7 Mon Sep 17 00:00:00 2001 From: Antonia Frank <antonia.frank@epfl.ch> Date: Wed, 24 Jul 2024 16:01:45 +0200 Subject: [PATCH] Correct global quantities that should be not saved as cell array in core_sources --- matlab/TCV_IMAS/tcv_get_ids_core_sources.m | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/matlab/TCV_IMAS/tcv_get_ids_core_sources.m b/matlab/TCV_IMAS/tcv_get_ids_core_sources.m index 527be19c..388d7d17 100644 --- a/matlab/TCV_IMAS/tcv_get_ids_core_sources.m +++ b/matlab/TCV_IMAS/tcv_get_ids_core_sources.m @@ -47,7 +47,7 @@ id_ohm.index = 7; id_ohm.name = 'ohmic'; ids_core_sources.source{last_index+1} = source_template; ids_core_sources.source{last_index+1}.identifier = id_ohm; ids_core_sources.source{last_index+1}.profiles_1d(1:ohm_n_t) = {profiles_template}; -ids_core_sources.source{last_index+1}.global_quantities(1:ohm_n_t) = {globals_template}; +ids_core_sources.source{last_index+1}.global_quantities = globals_template; ohm_data = ohm_gdat.ohm.ohm_data; %fill profiles for times n t_grid @@ -58,10 +58,10 @@ for ii = 1:ohm_n_t ids_core_sources.source{last_index+1}.profiles_1d{ii}.time = ohm_t_grid(ii); ids_core_sources.source{last_index+1}.profiles_1d{ii}.j_parallel = ... ohm_data.cd_dens.data(:,ii)'; - % globals - ids_core_sources.source{last_index+1}.global_quantities{ii}.time = ohm_t_grid(ii); - ids_core_sources.source{last_index+1}.global_quantities{ii}.power = powers_gdat.ohm.data(ii); end + % globals +ids_core_sources.source{last_index+1}.global_quantities.time = ohm_t_grid; +ids_core_sources.source{last_index+1}.global_quantities.power = powers_gdat.ohm.data; last_index = last_index+1; % add if statement to only increment if ohmic source has been added @@ -74,7 +74,7 @@ id_bs.index = 13; id_bs.name = 'bootstrap_current'; ids_core_sources.source{last_index+1} = source_template; ids_core_sources.source{last_index+1}.identifier = id_bs; ids_core_sources.source{last_index+1}.profiles_1d(1:ohm_n_t) = {profiles_template}; -ids_core_sources.source{last_index+1}.global_quantities(1:ohm_n_t) = {globals_template}; +ids_core_sources.source{last_index+1}.global_quantities = globals_template; % fill profiles for times n t_grid @@ -110,7 +110,7 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources ids_core_sources.source{last_index+i_lau} = source_template; ids_core_sources.source{last_index+i_lau}.identifier = id_ec; ids_core_sources.source{last_index+i_lau}.profiles_1d(1:nt_ec_powers) = {profiles_template}; - ids_core_sources.source{last_index+i_lau}.global_quantities(1:nt_ec_powers) = {globals_template}; + ids_core_sources.source{last_index+i_lau}.global_quantities = globals_template; end % get data for globals from gdat powers and fill in ids_structure @@ -120,11 +120,9 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources ec_total_cur(isnan(ec_total_cur)) = 0; for i_lau = active_launchers - for ii = 1:nt_ec_powers - ids_core_sources.source{last_index+i_lau}.global_quantities{ii}.time = ec_powers_tgrid(ii); - ids_core_sources.source{last_index+i_lau}.global_quantities{ii}.power = ec_total_pow(ii); - ids_core_sources.source{last_index+i_lau}.global_quantities{ii}.current_parallel = ec_total_cur(ii); - end + ids_core_sources.source{last_index+i_lau}.global_quantities.time = ec_powers_tgrid; + ids_core_sources.source{last_index+i_lau}.global_quantities.power = ec_total_pow; + ids_core_sources.source{last_index+i_lau}.global_quantities.current_parallel = ec_total_cur; end % interpoating p_dens profiles from 'ec_data_tgrid' grid (toray tgrid) to 'ec_powers_tgrid' (powers tgrid) -- GitLab