Reactivity Curves From Registered Relations¶
This notebook replaces the removed plotting helper with direct calls to the current reactivity relations.
In [ ]:
Copied!
from pathlib import Path
import sys
import matplotlib.pyplot as plt
import numpy as np
root = Path.cwd().resolve()
while root != root.parent and not (root / "src" / "fusdb").is_dir():
root = root.parent
src_path = str(root / "src")
if src_path not in sys.path:
sys.path.insert(0, src_path)
from fusdb.relations.reactions.DD import sigmav_DD_NRL
from fusdb.relations.reactions.DHe3 import sigmav_DHe3_NRL
from fusdb.relations.reactions.DT import sigmav_DT_BoschHale, sigmav_DT_NRL
from fusdb.relations.reactions.TT import sigmav_TT_NRL
from pathlib import Path
import sys
import matplotlib.pyplot as plt
import numpy as np
root = Path.cwd().resolve()
while root != root.parent and not (root / "src" / "fusdb").is_dir():
root = root.parent
src_path = str(root / "src")
if src_path not in sys.path:
sys.path.insert(0, src_path)
from fusdb.relations.reactions.DD import sigmav_DD_NRL
from fusdb.relations.reactions.DHe3 import sigmav_DHe3_NRL
from fusdb.relations.reactions.DT import sigmav_DT_BoschHale, sigmav_DT_NRL
from fusdb.relations.reactions.TT import sigmav_TT_NRL
In [ ]:
Copied!
temperature_keV = np.logspace(0, 2.7, 240)
reactivity_curves = {
"DT NRL": np.array([sigmav_DT_NRL(T_i=value) for value in temperature_keV], dtype=float),
"DT Bosch-Hale": np.array([sigmav_DT_BoschHale(T_i=value) for value in temperature_keV], dtype=float),
"DD NRL": np.array([sigmav_DD_NRL(T_i=value) for value in temperature_keV], dtype=float),
"DHe3 NRL": np.array([sigmav_DHe3_NRL(T_i=value) for value in temperature_keV], dtype=float),
"TT NRL": np.array([sigmav_TT_NRL(T_i=value) for value in temperature_keV], dtype=float),
}
fig, ax = plt.subplots(figsize=(10, 6))
for label, values in reactivity_curves.items():
ax.loglog(temperature_keV, values, linewidth=2, label=label)
ax.set_xlabel("Ion temperature [keV]")
ax.set_ylabel(r"$\langle \sigma v \rangle$ [m$^3$/s]")
ax.set_title("Fusion reactivities from current relation objects")
ax.grid(True, which="both", alpha=0.3)
ax.legend()
plt.show()
temperature_keV = np.logspace(0, 2.7, 240)
reactivity_curves = {
"DT NRL": np.array([sigmav_DT_NRL(T_i=value) for value in temperature_keV], dtype=float),
"DT Bosch-Hale": np.array([sigmav_DT_BoschHale(T_i=value) for value in temperature_keV], dtype=float),
"DD NRL": np.array([sigmav_DD_NRL(T_i=value) for value in temperature_keV], dtype=float),
"DHe3 NRL": np.array([sigmav_DHe3_NRL(T_i=value) for value in temperature_keV], dtype=float),
"TT NRL": np.array([sigmav_TT_NRL(T_i=value) for value in temperature_keV], dtype=float),
}
fig, ax = plt.subplots(figsize=(10, 6))
for label, values in reactivity_curves.items():
ax.loglog(temperature_keV, values, linewidth=2, label=label)
ax.set_xlabel("Ion temperature [keV]")
ax.set_ylabel(r"$\langle \sigma v \rangle$ [m$^3$/s]")
ax.set_title("Fusion reactivities from current relation objects")
ax.grid(True, which="both", alpha=0.3)
ax.legend()
plt.show()
In [ ]:
Copied!
for label, values in reactivity_curves.items():
peak_index = int(np.argmax(values))
print(f"{label}: max={values[peak_index]:.3e} at T_i={temperature_keV[peak_index]:.2f} keV")
for label, values in reactivity_curves.items():
peak_index = int(np.argmax(values))
print(f"{label}: max={values[peak_index]:.3e} at T_i={temperature_keV[peak_index]:.2f} keV")