Ejemplo n.º 1
0
print('Conductivity from RTA (W/m-K): %.3f' %
      (np.mean(np.diag(rta_cond_matrix))))
print(rta_cond_matrix)

# Define the base folder to contain plots
# 'base_folder':name of the base folder
folder = get_folder_from_label(phonons, base_folder='plots')
if not os.path.exists(folder):
    os.makedirs(folder)
# Define a boolean flag to specify if figure window pops during simulation
is_show_fig = False

# Plot cumulative functions for conductivity
frequency = phonons.frequency.flatten(order='C')
rta_full_cond = Conductivity(phonons=phonons, method='rta').conductivity
rta_cumulative_cond = plotter.cumulative_cond_cal(frequency, rta_full_cond,
                                                  phonons.n_phonons)
inv_full_cond = Conductivity(phonons=phonons, method='inverse').conductivity
inv_cumulative_cond = plotter.cumulative_cond_cal(frequency, inv_full_cond,
                                                  phonons.n_phonons)

plt.figure()
plt.plot(frequency[3:],
         rta_cumulative_cond[3:],
         'r.',
         label=r'$\kappa_{cum,RTA}$')
plt.plot(frequency[3:],
         inv_cumulative_cond[3:],
         'k.',
         label=r'$\kappa_{cum,inverse}$')
plt.xlabel(r'frequency($THz$)', fontsize=16)
plt.ylabel(r'$\kappa_{cum}(W/m/K)$', fontsize=16)
# 'band_width': phonon bandwdith (THz) computed from diagonal elements

frequency = phonons.frequency.flatten(order='C')
diffusivity = qhgk_cond.diffusivity.flatten(order='C')

plt.figure()
plt.scatter(frequency[3:], diffusivity[3:], s=5)
plt.xlabel("$\\nu$ (THz)", fontsize=16)
plt.ylabel("$D (mm/s)$", fontsize=16)
plt.xlim([0, 25])
plt.savefig(folder + '/diffusivity_vs_freq.png', dpi=300)
if not is_show_fig:
    plt.close()
else:
    plt.show()

# Plot cumulative conductivity from QHGK methods
qhgk_full_cond = Conductivity(phonons=phonons, method='qhgk').conductivity
qhgk_cumulative_cond = plotter.cumulative_cond_cal(frequency, qhgk_full_cond,
                                                   phonons.n_phonons)
plt.figure()
plt.plot(frequency, qhgk_cumulative_cond, '.')
plt.xlabel(r'frequency($THz$)', fontsize=16)
plt.ylabel(r'$\kappa_{cum,QHGK}(W/m/K)$', fontsize=16)
plt.xlim([0, 20])
plt.savefig(folder + '/qhgk_cum_cond_vs_freq.png', dpi=300)
if not is_show_fig:
    plt.close()
else:
    plt.show()