bluemira.radiation_transport.radiation_tools

1-D radiation model inspired by the PROCESS function “plot_radprofile” in plot_proc.py.

Classes

WallDetector

Dataclass for wall detectors.

DetectedRadiation

Detected radiation data

FirstWallRadiationSolver

Calculate the radiation detected at the first wall.

Functions

upstream_temperature(→ float)

Calculate the upstream temperature.

target_temperature(→ float)

Calculate the target as suggested from the 2-point model.

specific_point_temperature(→ float)

Calculate the temperature at a specific point above the x-point.

electron_density_and_temperature_sol_decay(...)

Generic radial exponential decay to be applied from a generic starting point

gaussian_decay(→ numpy.ndarray)

Generic gaussian decay to be applied between two extreme values and for a

exponential_decay(→ numpy.ndarray)

Generic exponential decay to be applied between two extreme values and for a

ion_front_distance(→ float)

Manual definition of ion penetration depth.

calculate_zeff(impurities_content, imp_data_z_ref, ...)

Calculate the effective charge (Z_eff) for the plasma core.

calculate_total_radiated_power(→ float)

Calculate the total radiated power from the radiation map.

radiative_loss_function_values(→ numpy.ndarray)

By interpolation, from reference values, it returns the

radiative_loss_function_plot(→ matplotlib.pyplot.Axes)

Radiative loss function plot for a set of given impurities.

calculate_line_radiation_loss(→ numpy.ndarray)

Calculation of Line radiation losses.

linear_interpolator(...)

Interpolating function calculated over 1D coordinate

interpolated_field_values(→ numpy.ndarray)

Interpolated field values for a given set of points.

grid_interpolator(...)

Interpolated field function obtained for a given grid.

pfr_filter(→ tuple[numpy.ndarray, Ellipsis])

To filter out from the radiation interpolation domain the private flux regions

filtering_in_or_out(...)

To exclude from the calculation a specific region which is

get_impurity_data(, confinement_time_ms, dict[str, ...)

Function getting the PROCESS impurity data

detect_radiation(→ DetectedRadiation)

To sample the wall and detect radiation.

make_wall_detectors(→ list[WallDetector])

To make the detectors on the wall

plot_radiation_loads(radiation_function, ...)

To plot the radiation on the wall as [MW/m^2].

Module Contents

class bluemira.radiation_transport.radiation_tools.WallDetector

Dataclass for wall detectors.

detector_id:

ID number for detector

x_width:

Detector (rectangular) width in x-direction [m] (N.B this value is in detector local coordinates)

y_width:

Detector (rectangular) width in y-direction [m] (N.B this value is in detector local coordinates)

detector_center:

Detector center pont

normal_vector:

Unit vector normal to the detector surface

y_vector:

Detector unit y-vector

detector_id: int
x_width: float
y_width: float
detector_center: raysect.core.Point3D
normal_vector: raysect.core.Vector3D
y_vector: raysect.core.Vector3D
bluemira.radiation_transport.radiation_tools.upstream_temperature(b_pol: float, b_tot: float, lambda_q_near: float, p_sol: float, eq: bluemira.equilibria.equilibrium.Equilibrium, r_sep_mp: float, z_mp: float, k_0: float, firstwall_geom: bluemira.geometry.coordinates.Coordinates, connection_length: float | None = None) float

Calculate the upstream temperature. Knowing the power entering the SOL, and assuming large temperature gradient between upstream and target.

Parameters:
  • b_pol (float) – Poloidal magnetic field at the midplane [T]

  • b_tot (float) – Total magnetic field at the midplane [T]

  • lambda_q_near (float) – Power decay length in the near SOL [m]

  • p_sol (float) – Total power entering the SOL [W]

  • eq (bluemira.equilibria.equilibrium.Equilibrium) – Equilibrium in which to calculate the upstream temperature

  • r_sep_mp (float) – Upstream location radial coordinate [m]

  • z_mp (float) – Upstream location z coordinate [m]

  • k_0 (float) – Material’s conductivity

  • firstwall_geom (bluemira.geometry.coordinates.Coordinates) – First wall geometry

  • connection_length (float | None) – connection length from the midplane to the target

Returns:

upstream temperature. Unit [keV]

Return type:

t_upstream_kev

Notes

C S Pitcher and P C Stangeby, 1997

bluemira.radiation_transport.radiation_tools.target_temperature(p_sol: float, t_u: float, n_u: float, gamma: float, eps_cool: float, f_ion_t: float, b_pol_tar: float, b_pol_u: float, alpha_pol_deg: float, r_u: float, r_tar: float, lambda_q_near: float, b_tot_tar: float) float

Calculate the target as suggested from the 2-point model. It includes hydrogen recycle loss energy.

Parameters:
  • p_sol (float) – Total power entering the SOL [W]

  • t_u (float) – Upstream temperature. Unit [eV]

  • n_u (float) – Electron density at the upstream [1/m^3]

  • gamma (float) – Sheath heat transmission coefficient

  • eps_cool (float) – Electron energy loss [eV]

  • f_ion_t (float) – Hydrogen first ionization [eV]

  • b_pol_tar (float) – Poloidal magnetic field at the target [T]

  • b_pol_u (float) – Poloidal magnetic field at the midplane [T]

  • alpha_pol_deg (float) – Incident angle between separatrix and target plate as poloidal projection [deg]

  • r_u (float) – Upstream location radial coordinate [m]

  • r_tar (float) – strike point radial coordinate [m]

  • lambda_q_near (float) – Power decay length in the near SOL at the midplane [m]

  • b_tot_tar (float) – Total magnetic field at the target [T]

Returns:

target temperature. Unit [eV]

Return type:

t_tar

Notes

P C Stangeby, 2000

bluemira.radiation_transport.radiation_tools.specific_point_temperature(x_p: float, z_p: float, t_u: float, p_sol: float, lambda_q_near: float, eq: bluemira.equilibria.equilibrium.Equilibrium, r_sep_mp: float, z_mp: float, k_0: float, sep_corrector: float, firstwall_geom: bluemira.geometry.coordinates.Coordinates, connection_length: float | None = None, *, lfs=True) float

Calculate the temperature at a specific point above the x-point.

Parameters:
  • x_p (float) – x coordinate of the point of interest [m]

  • z_p (float) – z coordinate of the point of interest [m]

  • t_u (float) – upstream temperature [eV]

  • p_sol (float) – Total power entering the SOL [W]

  • lambda_q_near (float) – Power decay length in the near SOL at the midplane [m]

  • eq (bluemira.equilibria.equilibrium.Equilibrium) – Equilibrium in which to calculate the point temperature

  • r_sep_mp (float) – radial coordinate (i.e. x coordinate on the xz plane) of the x-point [m]

  • z_mp (float) – z coordinate of the x-point [m]

  • k_0 (float) – Material’s conductivity

  • firstwall_geom (bluemira.geometry.coordinates.Coordinates) – first wall geometry

  • connection_length (float | None) – connection length from the midplane to the target

  • lfs – low (toroidal) field side (outer wall side). Default value True. If False it stands for high field side (hfs).

  • sep_corrector (float)

Returns:

point temperature. Unit [eV]

Return type:

t_p

bluemira.radiation_transport.radiation_tools.electron_density_and_temperature_sol_decay(t_sep: float, n_sep: float, lambda_q_near: float, lambda_q_far: float, dx_mp: float, f_exp: float = 1, t_factor_det: float | None = None, n_factor_det: float | None = None) tuple[numpy.ndarray, Ellipsis]

Generic radial exponential decay to be applied from a generic starting point at the separatrix (not only at the mid-plane). The vertical location is dictated by the choice of the flux expansion f_exp. By default f_exp = 1, meaning mid-plane. From the power decay length it calculates the temperature decay length and the density decay length.

Parameters:
  • t_sep (float) – initial temperature value at the separatrix [keV]

  • n_sep (float) – initial density value at the separatrix [1/m^3]

  • lambda_q_near (float) – Power decay length in the near SOL [m]

  • lambda_q_far (float) – Power decay length in the far SOL [m]

  • dx_mp (float) – Gaps between flux tubes at the mp [m]

  • f_exp (float) – flux expansion. Default value=1 referred to the mid-plane

  • t_factor_det (temperature decay length scaling factor in relation) – to the power decay length.

  • n_factor_det (density decay length scaling factor in relation) – to the temperature decay length.

Returns:

  • te_sol – radial decayed temperatures through the SoL. Unit [eV]

  • ne_sol – radial decayed densities through the SoL. unit [1/m^3]

Return type:

tuple[numpy.ndarray, Ellipsis]

Notes

Temperature and density radially decay different than power. At the mid-plane, the decay length relationships are usually assumed to be lambda_q = 0.285*lambda_t and lambda_n = 0.333*lambda_t. In more radiative regions, especially in a detached regime, they may change.

References

[1] Stangeby, P. C. (2000). The Plasma Boundary of Magnetic Fusion Devices.

Institute of Physics Publishing.

[2] Loarte, A., et al. (2007). “Chapter 4: Power and particle control.”

Nuclear Fusion, 47(6), S203.

bluemira.radiation_transport.radiation_tools.gaussian_decay(max_value: float, min_value: float, no_points: float, *, decay: bool = True) numpy.ndarray

Generic gaussian decay to be applied between two extreme values and for a given number of points.

Parameters:
  • max_value (float) – maximum value of the parameters

  • min_value (float) – minimum value of the parameters

  • no_points (float) – number of points through which make the parameter decay

  • decay (bool)

Returns:

decayed parameter

Return type:

dec_param

bluemira.radiation_transport.radiation_tools.exponential_decay(max_value: float, min_value: float, no_points: float, *, decay: bool = False) numpy.ndarray

Generic exponential decay to be applied between two extreme values and for a given number of points.

Parameters:
  • max_value (float) – maximum value of the parameters

  • min_value (float) – minimum value of the parameters

  • no_points (float) – number of points through which make the parameter decay

  • decay (bool) – to define either a decay or increment

Returns:

decayed parameter

Return type:

dec_param

bluemira.radiation_transport.radiation_tools.ion_front_distance(x_strike: float, z_strike: float, eq: bluemira.equilibria.equilibrium.Equilibrium, x_pt_z: float, t_tar: float | None = None, avg_ion_rate: float | None = None, avg_momentum_rate: float | None = None, n_r: float | None = None, rec_ext: float | None = None) float

Manual definition of ion penetration depth. TODO: Find sv_i and sv_m # 4016

Parameters:
  • x_strike (float) – x coordinate of the strike point [m]

  • z_strike (float) – z coordinate of the strike point [m]

  • eq (bluemira.equilibria.equilibrium.Equilibrium) – Equilibrium in which to calculate the x-point temperature

  • x_pt_z (float) – x-point location z coordinate [m]

  • t_tar (float | None) – target temperature [keV]

  • avg_ion_rate (float | None) – average ionization rate

  • avg_momentum_rate (float | None) – average momentum loss rate

  • n_r (float | None) – density at the recycling region entrance [1/m^3]

  • rec_ext (float | None) – recycling region extension (along the field line) from the target [m]

Returns:

z coordinate of the ionization front

Return type:

z_front

bluemira.radiation_transport.radiation_tools.calculate_zeff(impurities_content: numpy.ndarray, imp_data_z_ref: numpy.ndarray, imp_data_t_ref: numpy.ndarray, impurity_symbols: numpy.ndarray, te: numpy.ndarray)

Calculate the effective charge (Z_eff) for the plasma core.

This function computes Z_eff based on the species information and the temperature profile.

Parameters:
  • impurities_content (np.array) – Content of each impurity species in the plasma.

  • imp_data_z_ref (np.array) – Reference effective charge values corresponding to the reference temperatures.

  • imp_data_t_ref (np.array) – Reference temperatures (in keV) for interpolation.

  • impurity_symbols (np.array) – All the impurity species symbols in the plasma.

  • te (np.ndarray) – Electron temperature profile (in keV) at various positions in the plasma.

Returns:

  • zeff (np.ndarray) – Effective charge profile for each plasma position.

  • avg_zeff (float) – Average Z_eff across the plasma.

  • total_fraction (float) – Total fraction of impurities.

  • intermediate_values (dict) – A dictionary containing species fractions, average charge states, and symbols.

bluemira.radiation_transport.radiation_tools.calculate_total_radiated_power(x: numpy.ndarray, z: numpy.ndarray, p_rad: numpy.ndarray) float

Calculate the total radiated power from the radiation map.

Parameters:
  • x (numpy.ndarray) – Array of x-coordinates (in meters) of the radiation map.

  • z (numpy.ndarray) – Array of z-coordinates (in meters) of the radiation map.

  • p_rad (numpy.ndarray) – Array of radiation power density values (in MW/m³) at the corresponding x and z coordinates.

Returns:

P_total – Total radiated power in megawatts (MW).

Return type:

float

bluemira.radiation_transport.radiation_tools.radiative_loss_function_values(te: numpy.ndarray, t_ref: numpy.ndarray, l_ref: numpy.ndarray) numpy.ndarray

By interpolation, from reference values, it returns the radiative power loss values for a given set of electron temperature.

Parameters:
  • te (numpy.ndarray) – electron temperature [keV]

  • t_ref (numpy.ndarray) – temperature reference [eV]

  • l_ref (numpy.ndarray) – radiative power loss reference [Wm^3]

Returns:

interpolated local values of the radiative power loss function [W m^3]

Return type:

numpy.ndarray

bluemira.radiation_transport.radiation_tools.radiative_loss_function_plot(t_ref: numpy.ndarray, lz_val: collections.abc.Iterable[numpy.ndarray], species: collections.abc.Iterable[str]) matplotlib.pyplot.Axes

Radiative loss function plot for a set of given impurities.

Parameters:
  • t_ref (numpy.ndarray) – temperature reference [keV]

  • lz_val (collections.abc.Iterable[numpy.ndarray]) – radiative power loss reference [Wm^3]

  • species (collections.abc.Iterable[str]) – species names

Returns:

The axes object on which radiative loss function is plotted.

Return type:

ax

bluemira.radiation_transport.radiation_tools.calculate_line_radiation_loss(ne: numpy.ndarray, p_loss_f: numpy.ndarray, species_frac: float) numpy.ndarray

Calculation of Line radiation losses. For a given impurity this is the total power lost, per unit volume, by all line-radiation processes INCLUDING Bremsstrahlung.

Parameters:
  • ne (numpy.ndarray) – electron density [1/m^3]

  • p_loss_f (numpy.ndarray) – local values of the radiative power loss function

  • species_frac (float) – fraction of relevant impurity

Returns:

Line radiation losses [MW m^-3]

Return type:

numpy.ndarray

bluemira.radiation_transport.radiation_tools.linear_interpolator(x: numpy.ndarray, z: numpy.ndarray, field: numpy.ndarray) collections.abc.Callable[[numpy.ndarray, numpy.ndarray], numpy.ndarray]

Interpolating function calculated over 1D coordinate arrays and 1D field value array.

Parameters:
  • x (numpy.ndarray) – x coordinates of given points [m]

  • z (numpy.ndarray) – z coordinates of given points [m]

  • field (numpy.ndarray) – set of punctual field values associated to the given points

Returns:

LinearNDInterpolator object

Return type:

interpolated_function

bluemira.radiation_transport.radiation_tools.interpolated_field_values(x: numpy.ndarray, z: numpy.ndarray, linear_interpolator: collections.abc.Callable[[numpy.ndarray, numpy.ndarray], numpy.ndarray]) numpy.ndarray

Interpolated field values for a given set of points.

Parameters:
  • x (numpy.ndarray) – x coordinates of point in which interpolate [m]

  • z (numpy.ndarray) – z coordinates of point in which interpolate [m]

  • linear_interpolator (collections.abc.Callable[[numpy.ndarray, numpy.ndarray], numpy.ndarray]) – LinearNDInterpolator object

Returns:

matrix len(x) x len(z), 2D grid of interpolated field values

Return type:

field_grid

bluemira.radiation_transport.radiation_tools.grid_interpolator(x: numpy.ndarray, z: numpy.ndarray, field_grid: numpy.ndarray) collections.abc.Callable[[numpy.ndarray], numpy.ndarray]

Interpolated field function obtained for a given grid. Needed: length(xx) = m, length(zz) = n, field_grid.shape = n x m.

Parameters:
  • x (np.array) – x coordinates. length(xx)=m [m]

  • z (np.array) – z coordinates. length(xx)=n [m]

  • field_grid (numpy.ndarray) – matrix n x m corresponding field values arranged according to the grid of given points

Returns:

interpolated field function, to be used to calculate the field values for a new set of points or to be provided to a tracing code such as CHERAB

Return type:

interpolated_function

bluemira.radiation_transport.radiation_tools.pfr_filter(separatrix: collections.abc.Iterable[bluemira.geometry.coordinates.Coordinates] | bluemira.geometry.coordinates.Coordinates, x_point_z: float) tuple[numpy.ndarray, Ellipsis]

To filter out from the radiation interpolation domain the private flux regions

Parameters:
Returns:

  • domains_x – x coordinates of pfr domain

  • domains_z – z coordinates of pfr domain

Return type:

tuple[numpy.ndarray, Ellipsis]

bluemira.radiation_transport.radiation_tools.filtering_in_or_out(domain_x: list[float], domain_z: list[float], *, include_points: bool = True) collections.abc.Callable[[collections.abc.Iterable[float]], bool]

To exclude from the calculation a specific region which is either contained or not contained within a given domain

Parameters:
  • domain_x (list[float]) – list of x coordinates defining the domain

  • domain_z (list[float]) – list of x coordinates defining the domain

  • include_points (bool) – whether the points inside or outside the domain must be excluded

Returns:

method which includes or excludes from the domain a given point

Return type:

include

bluemira.radiation_transport.radiation_tools.get_impurity_data(impurities_list: collections.abc.Iterable[str] = ('H', 'He'), confinement_time_ms: float = 0.1) dict[str, dict[str, tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]]]

Function getting the PROCESS impurity data

Parameters:
  • impurities_list (collections.abc.Iterable[str]) – List of impurity dictionaries to get the species data for. Dictionary contains the impurity names (which should be found in the Impurities Enum0, and their fraction in the region of interest.

  • confinement_time_ms (float) – Confinement timescale in the region of interest. Times available to read the data for are: [0.1, 1.0, 10.0, 100.0, 1000.0, np.inf].

Returns:

The dictionary of impurities at the defined time, sorted by species, then sorted by “T_ref” v.s. “L_ref”, where “T_ref” = reference ion temperature [eV], “L_ref” = the loss function value $L_z(n_e, T_e)$ [W m^3].

Return type:

impurity_data

class bluemira.radiation_transport.radiation_tools.DetectedRadiation

Detected radiation data

power_density:

The mean detected power divided by the detector (aka pixel/tile) rectangular area [W/m^2]

power_density_stdev:

Standard deviation of the power density

detected_power:

Average power observed by the detector [W] (N.B. Pixel/tile is revolved around the CYLINDRICAL z-axis)

detected_power_stdev:

Standard deviation of power observed by the detector

detector_area:

Detector area [m^2]

detector_numbers:

Number of wall detectors that have been created

distance:

The running distance from detector centre to detector centre, starting from the first listed detector, moving around the wall in the poloidal direction [m].

total_power:

Sum of the power observed by the detectors [W]

power_density: numpy.typing.NDArray[numpy.float64]
power_density_stdev: numpy.typing.NDArray[numpy.float64]
detected_power: numpy.typing.NDArray[numpy.float64]
detected_power_stdev: numpy.typing.NDArray[numpy.float64]
detector_area: numpy.typing.NDArray[numpy.float64]
detector_numbers: numpy.typing.NDArray[numpy.float64]
distance: numpy.typing.NDArray[numpy.float64]
total_power: float
bluemira.radiation_transport.radiation_tools.detect_radiation(wall_detectors: list[WallDetector], n_samples: int, world: raysect.optical.World, *, verbose: bool = False) DetectedRadiation

To sample the wall and detect radiation.

Parameters:
  • wall_detectors (list[WallDetector]) – List of wall detector dataclasses

  • n_samples (int) – Number of samples to generate per pixel for a Raysect Pixel observer. A Pixel observer samples rays from a hemisphere and rectangular area.

  • world (raysect.optical.World) – Raysect class, tracks all primitives (objects making up the Raysect scene) and observers in the ‘world’.

  • verbose (bool)

Returns:

DetectedRadiation object describing the radiation data.

Return type:

DetectedRadiation

Notes

Each detector tile is rectangular and located on a cylindrical surface. The detected power is the average radiation power that would be intercepted by revolving the tile around the cylindrical z-axis.

i.e. This models a wall detector as representative of a full ring in a cylindrically symmetric system.

For more information on observers please see the Raysect documentation

bluemira.radiation_transport.radiation_tools.make_wall_detectors(wall_r, wall_z, max_wall_len, x_width, *, plot=False) list[WallDetector]

To make the detectors on the wall

Returns:

list of WallDetectors

Return type:

wall_detectors

bluemira.radiation_transport.radiation_tools.plot_radiation_loads(radiation_function, wall_detectors, wall_loads, plot_title, fw_shape)

To plot the radiation on the wall as [MW/m^2].

Parameters:
  • radiation_function – Cherab AxisymmetricMapper created using a function describing radiation source

  • wall_detectors – List of wall detector objects

  • wall_loads – DetectedRadiation object for associated wall_detectors

  • plot_title – Name of the plot

  • fw_shape – First wall coordinates

class bluemira.radiation_transport.radiation_tools.FirstWallRadiationSolver(source_func: collections.abc.Callable, firstwall_shape: bluemira.geometry.coordinates.Coordinates)

Calculate the radiation detected at the first wall.

This class make use of Raysect and Cherab libraries.

  • The resulting data class contains the following information:

  • The power density for each first wall detector [W/m^2] and its associated standard deviation.

  • The power observed for each for each first wall detector [W] and its associated standard deviation.

  • The area of each detector [m^2].

  • The running distance from detector centre to detector centre, starting from the first listed detector, moving around the wall in the poloidal direction [m].

  • The sum of the power observed by the detectors [W]

Parameters:
Returns:

DetectedRadiation object for associated wall detectors

Return type:

wall_loads

rad_source
rad_3d
fw_shape
wall_detectors = None
wall_loads = None
solve(max_wall_len: float = 0.1, x_width: float = 0.01, n_samples: int = 500, ray_stepsize=1.0, *, plot: bool = True, verbose: bool = False) DetectedRadiation

Solve first wall radiation problem.

Parameters:
  • max_wall_len (float) – Maximum wall length

  • x_width (float) – Detector (rectangular) width in x-direction (local coords) Note: y_width is calculated.

  • n_samples (int) – Number of samples to generate per pixel

  • ray_stepsize – cherab radiation function step size

  • plot (bool) – Whether or not to plot and show the radiation on the wall [MW/m^2].

  • verbose (bool) – Whether or not to print and plot additional information, i.e., plot wall detectors and their normal vectors, and print Raysect information (incident power, incident power error, time for render and rays per second).

Returns:

wall_loads – Detected radiation data.

Return type:

DetectedRadiation

plot()

Plot the radiation on the wall [MW/m^2].