Skip to content
Snippets Groups Projects
Commit 4ee32be6 authored by Olivier Sauter's avatar Olivier Sauter
Browse files

fix TCV ids for version 3.31

parent f7723eeb
No related branches found
No related tags found
1 merge request!88fix TCV ids for version 3.31
......@@ -2,7 +2,7 @@
%
% generate empty ids structures, from gateway in imasenv, get list and then generate present known ids
%
ids_list_all=ids_list;
ids_list_all=IDS_list;
% ids_list_to_generate = tcv_available_ids;
ids_list_to_generate = ids_list_all;
......@@ -12,3 +12,6 @@ for i=1:length(ids_list_to_generate)
end
% save ids_structures_IMAS326.mat ids_structures ids_list_to_generate ids_list_all
% then use ids_structures_mat_to_m to save all the structures as ids_empty_xx.m files
% [empty_dir_out] = ids_structures_mat_to_m('/tmp/sautero/ids_structures_IMAS331.mat','/tmp/sautero/ids_empty')
%
......@@ -82,10 +82,10 @@ params_ids2database = params;
% check ids_names
ids_names=fieldnames(ids2put);
try
if exist('ids_list')
ids_full_list = ids_list;
else
if exist('IDS_list')
ids_full_list = IDS_list;
else
ids_full_list = ids_list;
end
catch
ids_full_list = tcv_available_ids;
......
function [empty_dir_out] = ids_structures_mat_to_m(mat_filename,emptydirname)
%%
% auxiliary script to write .mat containing empty IDS to separate .m files
% in ids_empty_folder
%
% Example:
% [empty_dir_out] = ids_structures_mat_to_m('/tmp/sautero/ids_structures_IMAS331.mat','/tmp/sautero/ids_empty')
%
if nargin < 1 || isempty(mat_filename)
error('requires mat filename');
return
end
if nargin < 2 || isempty(emptydirname)
target_folder = 'ids_empty';
else
target_folder = emptydirname;
end
empty_dir_out = target_folder;
clear;
cd(fileparts(mfilename('fullpath')));
ids_struct_saved = '/home/sauter/matlab/gdat_develop/matlab/TCV_IMAS/ids_structures_20190312.mat';
ids_struct_saved = '/home/sauter/matlab/gdat_develop/matlab/TCV_IMAS/ids_structures_IMAS326.mat';
target_folder = 'ids_empty';
ffolder = fullfile(fileparts(mfilename('fullpath')),target_folder);
ids_struct_saved = mat_filename;
ffolder = fullfile(target_folder);
assert(~~exist(ffolder,'dir'),'target folder does not exist')
load(ids_struct_saved);
......@@ -19,7 +30,7 @@ okflag = writecell(fields,fullfile(ffolder,'ids_list_all'),15);
assert(okflag,'problem writing cell array');
assert(isequaln(fields,eval('ids_list_all'))); % check
%% write individual files per ids template
addpath(ffolder)
for ii=1:numel(fields)
myfield = fields{ii};
fieldval = ids_structures.(myfield);
......@@ -33,13 +44,10 @@ for ii=1:numel(fields)
assert(okflag,'failed writing %s',fpath);
try
cd ids_empty
S_out = eval(fname);
assert(isequaln(fieldval,S_out),'fields not equal %s',myfield);
cd ..
catch ME
cd ..
keyboard
keyboard
rethrow(ME)
end
end
......@@ -268,13 +268,13 @@ for it=1:length(ids_core_profiles.time)
ids_core_profiles.profiles_1d{it}.ion{1}.element{1}.a = 2.;
ids_core_profiles.profiles_1d{it}.ion{1}.element{1}.z_n = 1;
ids_core_profiles.profiles_1d{it}.ion{1}.element{1}.atoms_n = 1;
ids_core_profiles.profiles_1d{it}.ion{1}.z_ion = 1;
ids_core_profiles.profiles_1d{it}.ion{1}.multiple_states_flag = 0;
ids_core_profiles.profiles_1d{it}.ion{1}.temperature = temp_1d.ti.fit.data(:,it_ti(it));
ids_core_profiles.profiles_1d{it}.ion{1}.density = (temp_1d.ni.fit.data(:,it_ti(it)).*Zp-ids_core_profiles.profiles_1d{it}.electrons.density)./(Zp-1.);
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}.z_ion = 1;
ids_core_profiles.profiles_1d{it}.ion{1}.label = 'D+';
%
ids_core_profiles.profiles_1d{it}.t_i_average = ids_core_profiles.profiles_1d{it}.ion{1}.temperature;
......@@ -289,13 +289,13 @@ for it=1:length(ids_core_profiles.time)
ids_core_profiles.profiles_1d{it}.ion{2}.element{1}.a = 12.;
ids_core_profiles.profiles_1d{it}.ion{2}.element{1}.z_n = 6.;
ids_core_profiles.profiles_1d{it}.ion{2}.element{1}.atoms_n = 1.;
ids_core_profiles.profiles_1d{it}.ion{2}.z_ion = 6.;
ids_core_profiles.profiles_1d{it}.ion{2}.multiple_states_flag = 0;
ids_core_profiles.profiles_1d{it}.ion{2}.temperature = ids_core_profiles.profiles_1d{it}.ion{1}.temperature;
ids_core_profiles.profiles_1d{it}.ion{2}.density = (ids_core_profiles.profiles_1d{it}.electrons.density - ids_core_profiles.profiles_1d{it}.ion{1}.density) ./ ids_core_profiles.profiles_1d{it}.ion{2}.element{1}.z_ion;
ids_core_profiles.profiles_1d{it}.ion{2}.density = (ids_core_profiles.profiles_1d{it}.electrons.density - ids_core_profiles.profiles_1d{it}.ion{1}.density) ./ ids_core_profiles.profiles_1d{it}.ion{2}.z_ion;
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}.z_ion = 6.;
ids_core_profiles.profiles_1d{it}.ion{2}.label = 'C6+';
% average/sums
ids_core_profiles.profiles_1d{it}.t_i_average = ids_core_profiles.profiles_1d{it}.ion{1}.temperature;
......
......@@ -120,13 +120,27 @@ for iunit=1:nb_units
% ids_nbi.unit{iunit}.beamlets_group{1}.width_vertical_error_index: -999999999
% ids_nbi.unit{iunit}.beamlets_group{1}.width_vertical_error_lower: -9.0000e+40
% ids_nbi.unit{iunit}.beamlets_group{1}.width_vertical_error_upper: -9.0000e+40
ids_nbi.unit{iunit}.beamlets_group{1}.focus = beamlets_group.focus(iunit);
% Should always copy "leaves" only to avoid deleting non-filled in values like error_bars
fields_to_copy = fieldnames(beamlets_group.focus(iunit));
for i=1:numel(fields_to_copy)
ids_nbi.unit{iunit}.beamlets_group{1}.focus.(fields_to_copy{i}) = beamlets_group.focus(iunit).(fields_to_copy{i});
end
%% divergence component struct
ids_nbi.unit{iunit}.beamlets_group{1}.divergence_component{1} = beamlets_group.divergence(iunit);
fields_to_copy = fieldnames(beamlets_group.divergence(iunit));
for i=1:numel(fields_to_copy)
ids_nbi.unit{iunit}.beamlets_group{1}.divergence_component{1}.(fields_to_copy{i}) = beamlets_group.divergence(iunit).(fields_to_copy{i});
end
%% tilting
% it is fixed in time. what should we do about it?
% At this stage empty, so need empty cell, otherwise provide 2 time points with same values
ids_nbi.unit{iunit}.beamlets_group{1}.tilting = {};
%% position
ids_nbi.unit{iunit}.beamlets_group{1}.position = beamlets_group.position(iunit);
fields_to_copy = fieldnames(beamlets_group.position(iunit));
for i=1:numel(fields_to_copy)
ids_nbi.unit{iunit}.beamlets_group{1}.position.(fields_to_copy{i}) = beamlets_group.position(iunit).(fields_to_copy{i});
end
%% beamlets
% M. Vallar thinks it is useless now
......
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