From 452a5723c91413169149ca1a04686b573571fda4 Mon Sep 17 00:00:00 2001
From: Antoine Hoffmann <antoine.hoffmann@epfl.ch>
Date: Mon, 7 Aug 2023 19:16:15 +0200
Subject: [PATCH] add ExB rate in scripts

---
 matlab/setup.m          |  1 +
 matlab/write_fort90.m   |  1 +
 wk/lin_run_script.m     | 31 +++++++++++++++++--------------
 wk/parameters/lin_ITG.m | 21 +++++++++++----------
 4 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/matlab/setup.m b/matlab/setup.m
index a5b6f420..89d82681 100644
--- a/matlab/setup.m
+++ b/matlab/setup.m
@@ -38,6 +38,7 @@ if ADIAB_E; MODEL.ADIAB_E = '.true.'; else; MODEL.ADIAB_E = '.false.';end;
 if ADIAB_I; MODEL.ADIAB_I = '.true.'; else; MODEL.ADIAB_I = '.false.';end;
 if MHD_PD;  MODEL.MHD_PD  = '.true.'; else; MODEL.MHD_PD  = '.false.';end;
 MODEL.beta    = BETA;
+MODEL.ExBrate = EXBRATE;
 MODEL.mu_x    = MU_X;
 MODEL.mu_y    = MU_Y;
 MODEL.N_HD    = N_HD;
diff --git a/matlab/write_fort90.m b/matlab/write_fort90.m
index abba1afe..0c0dc4e9 100644
--- a/matlab/write_fort90.m
+++ b/matlab/write_fort90.m
@@ -72,6 +72,7 @@ fprintf(fid,['  k_gB    = ', num2str(MODEL.k_gB),'\n']);
 fprintf(fid,['  k_cB    = ', num2str(MODEL.k_cB),'\n']);
 fprintf(fid,['  lambdaD = ', num2str(MODEL.lambdaD),'\n']);
 fprintf(fid,['  beta    = ', num2str(MODEL.beta),'\n']);
+fprintf(fid,['  ExBrate = ', num2str(MODEL.ExBrate),'\n']);
 fprintf(fid,['  ADIAB_E = ', MODEL.ADIAB_E,'\n']);
 fprintf(fid,['  ADIAB_I = ', MODEL.ADIAB_I,'\n']);
 fprintf(fid,['  tau_i   = ', num2str(MODEL.tau_i),'\n']);
diff --git a/wk/lin_run_script.m b/wk/lin_run_script.m
index acb62f80..aad2bfd6 100644
--- a/wk/lin_run_script.m
+++ b/wk/lin_run_script.m
@@ -17,31 +17,34 @@ addpath(genpath([gyacomodir,'wk/parameters']))  % Add parameters folder
 %% Setup run or load an executable
 RUN = 1; % To run or just to load
 default_plots_options
+% EXECNAME = 'gyacomo23_sp_save'; % single precision
 EXECNAME = 'gyacomo23_sp'; % single precision
 % EXECNAME = 'gyacomo23_dp'; % double precision
+% EXECNAME = 'gyacomo23_debug'; % double precision
 
 %% Setup parameters
 % run lin_DTT_HM_rho85
 % run lin_DTT_HM_rho98
 % run lin_DTT_LM_rho90
 % run lin_DTT_LM_rho95
-run lin_JET_rho97
+% run lin_JET_rho97
 % run lin_Entropy
-% run lin_ITG
+run lin_ITG
 % run lin_KBM
 %% Change parameters
-NY   = 2;
-NX   = 4;
-PMAX = 2;
-JMAX = PMAX/2;
-ky   = 0.5;
-LY   = 2*pi/ky;
-DT   = 1e-3;
-TMAX = 10;
+% EXBRATE = 0.001;              % Background ExB shear flow
+% NY   = 2;
+% NX   = 4;
+% PMAX = 2;
+% JMAX = PMAX/2;
+% ky   = 0.5;
+% LY   = 2*pi/ky;
+% DT   = 1e-3;
+% TMAX = 10;
 % % SIGMA_E = 0.04;
 % TMAX     = 10;
 % DTSAVE0D = 200*DT;
-DTSAVE3D = TMAX/50;
+% DTSAVE3D = TMAX/50;
 %%-------------------------------------------------------------------------
 %% RUN
 setup
@@ -49,10 +52,10 @@ setup
 % Run linear simulation
 if RUN
     MVIN =['cd ../results/',SIMID,'/',PARAMS,'/;'];
-    % RUN  =['time ',mpirun,' -np 2 ',gyacomodir,'bin/',EXECNAME,' 1 2 1 0;'];
-   RUN  =['time ',mpirun,' -np 4 ',gyacomodir,'bin/',EXECNAME,' 1 2 2 0;'];
+    RUN  =['time ',mpirun,' -np 2 ',gyacomodir,'bin/',EXECNAME,' 1 2 1 0;'];
+   % RUN  =['time ',mpirun,' -np 4 ',gyacomodir,'bin/',EXECNAME,' 1 2 2 0;'];
      % RUN  =['time ',mpirun,' -np 8 ',gyacomodir,'bin/',EXECNAME,' 2 2 2 0;'];
-%     RUN  =['time ',mpirun,' -np 1 ',gyacomodir,'bin/',EXECNAME,' 1 1 1 0;'];
+    % RUN  =['time ',mpirun,' -np 1 ',gyacomodir,'bin/',EXECNAME,' 1 1 1 0;'];
       % RUN = ['./../../../bin/gyacomo23_sp 0;'];
     MVOUT='cd ../../../wk;';
     system([MVIN,RUN,MVOUT]);
diff --git a/wk/parameters/lin_ITG.m b/wk/parameters/lin_ITG.m
index 7e2167a3..07d85ebc 100644
--- a/wk/parameters/lin_ITG.m
+++ b/wk/parameters/lin_ITG.m
@@ -3,16 +3,17 @@ SIMID = 'lin_ITG'; % Name of the simulation
 
 %% Set up physical parameters
 CLUSTER.TIME = '99:00:00';  % Allocation time hh:mm:ss
-NU = 0.005;                 % Collision frequency
-TAU = 1.0;                  % e/i temperature ratio
-K_Ne = 0*2.22;              % ele Density
-K_Te = 0*6.96;              % ele Temperature
-K_Ni = 2.22;              % ion Density gradient drive
-K_Ti = 6.96;              % ion Temperature
+NU      = 0.005;            % Collision frequency
+TAU     = 1.0;              % e/i temperature ratio
+K_Ne    = 0*2.22;           % ele Density
+K_Te    = 0*6.96;           % ele Temperature
+K_Ni    = 2.22;             % ion Density gradient drive
+K_Ti    = 6.96;             % ion Temperature
 SIGMA_E = 0.0233380;        % mass ratio sqrt(m_a/m_i) (correct = 0.0233380)
-NA = 1;                     % number of kinetic species
+NA      = 1;                % number of kinetic species
 ADIAB_E = (NA==1);          % adiabatic electron model
-BETA = 0.0;                 % electron plasma beta
+BETA    = 0.0;              % electron plasma beta
+EXBRATE = 0.0;              % Background ExB shear flow
 %% Set up grid parameters
 P = 4;
 J = 2;%P/2;
@@ -40,8 +41,8 @@ SHIFT_Y = 0.0;    % Shift in the periodic BC in z
 NPOL   = 1;       % Number of poloidal turns
 
 %% TIME PARAMETERS
-TMAX     = 50;  % Maximal time unit
-DT       = 1e-2;   % Time step
+TMAX     = 20;  % Maximal time unit
+DT       = 2e-2;   % Time step
 DTSAVE0D = 1;      % Sampling time for 0D arrays
 DTSAVE2D = -1;     % Sampling time for 2D arrays
 DTSAVE3D = 1;      % Sampling time for 3D arrays
-- 
GitLab