Skip to content

Commit

Permalink
Updated plotting scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
savithru-j committed Nov 8, 2023
1 parent 7944a70 commit a8a6a91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions scripts/comparison_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
for mode in range(0,2):
# cpp_data = np.genfromtxt('../build/release/intensity_mode' + str(mode) + '_rk4_tderivorder2_nz3e5_gpu.txt', delimiter=',');
# cpp_data = np.genfromtxt('../build/release/intensity_mode' + str(mode) + '.txt', delimiter=',');
cpp_data = np.genfromtxt('solutions/intensity_mode' + str(mode) + '_kerr_noSS_tderivorder2_nz6e5.txt', delimiter=',');
print(cpp_data.shape)
cpp_data = np.genfromtxt('solutions/intensity_mode' + str(mode) + '_kerr_noSS_tderivorder4_nz3e5_nt8193_cpu.txt', delimiter=',');
print("cpp_data shape:", cpp_data.shape)
Nt_cpp = cpp_data.shape[1];
abs_u_cpp = np.transpose(cpp_data[zstep_cpp,:]);
intensity_db_cpp = np.maximum(20*np.log10(abs_u_cpp), -50);
print(abs_u_cpp.shape)
Expand All @@ -35,12 +36,12 @@

abs_u_mpa = np.abs(u_mpa);
intensity_db_mpa = np.maximum(20*np.log10(abs_u_mpa), -50);
Nt = u_mpa.shape[0];
Nt_mpa = u_mpa.shape[0];

tvec = np.linspace(-40.0, 40.0, Nt);
print(tvec[1::].shape)
tvec_mpa = np.linspace(-40.0, 40.0, Nt_mpa);
print(tvec_mpa[1::].shape)

tvec2 = np.linspace(-40.0, 40.0, Nt+1);
tvec_cpp = np.linspace(-40.0, 40.0, Nt_cpp);
# print(tvec[-1])
# tvec2 = np.concatenate([tvec[1::].reshape(Nt-1,1),tvec[-1].reshape(1,1)]);
# print(tvec2.shape)
Expand All @@ -52,8 +53,8 @@
# print('max_diff: ', np.max(np.abs(abs_u_cpp - abs_u_mpa)))

plt.subplot(1, 2, mode + 1);
# plt.plot(tvec, abs_u_mpa, 'b-', tvec2, abs_u_cpp, 'r-');
plt.plot(tvec, intensity_db_mpa, 'b-', tvec2, intensity_db_cpp, 'r-');
# plt.plot(tvec_mpa, abs_u_mpa, 'b-', tvec_cpp, abs_u_cpp, 'r-');
plt.plot(tvec_mpa, intensity_db_mpa, 'b-', tvec_cpp, intensity_db_cpp, 'r-');
plt.legend(['MPA','Finite difference with RK4'], loc='upper left')
plt.xlabel('Time [ps]')
plt.ylabel('Intensity (dB)')
Expand Down
2 changes: 1 addition & 1 deletion src/ode/MultimodeNLSE.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class MultimodeNLSE : public ODE<T>
const auto beta2p = beta_mat_(2,p);
const auto beta3p = beta_mat_(3,p);
const auto beta4p = beta_mat_(4,p);
ComputeTimeDerivativesOrder2(p, sol, sol_tderiv_);
ComputeTimeDerivativesOrder4(p, sol, sol_tderiv_);

#pragma omp for
for (int i = 0; i < num_time_points_; ++i)
Expand Down

0 comments on commit a8a6a91

Please sign in to comment.