bluemira.equilibria.find_legs
Class and Methods for separatrix legs.
Classes
Class for use with LegFlux. |
|
Class for use with LegFlux. |
|
Class for those pesky separatrix legs. |
|
Class for use with calculate_connection_length function. |
Functions
|
Calculates the length of all the divertor legs in a dictionary. |
|
|
|
|
|
|
|
Extracts leg/s from given flux line and return as sorted list. |
|
|
|
Convert a upper or lower pair of sorted legs into a dictionary. |
|
Extract legs from a flux surface using a chosen intersection point. |
|
Extract legs from a flux surface using |
|
Calculate the parallel connection length from a starting point to a flux-intercepting |
Module Contents
- class bluemira.equilibria.find_legs.NumNull(*args, **kwds)
Bases:
enum.EnumClass for use with LegFlux.
- DN
Double Null
- SN
Single Null
- class bluemira.equilibria.find_legs.SortSplit(*args, **kwds)
Bases:
enum.EnumClass for use with LegFlux.
- X
Split the flux in x-direction
- Z
Split the flux in z-direction
- class bluemira.equilibria.find_legs.LegFlux(eq: bluemira.equilibria.equilibrium.Equilibrium, psi_n_tol: float = 1e-06, delta_start: float = 0.01, rtol: float = 0.001)
Class for those pesky separatrix legs.
- Parameters:
eq (bluemira.equilibria.equilibrium.Equilibrium) – Input Equilibrium
psi_n_tol (float) – The normalised psi tolerance to use
delta_start (float) – Search range value for finding LCFS. Will search for the transition from a “closed” to “open” flux surface for normalised flux values between 1 - delta_start and 1 + delta_start.
rtol (float) – Relative tolerance used for finding configuration of separatrix split for double null
- eq
- o_point
- x_points
- rtol = 0.001
- x_range_lcfs
- delta
- delta_offsets
- dx_offsets = None
- which_legs()
Determine how to find and sort legs. For a double null this function: - sorts the x-points by lower then upper - keeps the separatrix list sorted by longest then shortest
- Returns:
n_null – Weather it is single (SN) or double null (DN) Configuration
sort_split – How the separatrix has been split. Z - split into Upper and Lower X - split into Inner and Outer
- get_leg_offsets(leg_dict)
Expands the leg list if user requires offset flux surfaces.
- get_legs(n_layers: int = 1, dx_off: float = 0.0, delta: float | None = None, delta_offsets: float | None = None)
Get separatrix legs.
- Parameters:
n_layers (int) – Number of flux surfaces to extract for each leg
dx_off (float) – Total span in radial space of the flux surfaces to extract
delta (float | None) – intersection point x value +- delta is used to find starting point of leg flux see ‘_extract_leg’.
delta_offsets (float | None) – intersection point x value +- delta_offsets is used to find starting point of offsets leg flux see ‘_extract_offsets’.
- Returns:
Dictionary of separatrix legs (lists of coordinates), with keys: - lower_inner - lower_outer - upper_inner - upper_outer
- Return type:
leg_dict
- Raises:
EquilibriaError – if a strange number of legs would be found for an X-point:
Notes
Will return two legs in the case of a single null (an upper or lower pair). Will return four legs in the case of a double null.
We can’t rely on the X-point being contained within the two legs, due to interpolation and local minimum finding tolerances.
- bluemira.equilibria.find_legs.get_legs_length_and_angle(eq: bluemira.equilibria.equilibrium.Equilibrium, leg_dict: dict[str, numpy.typing.NDArray[numpy.float64] | None], plasma_facing_boundary: bluemira.equilibria.equilibrium.Grid | bluemira.geometry.coordinates.Coordinates | None = None)
Calculates the length of all the divertor legs in a dictionary.
- Returns:
leg length dictionary for a given leg
the angle dictionary for a given leg
- Parameters:
leg_dict (dict[str, numpy.typing.NDArray[numpy.float64] | None])
plasma_facing_boundary (bluemira.equilibria.equilibrium.Grid | bluemira.geometry.coordinates.Coordinates | None)
- bluemira.equilibria.find_legs.get_single_null_legs(separatrix, delta, o_point, x_points, imin=None)
- Returns:
The legs from a single null separatrix as a dictionary.
- bluemira.equilibria.find_legs.get_legs_double_null_xsplit(separatrix, delta, x_points, o_point)
- Returns:
The legs from a double null separatrix, split in x-direction, as a dictionary.
- bluemira.equilibria.find_legs.get_legs_double_null_zsplit(separatrix, delta, x_points, o_point, x_range_lcfs)
- Returns:
The legs from a double null separatrix, split in z-direction, as a dictionary.
- bluemira.equilibria.find_legs.get_leg_list(leg_pair, delta, o_p, x_p=None, imin=None)
Extracts leg/s from given flux line and return as sorted list. Legs are sorted by inner then outer.
- Returns:
the legs sort by in and out
- Raises:
BluemiraError – if x_p and imin are both None
- bluemira.equilibria.find_legs._extract_offsets(eq, ref_leg, direction, o_p, dx_offsets, delta_offsets) list
- Returns:
Flux surfaces offset from separatrix leg
- Return type:
list
- bluemira.equilibria.find_legs.add_pair_to_dict(sorted_legs, x_p, o_p)
Convert a upper or lower pair of sorted legs into a dictionary.
- bluemira.equilibria.find_legs._extract_leg(flux_line: bluemira.geometry.coordinates.Coordinates, x_cut: float, z_cut: float, delta_x: float, o_point_z: float)
Extract legs from a flux surface using a chosen intersection point.
- Parameters:
flux_line (bluemira.geometry.coordinates.Coordinates) – Coordinates of a flux surface
x_cut (float) – a point on the horizontal line (radial_line) that intersects the flux surface, below beyond which the flux surface becomes the legs
z_cut (float) – a point on the horizontal line (radial_line) that intersects the flux surface, below beyond which the flux surface becomes the legs
delta_x (float) – the width of the radial_line (used for cutting)
o_point_z (float) – the approximate height of the o-point (center of the plasma). Used to determine whether the leg being processed in a loop is a top or button of a double-null divertor tokamak.
- Returns:
A list of the flux legs
- bluemira.equilibria.find_legs._extract_leg_using_index_value(flux_line: bluemira.geometry.coordinates.Coordinates, i_cut: float)
Extract legs from a flux surface using an intersection point chosen by index value.
- Returns:
The flux legs
- Parameters:
flux_line (bluemira.geometry.coordinates.Coordinates)
i_cut (float)
- class bluemira.equilibria.find_legs.CalcMethod(*args, **kwds)
Bases:
enum.EnumClass for use with calculate_connection_length function. User can choose how the connection length is calculated
- FIELD_LINE_TRACER
- FLUX_SURFACE_GEOMETRY
- bluemira.equilibria.find_legs.calculate_connection_length(eq: bluemira.equilibria.equilibrium.Equilibrium, div_target_start_point: bluemira.geometry.coordinates.Coordinates | None = None, first_wall: bluemira.geometry.coordinates.Coordinates | None = None, div_norm_psi: float | None = None, forward: bool = True, psi_n_tol: float = 1e-06, delta_start: float = 0.01, rtol: float = 0.1, n_turns_max: int = 50, n_points: int = 1000, calculation_method: str = 'flux_surface_geometry')
Calculate the parallel connection length from a starting point to a flux-intercepting surface using either flux surface geometry or a field line tracer.
User can choose an xz point or a normalised psi value to select a flux surface of interest - please NOTE, an input div_norm_psi will override an input div_target_start_point if both are entered.
If no starting point is selected then use the separatrix at the Outboard Midplane.
- Returns:
The connection length
- Raises:
BluemiraError – If an invalid option calculation_method is selected. If an invalid div_norm_psi value is entered. If no target is provided for FLT calculation_method - this is because the flux interception point found is not accurate enough to be used on a separatrix automatically found by bluemira (n.b., the FLT can not distinguish between open and closed flux).
- Parameters:
div_target_start_point (bluemira.geometry.coordinates.Coordinates | None)
first_wall (bluemira.geometry.coordinates.Coordinates | None)
div_norm_psi (float | None)
forward (bool)
psi_n_tol (float)
delta_start (float)
rtol (float)
n_turns_max (int)
n_points (int)
calculation_method (str)