From 257a31cc18b537efa542fc57c96c73e7c0cd907a Mon Sep 17 00:00:00 2001
From: Antoine Hoffmann <antoine.hoffmann@epfl.ch>
Date: Tue, 3 Oct 2023 11:49:57 +0200
Subject: [PATCH] save scripts

---
 bash scripts/fort_00.90                       | 107 ++++++++++++++++++
 bash scripts/submit_00.cmd                    |   3 +-
 testcases/CBC_ExBshear/fort_01.90             |   4 +-
 testcases/CBC_ExBshear/std/fort_00.90         |  97 ++++++++++++++++
 testcases/CBC_ExBshear/std/fort_01.90         |  97 ++++++++++++++++
 testcases/CBC_ExBshear/{ => std}/fort_02.90   |   0
 .../Dimits_2000_fig3_fit_to_LLNL_GK.txt       |  18 +++
 wk/fast_analysis.m                            |  13 ++-
 wk/lin_run_script.m                           |  28 +++--
 wk/parameters/lin_DIIID_LM_rho90.m            |   4 +-
 wk/parameters/lin_DIIID_LM_rho95.m            |   6 +-
 11 files changed, 350 insertions(+), 27 deletions(-)
 create mode 100644 bash scripts/fort_00.90
 create mode 100644 testcases/CBC_ExBshear/std/fort_00.90
 create mode 100644 testcases/CBC_ExBshear/std/fort_01.90
 rename testcases/CBC_ExBshear/{ => std}/fort_02.90 (100%)
 create mode 100644 wk/benchmark_and_scan_scripts/Dimits_2000_fig3_fit_to_LLNL_GK.txt

diff --git a/bash scripts/fort_00.90 b/bash scripts/fort_00.90
new file mode 100644
index 00000000..183029f9
--- /dev/null
+++ b/bash scripts/fort_00.90	
@@ -0,0 +1,107 @@
+&BASIC
+  nrun       = 100000000
+  dt         = 0.002
+  tmax       = 100
+  maxruntime = 356400
+  job2load   = -1
+/
+&GRID
+  pmax  = 2
+  jmax  = 1
+  Nx    = 192
+  Lx    = 90
+  Ny    = 48
+  Ly    = 200
+  Nz    = 32
+  SG    = .false.
+  Nexc  = 0
+/
+&GEOMETRY
+  geom     = 'miller'
+  q0       =-2.15
+  shear    = 3.62
+  eps      = 0.28
+  kappa    = 1.53
+  s_kappa  = 0.77
+  delta    = 0.23
+  s_delta  = 1.05
+  zeta     =-0.01
+  s_zeta   =-0.17
+  parallel_bc = 'dirichlet'
+  shift_y = 0
+  Npol    = 1
+  PB_PHASE= .false.
+/
+&OUTPUT_PAR
+  dtsave_0d = 0.5
+  dtsave_1d = -1
+  dtsave_2d = -1
+  dtsave_3d = 5.0
+  dtsave_5d = 10
+  write_doubleprecision = .false.
+  write_gamma = .true.
+  write_hf    = .true.
+  write_phi   = .true.
+  write_Na00  = .true.
+  write_Napj  = .true.
+  write_dens  = .true.
+  write_temp  = .true.
+/
+&MODEL_PAR
+LINEARITY = 'nonlinear'
+RM_LD_T_EQ= .false.
+  Na      = 2
+  mu_x    = 1.0
+  mu_y    = 1.0
+  N_HD    = 4
+  mu_z    = 2.0
+  HYP_V   = 'hypcoll'
+  mu_p    = 0
+  mu_j    = 0
+  nu      = 0.5
+  k_gB    = 1
+  k_cB    = 1
+  lambdaD = 0
+  beta    = 0.0034
+  ADIAB_E = .false.
+  ADIAB_I = .false.
+  MHD_PD  = .true.
+/
+&CLOSURE_PAR
+  hierarchy_closure='truncation'
+  dmax             =-1
+  nonlinear_closure='truncation'
+  nmax             =0
+/
+&SPECIES
+  name_  = 'ions' 
+  tau_   = 1
+  sigma_ = 1
+  q_     = 1
+  K_N_   = 1.33
+  K_T_   = 8.25
+/
+&SPECIES
+  name_  = 'electrons' 
+  tau_   = 1
+  sigma_ = 0.04!0.023338
+  q_     = -1
+  K_N_   = 1.33
+  K_T_   = 12
+/
+&COLLISION_PAR
+  collision_model = 'DG'
+  GK_CO      = .true.
+  INTERSPECIES    = .true.
+  mat_file        = '/Users/ahoffmann/gyacomo/iCa/null'
+  collision_kcut  = 1
+/
+&INITIAL_CON
+  INIT_OPT      = 'blob'
+  init_background  = 0
+  init_noiselvl = 1e-05
+  iseed         = 42
+/
+&TIME_INTEGRATION_PAR
+  numerical_scheme = 'RK4'
+/
\ No newline at end of file
diff --git a/bash scripts/submit_00.cmd b/bash scripts/submit_00.cmd
index 480ee2b3..0d1f9436 100644
--- a/bash scripts/submit_00.cmd	
+++ b/bash scripts/submit_00.cmd	
@@ -10,5 +10,4 @@
 #SBATCH --account=FUA36_TSVVT422
 #SBATCH --partition=skl_fua_dbg
 #SBATCH --qos=normal
-srun --cpu-bind=cores ./gyacomo 2 24 1 0
-
+srun --cpu-bind=cores ./gyacomo 2 24 1 0
\ No newline at end of file
diff --git a/testcases/CBC_ExBshear/fort_01.90 b/testcases/CBC_ExBshear/fort_01.90
index bf5ea997..45b83533 100644
--- a/testcases/CBC_ExBshear/fort_01.90
+++ b/testcases/CBC_ExBshear/fort_01.90
@@ -57,10 +57,10 @@
   HYP_V   = 'hypcoll'
   mu_p    = 0.0
   mu_j    = 0.0
-  nu      = 1.0
+  nu      = 1.00
   beta    = 0.0
   ADIAB_E = .t.
-  ExBrate = 0.01
+  ExBrate = 0.0
 /
 &CLOSURE
   hierarchy_closure='truncation'
diff --git a/testcases/CBC_ExBshear/std/fort_00.90 b/testcases/CBC_ExBshear/std/fort_00.90
new file mode 100644
index 00000000..b26e8952
--- /dev/null
+++ b/testcases/CBC_ExBshear/std/fort_00.90
@@ -0,0 +1,97 @@
+&BASIC
+  nrun       = 99999999
+  dt         = 0.01
+  tmax       = 50
+  maxruntime = 72000
+  job2load   = -1
+/
+&GRID
+  pmax   = 2
+  jmax   = 1
+  Nx     = 64
+  Lx     = 120
+  Ny     = 48
+  Ly     = 120
+  Nz     = 16
+  SG     = .f.
+  Nexc   = 0
+/
+&GEOMETRY
+  geom   = 's-alpha'
+  !geom   = 'miller'
+  q0     = 1.4
+  shear  = 0.8
+  eps    = 0.18
+  kappa  = 1.0
+  s_kappa= 0.0
+  delta  = 0.0
+  s_delta= 0.0
+  zeta   = 0.0
+  s_zeta = 0.0
+  parallel_bc = 'dirichlet'
+  shift_y= 0.0
+/
+&DIAGNOSTICS
+  dtsave_0d = 1
+  dtsave_1d = -1
+  dtsave_2d = -1
+  dtsave_3d = 1
+  dtsave_5d = 20
+  write_doubleprecision = .f.
+  write_gamma = .t.
+  write_hf    = .t.
+  write_phi   = .t.
+  write_Na00  = .t.
+  write_Napj  = .t.
+  write_dens  = .t.
+  write_fvel  = .t.
+  write_temp  = .t.
+/
+&MODEL
+  LINEARITY = 'nonlinear'
+  Na      = 1 ! number of species
+  mu_x    = 1.0
+  mu_y    = 1.0
+  N_HD    = 4
+  mu_z    = 1.0
+  HYP_V   = 'hypcoll'
+  mu_p    = 0.0
+  mu_j    = 0.0
+  nu      = 1.00
+  beta    = 0.0
+  ADIAB_E = .t.
+  ExBrate = 0.0
+/
+&CLOSURE
+  hierarchy_closure='truncation'
+  dmax = -1
+  nonlinear_closure='truncation'
+  nmax = 0
+/
+&SPECIES
+ ! ions
+ name_ = 'ions'
+ tau_  = 1.0
+ sigma_= 1.0
+ q_    = 1.0
+ k_N_  = 2.22
+ k_T_  = 6.96
+/
+
+&COLLISION
+  collision_model = 'DG' !DG/SG/PA/LD (dougherty, sugama, pitch angle, landau)
+  GK_CO           = .f.
+  INTERSPECIES    = .true.
+  mat_file       = 'gk_sugama_P_20_J_10_N_150_kpm_8.0.h5'
+/
+&INITIAL
+  INIT_OPT         = 'blob'
+  ACT_ON_MODES     = 'donothing'
+  init_background  = 0.0
+  init_noiselvl    = 0.005
+  iseed            = 42
+/
+&TIME_INTEGRATION
+  !numerical_scheme = 'RK4'
+  numerical_scheme = 'SSP_RK3'
+/
diff --git a/testcases/CBC_ExBshear/std/fort_01.90 b/testcases/CBC_ExBshear/std/fort_01.90
new file mode 100644
index 00000000..bf5ea997
--- /dev/null
+++ b/testcases/CBC_ExBshear/std/fort_01.90
@@ -0,0 +1,97 @@
+&BASIC
+  nrun       = 99999999
+  dt         = 0.01
+  tmax       = 100
+  maxruntime = 72000
+  job2load   = 0
+/
+&GRID
+  pmax   = 2
+  jmax   = 1
+  Nx     = 64
+  Lx     = 120
+  Ny     = 48
+  Ly     = 120
+  Nz     = 16
+  SG     = .f.
+  Nexc   = 0
+/
+&GEOMETRY
+  geom   = 's-alpha'
+  !geom   = 'miller'
+  q0     = 1.4
+  shear  = 0.8
+  eps    = 0.18
+  kappa  = 1.0
+  s_kappa= 0.0
+  delta  = 0.0
+  s_delta= 0.0
+  zeta   = 0.0
+  s_zeta = 0.0
+  parallel_bc = 'dirichlet'
+  shift_y= 0.0
+/
+&DIAGNOSTICS
+  dtsave_0d = 1
+  dtsave_1d = -1
+  dtsave_2d = -1
+  dtsave_3d = 1
+  dtsave_5d = 20
+  write_doubleprecision = .f.
+  write_gamma = .t.
+  write_hf    = .t.
+  write_phi   = .t.
+  write_Na00  = .t.
+  write_Napj  = .t.
+  write_dens  = .t.
+  write_fvel  = .t.
+  write_temp  = .t.
+/
+&MODEL
+  LINEARITY = 'nonlinear'
+  Na      = 1 ! number of species
+  mu_x    = 1.0
+  mu_y    = 1.0
+  N_HD    = 4
+  mu_z    = 1.0
+  HYP_V   = 'hypcoll'
+  mu_p    = 0.0
+  mu_j    = 0.0
+  nu      = 1.0
+  beta    = 0.0
+  ADIAB_E = .t.
+  ExBrate = 0.01
+/
+&CLOSURE
+  hierarchy_closure='truncation'
+  dmax = -1
+  nonlinear_closure='truncation'
+  nmax = 0
+/
+&SPECIES
+ ! ions
+ name_ = 'ions'
+ tau_  = 1.0
+ sigma_= 1.0
+ q_    = 1.0
+ k_N_  = 2.22
+ k_T_  = 6.96
+/
+
+&COLLISION
+  collision_model = 'DG' !DG/SG/PA/LD (dougherty, sugama, pitch angle, landau)
+  GK_CO           = .f.
+  INTERSPECIES    = .true.
+  mat_file       = 'gk_sugama_P_20_J_10_N_150_kpm_8.0.h5'
+/
+&INITIAL
+  INIT_OPT         = 'blob'
+  ACT_ON_MODES     = 'donothing'
+  init_background  = 0.0
+  init_noiselvl    = 0.005
+  iseed            = 42
+/
+&TIME_INTEGRATION
+  !numerical_scheme = 'RK4'
+  numerical_scheme = 'SSP_RK3'
+/
diff --git a/testcases/CBC_ExBshear/fort_02.90 b/testcases/CBC_ExBshear/std/fort_02.90
similarity index 100%
rename from testcases/CBC_ExBshear/fort_02.90
rename to testcases/CBC_ExBshear/std/fort_02.90
diff --git a/wk/benchmark_and_scan_scripts/Dimits_2000_fig3_fit_to_LLNL_GK.txt b/wk/benchmark_and_scan_scripts/Dimits_2000_fig3_fit_to_LLNL_GK.txt
new file mode 100644
index 00000000..8e72be2d
--- /dev/null
+++ b/wk/benchmark_and_scan_scripts/Dimits_2000_fig3_fit_to_LLNL_GK.txt
@@ -0,0 +1,18 @@
+5.988372093023255, -0.020876826722338038
+6.162790697674419, 0.4384133611691041
+6.308139534883722, 0.8559498956158684
+6.482558139534884, 1.1482254697286027
+6.627906976744185, 1.4822546972860131
+6.7441860465116275, 1.7954070981210872
+6.947674418604652, 2.0668058455114835
+7.093023255813954, 2.3382045929018798
+7.151162790697676, 2.44258872651357
+7.267441860465118, 2.713987473903968
+7.38372093023256, 2.8810020876826723
+7.500000000000002, 3.0480167014613784
+7.587209302325581, 3.1941544885177464
+7.674418604651164, 3.3402922755741127
+7.790697674418606, 3.549060542797495
+7.936046511627907, 3.757828810020877
+8.13953488372093, 4.050104384133613
+8.313953488372093, 4.237995824634655
diff --git a/wk/fast_analysis.m b/wk/fast_analysis.m
index c3418eb3..09b285b8 100644
--- a/wk/fast_analysis.m
+++ b/wk/fast_analysis.m
@@ -16,7 +16,7 @@ PARTITION = '';
 % resdir = 'LM_DIIID_rho95/5x3x512x92x32';
 % resdir = 'LM_DIIID_rho95/3x2x512x92x32';
 % resdir = '../testcases/cyclone_example';
-% resdir = '../testcases/CBC_ExBshear';
+resdir = '../testcases/CBC_ExBshear/std';
 % resdir = '../results/paper_3/HM_DTT_rho98/3x2x128x64x64';
  %%
 J0 = 00; J1 = 10;
@@ -49,7 +49,7 @@ if 0
 data.Ni00 = reshape(data.Na00(1,:,:,:,:),data.grids.Nky,data.grids.Nkx,data.grids.Nz,numel(data.Ts3D));
 options.INTERP    = 1;
 options.POLARPLOT = 0;
-options.BWR       = 1; % bluewhitered plot or gray
+options.BWR       = 0; % bluewhitered plot or gray
 options.CLIMAUTO  = 1; % adjust the colormap auto
 % options.NAME      = '\phi';
 % options.NAME      = '\phi^{NZ}';
@@ -60,7 +60,7 @@ options.NAME     = 'N_i^{00}';
 % options.NAME      = 'Q_x';
 % options.NAME      = 'n_i';
 % options.NAME      = 'n_i-n_e';
-options.PLAN      = 'kxky';
+options.PLAN      = 'xy';
 % options.NAME      = 'f_i';
 % options.PLAN      = 'sx';
 options.COMP      = 'avg';
@@ -85,11 +85,12 @@ options.POLARPLOT = 0;
 options.AXISEQUAL = 0;
 options.NORMALIZE = 0;
 options.LOGSCALE  = 1;
-% options.NAME      = 'N_i^{00}';
-options.NAME      = '\phi';
+options.CLIMAUTO  = 1;
+options.NAME      = 'N_i^{00}';
+% options.NAME      = '\phi';
 options.PLAN      = 'kxky';
 options.COMP      = 'avg';
-options.TIME      = [0 10 50 100 500];
+options.TIME      = [0 100];
 % options.TIME      = data.Ts3D(1:2:end);
 options.RESOLUTION = 256;
 fig = photomaton(data,options);
diff --git a/wk/lin_run_script.m b/wk/lin_run_script.m
index eddd7273..13da10b7 100644
--- a/wk/lin_run_script.m
+++ b/wk/lin_run_script.m
@@ -25,23 +25,26 @@ EXECNAME = 'gyacomo23_dp'; % double precision
 %% Setup parameters
 % run lin_DTT_HM_rho85
 % run lin_DTT_HM_rho98
-run lin_DIIID_LM_rho90
+% run lin_DIIID_LM_rho90
 % run lin_DIIID_LM_rho95
 % run lin_JET_rho97
 % run lin_Entropy
-% run lin_ITG
+run lin_ITG
 % run lin_KBM
 %% Change parameters
-EXBRATE = 0.0;              % Background ExB shear flow
-NY   = 2;
-NX   = 4;
-% PMAX = 4;
-% JMAX = PMAX/2;
-ky   = 0.8; LY   = 2*pi/ky;
-DT   = 1e-4;
-TAU  = 2.1;
+% EXBRATE = 0.0;              % Background ExB shear flow
+NU   = 0.1;
+CO   = 'SG';
+GKCO = 1;
+NY   = 16;
+NX   = 2;
+PMAX = 4;
+JMAX = PMAX/2;
+ky   = 0.1; LY   = 2*pi/ky;
+% DT   = 1e-4;
+% TAU  = 2.1;
 % SIGMA_E = 0.02;
-% TMAX = 50;
+TMAX = 25;
 % DTSAVE0D = 200*DT;
 % DTSAVE3D = TMAX/50;
 %%-------------------------------------------------------------------------
@@ -52,7 +55,8 @@ setup
 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 4 ',gyacomodir,'bin/',EXECNAME,' 1 2 2 0;'];
+   RUN  =['time ',mpirun,' -np 6 ',gyacomodir,'bin/',EXECNAME,' 1 6 1 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 = ['./../../../bin/gyacomo23_sp 0;'];
diff --git a/wk/parameters/lin_DIIID_LM_rho90.m b/wk/parameters/lin_DIIID_LM_rho90.m
index c8ff82e2..9995af00 100644
--- a/wk/parameters/lin_DIIID_LM_rho90.m
+++ b/wk/parameters/lin_DIIID_LM_rho90.m
@@ -20,8 +20,8 @@ P = 2;
 J = P/2;%P/2;
 PMAX = P;                   % Hermite basis size
 JMAX = J;                   % Laguerre basis size
-NX = 2;                    % real space x-gridpoints
-NY = 4;                     % real space y-gridpoints
+NX = 4;                    % real space x-gridpoints
+NY = 2;                     % real space y-gridpoints
 LX = 2*pi/0.1;              % Size of the squared frequency domain in x direction
 LY = 2*pi/0.3;             % Size of the squared frequency domain in y direction
 NZ = 32;                    % number of perpendicular planes (parallel grid)
diff --git a/wk/parameters/lin_DIIID_LM_rho95.m b/wk/parameters/lin_DIIID_LM_rho95.m
index 77a21328..2bd5ba9b 100644
--- a/wk/parameters/lin_DIIID_LM_rho95.m
+++ b/wk/parameters/lin_DIIID_LM_rho95.m
@@ -1,7 +1,7 @@
 %% Reference values
 % See Neiser et al. 2019 Gyrokinetic GENE simulations of DIII-D near-edge L-mode plasmas
 %% Set simulation parameters
-SIMID   = 'lin_DTT_HM_rho90';  % Name of the simulation
+SIMID   = 'lin_DIIID_HM_rho90';  % Name of the simulation
 %% Set up physical parameters
 CLUSTER.TIME = '99:00:00';  % Allocation time hh:mm:ss
 NU = 1.0; %(0.00235 in GENE)
@@ -20,7 +20,7 @@ P = 2;
 J = P/2;%P/2;
 PMAX = P;                   % Hermite basis size
 JMAX = J;                   % Laguerre basis size
-NX = 16;                    % real space x-gridpoints
+NX = 6;                    % real space x-gridpoints
 NY = 2;                     % real space y-gridpoints
 LX = 2*pi/0.1;              % Size of the squared frequency domain in x direction
 LY = 2*pi/0.3;             % Size of the squared frequency domain in y direction
@@ -46,7 +46,7 @@ NPOL   = 1;       % Number of poloidal turns
 PB_PHASE = 0;
 %% TIME PARAMETERS
 TMAX     = 15;  % Maximal time unit
-DT       = 1e-3;   % Time step
+DT       = 1e-4;   % Time step
 DTSAVE0D = 0.5;      % Sampling time for 0D arrays
 DTSAVE2D = -1;     % Sampling time for 2D arrays
 DTSAVE3D = 0.5;      % Sampling time for 3D arrays
-- 
GitLab