diff --git a/crpptbx_new/TCV/gdat_tcv.m b/crpptbx_new/TCV/gdat_tcv.m index b4cfa20ad03e3429403016f66107c1bbaa1e7a01..56916d660a0208dabf62d660546d1d248eee8b43 100644 --- a/crpptbx_new/TCV/gdat_tcv.m +++ b/crpptbx_new/TCV/gdat_tcv.m @@ -555,6 +555,25 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') gdat_data.request_description = ['data=psi, x=(R,Z), eqdsk contains eqdsk structure with which ' ... 'plot_eqdsk, write_eqdsk, read_eqdsk can be used']; + case {'mhd'} + % load n=1, 2 and 3 Bdot from magnetic measurements + n1=tdi('abs(mhdmode("LFS",1,1))'); + n2=tdi('abs(mhdmode("LFS",2,1))'); + n3=tdi('abs(mhdmode("LFS",3,1))'); + if ~isempty(n1.data) + gdat_data.data(:,1) = reshape(n1.data,length(n1.data),1); + if length(n2.data)==length(n1.data); gdat_data.data(:,2) = reshape(n2.data,length(n2.data),1); end + if length(n3.data)==length(n1.data); gdat_data.data(:,3) = reshape(n3.data,length(n3.data),1); end + gdat_data.dim{1} = n1.dim{1}; + gdat_data.t = gdat_data.dim{1}; + gdat_data.dim{2} = [1; 2; 3]; + gdat_data.dimunits{1} = n1.dimunits{1}; + gdat_data.dimunits{2} = 'n number'; + gdat_data.units = 'T/s'; + gdat_data.data_fullpath='abs(mhdmode("LFS",n,1))'; + gdat_data.request_description = 'delta_Bdot from magnetic probes to get n=1, 2 and 3'; + end + case {'ne','te'} % ne or Te from Thomson data on raw z mesh vs (z,t) nodenameeff=['\results::thomson:' data_request_eff]; @@ -595,9 +614,89 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') gdat_data.units=tracetdi.units; end - case 'nerho' - - + case {'ne_rho', 'te_rho', 'nete_rho'} + try + time=mdsdata('\results::thomson:times'); + catch + warning('Problems with \results::thomson:times') + warning(['!!!!!!!!!!!!!!!!!!!!!!!!! cannot continue with ' data_request_eff]) + return + end + if isempty(time) || ischar(time) + thomsontimes=time + warning('!!!!!!!!!!!!!!!!!!!!!!!!!\results::thomson:times is empty? Check') + disp(['!!!!!!!!!!!!!!!!!!!!!!!!! cannot continue with ' data_request_eff]) + return + end + edge_str_col = ''; + edge_str_dot = ''; + if isfield(gdat_data.gdat_params,'edge') && ~isempty(gdat_data.gdat_params.edge) && ... + gdat_data.gdat_params.edge>0 + edge_str_col = ':edge'; + edge_str_dot = ':edge'; + end + % if nete_rho, do first ne, then Te later (so fir stuff already done) + if strcmp(data_request_eff,'ne_rho') || strcmp(data_request_eff,'nete_rho') + nodenameeff=['\results::thomson' edge_str_col ':ne']; + tracetdi=tdi(nodenameeff); + nodenameeff=['\results::thomson' edge_str_col ':ne; error_bar ; fir_thom_rat; (ne,std)*fir_thom_rat']; + tracestd=tdi(['\results::thomson' edge_str_col ':ne:error_bar']); + tracefirrat_data = get_fir_thom_rat_data(shot,'thomson',time); + else + nodenameeff=['\results::thomson' edge_str_col ':te']; + tracetdi=tdi(nodenameeff); + nodenameeff=['\results::thomson' edge_str_col ':te; error_bar']; + tracestd=tdi(['\results::thomson' edge_str_col ':te:error_bar']); + end + gdat_data.data=tracetdi.data'; % Thomson data as (t,z) + gdat_data.error_bar=tracestd.data'; + gdat_data.data_fullpath=nodenameeff; + if strcmp(data_request_eff,'ne_rho') || strcmp(data_request_eff,'nete_rho') + gdat_data.firrat=tracefirrat_data; + gdat_data.data_abs=gdat_data.data*diag(tracefirrat_data); + gdat_data.error_bar_abs=gdat_data.error_bar*diag(tracefirrat_data); + gdat_data.data_fullpath=[gdat_data.data_fullpath ' ; _abs includes *firrat']; + end + % add correct dimensions + % construct rho mesh + psi_max=tdi(['\results::thomson' edge_str_dot ':psi_max' substr_liuqe]); + psiscatvol=tdi(['\results::thomson' edge_str_dot ':psiscatvol' substr_liuqe]); + if ~isempty(psiscatvol.data) && ~ischar(psiscatvol.data) && ~isempty(psi_max.data) && ~ischar(psi_max.data) + for ir=1:length(psiscatvol.dim{2}) + rho(ir,:)= sqrt(1.-psiscatvol.data(:,ir)./psi_max.data(:))'; + end + else + rho=NaN; + end + gdat_data.dim=[{rho};{time}]; + gdat_data.dimunits=[{'sqrt(psi)'} ; {'time [s]'}]; + gdat_data.x=rho; + gdat_data.t=time; + if any(strcmp(fieldnames(tracetdi),'units')) + gdat_data.units=tracetdi.units; + end + % if nete_rho, copy data as .ne, get .te and put pe=e ne Te in data: + if strcmp(data_request_eff,'nete_rho') + gdat_data.ne.data = gdat_data.data_abs; + gdat_data.ne.error_bar = gdat_data.error_bar_abs; + gdat_data.ne.firrat=gdat_data.firrat; + gdat_data.ne.units = 'm^{-3}'; + gdat_data = rmfield(gdat_data,{'firrat','data_abs','error_bar_abs'}); + % + nodenameeff=['\results::thomson' edge_str_col ':te']; + tracetdi=tdi(nodenameeff); + nodenameeff=['\results::thomson' edge_str_col ':te; error_bar']; + tracestd=tdi(['\results::thomson' edge_str_col ':te:error_bar']); + gdat_data.te.data=tracetdi.data'; + gdat_data.te.error_bar=tracestd.data'; + gdat_data.te.units = tracetdi.units; + gdat_data.data_fullpath=['pe=1.6e-19*ne*Te in data, .ne, .te from \results::thomson' ... + edge_str_col ':ne and te and projected on rhopol\_norm']; + gdat_data.units='N/m^2'; + gdat_data.data = 1.6022e-19 .* gdat_data.ne.data .* gdat_data.te.data; + gdat_data.error_bar = 1.6022e-19 .* (gdat_data.ne.data .* gdat_data.te.error_bar ... + + gdat_data.te.data .* gdat_data.ne.error_bar); + end otherwise warning(['switchcase= ' data_request_eff ' not known in gdat_tcv']) error_status=901; diff --git a/crpptbx_new/TCV/tcv_requests_mapping.m b/crpptbx_new/TCV/tcv_requests_mapping.m index 465d3ab15cc42182542a74834eca57a81cc0ea92..2478786aea8e9eca28f44f67cb5eafc76ca4f4ed 100644 --- a/crpptbx_new/TCV/tcv_requests_mapping.m +++ b/crpptbx_new/TCV/tcv_requests_mapping.m @@ -64,16 +64,16 @@ switch lower(data_request) mapping.expression = '\results::delta_edge'; % mapping.method = 'function'; % mapping.expression = ['tdi(''\results::q_psi'');']; % for tests - case 'delta_top' - mapping.timedim = 1; - mapping.label = 'delta\_top'; - mapping.method = 'tdiliuqe'; - mapping.expression = '\results::delta_ed_top'; case 'delta_bottom' mapping.timedim = 1; mapping.label = 'delta\_bottom'; mapping.method = 'tdiliuqe'; mapping.expression = '\results::delta_ed_bot'; + case 'delta_top' + mapping.timedim = 1; + mapping.label = 'delta\_top'; + mapping.method = 'tdiliuqe'; + mapping.expression = '\results::delta_ed_top'; case 'ece' mapping.timedim = 2; mapping.method = 'switchcase'; @@ -119,11 +119,11 @@ switch lower(data_request) mapping.label = 'line-averaged el. density'; mapping.method = 'tdi'; mapping.expression = '\results::fir:n_average'; - case 'nerho' + case 'ne_rho' mapping.timedim = 2; mapping.label = 'ne'; mapping.method = 'switchcase'; - case 'neterho' + case 'nete_rho' mapping.timedim = 2; mapping.label = 'ne and Te'; mapping.method = 'switchcase'; @@ -145,7 +145,7 @@ switch lower(data_request) mapping.timedim = 1; mapping.method = 'tdiliuqe'; mapping.expression = '\results::q_edge'; - case 'qrho' + case 'q_rho' mapping.timedim = 2; mapping.label = 'q'; mapping.method = 'switchcase'; @@ -153,6 +153,14 @@ switch lower(data_request) mapping.timedim = 1; mapping.label = 'Rgeom'; mapping.method = 'switchcase'; + case 'rhotor_edge' + mapping.timedim = 1; + mapping.label = 'rhotor\_edge=sqrt(Phi/pi/B0)'; + mapping.method = 'switchcase'; % from conf if exist otherwise computes it + case 'rhotor' + mapping.timedim = 2; + mapping.label = 'rhotor\_norm'; + mapping.method = 'switchcase'; % from conf if exist otherwise computes it case 'rhovol' mapping.timedim = 2; mapping.label = 'rhovol\_norm'; @@ -169,7 +177,7 @@ switch lower(data_request) mapping.timedim = 2; mapping.label = 'Te'; mapping.method = 'switchcase'; - case 'terho' + case 'te_rho' mapping.timedim = 2; mapping.label = 'Te'; mapping.method = 'switchcase'; @@ -185,9 +193,13 @@ switch lower(data_request) mapping.label = ''; mapping.method = 'tdi'; mapping.expression = [{'\magnetics::vloop[*,$1]'} {'001'}]; - case 'vol' + case 'volume' + mapping.timedim = 1; + mapping.label = 'Volume\_LCFS'; + mapping.method = 'switchcase'; + case 'volume_rho' mapping.timedim = 2; - mapping.label = 'Volume'; + mapping.label = 'Volume(\rho)'; mapping.method = 'switchcase'; % mapping.expression = '\results::psitbx:vol'; (if exists for liuqe2 and 3 as well) case 'zeff' diff --git a/crpptbx_new/gdat_data_request_names_rho.xlsx b/crpptbx_new/gdat_data_request_names_rho.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..a291e3bd6b325ee1e93a860aaa627486929ad29e Binary files /dev/null and b/crpptbx_new/gdat_data_request_names_rho.xlsx differ diff --git a/crpptbx_new/get_data_request_names.m b/crpptbx_new/get_data_request_names.m index 5aaf8099e7a2567e4f14a3d95874cd29bc1f6ee7..7ff6504e0ee9a08e6bf26da5f3096b43eeef4709 100644 --- a/crpptbx_new/get_data_request_names.m +++ b/crpptbx_new/get_data_request_names.m @@ -10,7 +10,7 @@ for j=1:length(expected_machines) data_request_names.(expected_machines{j}) = []; end -filename='gdat_data_request_names.xlsx'; +filename='gdat_data_request_names_rho.xlsx'; [numeric_struct,text_struct,raw_struct]=xlsread(filename);