Skip to content
Snippets Groups Projects
Commit 0256e6d1 authored by Antoine Cyril David Hoffmann's avatar Antoine Cyril David Hoffmann :seedling:
Browse files

update matlab scripts

parent 5be8619b
No related branches found
No related tags found
No related merge requests found
function S = read_namelist(filename)
% S = READ_NAMELIST(FILENAME) returns the struct S containg namelists and
% variables in the file FILENAME organised in hierachical way:
......@@ -80,11 +79,7 @@ while i < c;
nmlst_bdy = [nmlst_bdy ' ' line];
end
% Parse current namelist (set of variables)
switch namelst
case 'info'
otherwise
S.(namelst) = parse_namelist(nmlst_bdy);
end
S.(namelst) = parse_namelist(nmlst_bdy);
end
end
function S = parse_namelist(strng)
......@@ -126,9 +121,7 @@ for k = 1:nvars,
if k > 1, arg_end(k - 1) = i; end
vars{k} = ['S.' strng(i + 1: j)];
end
if numel(arg_end) > 0
arg_end(end) = length(strng);
end
% This variables are used in the eval function to evaluate True/False,
% so don't remove it!
T = '.true.';
......@@ -137,6 +130,7 @@ F = '.false.';
for k = 1:nvars,
arg = strng(arg_start(k):arg_end(k));
arglit = islit(arg_start(k):arg_end(k))';
% Remove commas in non literal string...
commas = ~arglit & arg == ',';
if any(commas)
......
function [ fig ] = imagesc_custom( XX,YY,FF)
% CUSTOM IMAGESC this custom function is meant to be used exaclty as pcolor
% but plotting array values in pixels (like imagesc) and not in vertices (like pcolor).
fig = imagesc( XX(1,:), YY(:,1), FF);
x = reshape(XX(1,:),[numel(XX(1,:)), 1]);
y = reshape(YY(:,1),[numel(YY(:,1)), 1]);
fig = imagesc( x, y, FF);
set(gca,'YDir','normal')
xticks(XX(1,:));
xticklabels(num2str(XX(1,:)));
yticks(YY(:,1));
yticklabels(num2str(YY(:,1)));
xticks(x);
xticklabels(num2str(x));
yticks(y);
yticklabels(num2str(y));
end
......@@ -14,7 +14,7 @@ Nrows = ceil(Nframes/4);
Ncols = ceil(Nframes/Nrows);
%
if OPTIONS.LOGSCALE
toplot.FIELD = max(abs(toplot.FIELD),1e-20);
toplot.FIELD = max(abs(toplot.FIELD),1e-40);
toplot.FIELD = log(toplot.FIELD);
end
TNAME = [];
......
......@@ -15,34 +15,33 @@ addpath(genpath([gyacomodir,'matlab/load'])) % Add load folder
addpath(genpath([gyacomodir,'wk/parameters'])) % Add parameters folder
%% Setup run or load an executable
RUN = 0; % To run or just to load
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_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_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 = 40;
NX = 8;
PMAX = 16;
JMAX = PMAX/2;
ky = 0.05;
LY = 2*pi/ky;
DT = 5e-3;
TMAX = 50;
% % SIGMA_E = 0.04;
% TMAX = 10;
NY = 2;
NX = 4;
% PMAX = 4;
% JMAX = PMAX/2;
ky = 0.8; LY = 2*pi/ky;
DT = 1e-4;
TAU = 2.1;
% SIGMA_E = 0.02;
% TMAX = 50;
% DTSAVE0D = 200*DT;
% DTSAVE3D = TMAX/50;
%%-------------------------------------------------------------------------
......@@ -53,8 +52,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 8 ',gyacomodir,'bin/',EXECNAME,' 2 2 2 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 = ['./../../../bin/gyacomo23_sp 0;'];
MVOUT='cd ../../../wk;';
......@@ -88,6 +87,7 @@ options.iz = 'avg'; % Compressing z
options.ik = 1; %
options.GOK2 = 0; % plot gamma/k^2
options.fftz.flag = 0; % Set fftz.flag option to 0
options.FIELD = 'phi';
[fig, kykx, wkykx, ekykx] = mode_growth_meter(data,options); % Call the function mode_growth_meter with data and options as input arguments, and store the result in fig
end
......@@ -98,7 +98,7 @@ if data.inputs.BETA > 0
[data.PSI, data.Ts3D] = compile_results_3D(LOCALDIR,J0,J1,'psi');
end
options.time_2_plot = [120];
options.kymodes = [0.25];
options.kymodes = [0.2 0.3 0.4];
options.normalized = 1;
options.PLOT_KP = 0;
% options.field = 'phi';
......
%% 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_DIID_LM_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,8 +20,8 @@ P = 2;
J = P/2;%P/2;
PMAX = P; % Hermite basis size
JMAX = J; % Laguerre basis size
NX = 8; % real space x-gridpoints
NY = 2; % real space y-gridpoints
NX = 2; % real space x-gridpoints
NY = 4; % 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)
......@@ -45,8 +45,8 @@ SHIFT_Y = 0.0; % Shift in the periodic BC in z
NPOL = 1; % Number of poloidal turns
PB_PHASE = 0;
%% TIME PARAMETERS
TMAX = 15; % Maximal time unit
DT = 1e-3; % Time step
TMAX = 10; % Maximal time unit
DT = 5e-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
......
......@@ -13,15 +13,15 @@ EXECDIR = [curdir(1:end-2),'bin/'];
% EXECNAME = 'gyacomo23_dp_O1';
% EXECNAME = 'gyacomo23_dp';
% EXECNAME = 'gyacomo23_sp';
% EXECNAME = 'gyacomo23_test';
EXECNAME = 'gyacomo23_debug';
EXECNAME = 'gyacomo23_test';
% EXECNAME = 'gyacomo23_debug';
% ------
NP = '1'; PARA = '1 1 1';
% NP = '1'; PARA = '1 1 1';
% NP = '2'; PARA = '1 2 1';
% NP = '6'; PARA = '1 6 1';
NP = '6'; PARA = '1 6 1';
%------
% Picture, const. zonal mode in phi in nonlin term
% INNAME = '0';
INNAME = '0';
% Picture, bckg ExB shear
% INNAME = '1';
% NL with padrallel modes initialization no ExB shear
......@@ -35,7 +35,7 @@ NP = '1'; PARA = '1 1 1';
% Mcmillan et al. 2019 correction
% INNAME = '6';
% Single mode single step
INNAME = '7';
% INNAME = '7';
%-------
RUN = [MPIRUN,' -np ',NP,' ',EXECDIR,EXECNAME,' ',PARA,' ',INNAME];
system([MVIN,'; ',RUN,'; ',MVOUT]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment