From c19902c93be31725bc5a2258754f71aa40a5f83a Mon Sep 17 00:00:00 2001
From: Antoine Hoffmann <antoine.hoffmann@epfl.ch>
Date: Mon, 10 Oct 2022 11:19:11 +0200
Subject: [PATCH] save some scripts

---
 wk/Zpinch_coll_scan_kN_1.7.m | 32 ++++++++++++++++++++++++++++++++
 wk/save_iFFT.m               | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 wk/Zpinch_coll_scan_kN_1.7.m
 create mode 100644 wk/save_iFFT.m

diff --git a/wk/Zpinch_coll_scan_kN_1.7.m b/wk/Zpinch_coll_scan_kN_1.7.m
new file mode 100644
index 00000000..b849c259
--- /dev/null
+++ b/wk/Zpinch_coll_scan_kN_1.7.m
@@ -0,0 +1,32 @@
+figure
+
+Kn = 1.7;
+
+% SUGAMA 4,2
+nu_a   = 1e-2*[1.00 2.00 3.00 4.00 5.00 6.00 7.00 10.0];
+Gavg_a = 1e-2*[1.00 1.71 2.18 3.11 4.11 5.20 6.08  5.59*Kn];
+Gstd_a = 1e-2*[1.78 2.67 2.82 3.08 2.33 1.35 1.43  0.0];
+
+errorbar(nu_a, Gavg_a/Kn, Gstd_a/Kn,'DisplayName','Sugama (4,2)'); hold on
+
+% LANDAU 4,2
+nu_a   = 1e-2*[1.00 2.00 3.00 4.00 5.00 6.00 7.00 10.0];
+Gavg_a = [8.57e-2 1.45e-1 2.25e-1 2.87e-1 3.48e-1 4.06e-1 4.51e-1 3.65e-1*Kn];
+Gstd_a = [2.07e-2 2.61e-2 2.40e-2 3.46e-2 4.30e-2 5.00e-2 5.11e-2  0];
+
+errorbar(nu_a, Gavg_a/Kn, Gstd_a/Kn,'DisplayName','Coulomb (4,2)'); hold on
+
+% LANDAU 6,3
+nu_a   = 1e-2*[1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00];
+Gavg_a = [3.86e-2 1.82e-2 3.08e-2 5.24e-2 7.08e-2 8.26e-2 5.78e-2 7.16e-2 7.96e-2];
+Gstd_a = [3.52e-2 1.87e-2 2.86e-2 2.79e-2 1.72e-2 2.40e-2 2.46e-2 1.01e-2 1.21e-2];
+
+errorbar(nu_a, Gavg_a/Kn, Gstd_a/Kn,'DisplayName','Coulomb (6,3)'); hold on
+
+% Collisionless
+plot([0 1], 0.02343*[1 1],'--k','DisplayName','$\nu=0$');
+
+
+%
+xlim([min(nu_a) max(nu_a)]);
+xlabel('$\nu R/c_s$'); ylabel('$\Gamma_x^\infty/\kappa_N$');
\ No newline at end of file
diff --git a/wk/save_iFFT.m b/wk/save_iFFT.m
new file mode 100644
index 00000000..d429b622
--- /dev/null
+++ b/wk/save_iFFT.m
@@ -0,0 +1,35 @@
+%% INPUT
+simdir    = '/misc/gyacomo_outputs/results/Zpinch_rerun';
+resolu    = 'UHD_512x256x2x1';
+output    = 'outputs_01.h5';
+filename  = [simdir,'/',resolu,'/',output]; 
+fieldname = 'Ni00';
+
+%% OUTPUT
+outdir    = '.';
+outname   = [fieldname,'_real_',resolu,'.h5'];
+outfile   = [outdir,'/',outname];
+
+%% Load the complex field F_c
+[ F_c, Ts3D, ~] = load_3D_data(filename, fieldname);
+
+%% Measure size and allocate the real field ff_
+sz_  =size(real(fftshift(ifourier_GENE(F_c(:,:,1,1))))); % size one frame for the real dimensions
+f_r  = zeros(sz_(1),sz_(2),numel(Ts3D));
+sz_  = size(f_r);
+
+%% Fill the real field f_r
+for it = 1:numel(Ts3D)
+    f_r(:,:,it) = squeeze(real(fftshift(ifourier_GENE(F_c(:,:,1,it)))));
+end
+clear F_c;
+
+%% Save the real field
+h5create(outfile,'/data',sz_,'Datatype','single')
+h5write(outfile,'/data',f_r)
+h5disp(outfile)
+clear f_r
+
+%% small check
+test_ = h5read(outfile,'/data');
+figure; imagesc(test_(:,:,end));
\ No newline at end of file
-- 
GitLab