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

add zeff from data or input with explicit default value as well

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@12143 d63d8f72-b253-0410-a779-e742ad2e26cf
parent ee95945a
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,8 @@ function [torbeam_out,torbeam_in,varargout] = torbeam_prepare_inputs_and_run(sho
% varargin{2}: source for gdat profiles/equilibrium related: [] (default sources), 'IDA' (IDA/IDE sources), {'TRA','expname'} for TRANSP
% varargin{3}: source for torbeam angles: 0 (default) from conversion from ECS/ECN with aug_setval2tp_mex; 1 from TBP/git shotfile
% varargin{4}: nb of radial points for outputs in shotfile structure (default 401)
% varargin{5}: if >0: zeff default if no data in gdat(shot,'zeff') (2. is default)
% if <0: zeff value (abs(varargin{5}) to impose for all times
%
% Examples:
% [torbeam_out,torbeam_in] = torbeam_prepare_inputs_and_run(30594,linspace(0,10,101));
......@@ -61,18 +63,29 @@ if nargin>=6 && ~isempty(varargin{4})
end
torbeam_in.prepare_run_options.nb_points_shotfile = nb_points_shotfile;
zeff_default = 2.0;
if nargin>=7 && ~isempty(varargin{5})
zeff_default = varargin{5};
end
torbeam_in.prepare_run_options.zeff_default = zeff_default;
if doload
tic
if isempty(source_gdat_profiles_exp_name)
torbeam_in.nete=gdat(shot,'nete_rho','machine','aug','source',source_gdat_profiles);
torbeam_in.nete = gdat(shot,'nete_rho','machine','aug','source',source_gdat_profiles);
torbeam_in.zeff = gdat(shot,'zeff','machine','aug');
else
torbeam_in.nete=gdat(shot,'nete_rho','machine','aug','source',source_gdat_profiles,'source_exp_name',source_gdat_profiles_exp_name);
torbeam_in.zeff = gdat(shot,'zeff','machine','aug','source_exp_name',source_gdat_profiles_exp_name);
end
% qrho_and_grid=gdat(shot,'q_rho','machine','aug');
else
if ~isfield(torbeam_in,'nete') || isempty(torbeam_in.nete)
error('expects nete as field of torbeam_in (varargin{1}) from gdat(shot,''nete_rho'')')
end
if ~isfield(torbeam_in,'zeff') || isempty(torbeam_in.zeff)
error('expects zeff as field of torbeam_in (varargin{1}) from gdat(shot,''zeff'')')
end
end
% base all times on Te data (most important? although ne as well), note take Thomson by default to avoid cut-off
......@@ -190,6 +203,12 @@ if doload,
if mod(nb_rmesh*nb_zmesh,8) ~= 0; fprintf(fid,'\n'); end
fclose(fid);
if isempty(torbeam_in.zeff.data) || torbeam_in.prepare_run_options.zeff_default < 0.
zeff_eff = abs(torbeam_in.prepare_run_options.zeff_default);
else
zeff_eff = interpos(21,torbeam_in.zeff.t,torbeam_in.zeff.data,torbeam_in.inbeam.t_some_beam_on(it));
end
torbeam_in.inbeam.zeff_t(it_inb(it)) = zeff_eff;
% extract beam info at given time
for ibeam=find(torbeam_in.inbeam.beam_on(:,it_inb(it)))',
torbeam_in.fname{it}.inbeam{ibeam} = fullfile(torbeam_in.dir_torbeam,['inbeam' '_t' num2str(torbeam_in.inbeam.t_some_beam_on(it)) 'g' num2str(ibeam) '.dat']);
......@@ -204,6 +223,7 @@ if doload,
fprintf(fid,[' ' tb_par_fields{i} ' = %f,\n'],torbeam_in.inbeam.tb_par.(tb_par_fields{i})(ibeam));
end
fprintf(fid,' xpw0 = %f,\n',torbeam_in.inbeam.power_t(ibeam,it_inb(it))/1.e6);
fprintf(fid,' xzeff = %f,\n',torbeam_in.inbeam.zeff_t(it_inb(it)));
fprintf(fid,'/\n');
fclose(fid);
end
......
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