From 37685bde400162315af2d80533fedc76d59ae8bf Mon Sep 17 00:00:00 2001
From: Antoine Hoffmann <antoine.hoffmann@epfl.ch>
Date: Thu, 9 Jun 2022 11:01:53 +0200
Subject: [PATCH] small scripts changes

---
 .../plot_radial_transport_and_spacetime.m     |  4 +-
 wk/analysis_HeLaZ.m                           | 10 +--
 wk/analysis_gbms.m                            | 17 +++++-
 wk/header_3D_results.m                        |  4 +-
 wk/quick_run.m                                | 61 +++++++++++--------
 5 files changed, 60 insertions(+), 36 deletions(-)

diff --git a/matlab/plot/plot_radial_transport_and_spacetime.m b/matlab/plot/plot_radial_transport_and_spacetime.m
index d052fc15..7e31997c 100644
--- a/matlab/plot/plot_radial_transport_and_spacetime.m
+++ b/matlab/plot/plot_radial_transport_and_spacetime.m
@@ -84,8 +84,8 @@ mvm = @(x) movmean(x,OPTIONS.NMVA);
     OPTIONS.POLARPLOT = 0;
     toplot = process_field(DATA,OPTIONS);
     f2plot = toplot.FIELD;
-    
-    clim = max(max(max(abs(plt(f2plot(:,:,its3D:ite3D))))));
+    dframe = ite3D - its3D;
+    clim = max(max(max(abs(plt(f2plot(:,:,:))))));
     subplot(313)
         [TY,TX] = meshgrid(DATA.x,DATA.Ts3D(toplot.FRAMES));
         pclr = pcolor(TX,TY,squeeze(plt(f2plot))'); 
diff --git a/wk/analysis_HeLaZ.m b/wk/analysis_HeLaZ.m
index 4a06a7a1..fbe4b779 100644
--- a/wk/analysis_HeLaZ.m
+++ b/wk/analysis_HeLaZ.m
@@ -10,7 +10,7 @@ system(['mkdir -p ',MISCDIR]);
 CMD = ['rsync ', LOCALDIR,'outputs* ',MISCDIR]; disp(CMD);
 system(CMD);
 % Load outputs from jobnummin up to jobnummax
-JOBNUMMIN = 15; JOBNUMMAX = 16;
+JOBNUMMIN = 00; JOBNUMMAX = 20;
 data = compile_results(MISCDIR,JOBNUMMIN,JOBNUMMAX); %Compile the results from first output found to JOBNUMMAX if existing
 data.localdir = LOCALDIR;
 data.FIGDIR   = LOCALDIR;
@@ -49,12 +49,12 @@ options.NAME      = '\phi';
 % options.NAME      = 'n_i^{NZ}';
 % options.NAME      = '\Gamma_x';
 % options.NAME      = 'n_i';
-options.PLAN      = 'xy';
+options.PLAN      = 'xz';
 % options.NAME      = 'f_e';
 % options.PLAN      = 'sx';
 options.COMP      = 9;
 % options.TIME      = dat.Ts5D;
-options.TIME      = [1800:1:2000];
+options.TIME      = [0:1:2000];
 data.EPS          = 0.1;
 data.a = data.EPS * 2000;
 create_film(data,options,'.gif')
@@ -119,7 +119,7 @@ options.ST         = 0;
 options.PLOT_TYPE  = 'space-time';
 options.NORMALIZED = 1;
 options.JOBNUM     = 0;
-options.TIME       = [1300 1400];
+options.TIME       = [50];
 options.specie     = 'i';
 options.compz      = 'avg';
 fig = show_moments_spectrum(data,options);
@@ -165,7 +165,7 @@ if 0
 %% Mode evolution
 options.NORMALIZED = 0;
 options.K2PLOT = 1;
-options.TIME   = 1800:2000;
+options.TIME   = 0:90;
 options.NMA    = 1;
 options.NMODES = 15;
 options.iz     = 'avg';
diff --git a/wk/analysis_gbms.m b/wk/analysis_gbms.m
index f3a35be5..1e3d2958 100644
--- a/wk/analysis_gbms.m
+++ b/wk/analysis_gbms.m
@@ -5,6 +5,7 @@
 
 %%
 resdir = '/home/ahoffman/Documents/gbms/benchmark_HeLaZ/shearless_linear_cyclone/';
+resdir = '/home/ahoffman/Documents/gbms/benchmark_HeLaZ/RH_test/';
 % resdir = '/home/ahoffman/Documents/gbms/benchmark_HeLaZ/linear_cyclone/';
 % resdir = '/home/ahoffman/molix/';
 outfile = [resdir,'field.dat.h5'];
@@ -18,7 +19,7 @@ gbms_dat.Nx = numel(gbms_dat.kx); gbms_dat.Nkx = numel(gbms_dat.kx);
 gbms_dat.Ny = numel(gbms_dat.ky); gbms_dat.Nky = numel(gbms_dat.ky); 
 gbms_dat.Nz = numel(gbms_dat.z);
 
-dky = min(gbms_dat.ky(gbms_dat.ky>0)); Ly = 2*pi/dky;
+dky = min(gbms_dat.ky(gbms_dat.ky>0)); Ly =0;% 2*pi/dky;
 gbms_dat.y  = linspace(-Ly/2,Ly/2,gbms_dat.Ny+1); gbms_dat.y = gbms_dat.y(1:end-1);
 gbms_dat.x  = 0;
 gbms_dat.PHI = zeros(gbms_dat.Ny,gbms_dat.Nx,gbms_dat.Nz,gbms_dat.Nt);
@@ -50,7 +51,7 @@ end
 if 0
 %% 2D snapshots
 % Options
-options.INTERP    = 0;
+options.INTERP    = 0;  
 options.POLARPLOT = 0;
 options.AXISEQUAL = 1;
 options.NAME      = '\phi';
@@ -70,7 +71,7 @@ nplots = 1;
 lg = compute_fluxtube_growth_rate(gbms_dat,trange,nplots);
 end
 
-if 1
+if 0
 %% Ballooning plot
 options.time_2_plot = data.Ts3D(end);
 options.kymodes     = [0.5];
@@ -78,4 +79,14 @@ options.normalized  = 1;
 options.sheared     = 0;
 options.field       = 'phi';
 fig = plot_ballooning(gbms_dat,options);
+end
+
+if 1
+%% RH TEST
+ikx = 1;
+plt = @(x) squeeze(mean(real(x(1,ikx,:,:)),3))./squeeze(mean(real(x(1,ikx,:,1)),3));
+figure
+plot(gbms_dat.Ts3D, plt(gbms_dat.PHI));
+xlabel('$t$'); ylabel('$\phi_z(t)/\phi_z(0)$')
+title(sprintf('$k_x=$%2.2f, $k_y=0.00$',gbms_dat.kx(ikx)))
 end
\ No newline at end of file
diff --git a/wk/header_3D_results.m b/wk/header_3D_results.m
index 9b790c18..b028f6c0 100644
--- a/wk/header_3D_results.m
+++ b/wk/header_3D_results.m
@@ -5,7 +5,9 @@ helazdir = '/home/ahoffman/HeLaZ/';
 outfile ='';
 outfile ='';
 outfile ='';
-outfile ='shearless_cyclone/128x128x16x5x3_start';
+% outfile ='shearless_cyclone/128x128x16x5x3_start';
+% outfile ='shearless_cyclone/128x128x16_CBC_100';
+outfile ='shearless_cyclone/128x128x16_CBC_120';
 % outfile ='shearless_cyclone/128x128x16xdmax_6_L_120_CBC_1.0';
 % outfile ='shearless_cyclone/128x128x16xdmax_L_120_CBC_1.0';
 % outfile ='shearless_cyclone/180x180x20x4x2_L_120_CBC_0.8_to_1.0';
diff --git a/wk/quick_run.m b/wk/quick_run.m
index 8165d782..77df8c3c 100644
--- a/wk/quick_run.m
+++ b/wk/quick_run.m
@@ -13,23 +13,23 @@ EXECNAME = 'helaz3';
 CLUSTER.TIME  = '99:00:00'; % allocation time hh:mm:ss
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% PHYSICAL PARAMETERS
-NU      = 0.2;   % Collision frequency
+NU      = 0.1;   % Collision frequency
 TAU     = 1.0;    % e/i temperature ratio
-K_N     = 2.22;   % Density gradient drive
-K_T     = 6.96;   % Temperature '''
+K_N     = 0;%2.22;   % Density gradient drive
+K_T     = 0;%6.96;   % Temperature '''
 K_E     = 0.0;   % Electrostat '''
-SIGMA_E = 0.0233380;   % mass ratio sqrt(m_a/m_i) (correct = 0.0233380)
+SIGMA_E = 0.05196152422706632;%0.0233380;   % mass ratio sqrt(m_a/m_i) (correct = 0.0233380)
 KIN_E   = 0;     % 1: kinetic electrons, 2: adiabatic electrons
 %% GRID PARAMETERS
-PMAXE   = 8;     % Hermite basis size of electrons
-JMAXE   = 4;     % Laguerre "
-PMAXI   = 8;     % " ions
-JMAXI   = 4;     % "
-NX      = 1;    % real space x-gridpoints
-NY      = 64;     %     ''     y-gridpoints
+PMAXE   = 6;     % Hermite basis size of electrons
+JMAXE   = 3;     % Laguerre "
+PMAXI   = 6;     % " ions
+JMAXI   = 3;     % "
+NX      = 2;    % real space x-gridpoints
+NY      = 1;     %     ''     y-gridpoints
 LX      = 100;   % Size of the squared frequency domain
 LY      = 60;     % Size of the squared frequency domain
-NZ      = 16;     % number of perpendicular planes (parallel grid)
+NZ      = 32;     % number of perpendicular planes (parallel grid)
 NPOL    = 1;
 SG      = 0;     % Staggered z grids option
 %% GEOMETRY
@@ -40,15 +40,15 @@ SHEAR   = 0.0;    % magnetic shear (Not implemented yet)
 EPS     = 0.18;    % inverse aspect ratio
 %% TIME PARMETERS
 TMAX    = 30;  % Maximal time unit
-DT      = 2*5e-3;   % Time step
-SPS0D   = 1;      % Sampling per time unit for 2D arrays
+DT      = 1e-2;   % Time step
+SPS0D   = 20;      % 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
+SPS3D   = 20;      % 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   = 'dbg';  % Name of the simulation
+SIMID   = 'Ros_Hin_test';  % Name of the simulation
 LINEARITY = 'linear';   % activate non-linearity (is cancelled if KXEQ0 = 1)
 % Collision operator
 % (LB:L.Bernstein, DG:Dougherty, SG:Sugama, LR: Lorentz, LD: Landau)
@@ -56,10 +56,10 @@ CO      = 'DG';
 GKCO    = 0; % gyrokinetic operator
 ABCO    = 1; % interspecies collisions
 INIT_ZF = 0; ZF_AMP = 0.0;
-CLOS    = 1;   % Closure model (0: =0 truncation, 1: gyrofluid closure (p+2j<=Pmax))s
+CLOS    = 0;   % Closure model (0: =0 truncation, 1: gyrofluid closure (p+2j<=Pmax))s
 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= 'phi';   % Start simulation with a noisy mom00/phi/allmom
+INIT_OPT= 'mom00';   % Start simulation with a noisy mom00/phi/allmom
 %% OUTPUTS
 W_DOUBLE = 1;
 W_GAMMA  = 1; W_HF     = 1;
@@ -75,12 +75,12 @@ MU      = 0.0; % Hyperdiffusivity coefficient
 INIT_BLOB = 0; WIPE_TURB = 0; ACT_ON_MODES = 0;
 MU_X    = MU;     %
 MU_Y    = MU;     %
-MU_Z    = 0.2;     %
+MU_Z    = 0.0;     %
 MU_P    = 0.0;     %
 MU_J    = 0.0;     %
 LAMBDAD = 0.0;
-NOISE0  = 1.0e-5; % Init noise amplitude
-BCKGD0  = 0.0;    % Init background
+NOISE0  = 0.0e-5; % Init noise amplitude
+BCKGD0  = 1.0;    % Init background
 GRADB   = 1.0;
 CURVB   = 1.0;
 %%-------------------------------------------------------------------------
@@ -91,8 +91,8 @@ system(['rm fort*.90']);
 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 1 ',HELAZDIR,'bin/',EXECNAME,' 1 1 1 0; cd ../../../wk'])
-%     system(['cd ../results/',SIMID,'/',PARAMS,'/; mpirun -np 4 ',HELAZDIR,'bin/',EXECNAME,' 1 2 2 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 4 ',HELAZDIR,'bin/',EXECNAME,' 1 2 2 0; cd ../../../wk'])
+%     system(['cd ../results/',SIMID,'/',PARAMS,'/; mpirun -np 6 ',HELAZDIR,'bin/',EXECNAME,' 1 6 1 0; cd ../../../wk'])
 end
 
 %% Load results
@@ -111,7 +111,7 @@ nplots = 1;
 lg = compute_fluxtube_growth_rate(data,trange,nplots);
 end
 
-if 1
+if 0
 %% Ballooning plot
 options.time_2_plot = [0.9 1]*data.Ts3D(end);
 options.kymodes     = [0.5];
@@ -150,14 +150,25 @@ options.kzky = 0;
 save_figure(data,fig)
 end
 
-if 1
+if 0
 %% Mode evolution
 options.NORMALIZED = 1;
 options.K2PLOT = 1;
 options.TIME   = [0.8 1]*data.Ts3D(end);
 options.NMA    = 1;
-options.NMODES = 5;
+options.NMODES = 2;
 options.iz     = 9;
 fig = mode_growth_meter(data,options);
 save_figure(gbms_dat,fig)
 end
+
+
+if 1
+%% RH TEST
+ikx = 2;
+plt = @(x) squeeze(mean(real(x(1,ikx,:,:)),3))./squeeze(mean(real(x(1,ikx,:,1)),3));
+figure
+plot(data.Ts3D, plt(data.PHI));
+xlabel('$t$'); ylabel('$\phi_z(t)/\phi_z(0)$')
+title(sprintf('$k_x=$%2.2f, $k_y=0.00$',data.kx(ikx)))
+end
-- 
GitLab