From 76b3fe8554b27cda4459807362ca51fac99f77b6 Mon Sep 17 00:00:00 2001 From: Antoine Cyril David Hoffmann <ahoffman@spcpc606.epfl.ch> Date: Mon, 1 Nov 2021 08:43:56 +0100 Subject: [PATCH] Wrote two benchmarks scripts, data for benchmark should be uploaded --- wk/benchmark_HeLaZ_molix.m | 50 +++++++++++++++++++++++++++ wk/benchmark_linear_1D_entropy_mode.m | 33 ++++++++++++++++++ wk/molix_helaz_benchmark.m | 21 ----------- 3 files changed, 83 insertions(+), 21 deletions(-) create mode 100644 wk/benchmark_HeLaZ_molix.m create mode 100644 wk/benchmark_linear_1D_entropy_mode.m delete mode 100644 wk/molix_helaz_benchmark.m diff --git a/wk/benchmark_HeLaZ_molix.m b/wk/benchmark_HeLaZ_molix.m new file mode 100644 index 00000000..a7394a7e --- /dev/null +++ b/wk/benchmark_HeLaZ_molix.m @@ -0,0 +1,50 @@ +addpath(genpath('../matlab')) % ... add +default_plots_options + +%% KINETIC ELECTRON TEST +% Run HeLaZ +cd .. +system('make'); +cd wk +SIMDIR = '../results/benchmarks/shearless_molix_Kin_e/'; +system(['cd ',SIMDIR,';',' ./../../../bin/helaz 0; cd ../../../wk']) + +% Run molix +% cd ../../molix +% system('make'); +% system('./bin/molix > out.txt'); +% cd ../HeLaZ/wk +% Compare the results with molix at a given time +time_2_plot = 5.0; +[Y_,X_]=molix_plot_phi([SIMDIR,'molix_phi.h5'],time_2_plot); +[ PHI, Ts3D, dt3D] = load_3D_data([SIMDIR,'outputs_00.h5'], 'phi'); +[Pe, Je, Pi, Ji, kx, ky, z] = load_grid_data(filename); + +plot_phi_ballooning; hold on +plot(X_/pi,real(Y_),'ob'); +plot(X_/pi,imag(Y_),'or'); +plot(X_/pi,abs(Y_) ,'ok'); + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% ADIABATIC ELECTRON TEST +% Run HeLaZ +cd .. +system('make'); +cd wk +SIMDIR = '../results/benchmarks/shearless_molix_Adiab_e/'; +system(['cd ',SIMDIR,';',' ./../../../bin/helaz 0; cd ../../../wk']) +% Run molix +% cd ../../molix +% system('make'); +% system('./bin/molix > out.txt'); +% cd ../HeLaZ/wk +% Compare the results with molix at a given time +time_2_plot = 5.0; +[Y_,X_]=molix_plot_phi([SIMDIR,'molix_phi.h5'],time_2_plot); +[ PHI, Ts3D, dt3D] = load_3D_data([SIMDIR,'outputs_00.h5'], 'phi'); +[Pe, Je, Pi, Ji, kx, ky, z] = load_grid_data([SIMDIR,'outputs_00.h5']); + +plot_phi_ballooning; hold on +plot(X_/pi,real(Y_),'ob'); +plot(X_/pi,imag(Y_),'or'); +plot(X_/pi,abs(Y_) ,'ok'); diff --git a/wk/benchmark_linear_1D_entropy_mode.m b/wk/benchmark_linear_1D_entropy_mode.m new file mode 100644 index 00000000..ae422643 --- /dev/null +++ b/wk/benchmark_linear_1D_entropy_mode.m @@ -0,0 +1,33 @@ +addpath(genpath('../matlab')) % ... add +default_plots_options +SIMDIR = '../results/benchmarks/1D_linear_entropy_mode/'; +% Compile HeLaZ +cd .. +system('make'); +cd wk +% Run HeLaZ +system(['cd ',SIMDIR,';',' ./../../../bin/helaz 0; cd ../../../wk']) +%compute growth rate +%% +filename = [SIMDIR,'/outputs_00.h5']; +[ PHI, Ts3D, dt3D] = load_3D_data(filename, 'phi'); +[Pe, Je, Pi, Ji, kx, ky, z] = load_grid_data(filename); +gamma_phi = kx; +for ikx = 2:size(kx) + tend = max(Ts3D(abs(PHI(ikx,1,1,:))~=0)); + tstart = 0.6*tend; + [~,itstart] = min(abs(Ts3D-tstart)); + [~,itend] = min(abs(Ts3D-tend)); + trange = itstart:itend; + % exp fit on phi + X_ = Ts3D(trange); Y_ = squeeze(abs(PHI(ikx,1,1,trange))); + gamma_phi (ikx) = LinearFit_s(X_,Y_); +end + +%% Plot +SCALE = 1;%sqrt(2); +openfig([SIMDIR,'/benchmark_data.fig']); hold on; +plot(kx,gamma_phi,'-x','DisplayName','new results'); +hold on; +legend('show'); + diff --git a/wk/molix_helaz_benchmark.m b/wk/molix_helaz_benchmark.m deleted file mode 100644 index 0863988a..00000000 --- a/wk/molix_helaz_benchmark.m +++ /dev/null @@ -1,21 +0,0 @@ -%% - -cd .. -system('make'); -cd wk - -shearless_linear_fluxtube - - -cd ../../molix -system('make'); -system('./bin/molix'); -cd ../HeLaZ/wk -%% -time_2_plot = 5.0; -[Y_,X_]=molix_plot_phi('../../molix/field.dat.h5',time_2_plot); - -plot_phi_ballooning; hold on -plot(X_/pi,real(Y_),'ob'); -plot(X_/pi,imag(Y_),'or'); -plot(X_/pi,abs(Y_) ,'ok'); \ No newline at end of file -- GitLab