Skip to content

impurity_radiation_variables

Module containing variables for the impurity radiation models

N_IMPURITIY_LOSS_FUNCTION_POINTS = 600 module-attribute

Number of points in the impurity loss function (L_z) tables

N_ION_SPECIES = len(IonSpecies) module-attribute

Number of ion species in impurity radiation model

CREATE_DICTS_FROM_DATACLASS = ImpurityRadiationData module-attribute

IonSpecies

Bases: IntEnum

Enumeration of ion species for impurity radiation model

Source code in process/data_structure/impurity_radiation_variables.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@unique
class IonSpecies(IntEnum):
    """Enumeration of ion species for impurity radiation model"""

    HYDROGEN = (0, 1, "H_", constants.M_PROTIUM_AMU, "hydrogen")
    HELIUM = (1, 2, "He", constants.M_HELIUM_AMU, "helium")
    BERYLLIUM = (2, 4, "Be", constants.M_BERYLLIUM_AMU, "beryllium")
    CARBON = (3, 6, "C_", constants.M_CARBON_AMU, "carbon")
    NITROGEN = (4, 7, "N_", constants.M_NITROGEN_AMU, "nitrogen")
    OXYGEN = (5, 8, "O_", constants.M_OXYGEN_AMU, "oxygen")
    NEON = (6, 10, "Ne", constants.M_NEON_AMU, "neon")
    SILICON = (7, 14, "Si", constants.M_SILICON_AMU, "silicon")
    ARGON = (8, 18, "Ar", constants.M_ARGON_AMU, "argon")
    IRON = (9, 26, "Fe", constants.M_IRON_AMU, "iron")
    NICKEL = (10, 28, "Ni", constants.M_NICKEL_AMU, "nickel")
    KRYPTON = (11, 36, "Kr", constants.M_KRYPTON_AMU, "krypton")
    XENON = (12, 54, "Xe", constants.M_XENON_AMU, "xenon")
    TUNGSTEN = (13, 74, "W_", constants.M_TUNGSTEN_AMU, "tungsten")

    def __new__(
        cls,
        value: int,
        full_ion_charge: int,
        label: str,
        mass_amu: float,
        full_name: str,
    ):
        """Create a new instance of IonSpecies"""
        obj = int.__new__(cls, value)
        obj._value_ = value
        obj._full_ion_charge_ = full_ion_charge
        obj._label_ = label
        obj._mass_amu_ = mass_amu
        obj._full_name_ = full_name
        return obj

    @DynamicClassAttribute
    def index(self) -> int:
        """The index of this ion species."""
        return self.value

    @DynamicClassAttribute
    def full_ion_charge(self):
        """The full ion charge for this ion species."""
        return self._full_ion_charge_

    @DynamicClassAttribute
    def label(self):
        """The label for this ion species."""
        return self._label_

    @DynamicClassAttribute
    def mass_amu(self):
        """The atomic mass of this ion species in Atomic Mass Units (amu)."""
        return self._mass_amu_

    @DynamicClassAttribute
    def full_name(self):
        """The full name of this ion species."""
        return self._full_name_

    @DynamicClassAttribute
    def symbol(self):
        """The symbol of this ion species."""
        return self._label_.replace("_", "")

    @DynamicClassAttribute
    def is_impurity(self) -> bool:
        """Whether this ion species is an impurity."""
        return self not in {IonSpecies.HYDROGEN, IonSpecies.HELIUM}

HYDROGEN = (0, 1, 'H_', constants.M_PROTIUM_AMU, 'hydrogen') class-attribute instance-attribute

HELIUM = (1, 2, 'He', constants.M_HELIUM_AMU, 'helium') class-attribute instance-attribute

BERYLLIUM = (2, 4, 'Be', constants.M_BERYLLIUM_AMU, 'beryllium') class-attribute instance-attribute

CARBON = (3, 6, 'C_', constants.M_CARBON_AMU, 'carbon') class-attribute instance-attribute

NITROGEN = (4, 7, 'N_', constants.M_NITROGEN_AMU, 'nitrogen') class-attribute instance-attribute

OXYGEN = (5, 8, 'O_', constants.M_OXYGEN_AMU, 'oxygen') class-attribute instance-attribute

NEON = (6, 10, 'Ne', constants.M_NEON_AMU, 'neon') class-attribute instance-attribute

SILICON = (7, 14, 'Si', constants.M_SILICON_AMU, 'silicon') class-attribute instance-attribute

ARGON = (8, 18, 'Ar', constants.M_ARGON_AMU, 'argon') class-attribute instance-attribute

IRON = (9, 26, 'Fe', constants.M_IRON_AMU, 'iron') class-attribute instance-attribute

NICKEL = (10, 28, 'Ni', constants.M_NICKEL_AMU, 'nickel') class-attribute instance-attribute

KRYPTON = (11, 36, 'Kr', constants.M_KRYPTON_AMU, 'krypton') class-attribute instance-attribute

XENON = (12, 54, 'Xe', constants.M_XENON_AMU, 'xenon') class-attribute instance-attribute

TUNGSTEN = (13, 74, 'W_', constants.M_TUNGSTEN_AMU, 'tungsten') class-attribute instance-attribute

index()

The index of this ion species.

Source code in process/data_structure/impurity_radiation_variables.py
51
52
53
54
@DynamicClassAttribute
def index(self) -> int:
    """The index of this ion species."""
    return self.value

full_ion_charge()

The full ion charge for this ion species.

Source code in process/data_structure/impurity_radiation_variables.py
56
57
58
59
@DynamicClassAttribute
def full_ion_charge(self):
    """The full ion charge for this ion species."""
    return self._full_ion_charge_

label()

The label for this ion species.

Source code in process/data_structure/impurity_radiation_variables.py
61
62
63
64
@DynamicClassAttribute
def label(self):
    """The label for this ion species."""
    return self._label_

mass_amu()

The atomic mass of this ion species in Atomic Mass Units (amu).

Source code in process/data_structure/impurity_radiation_variables.py
66
67
68
69
@DynamicClassAttribute
def mass_amu(self):
    """The atomic mass of this ion species in Atomic Mass Units (amu)."""
    return self._mass_amu_

full_name()

The full name of this ion species.

Source code in process/data_structure/impurity_radiation_variables.py
71
72
73
74
@DynamicClassAttribute
def full_name(self):
    """The full name of this ion species."""
    return self._full_name_

symbol()

The symbol of this ion species.

Source code in process/data_structure/impurity_radiation_variables.py
76
77
78
79
@DynamicClassAttribute
def symbol(self):
    """The symbol of this ion species."""
    return self._label_.replace("_", "")

is_impurity()

Whether this ion species is an impurity.

Source code in process/data_structure/impurity_radiation_variables.py
81
82
83
84
@DynamicClassAttribute
def is_impurity(self) -> bool:
    """Whether this ion species is an impurity."""
    return self not in {IonSpecies.HYDROGEN, IonSpecies.HELIUM}

ImpurityRadiationData dataclass

Dataclass holding impurity radiation variables

Source code in process/data_structure/impurity_radiation_variables.py
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
@dataclass(slots=True)
class ImpurityRadiationData:
    """Dataclass holding impurity radiation variables"""

    radius_plasma_core_norm: float = 0.6
    """Normalised radius defining the 'core' region"""

    f_p_plasma_core_rad_reduction: float = 1.0
    """Fraction of radiation from 'core' region"""

    f_nd_impurity_electrons: list[float] = field(
        default_factory=lambda: np.array([
            1.0,
            0.1,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
        ])
    )

    n_charge_impurity_profile: list[float] = field(
        default_factory=lambda: np.zeros((
            N_ION_SPECIES,
            N_IMPURITIY_LOSS_FUNCTION_POINTS,
        ))
    )
    """charge profile of impurities"""

    impurity_arr_len_tab: list[int] = field(
        default_factory=lambda: np.full(N_ION_SPECIES, 0)
    )

    temp_impurity_keV_array: list[float] = field(
        default_factory=lambda: np.zeros((
            N_ION_SPECIES,
            N_IMPURITIY_LOSS_FUNCTION_POINTS,
        ))
    )
    """2D array of impurity temperatures in kilo-electronvolts (keV)"""

    pden_impurity_lz_nd_temp_array: list[float] = field(
        default_factory=lambda: np.zeros((
            N_ION_SPECIES,
            N_IMPURITIY_LOSS_FUNCTION_POINTS,
        ))
    )

    impurity_arr_zav: list[float] = field(
        default_factory=lambda: np.zeros((
            N_ION_SPECIES,
            N_IMPURITIY_LOSS_FUNCTION_POINTS,
        ))
    )

radius_plasma_core_norm = 0.6 class-attribute instance-attribute

Normalised radius defining the 'core' region

f_p_plasma_core_rad_reduction = 1.0 class-attribute instance-attribute

Fraction of radiation from 'core' region

f_nd_impurity_electrons = field(default_factory=lambda: np.array([1.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])) class-attribute instance-attribute

n_charge_impurity_profile = field(default_factory=lambda: np.zeros((N_ION_SPECIES, N_IMPURITIY_LOSS_FUNCTION_POINTS))) class-attribute instance-attribute

charge profile of impurities

impurity_arr_len_tab = field(default_factory=lambda: np.full(N_ION_SPECIES, 0)) class-attribute instance-attribute

temp_impurity_keV_array = field(default_factory=lambda: np.zeros((N_ION_SPECIES, N_IMPURITIY_LOSS_FUNCTION_POINTS))) class-attribute instance-attribute

2D array of impurity temperatures in kilo-electronvolts (keV)

pden_impurity_lz_nd_temp_array = field(default_factory=lambda: np.zeros((N_ION_SPECIES, N_IMPURITIY_LOSS_FUNCTION_POINTS))) class-attribute instance-attribute

impurity_arr_zav = field(default_factory=lambda: np.zeros((N_ION_SPECIES, N_IMPURITIY_LOSS_FUNCTION_POINTS))) class-attribute instance-attribute