From 96c8be496d384679993595aca3d331a5b999bb8f Mon Sep 17 00:00:00 2001 From: Olivier Sauter <olivier.sauter@epfl.ch> Date: Wed, 24 Apr 2019 13:43:04 +0000 Subject: [PATCH] ids_core_profiles ready to be tested git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@11790 d63d8f72-b253-0410-a779-e742ad2e26cf --- crpptbx/TCV_IMAS/tcv_get_ids_core_profiles.m | 142 +++---------------- 1 file changed, 19 insertions(+), 123 deletions(-) diff --git a/crpptbx/TCV_IMAS/tcv_get_ids_core_profiles.m b/crpptbx/TCV_IMAS/tcv_get_ids_core_profiles.m index 1f6d82cf..17eb3faf 100644 --- a/crpptbx/TCV_IMAS/tcv_get_ids_core_profiles.m +++ b/crpptbx/TCV_IMAS/tcv_get_ids_core_profiles.m @@ -92,7 +92,11 @@ end %% profiles_1d (cannot use eqdsk since not same radial mesh) temp_1d.area = gdat(shot,'area_rho','machine',machine); for ir=1:length(temp_1d.area.x) - aa(ir,:) = interpos(temp_1d.area.t,temp_1d.area.data(ir,:),ids_cores_profiles.time,tens_time); + area_cpt(ir,:) = interpos(temp_1d.area.t,temp_1d.area.data(ir,:),ids_cores_profiles.time,tens_time); +end +temp_1d.q = gdat(shot,'q_rho','machine',machine); +for ir=1:length(temp_1d.q.x) + q_cpt(ir,:) = interpos(temp_1d.q.t,temp_1d.q.data(ir,:),ids_cores_profiles.time,tens_time); end it_thom = iround_os(temp_1d.te_rho.t,ids_cores_profiles.time); for it=1:length(ids_cores_profiles.time) @@ -102,8 +106,8 @@ for it=1:length(ids_cores_profiles.time) ids_cores_profiles.profiles_1d{it}.grid.psi = temp_1d.fit.te_rho.grids_1d.psi(:,it); ids_cores_profiles.profiles_1d{it}.grid.volume = temp_1d.fit.te_rho.grids_1d.rhovolnorm(:,it).^2 ... .* temp_1d.fit.te_rho.grids_1d.volume_edge(it); - ids_cores_profiles.profiles_1d{it}.grid.area = interpos(temp_1d.area.x,aa(:,it),temp_1d.fit.te_rho.grids_1d.rhopolnorm, ... - tens_rho,[1 2],[0 aa(end,it)]); + ids_cores_profiles.profiles_1d{it}.grid.area = interpos(temp_1d.area.x,area_cpt(:,it),temp_1d.fit.te_rho.grids_1d.rhopolnorm, ... + tens_rho,[1 2],[0 area_cpt(end,it)]); ids_cores_profiles.profiles_1d{it}.time = ids_cores_profiles.time(it); ids_cores_profiles.profiles_1d{it}.electrons.temperature = temp_1d.fit.te_rho.data(:,it); ids_cores_profiles.profiles_1d{it}.electrons.temperature_fit.measured = temp_1d.te_rho.data(:,it_thom(it)); @@ -170,130 +174,22 @@ if ~isempty(temp_1d.cxrs_rho.ti.fit.data) end end -keyboard - -% -profiles_1d.dpressure_dpsi = gdat(params_cores_profiles.shot,'pprime','machine',machine); -% dpsi_drho_tor = gdat(params_cores_profiles.shot,'dpsi_drho_tor','machine',machine); -% dvolume_dpsi = gdat(params_cores_profiles.shot,'dvolume_dpsi','machine',machine); -% dvolume_drho_tor = gdat(params_cores_profiles.shot,'dvolume_drho_tor','machine',machine); -% elongation = gdat(params_cores_profiles.shot,'elongation','machine',machine); -profiles_1d.f_df_dpsi = gdat(params_cores_profiles.shot,'ttprime','machine',machine); -profiles_1d.f = gdat(params_cores_profiles.shot,'rbphi_rho','machine',machine); -% geometric_axis = gdat(params_cores_profiles.shot,'geometric_axis','machine',machine); -% gm1 = gdat(params_cores_profiles.shot,'gm1','machine',machine); -% gm2 = gdat(params_cores_profiles.shot,'gm2','machine',machine); -% gm3 = gdat(params_cores_profiles.shot,'gm3','machine',machine); -% gm4 = gdat(params_cores_profiles.shot,'gm4','machine',machine); -% gm5 = gdat(params_cores_profiles.shot,'gm5','machine',machine); -% gm6 = gdat(params_cores_profiles.shot,'gm6','machine',machine); -% gm7 = gdat(params_cores_profiles.shot,'gm7','machine',machine); -% gm8 = gdat(params_cores_profiles.shot,'gm8','machine',machine); -% gm9 = gdat(params_cores_profiles.shot,'gm9','machine',machine); -% j_parallel = gdat(params_cores_profiles.shot,'j_parallel','machine',machine); -% j_tor = gdat(params_cores_profiles.shot,'j_tor','machine',machine); -% magnetic_shear = gdat(params_cores_profiles.shot,'magnetic_shear','machine',machine); -% mass_density = gdat(params_cores_profiles.shot,'mass_density','machine',machine); -profiles_1d.phi = gdat(params_cores_profiles.shot,'phi_tor','machine',machine); -profiles_1d.pressure = gdat(params_cores_profiles.shot,'pressure','machine',machine); -% psi = gdat(params_cores_profiles.shot,'psi_rho','machine',machine); % (could take from .x of any like rhotor and psi_axis, psi_edge from global_quantities) -profiles_1d.q = gdat(params_cores_profiles.shot,'q_rho','machine',machine); -profiles_1d.rho_tor = gdat(params_cores_profiles.shot,'rhotor','machine',machine); -%rho_tor_norm = gdat(params_cores_profiles.shot,'rhotor_norm','machine',machine); % from rho_tor -profiles_1d.rho_volume_norm = gdat(params_cores_profiles.shot,'rhovol','machine',machine); -% r_inboard = gdat(params_cores_profiles.shot,'r_inboard','machine',machine); -% r_outboard = gdat(params_cores_profiles.shot,'r_outboard','machine',machine); -% squareness_lower_inner = gdat(params_cores_profiles.shot,'squareness_lower_inner','machine',machine); -% squareness_lower_outer = gdat(params_cores_profiles.shot,'squareness_lower_outer','machine',machine); -% squareness_upper_inner = gdat(params_cores_profiles.shot,'squareness_upper_inner','machine',machine); -% squareness_upper_outer = gdat(params_cores_profiles.shot,'squareness_upper_outer','machine',machine); -% surface = gdat(params_cores_profiles.shot,'surface','machine',machine); -% trapped_fraction = gdat(params_cores_profiles.shot,'trapped_fraction','machine',machine); -% triangularity_lower = gdat(params_cores_profiles.shot,'triangularity_lower','machine',machine); -% triangularity_upper = gdat(params_cores_profiles.shot,'triangularity_upper','machine',machine); -profiles_1d.volume = gdat(params_cores_profiles.shot,'volume_rho','machine',machine); - -profiles_1d_fieldnames = fieldnames(profiles_1d); -special_fields = {'geometric_axis', 'rho_tor_norm', 'psi'}; % fields needing non-automatic treatments -for it=1:length(ids_cores_profiles.time) - for i=1:length(profiles_1d_fieldnames) - if ~any(strcmp(profiles_1d_fieldnames{i},special_fields)) - if ~isstruct(ids_cores_profiles.time_slice{it}.profiles_1d.(profiles_1d_fieldnames{i})) - if ~ischar(profiles_1d.(profiles_1d_fieldnames{i}).data) && ~isempty(profiles_1d.(profiles_1d_fieldnames{i}).data) ... - && size(profiles_1d.(profiles_1d_fieldnames{i}).data,2)>=it - ids_cores_profiles.time_slice{it}.profiles_1d.(profiles_1d_fieldnames{i}) = ... - profiles_1d.(profiles_1d_fieldnames{i}).data(:,it); - end - else - special_fields{end+1} = profiles_1d_fieldnames{i}; - end - end - end -end - -% special cases -nrho = length(profiles_1d.rho_tor.x); -ntime = length(temp.psi_axis.data); -for it=1:length(ids_cores_profiles.time) - ids_cores_profiles.time_slice{it}.profiles_1d.rho_tor_norm = ids_cores_profiles.time_slice{it}.profiles_1d.rho_tor./ ... - ids_cores_profiles.time_slice{it}.profiles_1d.rho_tor(end); - ids_cores_profiles.time_slice{it}.profiles_1d.psi = temp.psi_axis.data(it) + ... - profiles_1d.rho_tor.x.^2.*(global_quantities.psi_boundary.data(it)-temp.psi_axis.data(it)); -end - -% -%% profiles_2d{1} ala eqdsk, only this one thus grid_type=1 -% -% b_field_r = gdat(params_cores_profiles.shot,'b_field_r','machine',machine); -% b_field_tor = gdat(params_cores_profiles.shot,'b_field_tor','machine',machine); -% b_field_z = gdat(params_cores_profiles.shot,'b_field_z','machine',machine); -% b_r = gdat(params_cores_profiles.shot,'b_r','machine',machine); -% b_tor = gdat(params_cores_profiles.shot,'b_tor','machine',machine); -% b_z = gdat(params_cores_profiles.shot,'b_z','machine',machine); -% grid = gdat(params_cores_profiles.shot,'grid','machine',machine); % special -profiles_2d.grid_type.name = 'rectangular'; -profiles_2d.grid_type.index = 1; -profiles_2d.grid_type.description = 'Cylindrical R,Z ala eqdsk'; -% j_parallel = gdat(params_cores_profiles.shot,'j_parallel','machine',machine); -% j_tor = gdat(params_cores_profiles.shot,'j_tor','machine',machine); -% phi = gdat(params_cores_profiles.shot,'phi','machine',machine); -profiles_2d.psi = gdat(params_cores_profiles.shot,'psi','machine',machine); % add psi_bound in a second step in special cases -% r = gdat(params_cores_profiles.shot,'r','machine',machine); % not to be filled since in grid.dim1 -% theta = gdat(params_cores_profiles.shot,'theta','machine',machine); -% z = gdat(params_cores_profiles.shot,'z','machine',machine); % not to be filled since in grid.dim2 - -profiles_2d_fieldnames = fieldnames(profiles_2d); -special_fields = {'grid', 'grid_type'}; % fields needing non-automatic treatments -for it=1:length(ids_cores_profiles.time) - for i=1:length(profiles_2d_fieldnames) - if ~any(strcmp(profiles_2d_fieldnames{i},special_fields)) - if ~isstruct(ids_cores_profiles.time_slice{it}.profiles_2d{1}.(profiles_2d_fieldnames{i})) - if ~ischar(profiles_2d.(profiles_2d_fieldnames{i}).data) && ~isempty(profiles_2d.(profiles_2d_fieldnames{i}).data) ... - && size(profiles_2d.(profiles_2d_fieldnames{i}).data,3)>=it - ids_cores_profiles.time_slice{it}.profiles_2d{1}.(profiles_2d_fieldnames{i}) = ... - profiles_2d.(profiles_2d_fieldnames{i}).data(:,:,it); - end - else - special_fields{end+1} = profiles_2d_fieldnames{i}; - end - end - end +temp_1d.q = gdat(shot,'q_rho','machine',machine); +for ir=1:length(temp_1d.q.x) + q_cpt(ir,:) = interpos(temp_1d.q.t,temp_1d.q.data(ir,:),ids_cores_profiles.time,tens_time); end - -% special cases for it=1:length(ids_cores_profiles.time) - ids_cores_profiles.time_slice{it}.profiles_2d{1}.grid_type.name = profiles_2d.grid_type.name; - ids_cores_profiles.time_slice{it}.profiles_2d{1}.grid_type.index = profiles_2d.grid_type.index; - ids_cores_profiles.time_slice{it}.profiles_2d{1}.grid_type.description = profiles_2d.grid_type.description; - ids_cores_profiles.time_slice{it}.profiles_2d{1}.grid.dim1 = profiles_2d.psi.dim{1}; - ids_cores_profiles.time_slice{it}.profiles_2d{1}.grid.dim2 = profiles_2d.psi.dim{2}; - ids_cores_profiles.time_slice{it}.profiles_2d{1}.psi(:,:) = ids_cores_profiles.time_slice{it}.profiles_2d{1}.psi(:,:) + ... - global_quantities.psi_boundary.data(it); + [ids_cores_profiles.profiles_1d{it}.q] = interpos(temp_1d.q.x,q_cpt(:,it),temp_1d.fit.te_rho.grids_1d.rhopolnorm, ... + tens_rho,[1 0],[0 0]); + [qfit,dqdrhotor] = interpos(ids_cores_profiles.profiles_1d{it}.grid.rho_tor,ids_cores_profiles.profiles_1d{it}.q,tens_rho,[1 0],[0 0]); + ids_cores_profiles.profiles_1d{it}.shear = ids_cores_profiles.profiles_1d{it}.grid.rho_tor./ids_cores_profiles.profiles_1d{it}.q ... + .* dqdrhotor; end +ids_cores_profiles.code.name = ['tcv_get_ids_core_profiles, within gdat, with shot= ' num2str(shot) '; varargin' varargin{:}]; +ids_cores_profiles.code.output_flag = zeros(size(ids_cores_profiles.time)); % make arrays not filled in empty: -ids_cores_profiles.grids_ggd = {}; -for it=1:length(ids_cores_profiles.time_slice) - ids_cores_profiles.time_slice{it}.ggd = {}; +for it=1:length(ids_cores_profiles.time) + ids_cores_profiles.profiles_1d{it}.neutral = {}; end -- GitLab