From 787b4769eda705a7807014e18f0ae8d51a4a5c8f Mon Sep 17 00:00:00 2001 From: Antoine Hoffmann <antoine.hoffmann@epfl.ch> Date: Fri, 11 Aug 2023 13:43:11 +0200 Subject: [PATCH] save scripts --- matlab/plot/quick_lin_gene_plot.m | 112 ++++++++++++++++++++++++++++++ wk/lin_run_script.m | 27 +++---- wk/lin_scan_script.m | 5 +- wk/load_and_replot.m | 23 ++++++ wk/load_metadata_scan.m | 2 +- 5 files changed, 153 insertions(+), 16 deletions(-) create mode 100644 matlab/plot/quick_lin_gene_plot.m create mode 100644 wk/load_and_replot.m diff --git a/matlab/plot/quick_lin_gene_plot.m b/matlab/plot/quick_lin_gene_plot.m new file mode 100644 index 00000000..2a5a4219 --- /dev/null +++ b/matlab/plot/quick_lin_gene_plot.m @@ -0,0 +1,112 @@ +%% gyroLES plot +% genepath = '/misc/gene_results'; +% % simpath = '/NL_Zpinch_Kn_1.7_eta_0.25_nuSG_1e-1_gyroLES/'; +% simpath = '/NL_Zpinch_Kn_1.8_eta_0.25_nuSG_5e-2_gyroLES/'; +% filename = 'GyroLES_ions.dat'; +% toload = [genepath simpath filename]; +% data = readtable(toload); +% t = data.Var1; +% mu_x = data.Var2; +% mu_y = data.Var3; +% figure; +% plot(t,mu_x); hold on +% plot(t,mu_y); +% legend('mu_x','mu_y'); xlabel('time'); ylabel('Hyper-diff'); +% title('gyroLES results for H&P fig. 2c') + +%% Plot linear results +% path = '/home/ahoffman/gene/linear_zpinch_results/'; +% fname ='tmp.txt'; +% fname ='GENE_LIN_Kn_1.8_KT_0.45_nuSG_0.047_32x16.txt'; +% fname ='GENE_LIN_Kn_1.5_KT_0.325_nuSG_0.047_32x16.txt'; +% fname ='GENE_LIN_Kn_1.5_KT_0.325_nuSG_0.0235_32x16.txt'; +% fname ='GENE_LIN_Kn_1.5_KT_0.325_nuSG_0.0047_32x16.txt'; +% fname ='GENE_LIN_Kn_1.5_KT_0.325_nuSG_0.0047_64x32.txt'; +% fname ='GENE_LIN_Kn_1.4_KT_0.35_nuSG_0.0047_64x32.txt'; +% fname ='GENE_LIN_Kn_1.6_KT_0.4_nuSG_0.0047_64x32.txt'; +% fname ='GENE_LIN_Kn_1.6_KT_0.4_nuSGDK_0.0047_64x32.txt'; +% fname ='GENE_LIN_Kn_1.6_KT_0.4_nuLDDK_0.0047_64x32.txt'; +% fname ='GENE_LIN_Kn_1.8_KT_0.4_nuLDDK_0.0047_64x32.txt'; +% fname ='GENE_LIN_Kn_1.8_KT_0.45_nu_0_32x16.txt'; +% fname ='GENE_LIN_Kn_1.8_KT_0.45_nuSG_0.0235_64x32.txt'; +% fname ='GENE_LIN_Kn_1.9_KT_0.475_nuSG_0.047_64x32.txt'; +% fname ='GENE_LIN_Kn_1.9_KT_0.475_nuSG_0.235_64x32.txt'; +% fname ='GENE_LIN_Kn_1.7_KT_0.425_nuSG_0.235_64x32.txt'; +% fname ='GENE_LIN_Kn_1.8_KT_0.45_nuSGDK_0.047_32x16.txt'; +% fname ='GENE_LIN_Kn_1.8_KT_0.475_nu_0_mu_5e-2.txt'; +% fname ='GENE_LIN_Kn_1.8_KT_0.45_nuSGDK_0.0235_64x32.txt'; +% fname ='GENE_LIN_Kn_1.8_KT_0.45_nuSGDK_0.0235_32x16.txt'; +% fname ='GENE_LIN_Kn_2.0_KT_0.5_nu_0_32x16.txt'; +% fname ='GENE_LIN_Kn_2.0_KT_0.5_nuSGDK_0.0235_32x16.txt'; +% fname ='GENE_LIN_Kn_1.6_KT_0.4_nu_0_32x16.txt'; +% fname ='GENE_LIN_Kn_2.5_KT_0.625_nu_0_32x16.txt'; +path = '/home/ahoffman/gene/linear_CBC_results/'; +% fname = 'CBC_100_20x1x32x30x14_Lv_3_Lw_12_circ.txt'; +% fname = 'CBC_100_20x1x32x32x12_Lv_3_Lw_12.txt'; +% fname = 'CBC_KT_4_20x1x32x32x12_Lv_3_Lw_12.txt'; +% fname = 'CBC_KT_4_20x1x32x64x24_Lv_6_Lw_24.txt'; +% fname = 'CBC_KT_5.3_20x1x32x32x12_Lv_3_Lw_12.txt'; +% fname = 'CBC_KT_5.3_32x1x48x40x16_Lv_3_Lw_12.txt'; +% fname = 'CBC_ky_0.3_20x1x32x32x12_Lv_3_Lw_12.txt'; +% fname = 'CBC_ky_0.3_20x1x32x32x12_Lv_3_Lw_12_nuv_1e-3.txt'; +% fname = 'CBC_KT_11_20x1x16x24x10_Lv_3_Lw_12.txt'; +% fname = 'CBC_KT_11_20x1x32x30x14_Lv_3_Lw_12.txt'; +% fname = 'CBC_ky_0.3_20x1x16x24x10_Lv_3_Lw_12_nuv_1e-3.txt'; +%----------Shearless CBC +% fname = 'CBC_salpha_s0_nz_24_nv_48_nw_16_adiabe.txt'; +% fname = 'CBC_salpha_s0_nz_24_nv_48_nw_16_kine.txt'; +% fname = 'CBC_salpha_s0_nz_24_nv_48_nw_16_kine_beta_1e-4.txt'; +% fname = 'CBC_miller_s0_nz_24_nv_48_nw_16_adiabe.txt'; +% fname = 'CBC_miller_s0_nz_24_nv_48_nw_16_kine.txt'; +%----------Shearless pITG +% fname = 'pITG_salpha_s0_nz_24_nv_48_nw_16_adiabe.txt'; +% fname = 'pITG_miller_s0_nz_24_nv_48_nw_16_adiabe.txt'; +% fname = 'pITG_salpha_s0_nz_24_nv_48_nw_16_kine.txt'; +% fname = 'pITG_miller_s0_nz_24_nv_48_nw_16_kine.txt'; +%----------Convergence nvpar shearless pITG +% fname = 'pITG_salpha_s0_nz_24_nv_scan_nw_16_adiabe.txt'; +% fname = 'pITG_miller_s0_nz_24_nv_scan_nw_16_adiabe.txt'; +% fname = 'pITG_salpha_s0_nz_24_nv_scan_nw_16_kine.txt'; +% fname = 'pITG_miller_s0_nz_24_nv_scan_nw_16_kine.txt'; +% fname = 'pITG_salpha_s0_nz_24_nv_scan_nw_24_adiabe.txt'; +% fname = 'pITG_miller_s0_nz_24_nv_scan_nw_24_adiabe.txt'; +%----------Convergence nvpar shearless CBC +% fname = 'CBC_salpha_nz_24_nv_scan_nw_16_adiabe.txt'; +% fname = 'CBC_miller_nz_24_nv_scan_nw_16_adiabe.txt'; +% fname = 'CBC_salpha_nz_24_nv_scan_nw_16_kine.txt'; +% fname = 'CBC_miller_nz_24_nv_scan_nw_16_kine.txt'; +%---------- CBC +% fname = 'CBC_salpha_nx_8_nz_18_nv_12_nw_8_adiabe.txt'; +% fname = 'CBC_salpha_nx_8_nz_18_nv_18_nw_8_adiabe.txt'; + +% fname = 'CBC_salpha_nx_8_nz_24_nv_6_nw_4_adiabe.txt'; +% fname = 'CBC_salpha_nx_8_nz_24_nv_6_nw_4_adiabe_0.5L.txt'; +% fname = 'CBC_salpha_nx_8_nz_24_nv_8_nw_4_adiabe.txt'; +% fname = 'CBC_salpha_nx_8_nz_24_nv_8_nw_4_adiabe_0.5L.txt'; +fname = 'CBC_salpha_nx_8_nz_24_nv_8_nw_4_adiabe_0.2L.txt'; +% fname = 'CBC_salpha_nx_8_nz_24_nv_16_nw_8_adiabe.txt'; +% fname = 'CBC_salpha_nx_8_nz_24_nv_16_nw_8_adiabe_0.5L.txt'; +% fname = 'CBC_salpha_nx_8_nz_24_nv_36_nw_16_adiabe.txt'; +% fname = 'CBC_salpha_nx_8_nz_24_nv_36_nw_16_adiabe_0.5L.txt'; +% fname = 'CBC_salpha_nx_8_nz_24_nv_48_nw_16_adiabe.txt'; + +% fname = 'kT_5.3_salpha_nx_8_nz_24_nv_60_nw_30_adiabe.txt'; + +% fname = 'CBC_salpha_nx_8_nz_24_nv_36_nw_16_kine.txt'; +% fname = 'CBC_miller_nx_20_nz_32_nv_32_nw_12_adiabe.txt'; +% fname = 'CBC_miller_nx_8_nz_24_nv_36_nw_16_adiabe.txt'; +% fname = 'CBC_miller_nx_20_nz_32_nv_32_nw_12_kine.txt'; +% fname = 'CBC_miller_nx_8_nz_24_nv_36_nw_16_kine.txt'; +%----------Convergence nv CBC +% fname = 'CBC_ky_0.3_nv_scan_8x1x24_nw_8_Lv_3_Lw_6.txt'; +% fname = 'CBC_ky_0.3_nv_scan_8x1x24_nw_16_Lv_3_Lw_6.txt'; +% fname = 'CBC_ky_0.3_nv_scan_8x1x24_nw_24_Lv_3_Lw_6.txt'; + +data_ = load([path,fname]); + +figure +% plot(data_(:,2),data_(:,3),'-dk','DisplayName',fname); hold on; +% plot(data_(:,2),data_(:,4),'--*k','DisplayName',fname); + +plot(data_(:,2),data_(:,3)./data_(:,2).^2,'-dk','DisplayName',fname); hold on; +legend show diff --git a/wk/lin_run_script.m b/wk/lin_run_script.m index aad2bfd6..b4832e7d 100644 --- a/wk/lin_run_script.m +++ b/wk/lin_run_script.m @@ -15,7 +15,7 @@ addpath(genpath([gyacomodir,'matlab/load'])) % Add load folder addpath(genpath([gyacomodir,'wk/parameters'])) % Add parameters folder %% Setup run or load an executable -RUN = 1; % To run or just to load +RUN = 0; % To run or just to load default_plots_options % EXECNAME = 'gyacomo23_sp_save'; % single precision EXECNAME = 'gyacomo23_sp'; % single precision @@ -32,15 +32,15 @@ EXECNAME = 'gyacomo23_sp'; % single precision run lin_ITG % run lin_KBM %% Change parameters -% 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; +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; % DTSAVE0D = 200*DT; @@ -52,9 +52,9 @@ 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 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 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;'; @@ -86,8 +86,9 @@ options.NMA = 1; % Set NMA option to 1 options.NMODES = 999; % Set how much modes we study 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 -fig = mode_growth_meter(data,options); % Call the function mode_growth_meter with data and options as input arguments, and store the result in fig +[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 if (1 && NZ>4) diff --git a/wk/lin_scan_script.m b/wk/lin_scan_script.m index fa4b3509..5497c8e2 100644 --- a/wk/lin_scan_script.m +++ b/wk/lin_scan_script.m @@ -18,8 +18,8 @@ addpath(genpath([gyacomodir,'wk/parameters'])) % Add parameters folder RUN = 1; % To run or just to load RERUN = 0; % rerun if the data does not exist default_plots_options -EXECNAME = 'gyacomo23_sp'; % single precision -% EXECNAME = 'gyacomo23_dp'; % double precision +% EXECNAME = 'gyacomo23_sp'; % single precision +EXECNAME = 'gyacomo23_dp'; % double precision %% Setup parameters % run lin_DTT_AB_rho85 @@ -30,6 +30,7 @@ run lin_JET_rho97 %% Change parameters NY = 2; +EXBRATE = 0; % SIGMA_E = 0.023; %% Scan parameters SIMID = [SIMID,'_scan']; diff --git a/wk/load_and_replot.m b/wk/load_and_replot.m new file mode 100644 index 00000000..3d0e7ee5 --- /dev/null +++ b/wk/load_and_replot.m @@ -0,0 +1,23 @@ +% Load the .fig file +figFile = '/home/ahoffman/paper2_fig/31_CBC_linear_convergence.fig'; % Replace with the actual path to your .fig file +% figFile = 'tmp.fig'; % Replace with the actual path to your .fig file +figHandle = openfig(figFile); + +%% Extract data from the figure +% Here, we assume that the plotted data is stored in a single line plot +lineHandle = findobj(figHandle, 'Type', 'line'); +xData = get(lineHandle, 'XData'); +yData = get(lineHandle, 'YData'); +% Extract legend labels +legendHandle = findobj(figHandle, 'Type', 'legend'); +legendEntries = flip(get(legendHandle, 'String')); +% legendEntries = legendEntries{end:-1:1}; +% Close the loaded figure +close(figHandle); +%% + figure +for i = numel(xData):-1:1 + % plot(xData{i},yData{i},'DisplayName',legendEntries{i}); hold on + plot(xData{i},yData{i}./xData{i}.^2,'DisplayName',legendEntries{i}); hold on +end +legend show \ No newline at end of file diff --git a/wk/load_metadata_scan.m b/wk/load_metadata_scan.m index 6615ee53..f15aee8a 100644 --- a/wk/load_metadata_scan.m +++ b/wk/load_metadata_scan.m @@ -19,7 +19,7 @@ addpath(genpath([gyacomodir,'matlab/load'])) % ... add% EXECNAME = 'gyacomo_1.0' % datafname = 'lin_JET_rho97_scan/4x32_ky_0.01_10_P_2_8_kN_10_DGGK_0.05_be_0.0031.mat'; % datafname = 'lin_JET_rho97_scan/8x32_ky_0.01_10_P_2_8_kN_10_DGGK_0.05_be_0.0031.mat'; % datafname = 'lin_JET_rho97_scan/8x32_ky_0.01_10_P_2_2_kN_10_DGGK_0.05_be_0.0031.mat'; -datafname = 'lin_JET_rho97_scan/8x32_ky_0.031623_31.6228_P_2_2_kN_10_DGGK_0.1_be_0.0031.mat'; +datafname = 'lin_JET_rho97_scan/8x32_ky_0.031623_31.6228_P_2_8_kN_10_DGGK_0.1_be_0.0031.mat'; %% Chose if we filter gamma>0.05 FILTERGAMMA = 0; -- GitLab