Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • spc/gdat
1 result
Select Git revision
Show changes
Commits on Source (86)
......@@ -1639,7 +1639,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
% power deposition related:
ec_data.p_abs_plasma.data = pabs_gyro.data * 1e6;
ec_data.p_abs_plasma.data(end+1,:) = sum(ec_data.p_abs_plasma.data,1,'omitnan');
ec_data.p_abs_plasma.data(end+1,:) = sum(ec_data.p_abs_plasma.data,1,'omitnan'); % add total
ec_data.p_abs_plasma.label = [strrep(pabs_gyro.comment,'MW','W') ' ; last index is total'];
ec_data.p_abs_plasma.units = 'W';
ec_data.p_abs_plasma.x = launchers_grid;
......@@ -1648,21 +1648,21 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
ec_data.p_abs_plasma.dimunits = {launchers_label, 's'};
%
ec_data.p_dens.data = pow_dens.data * 1e6;
ec_data.p_dens.data(:,end+1,:) = sum(ec_data.p_dens.data,2,'omitnan');
ec_data.p_dens.data(:,end+1,:) = sum(ec_data.p_dens.data,2,'omitnan'); % add total
ec_data.p_dens.label = [strrep(pow_dens.comment,'MW','W') ' ; last index is total'];
ec_data.p_dens.units = 'W/m^3';
ec_data.p_dens.x = pow_dens.rgrid';
ec_data.p_dens.rhotor_norm = ec_data.p_dens.x;
ec_data.p_dens.x = pow_dens.rgrid;
ec_data.p_dens.grids = pow_dens.grids;
ec_data.p_dens.t = pow_dens.tgrid;
ec_data.p_dens.dim = {ec_data.p_dens.x, launchers_grid, ec_data.p_dens.t};
ec_data.p_dens.dimunits = {'rhotor_norm', launchers_label, 's'};
%
ec_data.p_integrated.data = power_integrated.data * 1e6;
ec_data.p_integrated.data(:,end+1,:) = sum(ec_data.p_integrated.data,2,'omitnan');
ec_data.p_integrated.data(:,end+1,:) = sum(ec_data.p_integrated.data,2,'omitnan'); % add total
ec_data.p_integrated.label = [strrep(power_integrated.comment,'MW','W') ' ; last index is total'];
ec_data.p_integrated.units = 'W';
ec_data.p_integrated.x = power_integrated.rgrid';
ec_data.p_integrated.rhotor_norm = ec_data.p_integrated.x;
ec_data.p_integrated.x = power_integrated.rgrid;
ec_data.p_integrated.grids = power_integrated.grids;
ec_data.p_integrated.t = power_integrated.tgrid;
ec_data.p_integrated.dim = {ec_data.p_integrated.x, launchers_grid, ec_data.p_integrated.t};
ec_data.p_integrated.dimunits = {'rhotor_norm', launchers_label, 's'};
......@@ -1693,7 +1693,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
% current drive deposition related:
ec_data.cd_tot.data = icdtot.data * 1e6;
ec_data.cd_tot.data(end+1,:) = sum(ec_data.cd_tot.data,1,'omitnan');
ec_data.cd_tot.data(end+1,:) = sum(ec_data.cd_tot.data,1,'omitnan'); % add total
ec_data.cd_tot.label = [strrep(icdtot.comment,'MA','A') ' ; last index is total'];
ec_data.cd_tot.units = 'A';
ec_data.cd_tot.x = launchers_grid;
......@@ -1702,28 +1702,28 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
ec_data.cd_tot.dimunits = {launchers_label, 's'};
%
ec_data.cd_dens.data = currentdrive_dens.data * 1e6;
ec_data.cd_dens.data(:,end+1,:) = sum(ec_data.cd_dens.data,2,'omitnan');
ec_data.cd_dens.data(:,end+1,:) = sum(ec_data.cd_dens.data,2,'omitnan'); % add total
ec_data.cd_dens.label = [strrep(currentdrive_dens.comment,'MA','A') ' ; last index is total'];
ec_data.cd_dens.units = 'A/m^2';
ec_data.cd_dens.x = currentdrive_dens.rgrid';
ec_data.cd_dens.rhotor_norm = ec_data.cd_dens.x;
ec_data.cd_dens.units = 'A/m^3';
ec_data.cd_dens.x = currentdrive_dens.rgrid;
ec_data.cd_dens.grids = currentdrive_dens.grids;
ec_data.cd_dens.t = currentdrive_dens.tgrid;
ec_data.cd_dens.dim = {ec_data.cd_dens.x, launchers_grid, ec_data.cd_dens.t};
ec_data.cd_dens.dimunits = {'rhotor_norm', launchers_label, 's'};
%
ec_data.cd_integrated.data = currentdrive_integrated.data * 1e6;
ec_data.cd_integrated.data(:,end+1,:) = sum(ec_data.cd_integrated.data,2,'omitnan');
ec_data.cd_integrated.data(:,end+1,:) = sum(ec_data.cd_integrated.data,2,'omitnan'); % add total
ec_data.cd_integrated.label = [strrep(currentdrive_integrated.comment,'MA','A') ' ; last index is total'];
ec_data.cd_integrated.units = 'A';
ec_data.cd_integrated.x = currentdrive_integrated.rgrid';
ec_data.cd_integrated.rhotor_norm = ec_data.cd_integrated.x;
ec_data.cd_integrated.x = currentdrive_integrated.rgrid;
ec_data.cd_integrated.grids = currentdrive_integrated.grids;
ec_data.cd_integrated.t = currentdrive_integrated.tgrid;
ec_data.cd_integrated.dim = {ec_data.cd_integrated.x, launchers_grid, ec_data.cd_integrated.t};
ec_data.cd_integrated.dimunits = {'rhotor_norm', launchers_label, 's'};
%
ec_data.max_cd_dens.data = icdmax.data * 1e6;
ec_data.max_cd_dens.label = strrep(icdmax.comment,'MA','A');
ec_data.max_cd_dens.units = 'A/m^2';
ec_data.max_cd_dens.units = 'A/m^3';
ec_data.max_cd_dens.x = [];
ec_data.max_cd_dens.t = icdmax.tgrid;
ec_data.max_cd_dens.dim = {ec_data.max_cd_dens.t};
......@@ -1746,8 +1746,9 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
ec_data.width_cd_dens.dimunits = {'s'};
%
ec_data.cd_dens_doublewidth.data = currentdrive_dens_w2.data * 1e6;
ec_data.cd_dens_doublewidth.data(:,end+1,:) = sum(ec_data.cd_dens_doublewidth.data,2,'omitnan'); % add total
ec_data.cd_dens_doublewidth.label = [strrep(currentdrive_dens_w2.comment,'MA','A') ' ; last index is total'];
for subfields={'x','rhotor_norm','t','dim','dimunits','units'}
for subfields={'x','grids','t','dim','dimunits','units'}
ec_data.cd_dens_doublewidth.(subfields{1}) = ec_data.cd_dens.(subfields{1});
end
......@@ -1755,7 +1756,6 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
filled_successfully = true; %set flag to true
catch ME
warning('Problem retrieving TORAY data. \nError message: %s',ME.message);
getReport(ME) % without ; to get output
% try to identify cause of the error
if ~check_nodes_filled(shot,'toray')
if ~isempty(ec_inputs.launchers_active)
......@@ -1764,6 +1764,8 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
else
msg = 'write_pyro(shot) found active launchers, but TORAY nodes are not filled, check hldsi(shot), and (ask to) relaunch TORAY.';
end
else
msg = 'Run gdat(shot,''ec_data'',''ec_inputs'',1) to check whether there were active launchers in this shot or not.';
end
elseif ~isempty(gdat_data.gdat_params.trialindx)
msg = 'Is the trial index filled? Check TORAY nodes with hdlsi(shot).';
......@@ -1866,7 +1868,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
data_fullpath = '';
ohm_help = '';
if strcmp(lower(source_icd.ohm),'ibs')
ohm_data.cd_tot = gdat_tcv(shot,'\results::ibs:iohm');
ohm_data.cd_tot = gdat_tcv(shot,'\results::ibs:iohm','trialindx',gdat_params.trialindx);
if gdat_data.mapping_for.tcv.gdat_timedim ==2
tgrid_to_change = {'ohm_data.cd_tot.t','ohm_data.cd_tot.dim{1}'};
for i=1:length(tgrid_to_change)
......@@ -1875,7 +1877,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
end
ohm_data.cd_tot.data = ohm_data.cd_tot.data';
ohm_data.cd_tot.units = strrep(ohm_data.cd_tot.units,'kA','A');
ohm_data.cd_dens = gdat_tcv(shot,'\results::ibs:johmav'); % =jtild=<j.B> / R0 / <Bphi/R>, with Bphi=F(psi)/R
ohm_data.cd_dens = gdat_tcv(shot,'\results::ibs:johmav','trialindx',gdat_params.trialindx); % =jtild=<j.B> / R0 / <Bphi/R>, with Bphi=F(psi)/R
if gdat_data.mapping_for.tcv.gdat_timedim ==2
tgrid_to_change = {'ohm_data.cd_dens.t','ohm_data.cd_dens.dim{2}'};
for i=1:length(tgrid_to_change)
......@@ -1913,7 +1915,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
data_fullpath = '';
bs_help = '';
if strcmp(lower(source_icd.bs),'ibs')
bs_data.cd_tot = gdat_tcv(shot,'\results::ibs:ibs');
bs_data.cd_tot = gdat_tcv(shot,'\results::ibs:ibs','trialindx',gdat_params.trialindx);
if gdat_data.mapping_for.tcv.gdat_timedim ==2
tgrid_to_change = {'bs_data.cd_tot.t','bs_data.cd_tot.dim{1}'};
for i=1:length(tgrid_to_change)
......@@ -1922,7 +1924,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
end
bs_data.cd_tot.data = bs_data.cd_tot.data';
bs_data.cd_tot.units = strrep(bs_data.cd_tot.units,'kA','A');
bs_data.cd_dens = gdat_tcv(shot,'\results::ibs:jbsav'); % =jtild=<j.B> / R0 / <Bphi/R>, with Bphi=F(psi)/R
bs_data.cd_dens = gdat_tcv(shot,'\results::ibs:jbsav','trialindx',gdat_params.trialindx); % =jtild=<j.B> / R0 / <Bphi/R>, with Bphi=F(psi)/R
if gdat_data.mapping_for.tcv.gdat_timedim ==2
tgrid_to_change = {'bs_data.cd_dens.t','bs_data.cd_dens.dim{2}'};
for i=1:length(tgrid_to_change)
......
......@@ -473,6 +473,11 @@ switch lower(data_request)
'bb=interpos(aa.t,aa.data(ix,:),gdat_tmp.t,-100);' ...
'gdat_tmp.data = 4e-7*pi.*gdat_tmp.data.^2.*bb./1.22; gdat_tmp.label=''\tau_R'';gdat_tmp.gdat_request=''tau_r'';' ...
'gdat_tmp.units=''s'';gdat_tmp.help=''tauR=mu0 a^2 / 1.22 etaneo(rhopol=0.4)'''];
case 'tau_tot'
mapping.timedim = 1;
mapping.label = 'total energy confinment time';
mapping.method = 'tdi';
mapping.expression = '\results::conf:tau';
case 'te'
mapping.timedim = 2;
mapping.label = 'Te';
......
function [ids_core_profiles,ids_core_profiles_description,varargout] = tcv_get_ids_core_profiles(shot,ids_equil_empty, gdat_params,varargin)
function [ids_core_profiles,ids_core_profiles_description,varargout] = ...
tcv_get_ids_core_profiles(shot,ids_equil_empty,gdat_params,varargin)
%
% [ids_core_profiles,ids_core_profiles_description,varargout] = tcv_get_ids_core_profiles(shot,ids_equil_empty,varargin);
% [ids_core_profiles,ids_core_profiles_description,varargout] = ...
% tcv_get_ids_core_profiles(shot,ids_equil_empty,gdat_params,varargin);
%
%
% gdat_params: gdat_data.gdat_params to get all params passed from original call, in particular error_bar options
%
% gdat_params: gdat_data.gdat_params to get all params passed from original call,
% in particular error_bar options
%
% error_bar: from gdat_params.error_bar
% 'delta' (default): error_bar to be added inserted in "upper" only as mentioned in description
......@@ -22,18 +24,22 @@ tens_time = -1;
tens_rho = -0.1;
if exist('gdat_params','var')
[ids_core_profiles, params_cores_profiles] = tcv_ids_headpart(shot,ids_equil_empty,'cores_profiles','gdat_params',gdat_params,varargin{:});
[ids_core_profiles, params_cores_profiles] = ...
tcv_ids_headpart(shot,ids_equil_empty,'cores_profiles','gdat_params',gdat_params,varargin{:});
else
[ids_core_profiles, params_cores_profiles] = tcv_ids_headpart(shot,ids_equil_empty,'cores_profiles',varargin{:});
[ids_core_profiles, params_cores_profiles] = ...
tcv_ids_headpart(shot,ids_equil_empty,'cores_profiles',varargin{:});
aa=gdat_tcv;
gdat_params = aa.gdat_params; % to get default params
end
params_eff_ref = gdat_params; params_eff_ref.doplot=0;
try params_eff_ref=rmfield(params_eff_ref,'source');catch;end % make sure no source (from ids def)
% initialize description
ids_core_profiles_description = [];
% base all from times fro nete_rho (which should be conf by default)
%% setup profiles_1d
% base all from times for nete_rho (which should be conf by default)
params_eff = params_eff_ref;
params_eff.data_request='ne_rho'; params_eff.fit = 1;
temp_1d.ne_rho = gdat(params_cores_profiles.shot,params_eff);
......@@ -70,13 +76,11 @@ ids_core_profiles.profiles_1d{1}.ion{1}.state = {};
ids_core_profiles.profiles_1d{1}.neutral{1}.state = {};
ids_core_profiles.profiles_1d(1:length(ids_core_profiles.time)) = ids_core_profiles.profiles_1d(1);
% As a general rule, for a new substructure under the main ids, construct a local structure like:
% "global_quantities" with subfields being the relevant data to get and a local structure:
% "global_quantities_desc" which contains the same subfields themselves containing the gdat string aftre shot used
%
% vacuum_toroidal_field and time, using homogeneous
%
%% vacuum_toroidal_field and time, using homogeneous
params_eff = params_eff_ref;
params_eff.data_request='b0';
vacuum_toroidal_field.b0=gdat(params_cores_profiles.shot,params_eff);
......@@ -85,7 +89,10 @@ ids_core_profiles.vacuum_toroidal_field.r0 = vacuum_toroidal_field.b0.r0;
ids_core_profiles.vacuum_toroidal_field.b0 = interpos(63,vacuum_toroidal_field.b0.t,vacuum_toroidal_field.b0.data,ids_core_profiles.time,-1);
ids_core_profiles_description.vacuum_toroidal_field = [vacuum_toroidal_field_desc.b0 ' on ids_core_profiles.time, with interpos(63)'];
% global_quantities data into local global_quantities.* structure with correct end names and global_quantities_desc.* with description. Use temp.* and temp_desc.* structures for temporary data
%% global_quantities
% data into local global_quantities.* structure with correct end names and
% global_quantities_desc.* with description.
% Use temp.* and temp_desc.* structures for temporary data
params_eff.data_request='ip';
global_quantities.ip = gdat(params_cores_profiles.shot,'ip','machine',machine);
......@@ -141,25 +148,20 @@ for i=1:length(global_quantities_fieldnames_eff)
end
end
end
% special case
%
%% 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);
temp_1d_desc.area = params_eff.data_request;
for ir=1:length(temp_1d.area.x)
for ir=1:length(temp_1d.area.x) % map tmp_1d.area to core_profiles.time
area_cpt(ir,:) = interpos(temp_1d.area.t,temp_1d.area.data(ir,:),ids_core_profiles.time,tens_time);
end
params_eff.data_request = 'q_rho';
temp_1d.q = gdat(params_cores_profiles.shot,params_eff);
temp_1d_desc.q = params_eff.data_request;
for ir=1:length(temp_1d.q.x)
q_cpt(ir,:) = interpos(temp_1d.q.t,temp_1d.q.data(ir,:),ids_core_profiles.time,tens_time);
end
it_thom = iround_os(temp_1d.te_rho.t,ids_core_profiles.time);
for it=1:length(ids_core_profiles.time)
% fill grid
ids_core_profiles.profiles_1d{it}.grid.rho_tor_norm = temp_1d.fit.te_rho.grids_1d.rhotornorm(:,it);
ids_core_profiles.profiles_1d{it}.grid.rho_tor = temp_1d.fit.te_rho.grids_1d.rhotornorm(:,it) ...
.* temp_1d.fit.te_rho.grids_1d.rhotor_edge(it);
......@@ -171,7 +173,9 @@ for it=1:length(ids_core_profiles.time)
.* temp_1d.fit.te_rho.grids_1d.volume_edge(it);
ids_core_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)]);
% fill time
ids_core_profiles.profiles_1d{it}.time = ids_core_profiles.time(it);
% fill electrons struct
ids_core_profiles.profiles_1d{it}.electrons.temperature = temp_1d.fit.te_rho.data(:,it);
ids_core_profiles.profiles_1d{it}.electrons.temperature_fit.measured = temp_1d.te_rho.data(:,it_thom(it));
ids_core_profiles.profiles_1d{it}.electrons.temperature_fit.time_measurement = temp_1d.te_rho.t(it_thom(it));
......@@ -185,6 +189,7 @@ for it=1:length(ids_core_profiles.time)
ids_core_profiles.profiles_1d{it}.electrons.density_fit.source = {'Thomson, interpos fit'};
ids_core_profiles.profiles_1d{it}.electrons.pressure_thermal = 1.6022e-19.*ids_core_profiles.profiles_1d{it}.electrons.density_thermal ...
.* ids_core_profiles.profiles_1d{it}.electrons.temperature;
% fill zeff
ids_core_profiles.profiles_1d{it}.zeff = global_quantities.z_eff_resistive.data(it) .* ...
ones(size(ids_core_profiles.profiles_1d{it}.electrons.density));
end
......@@ -231,7 +236,8 @@ switch error_bar
error(['tcv_ids_bpol_loop: error_bar option not known: ' error_bar])
end
% ion, assume only D if no CXRS (need to ask how to check if H...)
%% ion struct
% assume only D if no CXRS (need to ask how to check if H...)
params_eff_fit1.data_request = 'cxrs';
temp_1d.cxrs_rho = gdat(params_cores_profiles.shot,params_eff_fit1);
temp_1d_desc.cxrs_rho = params_eff_fit1.data_request;
......@@ -316,9 +322,14 @@ if ~isempty(temp_1d.cxrs_rho.ti.fit.data)
end
end
for ir=1:length(temp_1d.q.x)
%% q profile and magnetic shear
params_eff.data_request = 'q_rho';
temp_1d.q = gdat(params_cores_profiles.shot,params_eff);
temp_1d_desc.q = params_eff.data_request;
for ir=1:length(temp_1d.q.x) % map tmp_1d.q to core_profiles.time
q_cpt(ir,:) = interpos(temp_1d.q.t,temp_1d.q.data(ir,:),ids_core_profiles.time,tens_time);
end
for it=1:length(ids_core_profiles.time)
ij=isfinite(q_cpt(:,it));
if sum(ij) >= 5
......@@ -335,9 +346,28 @@ for it=1:length(ids_core_profiles.time)
ids_core_profiles.profiles_1d{it}.magnetic_shear = -9.e40;
end
end
temp_1d_desc.magnetic_shear = 'from interpos with rhotor';
%% Current densities
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;
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;
end
%% parallel conductivity (neoclassical)
signeo = gdat(params_cores_profiles.shot,'\results::ibs:signeo');
for it=1:length(ids_core_profiles.time)
ids_core_profiles.profiles_1d{it}.conductivity_parallel = signeo.data(:,it);
temp_1d_desc.conductivity_parallel = signeo.label;
end
ids_core_profiles_description.temp_1d_desc = temp_1d_desc;
ids_core_profiles_description.profiles_1d.magnetic_shear = 'from interpos with rhotor';
%% add descriptions for profiles_1d
ids_core_profiles_description.profiles_1d = temp_1d_desc;
if nargin <= 2
ids_core_profiles.code.name = ['tcv_get_ids_core_profiles, within gdat, with shot= ' num2str(params_cores_profiles.shot) ];
......
This diff is collapsed.
function [ids_core_transport,ids_core_transport_description,varargout] = ...
tcv_get_ids_core_transport(shot,ids_equil_empty,gdat_params,varargin)
%
% [ids_core_transport,ids_core_transport_description,varargout] = ...
% tcv_get_ids_core_transport(shot,ids_equil_empty,gdat_params,varargin);
%
%
% gdat_params: gdat_data.gdat_params to get all params passed from original call
%
machine = 'tcv';
tens_time = -1;
tens_rho = -0.1;
if exist('gdat_params','var')
[ids_core_transport, params_core_transport] = ...
tcv_ids_headpart(shot,ids_equil_empty,'cores_profiles','gdat_params',gdat_params,varargin{:});
else
[ids_core_transport, params_core_transport] = ...
tcv_ids_headpart(shot,ids_equil_empty,'cores_profiles',varargin{:});
aa=gdat_tcv;
gdat_params = aa.gdat_params; % to get default params
end
params_eff_ref = gdat_params; params_eff_ref.doplot=0;
try params_eff_ref=rmfield(params_eff_ref,'source');catch;end % make sure no source (from ids def)
% initialize description
ids_core_transport_description = [];
%%
last_index = 0;
% fill model [name: transport solver, desc: output from transport solver]
% setup model and profiles_1d
comment = 'Output from a transport solver';
ids_core_transport.model{last_index+1}.comment = comment;
ids_core_transport.model{last_index+1}.name = comment;
ids_core_transport.model{last_index+1}.identifier.index = 2;
ids_core_transport.model{last_index+1}.name = 'transport_solver';
% read data and setup time
params_eff.data_request='\results::conf:chie';
temp_1d.chie = gdat(params_core_transport.shot,params_eff.data_request);
temp_1d_desc.chie = params_eff.data_request;
if isempty(temp_1d.chie.t)
warning('no data in chie node, might need to rerun anaprofs')
return
end
ids_core_transport.time = temp_1d.chie.t;
ids_core_transport_description.time = ['from node' params_eff.data_request];
ids_core_transport.model{last_index+1}.profiles_1d(1:length(ids_core_transport.time)) = ...
ids_core_transport.model{last_index+1}.profiles_1d(1);
% fill profiles_1d
for it=1:length(ids_core_transport.time)
ids_core_transport.model{last_index+1}.profiles_1d{it}.time = ids_core_transport.time(it);
ids_core_transport.model{last_index+1}.profiles_1d{it}.electrons.energy.d = temp_1d.chie.data(:,it);
temp_1d_desc.electrons.energy.d = temp_1d.chie.label;
end
%% add descriptions for profiles_1d
ids_core_transport_description.profiles_1d = temp_1d_desc;
%%
if nargin <= 2
ids_core_transport.code.name = ['tcv_get_ids_core_transport, within gdat, with shot= ' num2str(params_core_transport.shot) ];
else
ids_core_transport.code.name = ['tcv_get_ids_core_transport, within gdat, with shot= ' num2str(params_core_transport.shot) '; varargin: ' varargin{:}];
end
ids_core_transport_description.code.name = ids_core_transport.code.name;
ids_core_transport.code.output_flag = zeros(size(ids_core_transport.time));
% cocos automatic transform
if ~isempty(which('ids_generic_cocos_nodes_transformation_symbolic'))
[ids_core_transport,cocoscoeff]=ids_generic_cocos_nodes_transformation_symbolic(ids_core_transport,'core_transport',gdat_params.cocos_in, ...
gdat_params.cocos_out,gdat_params.ipsign_out,gdat_params.b0sign_out,gdat_params.ipsign_in,gdat_params.b0sign_in, ...
gdat_params.error_bar,gdat_params.nverbose);
end
function [ids_equilibrium,ids_equilibrium_description,varargout] = tcv_get_ids_equilibrium(shot,ids_equil_empty, gdat_params,varargin)
function [ids_equilibrium,ids_equilibrium_description,varargout] = ...
tcv_get_ids_equilibrium(shot,ids_equil_empty,gdat_params,varargin)
%
% [ids_equilibrium,ids_equilibrium_description,varargout] = tcv_get_ids_equilibrium(shot,ids_equil_empty,varargin);
% [ids_equilibrium,ids_equilibrium_description,varargout] = ...
% tcv_get_ids_equilibrium(shot,ids_equil_empty,gdat_params,varargin);
%
%
% gdat_params: gdat_data.gdat_params to get all params passed from original call, in particular error_bar and cocos_out options
% gdat_params: gdat_data.gdat_params to get all params passed from original call,
% in particular error_bar and cocos_out options
%
if exist('gdat_params','var')
[ids_equilibrium, params_equilibrium] = tcv_ids_headpart(shot,ids_equil_empty,'equilibrium','gdat_params',gdat_params,varargin{:});
[ids_equilibrium, params_equilibrium] = ...
tcv_ids_headpart(shot,ids_equil_empty,'equilibrium','gdat_params',gdat_params,varargin{:});
else
[ids_equilibrium, params_equilibrium] = tcv_ids_headpart(shot,ids_equil_empty,'equilibrium',varargin{:});
[ids_equilibrium, params_equilibrium] = ...
tcv_ids_headpart(shot,ids_equil_empty,'equilibrium',varargin{:});
aa=gdat_tcv;
gdat_params = aa.gdat_params; % to get default params
end
......
......@@ -16,7 +16,7 @@ end
% As a general rule, for a new substructure under the main ids, construct a local structure like:
% "global_quantities" with subfields being the relevant data to get and a local structure:
% "global_quantities_desc" which contains the same subfields themselves containing the gdat string aftre shot used
% "global_quantities_desc" which contains the same subfields themselves containing the gdat string after shot used
%
% vacuum_toroidal_field and time, using homogeneous
%
......@@ -36,6 +36,7 @@ ids_summary.code.name = 'gdat';
ids_summary.code.version = git_release_hash;
ids_summary.code.repository = git_url;
%% boundary
% use equilibrium time as reference, so load first elongation(time)
params_eff = params_eff_ref;
......@@ -59,7 +60,6 @@ ids_summary.time = unique([t_before; [kappa.t(1):max((kappa.t(end)-kappa.t(1))/(
ids_summary_description.time = 'time from gdat(shot,''kappa'') and adding from 0 up to t(ip_trapeze(end))';
params_eff = params_eff_ref;
% boundary:
boundary.elongation = kappa;
boundary_desc.elongation = kappa.gdat_params.data_request;
params_eff.data_request = 'r_geom';
......@@ -121,13 +121,13 @@ if ~isempty(special_fields)
% $$$ end
end
% disruption, use specific function
%% disruption, use specific function
% to be decided if changes only ids_summary_out.disruption or also elsewhere..., if ids_summary_out.time is changed,
% then all the other data should be related, thus call this first?
[ids_summary_out,ids_summary_out_description] = ids_summary_disruption(shot, ids_summary, gdat_params);
% gas: bottom/top?, deuterium, helium_xx, ?
%% gas: bottom/top?, deuterium, helium_xx, ?
params_eff.data_request = 'gas_flux';
gas_injection_rates.deuterium = gdat(params_summary.shot,params_eff);
gas_injection_rates_desc.deuterium = params_eff.data_request;
......@@ -148,7 +148,8 @@ for i=1:numel(gas_injection_rates_fieldnames)
end
end
%params_eff.doplot=1;
% global_quantities:
%% global_quantities
params_eff.data_request = 'b0';
global_quantities.b0 = gdat(params_summary.shot,params_eff); % do not add 'source','liuqe' to get all times
global_quantities_desc.b0 = [params_eff.data_request ' ; ' global_quantities.b0.data_fullpath];
......@@ -182,6 +183,9 @@ global_quantities_desc.current_non_inductive = [params_eff.data_request ' ; ' gl
params_eff.data_request = 'w_mhd';
global_quantities.energy_diamagnetic = gdat(params_summary.shot,params_eff);
global_quantities_desc.energy_diamagnetic = [params_eff.data_request ' ; ' global_quantities.energy_diamagnetic.data_fullpath];
params_eff.data_request = 'tau_tot';
global_quantities.tau_energy = gdat(params_summary.shot,params_eff);
global_quantities_desc.tau_energy = [params_eff.data_request ' ; ' global_quantities.tau_energy.data_fullpath];
params_eff.data_request = '\tcv_shot::top.results.conf:we';
global_quantities.energy_electrons_thermal = gdat(params_summary.shot,params_eff);
global_quantities_desc.energy_electrons_thermal = [params_eff.data_request ' ; ' global_quantities.energy_electrons_thermal.data_fullpath];
......@@ -263,6 +267,7 @@ end
ids_summary.global_quantities.r0.value = global_quantities.r0.data;
ids_summary.global_quantities.r0.source = ['gdat request: ' global_quantities_desc.r0];
%% volume average
% cst zeff
params_eff.data_request = '\tcv_shot::top.results.ibs:z_eff';
volume_average.zeff = gdat(params_summary.shot,params_eff);
......@@ -283,6 +288,29 @@ for i=1:numel(volume_average_fieldnames)
end
end
%% line average
params_eff.data_request = 'nel';
line_average.n_e = gdat(params_summary.shot,params_eff);
line_average_desc.n_e = [params_eff.data_request ' ; ' volume_average.zeff.data_fullpath ' (not vol avrg but to match Iohm)'];
special_fields = {}; % fields needing non-automatic treatments
line_average_fieldnames = fieldnames(line_average);
for i=1:numel(line_average_fieldnames)
if ~any(strcmp(line_average_fieldnames{i},special_fields))
if ~isstruct(ids_summary.line_average.(line_average_fieldnames{i}).value)
ids_summary.line_average.(line_average_fieldnames{i}).value = interp1( ...
line_average.(line_average_fieldnames{i}).t,line_average.(line_average_fieldnames{i}).data, ...
ids_summary.time,'linear',NaN);
ids_summary.line_average.(line_average_fieldnames{i}).source = ['gdat request: ' line_average_desc.(line_average_fieldnames{i})];
else
special_fields{end+1} = line_average_fieldnames{i};
end
end
end
%%
% cocos automatic transform
if ~isempty(which('ids_generic_cocos_nodes_transformation_symbolic'))
[ids_summary,cocoscoeff]=ids_generic_cocos_nodes_transformation_symbolic(ids_summary,'summary',gdat_params.cocos_in, ...
......
function [ids_generic, params_ids_generic] = tcv_ids_headpart(shot,ids_in,ids_name,varargin);
function [ids_generic, params_ids_generic] = tcv_ids_headpart(shot,ids_in,ids_name,varargin)
%
% [ids_generic, params_ids_generic] = tcv_ids_headpart(shot,ids_in,ids_name,varargin);
%
% parses inputs and fill in ids_properties
%
%
% varargin options:
%
% 'comment': comment to include in ids_properties, using gdat_params for example cocos_in and cocos_out
% 'homogeneous_time': homogeneous_time in ids_properties: 1 (default) if the whole ids has same time, 0 otherwise
% 'gdat_params': gdat params structure
% 'comment': comment to include in ids_properties, using gdat_params
% for example cocos_in and cocos_out
% 'homogeneous_time': homogeneous_time in ids_properties:
% 1 (default) if the whole ids has same time, 0 otherwise
% 'gdat_params': gdat params structure
%
%
% example:
% [ids_equilibrium, params_ids_equilibrium] = tcv_ids_headpart(shot,ids_equil_empty,'equilibrium','comment','your comment');
%
%
% initialize input parser
p = inputParser;
......