RUN = 1; % To run or just to load addpath(genpath('../matlab')) % ... add default_plots_options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Set Up parameters CLUSTER.TIME = '99:00:00'; % allocation time hh:mm:ss %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% PHYSICAL PARAMETERS NU = 0.1; % Collision frequency TAU = 1.0; % e/i temperature ratio K_N = 1/0.6; % Density gradient drive K_T = 0.0; % Temperature ''' K_E = 0.0; % Electrostat ''' SIGMA_E = 0.0233380; % mass ratio sqrt(m_a/m_i) (correct = 0.0233380) %% GRID PARAMETERS Nx = 100; % real space x-gridpoints Ny = 1; % '' y-gridpoints Lx = 150; % Size of the squared frequency domain Ly = 1; % Size of the squared frequency domain Nz = 1; % number of perpendicular planes (parallel grid) q0 = 1.0; % safety factor shear = 0.0; % magnetic shear eps = 0.0; % inverse aspect ratio %% TIME PARMETERS TMAX = 100; % Maximal time unit DT = 1e-2; % Time step SPS0D = 1; % Sampling per time unit for 2D arrays SPS2D = 0; % Sampling per time unit for 2D arrays SPS3D = 1; % Sampling per time unit for 2D arrays SPS5D = 1; % Sampling per time unit for 5D arrays SPSCP = 0; % Sampling per time unit for checkpoints JOB2LOAD= -1; %% OPTIONS SIMID = 'test_4.1'; % Name of the simulation NON_LIN = 0; % activate non-linearity (is cancelled if KXEQ0 = 1) % Collision operator % (0:L.Bernstein, 1:Dougherty, 2:Sugama, 3:Pitch angle, 4:Full Couloumb ; +/- for GK/DK) CO = 2; INIT_ZF = 0; ZF_AMP = 0.0; CLOS = 0; % Closure model (0: =0 truncation, 1: gyrofluid closure (p+2j<=Pmax)) NL_CLOS = 0; % nonlinear closure model (-2:nmax=jmax; -1:nmax=jmax-j; >=0:nmax=NL_CLOS) KERN = 0; % Kernel model (0 : GK) INIT_PHI= 0; % Start simulation with a noisy phi %% OUTPUTS W_DOUBLE = 1; W_GAMMA = 1; W_HF = 1; W_PHI = 1; W_NA00 = 1; W_DENS = 1; W_TEMP = 1; W_NAPJ = 1; W_SAPJ = 0; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % unused HD_CO = 0.5; % Hyper diffusivity cutoff ratio kmax = Nx*pi/Lx;% Highest fourier mode NU_HYP = 0.0; % Hyperdiffusivity coefficient MU = NU_HYP/(HD_CO*kmax)^4; % Hyperdiffusivity coefficient INIT_BLOB = 0; WIPE_TURB = 0; WIPE_ZF = 0; MU_P = 0.0; % Hermite hyperdiffusivity -mu_p*(d/dvpar)^4 f MU_J = 0.0; % Laguerre hyperdiffusivity -mu_j*(d/dvperp)^4 f LAMBDAD = 0.0; NOISE0 = 1.0e-5; % Init noise amplitude BCKGD0 = 0.0; % Init background GRADB = 1.0; CURVB = 1.0; %% PARAMETER SCANS if 1 %% Parameter scan over PJ % PA = [2 4]; % JA = [1 2]; PA = [4]; JA = [2]; DTA= DT*ones(size(JA));%./sqrt(JA); % DTA= DT; mup_ = MU_P; muj_ = MU_J; Nparam = numel(PA); param_name = 'PJ'; gamma_Ni00 = zeros(Nparam,floor(Nx/2)+1); gamma_Nipj = zeros(Nparam,floor(Nx/2)+1); gamma_phi = zeros(Nparam,floor(Nx/2)+1); for i = 1:Nparam % Change scan parameter PMAXE = PA(i); PMAXI = PA(i); JMAXE = JA(i); JMAXI = JA(i); DT = DTA(i); setup system(['rm fort*.90']); % Run linear simulation if RUN % system(['cd ../results/',SIMID,'/',PARAMS,'/; mpirun -np 6 ./../../../bin/helaz 1 6 0; cd ../../../wk']) % system(['cd ../results/',SIMID,'/',PARAMS,'/; mpirun -np 2 ./../../../bin/helaz 1 2 0; cd ../../../wk']) system(['cd ../results/',SIMID,'/',PARAMS,'/; ./../../../bin/helaz 0; cd ../../../wk']) end % Load and process results %% filename = ['../results/',SIMID,'/',PARAMS,'/outputs_00.h5']; load_results for ikx = 1:Nx/2+1 tend = max(Ts3D(abs(Ni00(ikx,1,1,:))~=0)); tstart = 0.6*tend; [~,itstart] = min(abs(Ts3D-tstart)); [~,itend] = min(abs(Ts3D-tend)); trange = itstart:itend; % exp fit on moment 00 X_ = Ts3D(trange); Y_ = squeeze(abs(Ni00(ikx,1,1,trange))); gamma_Ni00(i,ikx) = LinearFit_s(X_,Y_); % exp fit on phi X_ = Ts3D(trange); Y_ = squeeze(abs(PHI(ikx,1,1,trange))); gamma_phi (i,ikx) = LinearFit_s(X_,Y_); end gamma_Ni00(i,:) = real(gamma_Ni00(i,:));% .* (gamma_Ni00(i,:)>=0.0)); gamma_Nipj(i,:) = real(gamma_Nipj(i,:));% .* (gamma_Nipj(i,:)>=0.0)); if 0 %% Fit verification figure; for i = 1:1:Nx/2+1 X_ = Ts3D(:); Y_ = squeeze(abs(Ni00(i,1,1,:))); semilogy(X_,Y_,'DisplayName',['k=',num2str(kx(i))]); hold on; end end if 1 %% Plot SCALE = 1;%sqrt(2); fig = figure; FIGNAME = 'linear_study'; plt = @(x) x; % subplot(211) for i = 1:Nparam clr = line_colors(mod(i-1,numel(line_colors(:,1)))+1,:); linestyle = line_styles(floor((i-1)/numel(line_colors(:,1)))+1); plot(plt(SCALE*kx),plt(gamma_phi(i,1:end)),... 'Color',clr,... 'LineStyle',linestyle{1},'Marker','^',... ...% 'DisplayName',['$\kappa_N=',num2str(K_N),'$, $\nu_{',CONAME,'}=',num2str(NU),'$, $P=',num2str(PA(i)),'$, $J=',num2str(JA(i)),'$']); 'DisplayName',[CONAME,', $P,J=',num2str(PA(i)),',',num2str(JA(i)),'$']); hold on; end grid on; xlabel('$k_y\rho_s^{R}$'); ylabel('$\gamma(\phi)L_\perp/c_s$'); xlim([0.0,max(kx)]); title(['$\kappa_N=',num2str(K_N),'$, $\nu_{',CONAME,'}=',num2str(NU),'$']) % title(['$\nabla N = 0$', ', $\nu=',num2str(NU),'$']) legend('show'); %xlim([0.01,10]) saveas(fig,[SIMDIR,'gamma_Ni_vs_',param_name,'_',PARAMS,'.fig']); saveas(fig,[SIMDIR,'gamma_Ni_vs_',param_name,'_',PARAMS,'.png']); end end if 0 %% Space time [YT,XT] = meshgrid(Ts3D,kx); figure; % pclr = surf(XT,YT,squeeze(abs(PHI_ST(1,:,:)))); set(pclr, 'edgecolor','none'); colorbar; % pclr = pcolor(XT,YT,squeeze(abs(Ni00_ST(1,:,:)))); set(pclr, 'edgecolor','none'); colorbar; semilogy(Ts3D(1:TMAX/SPS3D),squeeze(abs(PHI_ST(1,50:5:100,:)))); end end