Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
"""Plotting script for the total impurity radiation loss function (L_z) profiles."""

from importlib import resources
from pathlib import Path

import matplotlib.pyplot as plt
import numpy as np

from process.core.io.plot.summary import read_imprad_data


def plot_line_brem_loss_function_profile(
axis: plt.Axes,
impp: str,
):
"""Function to plot Line and Bremsstrahlung loss function (L_z) profile.

Parameters
----------
axis : plt.Axes
axis object to add plot to
impp : str
impurity path

"""
# read in the impurity data
imp_data = read_imprad_data(_skiprows=2, data_path=impp)

impurity_labels = [
"H",
"He",
"Be",
"C",
"N",
"O",
"Ne",
"Si",
"Ar",
"Fe",
"Ni",
"Kr",
"Xe",
"W",
]

line_styles = [
"-",
"--",
"-.",
":",
(0, (5, 1)),
(0, (3, 1, 1, 1)),
(0, (1, 1)),
]

for index, (label, raw_species_data) in enumerate(
zip(impurity_labels, imp_data, strict=True)
):
species_data = np.asarray(raw_species_data)
axis.plot(
species_data[:, 0],
species_data[:, 1],
label=label,
linestyle=line_styles[index % len(line_styles)],
)

axis.legend(loc="best", ncol=4)
axis.minorticks_on()

axis.set_xlabel(r"$T_e$ [eV]")
axis.set_ylabel(r"$L_z$ $[\mathrm{W}\mathrm{m}^3]$")
axis.set_title("Line & Bremsstrahlung Loss Function ($L_z$) vs Temperature")
axis.set_xlim([
min(np.asarray(species_data)[:, 0].min() for species_data in imp_data),
max(np.asarray(species_data)[:, 0].max() for species_data in imp_data),
])
axis.set_xscale("log")
axis.set_yscale("log")
axis.minorticks_on()
axis.xaxis.grid(True, which="both", alpha=0.2)
axis.yaxis.grid(True, which="both", alpha=0.2)
plt.savefig("adas_radiation.png", dpi=300, bbox_inches="tight")


if __name__ == "__main__":
with resources.path(
"process.data.lz_non_corona_14_elements", "Ar_lz_tau.dat"
) as imp_path:
data_folder = str(imp_path.parent) + "/"

if Path(data_folder).is_dir():
fig, ax = plt.subplots(figsize=(8, 6))
plot_line_brem_loss_function_profile(ax, impp=data_folder)
else:
print(
"\033[91m Warning : Impossible to recover impurity data, try running the "
"macro in the main/utility folder"
)
print(" -> No impurity plot done\033[0m")
Binary file modified documentation/source/images/adas_radiation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions documentation/source/physics-models/plasma_radiation.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ These coefficients utilize the generalized collisional-radiative approach [^3] f
For $\text{Ni}$, the data is based on [^4], for $\text{Fe}$ it is derived from [^5]; and for $\text{W,}$ the data is obtained from [^6].
The $\text{Ni}$ and $\text{Fe}$ rates incorporate a density dependence as described in [^7]. For $\text{Kr}$ and $\text{Xe}$, data is taken from the ADAS baseline.

The computed loss functions exhibit a weak dependence on density but are evaluated at a fixed electron density of $10^{19} \text{m}^{-3}$.
The computed loss functions exhibit a weak dependence on density but are evaluated at a fixed electron density of $10^{20} \text{m}^{-3}$.
This differs from strict coronal equilibrium, which assumes density independence.
In practice, non-local effects arising from density and temperature gradients are significant but are not considered here.
The loss functions account for Bremsstrahlung, line radiation, and recombination radiation, represented by:
Expand All @@ -32,19 +32,21 @@ $$
where $P_i$ is the radiation per unit volume (excluding synchrotron radiation),
$L_Z (Z_i, T)$ is the loss function for ion species $i$ at temperature $T$, and $n_i$ is the density of ion species $i$.

The source data comprises of 200 separate data points with a fitted temperature range of $1 \ \text{eV}$ tp $40 \ \text{keV}$. The fitted radiation profiles for each species against temperature can be found in the figure below.
The source data comprises of 600 separate data points with a fitted temperature range of $0.25 \ \text{eV}$ tp $500 \ \text{keV}$. The fitted radiation profiles for each species against temperature can be found in the figure below.




<figure markdown>
![ADAS Radiation](../images/adas_radiation.png){ width = "100"}
<figcaption>Figure 1: Radiation loss functions as a function of temperature, at 10^19 electrons m^−3.
<figcaption>Figure 1: Radiation loss functions as a function of temperature, at 10^20 electrons m^−3.
The lowest line is H, with the other lines in the order listed. The dashed lines show
the bremsstrahlung calculated using a separate method.</figcaption>
</figure>

For the regime above $40 \ \text{keV}$ which can be seen by the dashed lines in Figure 1 above, the radiation is assumed to be Bremsstrahlung dominated so the values are extrapolated via a power law.
!!! warning "Extrapolated ranges"

For the regime above $40 \ \text{keV}$, the radiation is assumed to be Bremsstrahlung dominated so the values are extrapolated via a power law.


!!! note "Location of impurities"
Expand Down
Loading
Loading