From 7a631a931c3d6941e01aa64969c72a9800a60357 Mon Sep 17 00:00:00 2001
From: Antoine Cyril David Hoffmann <ahoffman@spcpc606.epfl.ch>
Date: Mon, 7 Dec 2020 16:08:10 +0100
Subject: [PATCH] minor changes

---
 src/srcinfo.h         |  4 +--
 src/srcinfo/srcinfo.h |  4 +--
 wk/analysis_2D.m      | 25 ++++++++------
 wk/flux_results.m     |  2 +-
 wk/fort.90            | 16 ++++-----
 wk/linear_study.m     | 76 +++++++++++++++++++++++++++++--------------
 wk/parameters_ZP.m    |  3 +-
 wk/setup.m            |  2 ++
 wk/test_parallel.m    | 11 ++++---
 9 files changed, 89 insertions(+), 54 deletions(-)

diff --git a/src/srcinfo.h b/src/srcinfo.h
index be4f109c..036a616f 100644
--- a/src/srcinfo.h
+++ b/src/srcinfo.h
@@ -3,8 +3,8 @@ character(len=40) BRANCH
 character(len=20) AUTHOR
 character(len=40) EXECDATE
 character(len=40) HOST
-parameter (VERSION='8dcebe0-dirty')
+parameter (VERSION='15a591a-dirty')
 parameter (BRANCH='MPI')
 parameter (AUTHOR='ahoffman')
-parameter (EXECDATE='Fri Nov 27 17:13:58 CET 2020')
+parameter (EXECDATE='Thu Dec 3 10:18:01 CET 2020')
 parameter (HOST ='spcpc606')
diff --git a/src/srcinfo/srcinfo.h b/src/srcinfo/srcinfo.h
index be4f109c..036a616f 100644
--- a/src/srcinfo/srcinfo.h
+++ b/src/srcinfo/srcinfo.h
@@ -3,8 +3,8 @@ character(len=40) BRANCH
 character(len=20) AUTHOR
 character(len=40) EXECDATE
 character(len=40) HOST
-parameter (VERSION='8dcebe0-dirty')
+parameter (VERSION='15a591a-dirty')
 parameter (BRANCH='MPI')
 parameter (AUTHOR='ahoffman')
-parameter (EXECDATE='Fri Nov 27 17:13:58 CET 2020')
+parameter (EXECDATE='Thu Dec 3 10:18:01 CET 2020')
 parameter (HOST ='spcpc606')
diff --git a/wk/analysis_2D.m b/wk/analysis_2D.m
index a47bcc7a..080186af 100644
--- a/wk/analysis_2D.m
+++ b/wk/analysis_2D.m
@@ -1,4 +1,9 @@
 %% Load results
+if LOAD_MARCONI
+    hostfolder = ['/marconi_scratch/userexternal/ahoffman/HeLaZ/results/',BASIC.SIMID,'/',BASIC.PARAMS];
+    localfolder= [BASIC.RESDIR,'..'];
+    system(['scp -r ahoffman@login.marconi.cineca.it:',hostfolder,' ',localfolder])
+end
 % JOBNUM = 0; load_results;
 % JOBNUM = 1; load_results;
 compile_results
@@ -233,7 +238,7 @@ save_figure
 end
 
 %%
-t0    = 0;
+t0    = 50;
 skip_ = 1; 
 DELAY = 0.01*skip_;
 FRAMES = floor(t0/(Ts2D(2)-Ts2D(1)))+1:skip_:numel(Ts2D);
@@ -358,20 +363,20 @@ end
 %%
 if 0
 %% Show frame in kspace
-tf = 20; [~,it] = min(abs(Ts5D-tf));
-fig = figure; FIGNAME = ['krkz_frame',sprintf('_%.2d',JOBNUM)];
+tf = 200; [~,it2] = min(abs(Ts2D-tf)); [~,it5] = min(abs(Ts5D-tf));
+fig = figure; FIGNAME = ['krkz_frame',sprintf('t=%.0f',Ts2D(it2))];set(gcf, 'Position',  [100, 100, 700, 600])
     subplot(221); plt = @(x) fftshift((abs(x)),2);
-        pclr = pcolor(fftshift(KR,2),fftshift(KZ,2),plt(PHI(:,:,it))); set(pclr, 'edgecolor','none'); colorbar;
-        xlabel('$k_r$'); ylabel('$k_z$'); title(sprintf('t=%.3d',Ts5D(it))); legend('$|\hat\phi|$');
+        pclr = pcolor(fftshift(KR,2),fftshift(KZ,2),plt(PHI(:,:,it2))); set(pclr, 'edgecolor','none'); colorbar;
+        xlabel('$k_r$'); ylabel('$k_z$'); title(sprintf('$t c_s/R=%.0f$',Ts2D(it2))); legend('$|\hat\phi|$');
     subplot(222); plt = @(x) fftshift(abs(x),2);
-        pclr = pcolor(fftshift(KR,2),fftshift(KZ,2),plt(Ni00(:,:,it))); set(pclr, 'edgecolor','none'); colorbar;
-        xlabel('$k_r$'); ylabel('$k_z$'); title(sprintf('t=%.3d',Ts5D(it))); legend('$|\hat n_i^{00}|$');
+        pclr = pcolor(fftshift(KR,2),fftshift(KZ,2),plt(Ni00(:,:,it2))); set(pclr, 'edgecolor','none'); colorbar;
+        xlabel('$k_r$'); ylabel('$k_z$'); legend('$|\hat n_i^{00}|$');
     subplot(223); plt = @(x) fftshift(abs(x),2);
-        pclr = pcolor(fftshift(KR,2),fftshift(KZ,2),plt(Ne00(:,:,it))); set(pclr, 'edgecolor','none'); colorbar;
-        xlabel('$k_r$'); ylabel('$k_z$'); title(sprintf('t=%.3d',Ts5D(it))); legend('$|\hat n_e^{00}|$');
+        pclr = pcolor(fftshift(KR,2),fftshift(KZ,2),plt(Ne00(:,:,it2))); set(pclr, 'edgecolor','none'); colorbar;
+        xlabel('$k_r$'); ylabel('$k_z$'); legend('$|\hat n_e^{00}|$');
 if strcmp(OUTPUTS.write_non_lin,'.true.')
     subplot(224); plt = @(x) fftshift((abs(x)),2);
-        pclr = pcolor(fftshift(KR,2),fftshift(KZ,2),plt(Si00(:,:,it))); set(pclr, 'edgecolor','none'); colorbar;
+        pclr = pcolor(fftshift(KR,2),fftshift(KZ,2),plt(Si00(:,:,it5))); set(pclr, 'edgecolor','none'); colorbar;
         xlabel('$k_r$'); ylabel('$k_z$');legend('$\hat S_i^{00}$');
 end
 save_figure
diff --git a/wk/flux_results.m b/wk/flux_results.m
index 2ff3e223..566c6308 100644
--- a/wk/flux_results.m
+++ b/wk/flux_results.m
@@ -88,7 +88,7 @@ end
 end
 grid on; title('$\nu = 0.1$')
 legend('Mix. Length, Ricci 2006','$P=2$, $J=1$','$P=3$, $J=2$','$P=4$, $J=2$')
-FIGNAME = [SIMDIR,'flux_study_nu_1e-2.png'];
+FIGNAME = [SIMDIR,'flux_study_nu_1e-1.png'];
 saveas(fig,FIGNAME);
 disp(['Figure saved @ : ',FIGNAME])
 end
\ No newline at end of file
diff --git a/wk/fort.90 b/wk/fort.90
index b2f3f7a2..21d7c268 100644
--- a/wk/fort.90
+++ b/wk/fort.90
@@ -1,23 +1,23 @@
 &BASIC
   nrun   = 100000000
   dt     = 0.005
-  tmax   = 200
-  RESTART = .true.
+  tmax   = 100
+  RESTART = .false.
 /
 &GRID
   pmaxe =2
   jmaxe = 1
   pmaxi = 2
   jmaxi = 1
-  Nr   = 400
+  Nr   = 512
   Lr = 100
-  Nz   = 400
+  Nz   = 512
   Lz = 100
   kpar = 0
   CANCEL_ODD_P = .false.
 /
 &OUTPUT_PAR
-  nsave_0d = 200
+  nsave_0d = 4
   nsave_1d = 0
   nsave_2d = 200
   nsave_5d = 2000
@@ -26,8 +26,8 @@
   write_phi     = .true.
   write_non_lin     = .true.
   write_doubleprecision = .true.
-  resfile0      = '../results/test_parallel/400x200_L_100_Pe_2_Je_1_Pi_2_Ji_1_nB_0.6_nN_1_nu_1e-01_FC_mu_5e-04/outputs'
-  rstfile0      = '../results/test_parallel/400x200_L_100_Pe_2_Je_1_Pi_2_Ji_1_nB_0.6_nN_1_nu_1e-01_FC_mu_5e-04/checkpoint'
+  resfile0      = '../results/Marconi/512x256_L_100_Pe_2_Je_1_Pi_2_Ji_1_nB_0.5_nN_1_nu_1e-01_FC_mu_5e-04/outputs'
+  rstfile0      = '../results/Marconi/512x256_L_100_Pe_2_Je_1_Pi_2_Ji_1_nB_0.5_nN_1_nu_1e-01_FC_mu_5e-04/checkpoint'
   job2load      = 0
 /
 &MODEL_PAR
@@ -45,7 +45,7 @@
   q_i     = 1
   eta_n   = 1
   eta_T   = 0
-  eta_B   = 0.6
+  eta_B   = 0.5
   lambdaD = 0
   kr0KH   = 0
   A0KH    = 0
diff --git a/wk/linear_study.m b/wk/linear_study.m
index 0e08540a..b84475b5 100644
--- a/wk/linear_study.m
+++ b/wk/linear_study.m
@@ -1,38 +1,37 @@
-clear all;
+%clear all;
 addpath(genpath('../matlab')) % ... add
 default_plots_options
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% Set Up parameters
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% PHYSICAL PARAMETERS
-NU      = 1e-2;   % Collision frequency
+NU      = 1e0;   % Collision frequency
 TAU     = 1.0;    % e/i temperature ratio
-ETAB    = 0.8;
+ETAB    = 0.5;
 ETAN    = 1.0;    % Density gradient
 ETAT    = 0.0;    % Temperature gradient
-MU      = 1e-4;   % Hyper diffusivity coefficient
+MU      = 0e-4;   % Hyper diffusivity coefficient
 LAMBDAD = 0.0; 
 NOISE0  = 1.0e-5;
 %% GRID PARAMETERS
-N       = 40;     % Frequency gridpoints (Nkr = N/2)
-L       = 60;     % Size of the squared frequency domain
+N       = 50;     % Frequency gridpoints (Nkr = N/2)
+L       = 100;     % Size of the squared frequency domain
 PMAXE   = 12;
 JMAXE   = 6; 
 PMAXI   = 12;
 JMAXI   = 6;
 KREQ0   = 1;      % put kr = 0
-CANCEL_ODD_P = 1;% Cancels the odd polynomials degree
 %% TIME PARAMETERS 
 TMAX    = 300;  % Maximal time unit
-DT      = 3e-2;   % Time step
+DT      = 1e-3;   % Time step
 SPS0D   = 0.5;      % Sampling per time unit for 2D arrays
 SPS2D   = 1;      % Sampling per time unit for 2D arrays
 SPS5D   = 0.1;    % Sampling per time unit for 5D arrays
 RESTART = 0;      % To restart from last checkpoint
 JOB2LOAD= 00;
 %% OPTIONS
-SIMID   = 'test_linear_study';  % Name of the simulation
-NON_LIN = 1 *(1-KREQ0);   % activate non-linearity (is cancelled if KREQ0 = 1)
+SIMID   = 'linear_study';  % Name of the simulation
+NON_LIN = 0 *(1-KREQ0);   % activate non-linearity (is cancelled if KREQ0 = 1)
 CO      = -1;  % Collision operator (0 : L.Bernstein, -1 : Full Coulomb, -2 : Dougherty)
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -41,29 +40,27 @@ KR0KH   = 0; A0KH = 0; % Background phi mode to drive Ray-Tay inst.
 NO_E    = 0;  % Remove electrons dynamic
 % DK    = 0;  % Drift kinetic model (put every kernel_n to 0 except n=0 to 1)
 JOBNUM = 00;
+CANCEL_ODD_P = 0;% Cancels the odd polynomials degree
 KPAR    = 0.0 * (1-CANCEL_ODD_P);    % Parellel wave vector component
 
-setup
-
-
 %% PARAMETER SCANS
-if 0
+if 1
 %% Parameter scan over PJ
 NU    = 1e-2;   % Collision frequency
-ETAB  = 1.0;
+ETAB  = 0.5;
 ETAN  = 1.0;
 TMAX  = 400;
-PA = [2,6,10,14,20,40,80];
-JA = [1,3,5,7,10,20,20];
-% PA = [4];
-% JA = [2];
+PA = [2, 8, 12, 20, 40];
+JA = [1, 4,  6, 10, 20];
+%  PA = [40];
+%  JA = [20];
 Nparam = numel(PA);
 param_name = 'PJ';
 CO      = -2;  % Collision operator (0 : L.Bernstein, -1 : Full Coulomb, -2 : Dougherty)
 DT      = 5e-3;   % Time step
 
 gamma_Ni = zeros(Nparam,N);
-
+Ni00_ST  = zeros(Nparam,N,TMAX);
 for i = 1:Nparam
     % Change scan parameter
     PMAXE = PA(i); PMAXI = PA(i);
@@ -73,15 +70,44 @@ for i = 1:Nparam
     system('./../bin/helaz');
     % Load and process results
     load_results
-    tend   = Ts2D(end); tstart   = 0.9*tend; 
+    tend   = Ts2D(end); tstart   = 0.4*tend; 
     for ikz = 1:N
         gamma_Ni(i,ikz) = LinearFit_s(Ts2D,squeeze(abs(Ni00(1,ikz,:))),tstart,tend);
+        Ni00_ST(i,ikz,1:numel(Ts2D)) = squeeze((Ni00(1,ikz,:)));
     end
     gamma_Ni(i,:) = real(gamma_Ni(i,:) .* (gamma_Ni(i,:)>=0.0));
     % Clean output
-%     system(['rm -r ',BASIC.RESDIR])
+    %system(['rm -r ',BASIC.RESDIR])
+end
+% if 0
+% %% Plot
+% fig = figure; FIGNAME = 'space_time_Ni00';
+% i = 1;
+% 
+% [YY, XX] = meshgrid(Ts2D,kz);
+% plt = @(x) squeeze(log(abs(x)))
+% pclr = pcolor(XX,YY,plt(Ni00_ST(i,:,:)));set(pclr, 'edgecolor','none');
+% grid on; xlabel('$k_z$'); ylabel('$t$');
+% title(['$\eta_B=',num2str(ETAB),'$,$P,J=',num2str(PA(i)),',',JA(i),'$'])
+% legend('show')
+% saveas(fig,[SIMDIR,'gamma_Ni_vs_',param_name,'_',PARAMS,'.fig']);
+% saveas(fig,[SIMDIR,'gamma_Ni_vs_',param_name,'_',PARAMS,'.png']);
+% end
+if 0
+%% Plot
+fig = figure; FIGNAME = 'space_time_Ni00';
+i = 3;
+plt = @(x) squeeze((abs(x)));
+for ikz=1:4:numel(kz)/2+1
+    NAME = ['$k_z=',num2str(kz(ikz)),'$'];
+    semilogy(1:TMAX,plt(Ni00_ST(i,ikz,1:TMAX)), 'DisplayName', NAME); hold on;
+end
+grid on; xlabel('$t c_s/\rho_s$'); ylabel('$|Ni^{00}|$');
+title(['$\eta_B=',num2str(ETAB),'$; $P,J=',num2str(PA(i)),',',num2str(JA(i)),'$, $\nu=',num2str(NU),'$'])
+legend('show');
+saveas(fig,[SIMDIR,'gamma_Ni_vs_',param_name,'_',PARAMS,'.fig']);
+saveas(fig,[SIMDIR,'gamma_Ni_vs_',param_name,'_',PARAMS,'.png']);
 end
-
 if 1
 %% Plot
 fig = figure; FIGNAME = 'linear_study';
@@ -96,7 +122,7 @@ for i = 1:Nparam
     hold on;
 end
 grid on; xlabel('$k_z$'); ylabel('$\gamma(N_i^{00})$'); xlim([0.0,max(kz)]);
-title(['$\eta_B=',num2str(ETAB),'$'])
+title(['$\eta_B=',num2str(ETAB),'$, $\nu=',num2str(NU),'$'])
 legend('show')
 saveas(fig,[SIMDIR,'gamma_Ni_vs_',param_name,'_',PARAMS,'.fig']);
 saveas(fig,[SIMDIR,'gamma_Ni_vs_',param_name,'_',PARAMS,'.png']);
@@ -145,7 +171,7 @@ for i = 1:Nparam
         'DisplayName',['$\eta_B=$',num2str(eta_B(i))]);
     hold on;
 end
-grid on; xlabel('$k_z$'); ylabel('$\gamma(N_i^{00})$'); xlim([0.0,max(kz)]);
+grid on; xlabel('$k_z\rho_s$'); ylabel('$\gamma(N_i^{00})\rho_2/c_s$'); xlim([0.0,max(kz)]);
 title(['$P_e=',num2str(PMAXE),'$',', $J_e=',num2str(JMAXE),'$',...
        ', $P_i=',num2str(PMAXE),'$',', $J_i=',num2str(JMAXI),'$'])
 legend('show')
diff --git a/wk/parameters_ZP.m b/wk/parameters_ZP.m
index e41c7578..7991aa72 100644
--- a/wk/parameters_ZP.m
+++ b/wk/parameters_ZP.m
@@ -1,4 +1,4 @@
-clear all;
+%clear all;
 addpath(genpath('../matlab')) % ... add
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% Set Up parameters
@@ -39,6 +39,7 @@ KREQ0   = 0;      % put kr = 0
 KPAR    = 0.0;    % Parellel wave vector component
 LAMBDAD = 0.0; 
 NON_LIN = 1 *(1-KREQ0);   % activate non-linearity (is cancelled if KREQ0 = 1)
+LOAD_MARCONI = 0;
 CANCEL_ODD_P = 0;% Cancels the odd polynomials degree
 
 setup
diff --git a/wk/setup.m b/wk/setup.m
index 5c48f1a9..588e5354 100644
--- a/wk/setup.m
+++ b/wk/setup.m
@@ -73,6 +73,8 @@ resolution = [num2str(GRID.Nr),'x',num2str(GRID.Nz/2),'_'];
 gridname   = ['L_',num2str(L),'_'];
 PARAMS = [resolution,gridname,degngrad];
 BASIC.RESDIR = [SIMDIR,PARAMS,'/'];
+BASIC.PARAMS = PARAMS;
+BASIC.SIMID  = SIMID;
 BASIC.nrun       = 1e8;
 BASIC.dt         = DT;   
 BASIC.tmax       = TMAX;    %time normalized to 1/omega_pe
diff --git a/wk/test_parallel.m b/wk/test_parallel.m
index 12a28d4b..2eb69bbc 100644
--- a/wk/test_parallel.m
+++ b/wk/test_parallel.m
@@ -6,26 +6,26 @@ addpath(genpath('../matlab')) % ... add
 %% PHYSICAL PARAMETERS
 NU      = 1e-1;   % Collision frequency
 TAU     = 1.0;    % e/i temperature ratio
-ETAB    = 0.6;    % Magnetic gradient
+ETAB    = 0.5;    % Magnetic gradient
 ETAN    = 1.0;    % Density gradient
 ETAT    = 0.0;    % Temperature gradient
 MU      = 5e-4;   % Hyper diffusivity coefficient
 NOISE0  = 1.0e-5;
 %% GRID PARAMETERS
-N       = 400;     % Frequency gridpoints (Nkr = N/2)
+N       = 512;     % Frequency gridpoints (Nkr = N/2)
 L       = 100;     % Size of the squared frequency domain
 PMAXE   = 2;     % Highest electron Hermite polynomial degree
 JMAXE   = 1;     % Highest ''       Laguerre ''
 PMAXI   = 2;     % Highest ion      Hermite polynomial degree
 JMAXI   = 1;     % Highest ''       Laguerre ''
 %% TIME PARAMETERS 
-TMAX    = 200;  % Maximal time unit
-DT      = 5e-3;   % Time step
+TMAX    = 100;  % Maximal time unit
+DT      = 1e-2;   % Time step
 SPS0D   = 1;    % Sampling per time unit for profiler
 SPS2D   = 1;      % Sampling per time unit for 2D arrays
 SPS5D   = 0.1;    % Sampling per time unit for 5D arrays
 RESTART = 1;      % To restart from last checkpoint
-JOB2LOAD= 0;
+JOB2LOAD= 1;
 %% OPTIONS
 SIMID   = 'test_parallel';  % Name of the simulation
 CO      = -1;  % Collision operator (0 : L.Bernstein, -1 : Full Coulomb, -2 : Dougherty)
@@ -40,5 +40,6 @@ KPAR    = 0.0;    % Parellel wave vector component
 LAMBDAD = 0.0; 
 NON_LIN = 1 *(1-KREQ0);   % activate non-linearity (is cancelled if KREQ0 = 1)
 CANCEL_ODD_P = 0;% Cancels the odd polynomials degree
+MARCONI = 0;
 
 setup
-- 
GitLab