From 243d1e4efd96145830f5f15d7976587c91744bd9 Mon Sep 17 00:00:00 2001
From: Antoine Hoffmann <antoine.hoffmann@epfl.ch>
Date: Mon, 14 Nov 2022 16:58:28 +0100
Subject: [PATCH] save

---
 matlab/compute/mode_growth_meter.m | 12 +++++++-----
 wk/analysis_gyacomo.m              |  8 ++++----
 wk/header_3D_results.m             |  7 ++++---
 wk/lin_ITG.m                       | 26 +++++++++++++-------------
 4 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/matlab/compute/mode_growth_meter.m b/matlab/compute/mode_growth_meter.m
index 8c2bce8f..03e36876 100644
--- a/matlab/compute/mode_growth_meter.m
+++ b/matlab/compute/mode_growth_meter.m
@@ -71,7 +71,8 @@ for i = 1:2
         amp(i_)   = gr(2);
         i_=i_+1;
     end
-
+    mod2plot = [2:OPTIONS.NMODES+1];
+    clr_ = jet(numel(mod2plot));
     %plot
     subplot(2,3,1+3*(i-1))
         [YY,XX] = meshgrid(t,fftshift(k));
@@ -82,9 +83,8 @@ for i = 1:2
         title(MODESTR)  
 
     subplot(2,3,2+3*(i-1))
-        mod2plot = [2:OPTIONS.NMODES+1];
-        for i_ = mod2plot
-            semilogy(t,plt(field,MODES(i_))); hold on;
+        for i_ = 1:numel(mod2plot)
+            semilogy(t,plt(field,MODES(mod2plot(i_))),'color',clr_(i_,:)); hold on;
     %         semilogy(t,exp(gamma(i_).*t+amp(i_)),'--k')
         end
         if MODES_SELECTOR == 2
@@ -96,7 +96,9 @@ for i = 1:2
 
     subplot(2,3,3+3*(i-1))
         plot(k(MODES),gamma); hold on;
-        plot(k(MODES(mod2plot)),gamma(mod2plot),'x')
+        for i_ = 1:numel(mod2plot)
+            plot(k(MODES(mod2plot(i_))),gamma(mod2plot(i_)),'x','color',clr_(i_,:))
+        end
         if MODES_SELECTOR == 2
             plot(k(ikzf),gamma(ikzf),'ok');
         end
diff --git a/wk/analysis_gyacomo.m b/wk/analysis_gyacomo.m
index b7bffafb..ad8a8c7b 100644
--- a/wk/analysis_gyacomo.m
+++ b/wk/analysis_gyacomo.m
@@ -62,9 +62,9 @@ if 0
 % Options
 options.INTERP    = 1;
 options.POLARPLOT = 0;
-% options.NAME      = '\phi';
+options.NAME      = '\phi';
 % options.NAME      = '\omega_z';
-options.NAME     = 'N_i^{00}';
+% options.NAME     = 'N_i^{00}';
 % options.NAME      = 'v_x';
 % options.NAME      = 'n_i^{NZ}';
 % options.NAME      = '\Gamma_x';
@@ -189,11 +189,11 @@ end
 
 if 0
 %% Mode evolution
-options.NORMALIZED = 1;
+options.NORMALIZED = 0;
 options.K2PLOT = [0.1 0.5 1.0 2.0 6.0];
 options.TIME   = [00:1200];
 options.NMA    = 1;
-options.NMODES = 5;
+options.NMODES = 30;
 options.iz     = 'avg';
 fig = mode_growth_meter(data,options);
 save_figure(data,fig,'.png')
diff --git a/wk/header_3D_results.m b/wk/header_3D_results.m
index aa7ca490..30e8b789 100644
--- a/wk/header_3D_results.m
+++ b/wk/header_3D_results.m
@@ -34,7 +34,7 @@ gyacomodir = '/home/ahoffman/gyacomo/';
 % resdir = 'CBC/128x64x16x5x3';
 % resdir = 'CBC/96x96x16x3x2_Nexc_6';
 % resdir = 'CBC/128x96x16x3x2';
-% resdir = 'CBC/192x96x16x3x2';
+resdir = 'CBC/192x96x16x3x2';
 % resdir = 'CBC/192x96x24x13x7';
 % resdir = 'CBC/kT_11_128x64x16x5x3';
 % resdir = 'CBC/kT_9_256x128x16x3x2';
@@ -62,10 +62,11 @@ gyacomodir = '/home/ahoffman/gyacomo/';
 % resdir = 'testcases/miller_example';
 % resdir = 'Miller/128x256x3x2_CBC_dt_5e-3';
 %% CBC Miller
-resdir = 'GCM_CBC/daint/Miller_GX_comparison';
+% resdir = 'GCM_CBC/daint/Miller_GX_comparison';
+% resdir = 'GCM_CBC/daint/Salpha_GX_comparison';
 %% RK3
 % resdir = 'dbg/SSPx_RK3_test';
 % resdir = 'dbg/SSPx_RK3_test/RK4';
-% resdir = ['results/',resdir];
+resdir = ['gyacomo_outputs/results/',resdir];
 JOBNUMMIN = 00; JOBNUMMAX = 10;
 run analysis_gyacomo
diff --git a/wk/lin_ITG.m b/wk/lin_ITG.m
index 339b1833..e64bb2a7 100644
--- a/wk/lin_ITG.m
+++ b/wk/lin_ITG.m
@@ -3,8 +3,8 @@
 % from matlab framework. It is meant to run only small problems in linear
 % for benchmark and debugging purpose since it makes matlab "busy"
 %
-% SIMID   = 'lin_ITG';  % Name of the simulation
-SIMID   = 'dbg';  % Name of the simulation
+SIMID   = 'lin_ITG';  % Name of the simulation
+% SIMID   = 'dbg';  % Name of the simulation
 RUN     = 1; % To run or just to load
 addpath(genpath('../matlab')) % ... add
 default_plots_options
@@ -34,11 +34,11 @@ PMAXE   = P;     % Hermite basis size of electrons
 JMAXE   = J;     % Laguerre "
 PMAXI   = P;     % " ions
 JMAXI   = J;     % "
-NX      = 20;    % real space x-gridpoints
-NY      = 20;     %     ''     y-gridpoints
+NX      = 8;    % real space x-gridpoints
+NY      = 16;     %     ''     y-gridpoints
 LX      = 2*pi/0.8;   % Size of the squared frequency domain
 LY      = 2*pi/0.05;     % Size of the squared frequency domain
-NZ      = 32;    % number of perpendicular planes (parallel grid)
+NZ      = 16;    % number of perpendicular planes (parallel grid)
 NPOL    = 1;
 SG      = 0;     % Staggered z grids option
 %% GEOMETRY
@@ -49,14 +49,14 @@ SHEAR   = 0.8;    % magnetic shear
 KAPPA   = 1.0;    % elongation
 DELTA   = 0.0;    % triangularity
 ZETA    = 0.0;    % squareness
-NEXC    = 1;      % To extend Lx if needed (Lx = Nexc/(kymin*shear))
+NEXC    = 0;      % To extend Lx if needed (Lx = Nexc/(kymin*shear))
 EPS     = 0.18;   % inverse aspect ratio
 %% TIME PARMETERS
-TMAX    = 20;  % Maximal time unit
+TMAX    = 60;  % Maximal time unit
 DT      = 1e-2;   % Time step
 SPS0D   = 1;      % Sampling per time unit for 2D arrays
 SPS2D   = -1;      % Sampling per time unit for 2D arrays
-SPS3D   = 5;      % Sampling per time unit for 2D arrays
+SPS3D   = 2;      % Sampling per time unit for 2D arrays
 SPS5D   = 1/5;    % Sampling per time unit for 5D arrays
 SPSCP   = 0;    % Sampling per time unit for checkpoints
 JOB2LOAD= -1;
@@ -72,7 +72,7 @@ CLOS    = 0;   % Closure model (0: =0 truncation, 1: v^Nmax 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_OPT= 'mom00';   % Start simulation with a noisy mom00/phi/allmom
-NUMERICAL_SCHEME = 'RK3'; % RK2,SSPx_RK2,RK3,SSP_RK3,SSPx_RK3,IMEX_SSP2,ARK2,RK4,DOPRI5
+NUMERICAL_SCHEME = 'RK4'; % RK2,SSPx_RK2,RK3,SSP_RK3,SSPx_RK3,IMEX_SSP2,ARK2,RK4,DOPRI5
 %% OUTPUTS
 W_DOUBLE = 1;
 W_GAMMA  = 1; W_HF     = 1;
@@ -106,8 +106,8 @@ if RUN
 %     system(['cd ../results/',SIMID,'/',PARAMS,'/; time mpirun -np 4 ',HELAZDIR,'bin/',EXECNAME,' 1 4 1 0; cd ../../../wk'])
 %     system(['cd ../results/',SIMID,'/',PARAMS,'/; mpirun -np 4 ',HELAZDIR,'bin/',EXECNAME,' 1 4 1 0; cd ../../../wk'])
 %     system(['cd ../results/',SIMID,'/',PARAMS,'/; mpirun -np 1 ',HELAZDIR,'bin/',EXECNAME,' 1 1 1 0; cd ../../../wk'])
-    system(['cd ../results/',SIMID,'/',PARAMS,'/; mpirun -np 6 ',gyacomodir,'bin/',EXECNAME,' 1 2 3 0; cd ../../../wk'])
-%     system(['cd ../results/',SIMID,'/',PARAMS,'/; mpirun -np 6 ',HELAZDIR,'bin/',EXECNAME,' 1 6 1 0; cd ../../../wk'])
+%     system(['cd ../results/',SIMID,'/',PARAMS,'/; mpirun -np 6 ',gyacomodir,'bin/',EXECNAME,' 1 2 3 0; cd ../../../wk'])
+    system(['cd ../results/',SIMID,'/',PARAMS,'/; mpirun -np 6 ',HELAZDIR,'bin/',EXECNAME,' 1 6 1 0; cd ../../../wk'])
 end
 
 %% Load results
@@ -115,7 +115,7 @@ end
 filename = [SIMID,'/',PARAMS,'/'];
 LOCALDIR  = [gyacomodir,'results/',filename,'/'];
 % Load outputs from jobnummin up to jobnummax
-JOBNUMMIN = 00; JOBNUMMAX = 00;
+JOBNUMMIN = 00; JOBNUMMAX = 01;
 data = compile_results(LOCALDIR,JOBNUMMIN,JOBNUMMAX); %Compile the results from first output found to JOBNUMMAX if existing
 
 %% Short analysis
@@ -174,7 +174,7 @@ options.NORMALIZED = 0;
 options.K2PLOT = 1;
 options.TIME   = [0:1000];
 options.NMA    = 1;
-options.NMODES = 1;
+options.NMODES = 16;
 options.iz     = 'avg';
 fig = mode_growth_meter(data,options);
 save_figure(data,fig,'.png')
-- 
GitLab