Newer
Older
gyacomodir = pwd; gyacomodir = gyacomodir(1:end-2); % get code directory
addpath(genpath([gyacomodir,'matlab'])) % ... add
addpath(genpath([gyacomodir,'matlab/plot'])) % ... add
addpath(genpath([gyacomodir,'matlab/compute'])) % ... add
addpath(genpath([gyacomodir,'matlab/load'])) % ... add
default_plots_options
% Partition of the computer where the data have to be searched
% PARTITION='/Users/ahoffmann/gyacomo/results/paper_3/';
% PARTITION='/misc/gyacomo23_outputs/paper_3/';
% resdir = 'DIIID_rho_95_Tstudy/ion_scale/ion_scale_5x2x256x64x32_tau_1_RN_0/0T/';
% resdir = 'DIIID_rho_95_Tstudy/adiab_e/5x2x256x64x32_tau_1_RN_0/0T/';
%%
PARTITION = '/misc/gyacomo23_outputs/triangularity_paper/';
% resdir = 'ion_scale/3x2x256x64x32/PT';
% resdir = 'ion_scale/5x2x256x64x32/0T';
% resdir = 'adiabatic_electrons/5x2x256x64x32/0T';
% resdir = 'adiabatic_electrons/5x2x192x48x24/NT';
% resdir = 'hot_electrons/256x64x32/0T';
% resdir = 'hot_electrons/L_300/256x64x32/0T';
resdir = 'hot_electrons/L_300_gradN_scaled/256x64x32/0T';
% resdir = 'hot_electrons/256x64x32/0T';
% resdir = 'hot_electrons/512x64x32/0T';
% PARTITION = '/misc/gyacomo23_outputs/paper_3/';
% resdir = 'DIIID_HEL_rho95/PT';
% Load basic info (grids and time traces)
[data.Na00, data.Ts3D] = compile_results_3Da(DATADIR,J0,J1,'Na00');
data.Ni00 = reshape(data.Na00(1,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
try
data.Ne00 = reshape(data.Na00(2,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
catch
end
[data.PHI, data.Ts3D] = compile_results_3D(DATADIR,J0,J1,'phi');
if 1
%%
[data.TEMP, data.Ts3D] = compile_results_3Da(data.folder,J0,J1,'temp');
% [data.UPAR, data.Ts3D] = compile_results_3Da(data.folder,J0,J1,'upar');
[data.DENS, data.Ts3D] = compile_results_3Da(data.folder,J0,J1,'dens');
data.TEMP_I = reshape(data.TEMP(1,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
% data.UPAR_I = reshape(data.UPAR(1,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
data.DENS_I = reshape(data.DENS(1,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
data.Ni00 = reshape(data.Na00(1,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
if data.inputs.Na > 1
data.TEMP_E = reshape(data.TEMP(2,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
data.DENS_E = reshape(data.DENS(2,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
data.Ne00 = reshape(data.Na00(2,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
end
end
%% Plot transport and phi radial profile
% [data.PHI, data.Ts3D] = compile_results_3D(DATADIR,J0,J1,'phi');
% [data.PSI, data.Ts3D] = compile_results_3D(DATADIR,J0,J1,'psi');
options.TAVG_0 = data.Ts3D(end)/2;
options.TAVG_1 = data.Ts3D(end);
options.NCUT = 5; % Number of cuts for averaging and error estimation
options.NMVA = 1; % Moving average for time traces
% options.ST_FIELD = '\Gamma_x'; % chose your field to plot in spacetime diag (e.g \phi,v_x,G_x)
% options.ST_FIELD = 'n_i'; % chose your field to plot in spacetime diag (e.g \phi,v_x,G_x)
% options.ST_FIELD = 'u_i'; % chose your field to plot in spacetime diag (e.g \phi,v_x,G_x)
options.ST_FIELD = 'T_i'; % chose your field to plot in spacetime diag (e.g \phi,v_x,G_x)
% options.ST_FIELD = 'n_i T_i'; % chose your field to plot in spacetime diag (e.g \phi,v_x,G_x)
% options.ST_FIELD = '\phi'; % chose your field to plot in spacetime diag (e.g \phi,v_x,G_x)
% options.ST_FIELD = 'Q_{xi}'; % chose your field to plot in spacetime diag (e.g \phi,v_x,G_x)
% options.ST_FIELD = 'G_x'; % chose your field to plot in spacetime diag (e.g \phi,v_x,G_x)
% options.ST_FIELD = 'w_{Ez}'; % chose your field to plot in spacetime diag (e.g \phi,v_x,G_x)
% options.ST_FIELD = 'v_{Ey}'; % chose your field to plot in spacetime diag (e.g \phi,v_x,G_x)
% options.ST_FIELD = 'N_i^{00}'; % chose your field to plot in spacetime diag (e.g \phi,v_x,G_x)
options.INTERP = 0;
options.RESOLUTION = 256;
plot_radial_transport_and_spacetime(data,options);
% options.NAME = 'u_i';
% options.NAME = 'n_i';
% options.NAME = 'Q_{xi}';
% options.NAME = 'v_{Ey}';
options.NAME = 'w_{Ez}';
% options.NAME = 'n_i-n_e';
loc =11;
[~,i_] = min(abs(loc - data.grids.y));
options.COMP =i_;
% options.PLAN = '3D';
options.PLAN = 'xy'; options.COMP =floor(data.grids.Nz/2)+1;
% options.PLAN = 'xz'; options.COMP ='avg';
% options.COMP ='avg';
options.XYZ =[-11 20 0];
options.TIME = [100 250 350 500]; options.TAVG = 0;
% options.TIME = [100:250]; options.TAVG = 1;
options.RESOLUTION = 256;
fig = photomaton(data,options);
% save_figure(data,fig)
end
if 0
%% Performance profiler
profiler(data)
end
if 1
%% Mode evolution
% [data.PHI, data.Ts3D] = compile_results_3D(DATADIR,J0,J1,'phi');
% [data.Na00, data.Ts3D] = compile_results_3Da(DATADIR,J0,J1,'Na00');
% data.Ni00 = reshape(data.Na00(1,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
% data.Ne00 = reshape(data.Na00(2,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
options.NORMALIZED = 0;
options.TIME = data.Ts3D;
options.KX_TW = [0.1 2.5]; %kx Growth rate time window
options.KY_TW = [0.1 2.5]; %ky Growth rate time window
options.NMA = 1;
options.NMODES = 64;
options.iz = 'avg'; % avg or index
options.ik = 1; % sum, max or index
options.fftz.flag = 0;
options.FIELD = 'Ni00';
% options.FIELD = 'phi';
% options.FIELD = 'T_i';
options.GOK2 = 0;
options.SHOWFIG = 1;
[fig, wkykx, ekykx] = mode_growth_meter(data,options);
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
% %%
% kx = (1:data.grids.Nx/2)'*2*pi/data.fort_00.GRID.Lx;
% ky = (1:data.grids.Ny/2)'*2*pi/data.fort_00.GRID.Ly;
% gkxky = real(wkykx(2:end,1:data.grids.Nx/2))';
% gkxky(isnan(gkxky)) =0;
% gkxky(isinf(gkxky)) =0;
% % gkxky(gkxky<0) =0;
% % gkxky = imgaussfilt(gkxky,1);
% %
% wkxky = imag(wkykx(2:end,1:data.grids.Nx/2))';
% wkxky(isnan(wkxky)) =0;
% wkxky(isinf(wkxky)) =0;
% % wkxky(wkxky<0) =0;
% % wkxky = imgaussfilt(wkxky,1.5);
% %
% figure;
% subplot(121)
% contourf(kx,ky,gkxky',10)
% % clim(0.5*[0 1]);
% % colormap(bluewhitered); colorbar;
% xlim([0.025 1]);
% xlabel('$k_x\rho_s$'); ylabel('$k_y\rho_s$')
% subplot(122)
% contourf(kx,ky,wkxky',10)
% % clim(1*[0 1]);
% % colormap(bluewhitered); colorbar
% xlim([0.025 1]);
% xlabel('$k_x\rho_s$'); ylabel('$k_y\rho_s$')
% % save_figure(data,fig,'.png')
[data.Napjz, data.Ts3D] = compile_results_3Da(DATADIR,J0,J1,'Napjz');
data.Napjz(1,3,1,:,:) = data.Napjz(1,3,1,:,:)*data.inputs.tau;
data.Napjz(1,1,2,:,:) = data.Napjz(1,1,2,:,:)*data.inputs.tau;
% [data.Napjz, data.Ts3D] = compile_results_3D(DATADIR,J0,J1,'Nipjz');
options.FILTER = 0; %filter the 50% time-average of the spectrum from
options.TAVG_2D = 0; %Show a 2D plot of the modes, 50% time averaged
options.TAVG_2D_CTR= 0; %make it contour plot
fig = show_moments_spectrum(data,options);
end
if (0 && NZ>4)
%% Ballooning plot
% [data.PHI, data.Ts3D] = compile_results_3D(DATADIR,J0,J1,'phi');
if data.inputs.BETA > 0
[data.PSI, data.Ts3D] = compile_results_3D(DATADIR,J0,J1,'psi');
end
options.time_2_plot = [25 100];
options.kymodes = 1.5;
options.normalized = 1;
options.PLOT_KP = 0;
% options.field = 'phi';
options.SHOWFIG = 1;
[fig, chi, phib, psib, ~] = plot_ballooning(data,options);
end
options.TIME = [100 300]; % averaging time window
% options.NAME = ['N_i^{00}'];
% options.NAME = 'n_i';
% options.NAME = 'T_i';
% options.NAME = 'Q_{xi}';
% options.NAME = 's_{Ey}';
options.NAME = '\phi';
% options.NAME = '\psi';
options.NORMALIZE = 0;
[fig] = plot_spectrum(data,options);
if 0
%% MOVIES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Options
% [data.PHI, data.Ts3D] = compile_results_3D(DATADIR,J0,J1,'phi');
% [data.PSI, data.Ts3D] = compile_results_3D(DATADIR,J0,J1,'psi');
% [data.Na00, data.Ts3D] = compile_results_3Da(DATADIR,J0,J1,'Na00');
% data.Ni00 = reshape(data.Na00(1,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
% data.Ne00 = reshape(data.Na00(2,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
% [data.DENS, data.Ts3D] = compile_results_3Da(DATADIR,J0,J1,'dens');
% data.DENS_I = reshape(data.DENS(1,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
% [data.TEMP, data.Ts3D] = compile_results_3Da(DATADIR,J0,J1,'temp');
% data.TEMP_I = reshape(data.TEMP(1,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
options.INTERP = 0;
options.POLARPLOT = 0;
options.BWR = 1; % bluewhitered plot or gray
options.CLIMAUTO = 0; % adjust the colormap auto
% options.NAME = '\phi';
% options.NAME = 'w_{Ez}';
% options.NAME = '\psi';
options.PLAN = 'xy'; options.COMP =floor(data.grids.Nz/2)+1;
% options.PLAN = 'xz'; options.COMP ='avg';
options.TIME = data.Ts3D(1:1:end);
% options.TIME = [0:1500];
data.EPS = 0.1;
data.a = data.EPS * 2000;
options.RESOLUTION = 256;
options.FPS = 12;
options.RMAXIS = 0;
create_film(data,options,'.gif');
end
if 0
%% Metric infos
options.SHOW_FLUXSURF = 1;
options.SHOW_METRICS = 1;
[fig, geo_arrays] = plot_metric(data,options);
end
if 0
%% Study singular values
[data.SV_ky_pj, data.Ts2D] = compile_results_2D(DATADIR,J0,J1,'sv_ky_pj');
nSV = data.grids.Np * data.grids.Nj;
colors_ = jet(nSV);
figure
for i = 1:nSV
sv = squeeze(data.SV_ky_pj(i,:));
semilogy(data.Ts2D,sv,...
'color',colors_(i,:),'DisplayName',['SV ',num2str(i)]);hold on
end
legend('show');