Skip to content
Snippets Groups Projects
Commit 6f748597 authored by Antonia Frank's avatar Antonia Frank
Browse files

Cleanup spacing and recheck of comments

parent 87bccfb3
No related branches found
No related tags found
1 merge request!137Add quantities to ids for MRE
Pipeline #203588 failed
......@@ -103,10 +103,6 @@ params_eff = params_eff_ref; params_eff.data_request='bs_data';
bs_gdat = gdat(params_core_sources.shot,params_eff); bs_data = bs_gdat.bs.bs_data;
bs_t_grid = bs_gdat.bs.t; bs_n_t = numel(bs_t_grid);
if any(bs_t_grid-ohm_t_grid')>0
warning('Bootstrap and ohmic time grids are not the same! Interpolation needed.')
end
main_desc = 'Bootstrap current'; production = 'IBS nodes';
id_bs.description = sprintf('%s from %s',main_desc,production);
id_bs.index = 13; id_bs.name = 'bootstrap_current';
......@@ -138,7 +134,7 @@ ids_core_sources.source{last_index+1}.global_quantities.current_parallel = curre
last_index = last_index+1; % add if statement to only increment if bs source has been added
%% ec
params_eff = params_eff_ref;
params_eff = params_eff_ref;
params_eff.data_request='ec_data';
params_eff.ec_inputs = 1; % load EC input information
ec_gdat = gdat(params_core_sources.shot,params_eff);
......@@ -153,17 +149,17 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
nb_launchers = numel(ec_inputs.launchers_active.data);
active_launchers = find(ec_inputs.launchers_active.data==1)';
% find times of injected ec powers, for setting up source and
% interpolating the power & current densities on p_inj time grid
% find times of injected EC power to interpolate power & current densities
% on p_ec_injected tgrid
ec_powers_tgrid = powers_gdat.ec.t; %nt_ec_powers = numel(ec_powers_tgrid);
itime_ec = powers_gdat.ec.data(:,end)>0;
interp_tgrid = ec_powers_tgrid(itime_ec); nt_interp = numel(interp_tgrid);
interp_p_ec_injected = powers_gdat.ec.data(itime_ec,end);
% Setup structures for active launchers from template
% Setup source structs for active launchers from template
main_desc = 'Source from electron cyclotron heating and current drive';
production = 'TORAY';
id_ec.index = 3; id_ec.name = 'ec';
id_ec.index = 3; id_ec.name = 'ec';
for i_lau = active_launchers
id_ec.description = sprintf('L%i/G%i, %s from %s double width CD profiles',i_lau,ec_inputs.gyro2launcher.data(i_lau),main_desc,production);
ids_core_sources.source{last_index+i_lau} = source_template;
......@@ -197,27 +193,26 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
interp1(rho_pol_norm_liu,vol(:,ii),ec_data.cd_dens.grids.rho_pol_norm(:,ii));
end
% interpoating p_dens profiles from 'ec_tgrid' grid (toray tgrid) to 'ec_powers_tgrid' (powers tgrid)
% load 1d_profiles from ec_data
p_dens = ec_data.p_dens.data;
p_integrated = ec_data.p_integrated.data;
cd_dens = ec_data.cd_dens_doublewidth.data; % use double width to have realistic deposition broadening
cd_integrated = ec_data.cd_integrated.data;
%
for i_lau = active_launchers
% convert to j// with conversion factor
% convert to j// with conversion factor
cd_dens(:,i_lau,:) = squeeze(cd_dens(:,i_lau,:)).*jtoray_to_jpar0_mapped;
for ii = 1:nt_ec_data
% integrate j//
cd_integrated(:,i_lau,ii) = cumtrapz(vol_mapped(:,ii),cd_dens(:,i_lau,ii))/(2*pi*R0);
end
end
%% remap ec outputs on power time grid
%% interpolating 1d_profiles from 'ec_tgrid' grid (toray tgrid) to 'interp_tgrid' (powers tgrid when powers.data>0)
ij = iround_os(interp_tgrid,ec_tgrid);
sparse_p_ec_injected = interp_p_ec_injected(ij,:); % injected ec power vals corresponding to ec_tgrid
n_rho = size(p_dens, 1);
%rho grids to be interpolated on power time grid
%rho grids to be interpolated on power time grid
rho_pol_norm = ec_data.cd_dens.grids.rho_pol_norm;
rho_tor_norm = ec_data.cd_dens.grids.rho_tor_norm;
......@@ -254,12 +249,12 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
interp_norm_p_integrated(irho,i_lau,:) = interpos(ec_tgrid,trace_p_integrated,interp_tgrid);
interp_norm_cd_dens(irho,i_lau,:) = interpos(ec_tgrid,trace_cd_dens,interp_tgrid);
interp_norm_cd_integrated(irho,i_lau,:) = interpos(ec_tgrid,trace_cd_integrated,interp_tgrid);
% only interpolate rho grids once
if interp_rho_flag
interp_rho_pol(irho,:) = interpos(ec_tgrid,rho_pol_norm(irho,:),interp_tgrid');
interp_rho_tor(irho,:) = interpos(ec_tgrid,rho_tor_norm(irho,:),interp_tgrid');
end
end
end
interp_rho_flag = 0;
end
......@@ -282,7 +277,7 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
% integrated j// profiles and pdens last entry
current_parallel_tmp = nan(1,nt_interp);
power_coupled_tmp = nan(1,nt_interp);
for ii = 1:nt_interp
% time
ids_core_sources.source{last_index+i_lau}.profiles_1d{ii}.time = interp_tgrid(ii);
......@@ -307,7 +302,7 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
ids_core_sources.source{last_index+i_lau}.globa_quantities.time = interp_tgrid;
ids_core_sources.source{last_index+i_lau}.global_quantities.power = power_coupled_tmp;
ids_core_sources.source{last_index+i_lau}.global_quantities.current_parallel = current_parallel_tmp;
end
end
%add empty sources for rest of unsused launchers
if numel(ids_core_sources.source)-last_index ~= nb_launchers
......@@ -315,7 +310,6 @@ if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
end
last_index = last_index+nb_launchers;
end
%% nbi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment