diff --git a/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m b/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m index ef07977cbe8560341dcd21c111841291ec62a4a8..8a93e18dfbc267204895b03fb81ddee330bfa7c3 100644 --- a/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m +++ b/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m @@ -94,22 +94,34 @@ ids_core_profiles_description.vacuum_toroidal_field = [vacuum_toroidal_field_des % global_quantities_desc.* with description. % Use temp.* and temp_desc.* structures for temporary data +%% Currents MIGHT REQUIRE TOROIDAL->PARALLEL TRANSFORMATION params_eff.data_request='ip'; global_quantities.ip = gdat(params_cores_profiles.shot,'ip','machine',machine); global_quantities_desc.ip = params_eff.data_request; params_eff.data_request = 'ohm_data'; -current_non_inductive = gdat(params_cores_profiles.shot,params_eff); -global_quantities.current_non_inductive.data = current_non_inductive.ohm.ohm_data.cd_tot.data; -global_quantities.current_non_inductive.t = current_non_inductive.ohm.ohm_data.cd_tot.t; -global_quantities_desc.current_non_inductive = current_non_inductive.ohm.ohm_data.cd_tot.label; +current_inductive = gdat(params_cores_profiles.shot,params_eff); + +% current_inductive.data is smoothed +% current_inductive.ohm.data and current_inductive.ohm.ohm_data.cd_tot.data are not. Unsmoothed data can be substituted below: +%current_inductive.data = current_inductive.ohm.ohm_data.cd_tot.data; +%current_inductive.label = current_inductive.ohm.ohm_data.cd_tot.label; + +current_inductive.data = current_inductive.data(1,:); +current_inductive_desc = current_inductive.label(1); params_eff.data_request = 'bs_data'; -current_bootstrap = gdat(params_cores_profiles.shot,params_eff); -global_quantities.current_bootstrap.data = current_bootstrap.bs.bs_data.cd_tot.data; -global_quantities.current_bootstrap.t = current_bootstrap.bs.bs_data.cd_tot.t; -global_quantities_desc.current_bootstrap = current_bootstrap.bs.bs_data.cd_tot.label; +global_quantities.current_bootstrap = gdat(params_cores_profiles.shot,params_eff); + +% current_bootstrap.data is smoothed +% current_bootstrap.ohm.data and current_bootstrap.ohm.ohm_data.cd_tot.data are not. Unsmoothed data can be substituted below: +%global_quantities.current_bootstrap.data = global_quantities.current_bootstrap.ohm.ohm_data.cd_tot.data; +%global_quantities.current_bootstrap.label = global_quantities.current_bootstrap.ohm.ohm_data.cd_tot.label; + +global_quantities.current_bootstrap.data = global_quantities.current_bootstrap.data(1,:); +global_quantities_desc.current_bootstrap = global_quantities.current_bootstrap.label(1); +%% Other global quantities params_eff.data_request = 'vloop'; global_quantities.v_loop = gdat(params_cores_profiles.shot,params_eff); global_quantities_desc.v_loop = params_eff.data_request; @@ -141,7 +153,7 @@ for i=1:length(global_quantities_fieldnames_eff) if ~any(strcmp(global_quantities_fieldnames_eff{i},special_fields)) if ~isstruct(ids_core_profiles.global_quantities.(global_quantities_fieldnames_eff{i})) ids_core_profiles.global_quantities.(global_quantities_fieldnames_eff{i}) = ... - interpos(global_quantities.(global_quantities_fieldnames_eff{i}).t, ... + interpos_nan(global_quantities.(global_quantities_fieldnames_eff{i}).t, ... global_quantities.(global_quantities_fieldnames_eff{i}).data,ids_core_profiles.time,tens_time); else special_fields{end+1} = global_quantities_fieldnames_eff{i}; @@ -149,8 +161,26 @@ for i=1:length(global_quantities_fieldnames_eff) end end -%% profiles_1d (cannot use eqdsk since not same radial mesh) +%% Operations +% Some data is already interpolated on the correct time grid at this point so operations should be done here +% Interpolating what is not: +current_inductive.data = ... + interpos_nan(current_inductive.t, ... + current_inductive.data,ids_core_profiles.time,tens_time); + +%ids_core_profiles.global_quantities.current_non_inductive = ids_core_profiles.global_quantities.ip - ... +% current_inductive.data - ids_core_profiles.global_quantities.current_bootstrap; +%global_quantities_desc.current_non_inductive = string(global_quantities_desc.ip) + ' - ' + ... +% string(current_inductive_desc) + ' - ' +string(global_quantities_desc.current_bootstrap); + +% In JINTRAC current_non_inductive includes the bootstrap current +ids_core_profiles.global_quantities.current_non_inductive = ids_core_profiles.global_quantities.ip - ... + current_inductive.data; +global_quantities_desc.current_non_inductive = string(global_quantities_desc.ip) + ' - ' + ... + string(current_inductive_desc); + +%% profiles_1d (cannot use eqdsk since not same radial mesh) % prepare area for ids_core_profiles.profiles_1d{*}.grid.area params_eff.data_request = 'area_rho'; temp_1d.area = gdat(params_cores_profiles.shot,params_eff); @@ -290,8 +320,8 @@ for it=1:length(ids_core_profiles.time) ids_core_profiles.profiles_1d{it}.ion{1}.density_thermal = ids_core_profiles.profiles_1d{it}.ion{1}.density; ids_core_profiles.profiles_1d{it}.ion{1}.pressure_thermal = 1.6022e-19.*ids_core_profiles.profiles_1d{it}.ion{1}.density_thermal ... .* ids_core_profiles.profiles_1d{it}.ion{1}.temperature; - ids_core_profiles.profiles_1d{it}.ion{1}.label = 'D+'; - % + ids_core_profiles.profiles_1d{it}.ion{1}.name = 'D+'; + ids_core_profiles.profiles_1d{it}.t_i_average = ids_core_profiles.profiles_1d{it}.ion{1}.temperature; ids_core_profiles.profiles_1d{it}.n_i_thermal_total = ids_core_profiles.profiles_1d{it}.ion{1}.density_thermal; ids_core_profiles.profiles_1d{it}.pressure_ion_total = 1.6022e-19 .* ids_core_profiles.profiles_1d{it}.n_i_thermal_total ... @@ -311,7 +341,7 @@ for it=1:length(ids_core_profiles.time) ids_core_profiles.profiles_1d{it}.ion{2}.density_thermal = ids_core_profiles.profiles_1d{it}.ion{2}.density; ids_core_profiles.profiles_1d{it}.ion{2}.pressure_thermal = 1.6022e-19.*ids_core_profiles.profiles_1d{it}.ion{2}.density_thermal ... .* ids_core_profiles.profiles_1d{it}.ion{2}.temperature; - ids_core_profiles.profiles_1d{it}.ion{2}.label = 'C6+'; + ids_core_profiles.profiles_1d{it}.ion{2}.name = 'C6+'; % average/sums ids_core_profiles.profiles_1d{it}.t_i_average = ids_core_profiles.profiles_1d{it}.ion{1}.temperature; ids_core_profiles.profiles_1d{it}.n_i_thermal_total = ids_core_profiles.profiles_1d{it}.ion{1}.density_thermal + ... @@ -357,15 +387,15 @@ for it=1:length(ids_core_profiles.time) end temp_1d_desc.magnetic_shear = 'from interpos with rhotor'; -%% Current densities +%% Current densities, MIGHT REQUIRE TOROIDAL->PARALLEL TRANSFORMATION for it=1:length(ids_core_profiles.time) ids_core_profiles.profiles_1d{it}.j_bootstrap = ... - current_bootstrap.bs.bs_data.cd_dens.data(:,it); - temp_1d_desc.j_bootstrap = current_bootstrap.bs.bs_data.cd_dens.label; + global_quantities.current_bootstrap.bs.bs_data.cd_dens.data(:,it); + temp_1d_desc.j_bootstrap = global_quantities.current_bootstrap.bs.bs_data.cd_dens.label; ids_core_profiles.profiles_1d{it}.j_ohmic = ... - current_non_inductive.ohm.ohm_data.cd_dens.data(:,it); - temp_1d_desc.j_ohmic = current_non_inductive.ohm.ohm_data.cd_dens.label; + current_inductive.ohm.ohm_data.cd_dens.data(:,it); + temp_1d_desc.j_ohmic = current_inductive.ohm.ohm_data.cd_dens.label; end %% parallel conductivity (neoclassical) @@ -375,6 +405,19 @@ for it=1:length(ids_core_profiles.time) temp_1d_desc.conductivity_parallel = signeo.label; end +%% e_field +% From IDS description: +% Electric field, averaged on the magnetic surface. E.g for the parallel component, average(E.B) / +% B0, using core_profiles/vacuum_toroidal_field/b0 [V.m^-1]. It is quite constant. Is this correct? +for it=1:length(ids_core_profiles.time) + %ids_core_profiles.profiles_1d{it}.e_field.parallel = ... + % signeo.data(:,it).*(current_inductive.ohm.ohm_data.cd_dens.data(:,it)); + ids_core_profiles.profiles_1d{it}.e_field.parallel = ... + current_inductive.ohm.ohm_data.cd_dens.data(:,it)./signeo.data(:,it); + temp_1d_desc.e_field.parallel = "\tcv_shot::top.results.ibs:johmav / \tcv_shot::top.results.ibs:signeo"; +end + + %% add descriptions for profiles_1d ids_core_profiles_description.profiles_1d = temp_1d_desc;