bluemira.radiation_transport.neutronics.make_pre_cell

Make pre-cells using bluemira wires.

Attributes

CCW_90

CW_90

Classes

PreCell

A pre-cell is the BluemiraWire outlining the reactor cross-section

PreCellArray

A list of pre-cells materials

DivertorPreCell

An intermediate class between the bluemira wire and the final csg product.

DivertorPreCellArray

An array of Divertor pre-cells

Functions

ratio_of_distances(→ numpy.typing.NDArray[numpy.float64])

Find how close a point is to line 1 and line 2, and then express that ratio as a

find_equidistant_point(...)

Find the two (or 0) points on a 2D plane that are equidistant to each other.

pick_higher_point(→ numpy.typing.NDArray[numpy.float64])

Pick the point that, when projected onto vector, gives a higher value.

calculate_new_circle(...)

Calculate how far does the new circle get shifted.

Module Contents

bluemira.radiation_transport.neutronics.make_pre_cell.CCW_90
bluemira.radiation_transport.neutronics.make_pre_cell.CW_90
bluemira.radiation_transport.neutronics.make_pre_cell.ratio_of_distances(point_of_interest: numpy.typing.NDArray[numpy.float64], anchor1: numpy.typing.NDArray[numpy.float64], normal1: numpy.typing.NDArray[numpy.float64], anchor2: numpy.typing.NDArray[numpy.float64], normal2: numpy.typing.NDArray[numpy.float64]) numpy.typing.NDArray[numpy.float64]

Find how close a point is to line 1 and line 2, and then express that ratio as a tuple of floats that sums up to unit. Each line is given by the user by specifying any point on that line, and a direction NORMAL to that line. The point_of_interest must lie on the positive side of the line.

Parameters:
  • point_of_interest (numpy.typing.NDArray[numpy.float64]) – point to which we want to calculate the ratio of distances.

  • anchor1 (numpy.typing.NDArray[numpy.float64]) – Any point on line 1 and line 2 respectively.

  • anchor2 (numpy.typing.NDArray[numpy.float64]) – Any point on line 1 and line 2 respectively.

  • normal1 (numpy.typing.NDArray[numpy.float64]) – The positive distance direction of line 1 and line 2 respectively.

  • normal2 (numpy.typing.NDArray[numpy.float64]) – The positive distance direction of line 1 and line 2 respectively.

Returns:

ratio of distances. Sum of these two numbers should yield unity (1.0).

Return type:

dist_to_1, dist_to_2

Raises:

GeometryError – distance not on positive side of line

bluemira.radiation_transport.neutronics.make_pre_cell.find_equidistant_point(point1: numpy.typing.NDArray[numpy.float64], point2: numpy.typing.NDArray[numpy.float64], distance: float) tuple[numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.float64]]

Find the two (or 0) points on a 2D plane that are equidistant to each other.

Parameters:
  • point1 (numpy.typing.NDArray[numpy.float64]) – 2D points, each with shape (2,)

  • point2 (numpy.typing.NDArray[numpy.float64]) – 2D points, each with shape (2,)

  • distance (float) – the distance that both points must obey by.

Returns:

The two intersection points of circle1 and circle2.

Return type:

intersection1, intersection2

Raises:

GeometryError – Points too close

bluemira.radiation_transport.neutronics.make_pre_cell.pick_higher_point(point1: numpy.typing.NDArray[numpy.float64], point2: numpy.typing.NDArray[numpy.float64], vector: numpy.typing.NDArray[numpy.float64]) numpy.typing.NDArray[numpy.float64]

Pick the point that, when projected onto vector, gives a higher value.

Parameters:
  • point1 (numpy.typing.NDArray[numpy.float64]) – Point to choose from.

  • point2 (numpy.typing.NDArray[numpy.float64]) – Point to choose from.

  • vector (numpy.typing.NDArray[numpy.float64]) – The co-vector direction that we want to project onto.

Returns:

The point further among the two choices [point1, point2].

Return type:

point

bluemira.radiation_transport.neutronics.make_pre_cell.calculate_new_circle(old_circle_info: bluemira.radiation_transport.neutronics.wires.CircleInfo, new_points: numpy.typing.NDArray) bluemira.radiation_transport.neutronics.wires.CircleInfo

Calculate how far does the new circle get shifted.

Parameters:
Returns:

An instance of CircleInfo representing the new (scaled) arc of circle.

Return type:

new_circle_info

class bluemira.radiation_transport.neutronics.make_pre_cell.PreCell(interior_wire: bluemira.geometry.wire.BluemiraWire | bluemira.geometry.coordinates.Coordinates, vv_wire: bluemira.geometry.wire.BluemiraWire, exterior_wire: bluemira.geometry.wire.BluemiraWire)

A pre-cell is the BluemiraWire outlining the reactor cross-section BEFORE they have been simplified into straight-lines. Unlike a Cell, its outline may be constructed from curved lines.

Parameters:
interior_wire
vv_wire
exterior_wire
vertex
vv_point
outline
property half_solid: bluemira.geometry.solid.BluemiraSolid

Create the 180° revolved shape on demand only. Revolved 180° instead of 360° for easier viewing

Return type:

bluemira.geometry.solid.BluemiraSolid

property blanket_outline: bluemira.geometry.wire.BluemiraWire

Create the outline of the blanket, i.e. the part excluding the vacuum vessel.

Return type:

bluemira.geometry.wire.BluemiraWire

property blanket_half_solid: bluemira.geometry.solid.BluemiraSolid

Get the volume of the blanket

Return type:

bluemira.geometry.solid.BluemiraSolid

plot_2d(*args, **kwargs) matplotlib.axes.Axes

Plot the outline in 2D

Returns:

Axes on which the pre-cell is plotted.

Return type:

matplotlib.axes.Axes

show_cad(*args, **kwargs) None

Plot the outline in 3D

Return type:

None

property cell_walls: bluemira.radiation_transport.neutronics.radial_wall.CellWalls

The side (clockwise side and counter-clockwise) walls of this cell. Only create it when called, because some instances of PreCell will never use it.

it is of type CellWalls.

Return type:

bluemira.radiation_transport.neutronics.radial_wall.CellWalls

property normal_to_interior: numpy.typing.NDArray

The vector pointing from the interior_wire direction towards the exterior_wire, specifically, it’s perpendicular to the interior_wire. Also only created when called, because it’s not needed

Return type:

numpy.typing.NDArray

get_cell_wall_cut_points_by_fraction(fraction: float) numpy.typing.NDArray

Find the cut points on the cell’s side walls by multiplying the original lengths by a fraction. When fraction=0, this returns the interior_start and interior_end.

Parameters:

fraction (float) – A scalar value

Returns:

The position of the pre-cell wall end points at the required fraction, array of shape (2, 2) [[cw_wall x, cw_wall z], [ccw_wall x, ccw_wall z]].

Return type:

new end points

get_cell_wall_cut_points_by_thickness(thickness: float)

Offset a line parallel to the interior_wire towards the exterior direction. Then, find where this line intersect the cell’s side walls.

Parameters:

thickness (float) – A scalar value

Returns:

The position of the pre-cell wall end points at the required thickness, array of shape (2, 2) [[cw_wall x, cw_wall z], [ccw_wall x, ccw_wall z]].

Return type:

new end points

class bluemira.radiation_transport.neutronics.make_pre_cell.PreCellArray(list_of_pre_cells: list[PreCell])

A list of pre-cells materials

Parameters:

list_of_pre_cells (list[PreCell]) – An adjacent list of pre-cells

Raises:

GeometryError – Precells must share corners

Notes

The list of pre-cells must be adjacent to each other.

pre_cells
cell_walls
check_convexity()

Check that the outermost points of self forms a convex hull.

Raises:

GeometryError – PreCellArray is not convex

property volumes: tuple[float]

Create the iterable of volumes on demand.

Return type:

tuple[float]

straighten_exterior(*, preserve_volume: bool = False) PreCellArray

Turn the exterior curves of each cell into a straight edge. This is done at the PreCellArray level instead of the PreCell level to allow volume preservation, see Parameters below for more details.

Parameters:

preserve_volume (bool) – Whether to preserve the volume of each cell during the transformation from pre-cell with curved-edge to pre-cell with straight edges. If True, increase the length of the cut lines appropriately to compensate for the volume loss due to the straight line approximation.

Returns:

An array of the copies of the pre-cells, where the exterior wall and interior walls (as well as the dividing walls between adjacent pre-cells) were made of straight BluemiraWire’s, as opposed to the curved lines initally provided.

Return type:

PreCellArray

plot_2d(*args, **kwargs)

Plot pre cells in 2d

Returns:

Axes on which the pre-cell array is plotted.

show_cad(*args, **kwargs) None

Show pre cell CAD

Return type:

None

exterior_vertices() numpy.typing.NDArray

Returns all of the vertices on the exterior side of the pre-cell array.

Returns:

array of shape (N+1, 3) arranged clockwise (inboard to outboard).

Return type:

exterior_vertices

interior_vertices() numpy.typing.NDArray

Returns all of the vertices on the interior side of the pre-cell array.

Returns:

array of shape (N+1, 3) arranged clockwise (inboard to outboard).

Return type:

interior_vertices

__len__() int

Number of pre cells

Return type:

int

__getitem__(index_or_slice) list[PreCell] | PreCell

Get pre cell

Return type:

list[PreCell] | PreCell

__setitem__(index_or_slice, new_pre_cell: PreCell | PreCellArray)

Set an element to be a new Precell, or a slice to be a new PreCellarray.

Parameters:

new_pre_cell (PreCell | PreCellArray)

__add__(other_array) PreCellArray

Adding two list together to create a new one.

Returns:

Both pre-cell arrays (self and other_array) concatenated together to form a new PreCellArray.

Raises:

TypeError – Operation not possible between types

Return type:

PreCellArray

__repr__() str

String representation

Returns:

A string that includes the number of pre-cells in the array.

Return type:

str

copy()

Each element of the new_copy.pre_cells list points to the same items as the self.pre_cells

Returns:

copy of itself

Return type:

new_copy

class bluemira.radiation_transport.neutronics.make_pre_cell.DivertorPreCell(interior_wire: bluemira.radiation_transport.neutronics.wires.WireInfoList, vv_wire: bluemira.radiation_transport.neutronics.wires.WireInfoList, exterior_wire: bluemira.radiation_transport.neutronics.wires.WireInfoList)

An intermediate class between the bluemira wire and the final csg product. A divertor pre-cell is the equivalent of a blanket’s pre-cell, but for the divertor.

Parameters:
interior_wire
vv_wire
exterior_wire
cw_wall
ccw_wall
vertex
plot_2d(*args, **kwargs) matplotlib.axes.Axes

Plot 2d precell

Returns:

The Axes object on which the divertor pre-cell was plotted.

Return type:

matplotlib.axes.Axes

show_cad(*args, **kwargs) None

Show precell CAD

Return type:

None

property outline: bluemira.geometry.wire.BluemiraWire

We don’t need the volume value, so we’re only going to generate the outline when the user wants to plot it.

Return type:

bluemira.geometry.wire.BluemiraWire

property half_solid: bluemira.geometry.solid.BluemiraSolid

Create the 180° revolved shape on demand only. Revolved 180° instead of 360° for easier viewing

Return type:

bluemira.geometry.solid.BluemiraSolid

offset_interior_wire(thickness: float) bluemira.radiation_transport.neutronics.wires.WireInfoList

Offset the interior wire towards the exterior_wire. The true problem of expanding/shrinking a wire is a much more difficult one, so I’ve only opted for a simpler (but incorrect) approach of pushing the wire to a desired direction determined by how close it is to the wall.

TODO: Re-write this method, as it currently do weird things to circles.

New method should do the following:

  1. Find a point to be our new origin. (Name that point “p”) This is likely to be a point near exterior_vertices.

  2. Scale down the interior_wire by x%.

We should give more thought of how to derive/search for the optimal vector (p[0], p[-1], x), such that all lines are displaced by

This proposed method has several new benefits:

  1. The circles will be scaled correctly (center moves towards the new origin by x%, radius scaled down by x%).

  2. All tangents are preserved, so no need to change them.

Returns:

The interior wire offsetted by thickness, represented as a WireInfoList.

Parameters:

thickness (float)

Return type:

bluemira.radiation_transport.neutronics.wires.WireInfoList

class bluemira.radiation_transport.neutronics.make_pre_cell.DivertorPreCellArray(list_of_div_pc: list[DivertorPreCell])

An array of Divertor pre-cells

Raises:

GeometryError – Divertor precells must share corners

Parameters:

list_of_div_pc (list[DivertorPreCell])

pre_cells
check_convexity()

Check that the outermost points of self forms a convex hull.

Raises:

GeometryError – Precell array is not convex

exterior_vertices() numpy.typing.NDArray

Returns all of the tokamak’s poloidal cross-section’s outside corners’ coordinates, in 3D.

Returns:

aray of shape (N+1, 3) arranged counter-clockwise (inboard to outboard).

Return type:

exterior_vertices

interior_vertices() numpy.typing.NDArray

Returns all of the tokamak’s poloidal cross-section’s inside corners’ coordinates, in 3D.

Returns:

A numpy array of every vertex in each pre-cell’s vertices.

Return type:

numpy.typing.NDArray

__len__() int

Number of pre cells

Return type:

int

__getitem__(index_or_slice) list[DivertorPreCell] | DivertorPreCell

Get pre cell

Return type:

list[DivertorPreCell] | DivertorPreCell

__repr__() str

String representation

Return type:

str

plot_2d(*args, **kwargs)

Plot precell array cad in 2d

Returns:

The Axes on which the divertor pre-cell array was plotted.

show_cad(*args, **kwargs) None

Show precell array CAD

Return type:

None

copy()

NOT a deepcopy, each element of the new_copy.pre_cells list points to the same items as the self.pre_cells

Returns:

copy of itself