<jupyter_start><jupyter_text>Reaction Rates<jupyter_code>""" 
Plot the Reaction rates in m^3 s^-1 as a function of
 E, the energy in keV of the incident particle 
 [the first ion of the reaction label]

 Data taken from NRL Formulary 2013.
"""
E, DD, DT, DH = loadtxt('reaction_rates_vs_energy_incident_particle.txt', 
                   skiprows=1, unpack=True)
cm3_2_m3 = 1e-6

fig, ax = plt.subplots(num=1)
ax.loglog(E, cm3_2_m3*DD, E, cm3_2_m3*DT, E, cm3_2_m3*DH, lw=3)

ax.grid(True)
ax.grid(True, which='minor')
ax.set_xlabel('Temperature [keV]', fontsize=16)
ax.set_ylabel(r'Reaction Rates $\left<\sigma v\right>$ [$m^3.s^{-1}$]', fontsize=16)
ax.tick_params(labelsize=14)
ax.set_xlim(min(E), max(E))
ax.legend(('D-D', 'D-T', 'D-He$^3$'), loc='best', fontsize=18)

def kev2deg(kev):
    # 1 eV is 11606 K
    return kev * 1e3 * 11606 

def deg2kev(deg):
    return deg / (1e3 * 11606)

secax = ax.secondary_xaxis('top', functions=(kev2deg, deg2kev))
secax.set_xlabel('Temperature [K]', fontsize=16)
secax.tick_params(labelsize=14)

tight_layout()
savefig('Fusion_Reactivity.png', dpi=150)<jupyter_output><empty_output><jupyter_text>Cross Sections Plot the total cross section in m^2 for various species vs incident energy in keV<jupyter_code>def cross_section(E, A):
    """
    The total cross section in barns (1 barns=1e-24 cm^2) as a function of E, 
    the energy in keV of the incident particle.
    
    Formula from NRL Formulary 2013.
    """
    sigma_T = (A[4]+((A[3]-A[2]*E)**2+1)**(-1) * A[1])/(E*(exp(A[0]/sqrt(E))-1))
    return(sigma_T)
    
A_DD_a = [46.097, 372, 4.36e-4, 1.220, 0]
A_DD_b = [47.88, 482, 3.08e-4, 1.177, 0]
A_DT   = [45.95, 50200, 1.368e-2, 1.076, 409]
A_DHe3 = [89.27, 25900, 3.98e-3, 1.297, 647]
A_TT   = [38.39, 448, 1.02e-3, 2.09, 0]
A_THe3 = [123.1, 11250, 0, 0, 0]
E = logspace(0, 3, 501)
barns2SI = 1e-24 * 1e-4 # in m^2
sigma_DD = barns2SI*(cross_section(E, A_DD_a) + cross_section(E, A_DD_b))
sigma_DT = barns2SI*cross_section(E, A_DT)
sigma_DHe3 = barns2SI*cross_section(E, A_DHe3)
figure(num=2)
loglog(E, sigma_DD, E, sigma_DT, E, sigma_DHe3, lw=3)
grid()
xlabel('Deuteron Energy [keV]', fontsize=16)
ylabel('Cross-section $\sigma$ [$m^2$]', fontsize=16)
legend(('D-D', 'D-T', 'D-He$^3$'), loc='best', fontsize=18)
ylim([1e-32, 2e-27])
xlim(min(E), max(E))
xticks(fontsize=14)
yticks(fontsize=14)
tight_layout()
savefig('Fusion_cross-section.png', dpi=150)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1800656275635767, 'fraction_numerical': 0.09351927809680066, 'mean_word_length': 4.807142857142857, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '148560', 'license': 'MIT', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1090, 'n_words': 238, 'path': 'notebooks/Fusion_Basics/Fusion Cross Sections and Reaction Rates.ipynb', 'repo_name': 'Hash--/documents', 'size': '2438'}