bluemira.codes.openmc.make_csg
Create csg geometry by converting from bluemira geometry objects made of wires. All units in this module are in SI (distrance:[m]) unless otherwise specified by the docstring.
Attributes
Classes
Stage of making cells. |
|
Container for CSG planes to enable reuse of planes, very eco friendly |
|
A generic blanket cell that forms the base class for the five specialised types of |
|
A stack of openmc.Cells, first cell is closest to the interior and last cell is |
|
An array of BlanketCellStack. Interior and exterior curve are both assumed convex. |
|
A generic Divertor cell forming either the (inner target's/outer target's/ |
|
A CONVEX object! i.e. all its exterior points together should make a convex hull. |
|
Turn the divertor into a cell array |
Functions
|
Check if a series is monotonically increasing |
|
Plot a list of surfaces in matplotlib. |
|
In the range [-1000, 1000], plot the RZ cross-section of the ZCylinder/ZPlane/ZCone. |
|
Choose the depth values that this pre-cell is suppose to use, according to where it |
|
If this pre-cell is an inboard, return True. |
|
Make a circular torus centered on the z-axis using 3 points. |
|
Make a circular torus centered on the z-axis. |
|
A circular torus centered on the z-axis. |
|
Simply take the centroid point of all of the choice_points, and choose the |
|
Choose a side of the Halfspace in the region of ZPlane and ZCylinder. |
|
Get the flat intersection of an entire list of regions. |
|
Get a dictionary of all of the elements that shall be intersected together, |
|
Get the flat union of an entire list of regions. |
|
Get a dictionary of all of the elements that shall be unioned together, |
|
Make openmc's surfaces' and cells' next IDs to be incremented to the next |
|
Get the 3D coordinates of every point at the outer boundary of the tokamak's |
|
Get the 3D coordinates of every point at the interior boundary of the tokamak's |
|
Box up the universe in a cylinder (including top and bottom). |
|
Define the radiation shield wall as a hollow of the universe box. |
|
Make tf coil and the central solenoid. The former wraps around the latter. |
|
Surface that marks the end of the divertor/blanket's exterior. |
|
Get the entire tokamak's poloidal cross-section (everything inside |
|
Get the plasma chamber's poloidal cross-section |
|
Make the plasma chamber and the outside ext_void. This should be called AFTER |
|
Make pre-cell arrays for the blanket and the divertor. |
Module Contents
- bluemira.codes.openmc.make_csg.SHRINK_DISTANCE = 0.0005
- class bluemira.codes.openmc.make_csg.CellStage
Stage of making cells.
- blanket: BlanketCellArray
- divertor: DivertorCellArray
- tf_coils: list[openmc.Cell]
- cs_coil: openmc.Cell
- plasma: openmc.Cell
- radiation_shield: openmc.Cell
- ext_void: openmc.Cell
- universe: openmc.region.Intersection
- property cells
Get the list of all cells.
- get_all_hollow_merged_cells()
Blanket and divertor cells
- set_volumes()
Sets the volume of the voids. Not necessary/ used anywhere yet.
- bluemira.codes.openmc.make_csg.is_monotonically_increasing(series)
Check if a series is monotonically increasing
- bluemira.codes.openmc.make_csg.plot_surfaces(surfaces_list: list[openmc.Surface], ax=None)
Plot a list of surfaces in matplotlib.
- Parameters:
surfaces_list (list[openmc.Surface])
- bluemira.codes.openmc.make_csg.plot_surface_at_1000cm(ax, surface: openmc.Surface, color_num: int)
In the range [-1000, 1000], plot the RZ cross-section of the ZCylinder/ZPlane/ZCone.
- Parameters:
surface (openmc.Surface)
color_num (int)
- bluemira.codes.openmc.make_csg.get_depth_values(pre_cell: bluemira.radiation_transport.neutronics.make_pre_cell.PreCell, blanket_dimensions: bluemira.radiation_transport.neutronics.geometry.TokamakDimensions) numpy.typing.NDArray[numpy.float64]
Choose the depth values that this pre-cell is suppose to use, according to where it is physically positioned (hence is classified as inboard or outboard).
- Parameters:
pre_cell (bluemira.radiation_transport.neutronics.make_pre_cell.PreCell) –
PreCellto be classified as either inboard or outboardblanket_dimensions (bluemira.radiation_transport.neutronics.geometry.TokamakDimensions) –
bluemira.radiation_transport.neutronics.params.TokamakDimensionsrecording the dimensions of the blanket in SI units (unit: [m]).
- Returns:
a series of floats corresponding to the N-1 interfaces between the N layers. Each float represents how deep into the blanket (i.e. how many [m] into the first wall we need to drill, from the plasma facing surface) to hit that interface layer.
- Return type:
depth_series
- bluemira.codes.openmc.make_csg.check_inboard_outboard(pre_cell: bluemira.radiation_transport.neutronics.make_pre_cell.PreCell, blanket_dimensions: bluemira.radiation_transport.neutronics.geometry.TokamakDimensions) bool
If this pre-cell is an inboard, return True. Otherwise, this pre-cell belongs to outboard, return False
- Parameters:
pre_cell (bluemira.radiation_transport.neutronics.make_pre_cell.PreCell)
blanket_dimensions (bluemira.radiation_transport.neutronics.geometry.TokamakDimensions)
- Return type:
bool
- bluemira.codes.openmc.make_csg.torus_from_3points(point1: numpy.typing.NDArray[numpy.float64], point2: numpy.typing.NDArray[numpy.float64], point3: numpy.typing.NDArray[numpy.float64], surface_id: int | None = None, name: str = '') openmc.ZTorus
Make a circular torus centered on the z-axis using 3 points. All 3 points should lie on the RZ plane AND the surface of the torus simultaneously.
- Parameters:
point1 (numpy.typing.NDArray[numpy.float64]) – RZ coordinates of the 3 points on the surface of the torus.
point2 (numpy.typing.NDArray[numpy.float64]) – RZ coordinates of the 3 points on the surface of the torus.
point3 (numpy.typing.NDArray[numpy.float64]) – RZ coordinates of the 3 points on the surface of the torus.
surface_id (int | None) – See openmc.Surface
name (str) – See openmc.Surface
- Return type:
openmc.ZTorus
- bluemira.codes.openmc.make_csg.torus_from_circle(center: collections.abc.Sequence[float], minor_radius: float, surface_id: int | None = None, name: str = '') openmc.ZTorus
Make a circular torus centered on the z-axis. The circle would lie on the RZ plane AND the surface of the torus simultaneously.
- Parameters:
minor_radius (float) – Radius of the cross-section circle, which forms the minor radius of the torus.
center (collections.abc.Sequence[float]) – Center of the cross-section circle, which forms the center of the torus.
surface_id (int | None) – See openmc.Surface
name (str) – See openmc.Surface
- Return type:
openmc.ZTorus
- bluemira.codes.openmc.make_csg.z_torus(center: numpy.typing.ArrayLike, minor_radius: float, surface_id: int | None = None, name: str = '') openmc.ZTorus
A circular torus centered on the z-axis. The center refers to the major radius and it’s z coordinate.
- Parameters:
center (numpy.typing.ArrayLike) – The center of the torus’ RZ plane cross-section
minor_radius (float) – minor radius of the torus
surface_id (int | None)
name (str)
- Return type:
openmc.ZTorus
- bluemira.codes.openmc.make_csg.choose_halfspace(surface: openmc.Surface, choice_points: numpy.typing.NDArray) openmc.Halfspace
Simply take the centroid point of all of the choice_points, and choose the corresponding half space
- Parameters:
surface (openmc.Surface) – an openmc surface
choice_points (numpy.typing.NDArray)
- Raises:
GeometryError – Point is directly on surface
- Return type:
openmc.Halfspace
- bluemira.codes.openmc.make_csg.choose_plane_cylinders(surface: openmc.ZPlane | openmc.ZCylinder, choice_points: numpy.typing.NDArray) openmc.Halfspace
Choose a side of the Halfspace in the region of ZPlane and ZCylinder.
- Parameters:
surface (openmc.ZPlane | openmc.ZCylinder) –
openmc.surface.Surfaceof a openmc.ZPlane or openmc.ZCylinderchoice_points (np.ndarray of shape (N, 3)) – a list of points representing the vertices of a convex polygon in RZ plane
- Raises:
GeometryError – Points on both sides of surface
- Return type:
openmc.Halfspace
- bluemira.codes.openmc.make_csg.flat_intersection(region_list: collections.abc.Iterable[openmc.Region]) openmc.Intersection
Get the flat intersection of an entire list of regions. e.g. (a (b c)) becomes (a b c)
- Parameters:
region_list (collections.abc.Iterable[openmc.Region])
- Return type:
openmc.Intersection
- bluemira.codes.openmc.make_csg.intersection_dictionary(region: openmc.Region) dict[str, openmc.Region]
Get a dictionary of all of the elements that shall be intersected together, applying the rule of associativity
- Parameters:
region (openmc.Region)
- Return type:
dict[str, openmc.Region]
- bluemira.codes.openmc.make_csg.flat_union(region_list: collections.abc.Iterable[openmc.Region]) openmc.Union
Get the flat union of an entire list of regions. e.g. (a | (b | c)) becomes (a | b | c)
- Parameters:
region_list (collections.abc.Iterable[openmc.Region])
- Return type:
openmc.Union
- bluemira.codes.openmc.make_csg.union_dictionary(region: openmc.Region) dict[str, openmc.Region]
Get a dictionary of all of the elements that shall be unioned together, applying the rule of associativity
- Parameters:
region (openmc.Region)
- Return type:
dict[str, openmc.Region]
- bluemira.codes.openmc.make_csg.round_up_next_openmc_ids(surface_step_size: int = 1000, cell_step_size: int = 100)
Make openmc’s surfaces’ and cells’ next IDs to be incremented to the next pre-determined interval.
- Parameters:
surface_step_size (int)
cell_step_size (int)
- bluemira.codes.openmc.make_csg.exterior_vertices(blanket, divertor) numpy.typing.NDArray
Get the 3D coordinates of every point at the outer boundary of the tokamak’s poloidal cross-section.
- Returns:
array of shape (N+1+n*M, 3), where N = number of blanket pre-cells, M = number of divertor pre-cells, n = discretisation_level used when chopping up the divertor in
bluemira.radiation_transport.neutronics.DivertorWireAndExteriorCurve.make_divertor_pre_cell_array()- Return type:
coordinates
- bluemira.codes.openmc.make_csg.interior_vertices(blanket, divertor) numpy.typing.NDArray
Get the 3D coordinates of every point at the interior boundary of the tokamak’s poloidal cross-section
- Returns:
array of shape ((N+1)+sum(number of interior points of the divertor), 3), where N = number of blanket pre-cells, M = number of divertor pre-cells. Runs clockwise, beginning at the inboard blanket-divertor joining point.
- Return type:
coordinates
- bluemira.codes.openmc.make_csg.make_universe_box(csg, z_min: float, z_max: float, r_max: float, *, control_id: bool = False)
Box up the universe in a cylinder (including top and bottom).
- Parameters:
z_min (float)
z_max (float)
r_max (float)
control_id (bool)
- bluemira.codes.openmc.make_csg.make_radiation_shield_box(csg, z_min: float, z_max: float, r_max: float, universe: openmc.region.Intersection, materials: bluemira.codes.openmc.material.MaterialsLibrary)
Define the radiation shield wall as a hollow of the universe box.
- Parameters:
z_min (float)
z_max (float)
r_max (float)
universe (openmc.region.Intersection)
materials (bluemira.codes.openmc.material.MaterialsLibrary)
- bluemira.codes.openmc.make_csg.make_coils(csg, solenoid_radius: float, tf_coil_thick: float, z_min: float, z_max: float, materials) tuple[openmc.Cell, list[openmc.Cell]]
Make tf coil and the central solenoid. The former wraps around the latter.
- Parameters:
solenoid_radius (float) – Central solenoid radius [m]
tf_coil_thick (float) – Thickness of the tf-coil, wrapped around the central solenoid [m]
z_max (float) – z-coordinate of the the top z-plane shared by both cylinders (cs and tf coil)
z_min (float) – z-coordinate of the the bottom z-plane shared by both cylinders (cs and tf coil)
- Raises:
GeometryError – Thickness of TF coil and solenoid must be positive
- Return type:
tuple[openmc.Cell, list[openmc.Cell]]
- bluemira.codes.openmc.make_csg.make_dividing_surface(csg, component)
Surface that marks the end of the divertor/blanket’s exterior.
- bluemira.codes.openmc.make_csg.blanket_and_divertor_outer_regions(csg, blanket, divertor, *, control_id: bool = False) openmc.Region
Get the entire tokamak’s poloidal cross-section (everything inside self.geom.boundary) as an openmc.Region.
- Parameters:
control_id (bool)
- Return type:
openmc.Region
- bluemira.codes.openmc.make_csg.plasma_void(csg, blanket, divertor, *, control_id: bool = False) openmc.Region
Get the plasma chamber’s poloidal cross-section
- Raises:
GeometryError – Geometry must be convex
- Parameters:
control_id (bool)
- Return type:
openmc.Region
- bluemira.codes.openmc.make_csg.make_void_cells(csg, universe: openmc.region.Intersection, blanket: BlanketCellArray, divertor: DivertorCellArray, central_solenoid: openmc.Cell, tf_coils: list[openmc.Cell] | None, rad_shield: openmc.Cell | None = None, *, control_id: bool = False)
Make the plasma chamber and the outside ext_void. This should be called AFTER the blanket and divertor cells are created.
- Parameters:
universe (openmc.region.Intersection)
blanket (BlanketCellArray)
divertor (DivertorCellArray)
central_solenoid (openmc.Cell)
tf_coils (list[openmc.Cell] | None)
rad_shield (openmc.Cell | None)
control_id (bool)
- bluemira.codes.openmc.make_csg.make_cell_arrays(pre_cell_reactor: bluemira.radiation_transport.neutronics.neutronics_axisymmetric.NeutronicsReactor, csg: BluemiraNeutronicsCSG, materials: bluemira.codes.openmc.material.MaterialsLibrary, *, control_id: bool = False) CellStage
Make pre-cell arrays for the blanket and the divertor.
- Parameters:
control_id (bool) – Whether to set the blanket Cells and surface IDs by force or not. With this set to True, it will be easier to understand where each cell came from. However, it will lead to warnings and errors if a cell/surface is generated to use a cell/surface ID that has already been used respectively. Keep this as False if you’re running openmc simulations multiple times in one session.
pre_cell_reactor (bluemira.radiation_transport.neutronics.neutronics_axisymmetric.NeutronicsReactor)
csg (BluemiraNeutronicsCSG)
materials (bluemira.codes.openmc.material.MaterialsLibrary)
- Return type:
- class bluemira.codes.openmc.make_csg.BluemiraNeutronicsCSG
Container for CSG planes to enable reuse of planes, very eco friendly
- hangar
- surface_from_2points(point1: numpy.typing.NDArray[numpy.float64], point2: numpy.typing.NDArray[numpy.float64], surface_id: int | None = None, name: str = '') openmc.Surface | openmc.model.ZConeOneSided | None
Create either a cylinder, a cone, or a surface from 2 points using only the rz coordinates of any two points on it.
- Parameters:
point1 (numpy.typing.NDArray[numpy.float64]) – any two non-trivial (i.e. cannot be the same) points on the rz cross-section of the surface, each containing the r and z coordinates Units: [m]
point2 (numpy.typing.NDArray[numpy.float64]) – any two non-trivial (i.e. cannot be the same) points on the rz cross-section of the surface, each containing the r and z coordinates Units: [m]
surface_id (int | None) – see openmc.Surface
name (str) – see openmc.Surface
- Returns:
if the two points provided are redundant: don’t return anything, as this is a single point pretending to be a surface. This will come in handy for handling the creation of BlanketCells made with 3 surfaces rather than 4.
- Return type:
surface
- surface_from_straight_line(straight_line_info: bluemira.radiation_transport.neutronics.wires.StraightLineInfo, surface_id: int | None = None, name: str = '')
Create a surface to match the straight line info provided.
- Parameters:
straight_line_info (bluemira.radiation_transport.neutronics.wires.StraightLineInfo)
surface_id (int | None)
name (str)
- surfaces_from_info_list(wire_info_list: bluemira.radiation_transport.neutronics.wires.WireInfoList, name: str = '')
Create a list of surfaces using a list of wire infos.
- Parameters:
wire_info_list (bluemira.radiation_transport.neutronics.wires.WireInfoList) – List of wires
name (str) – This name will be reused across all of the surfaces created in this list.
- find_suitable_z_plane(z0: float, z_range: collections.abc.Iterable[float] | None = None, surface_id: int | None = None, name: str = '', **kwargs)
Find a suitable z from the hangar, or create a new one if no matches are found.
- Parameters:
z0 (float) – The height of the plane, if we need to create it. Unit: [m]
z_range (collections.abc.Iterable[float] | None) – If we a suitable z-plane already exists, then we only accept it if it lies within this range of z. Unit: [m]
surface_id (int | None) – See openmc.Surface
name (str) – See openmc.Surface
- choose_region_cone(surface: openmc.ZCone, choice_points: numpy.typing.NDArray, *, control_id: bool = False) openmc.Region
Choose the region for a ZCone. When reading this function’s code, bear in mind that a Z cone can be separated into 3 parts:
the upper cone (evaluates to negative),
outside of the cone (evaluates to positive),
the lower cone (evaluates to negative).
We have to account for the following cases:
upper cone
outside
lower cone
Y
N
N
Y
Y
N
N
Y
N
N
Y
Y
N
N
Y
All other cases should raise an error. The tricky part to handle is the floating point precision problem. It’s possible that th every point used to create the cone does not lie on the cone/ lies on the wrong side of the cone. Hence the first step is to shrink the choice_points by SHRINK_DISTANCE towards the centroid.
- Parameters:
surface (openmc.ZCone) – where all points are expected to be excluded from at least one of its two one-sided cones.
choice_points (numpy.typing.NDArray) – An array of points that, after choosing the appropriate region, should all lie in the chosen region.
control_id (bool) – When an ambiguity plane is needed, we ned to create a surface. if control_id = True, then this would force the surface to be created with id = 1000 + the id of the cone. This is typically only used so that we have full control of (and easily understandable records of) every surfaces’ ID. Thus elsewhere in the code, most other classes/methods turns control_id on when cell_ids are also provided (proving intention on controlling IDs of OpenMC objects).
- Returns:
openmc.Region, specifically (openmc.Halfspace) or (openmc.Union of 2 openmc.Halfspaces)
- Return type:
region
- Raises:
GeometryError – cone construction invalid
- choose_region(surface: openmc.Surface | tuple[openmc.Surface] | tuple[openmc.Surface | openmc.ZTorus], vertices_array: numpy.typing.NDArray, *, control_id: bool = False) openmc.Region
Pick the correct region of the surface that includes all of the points in vertices_array.
- Parameters:
surface (openmc.Surface | tuple[openmc.Surface] | tuple[openmc.Surface | openmc.ZTorus]) – Either a
openmc.Surface, or a 1-tuple or 2-tuple ofopenmc.Surface. If it is a tuple, the first element is always aopenmc.ZPlane/openmc.ZCone/openmc.ZCylinder; the second element (if present) is alwaysopenmc.ZTorus.vertices_array (numpy.typing.NDArray) – array of shape (?, 3), that the final region should include.
control_id (bool) – Passed as argument onto
choose_region_cone()
- Return type:
An openmc.Region built from surface provided and includes all of these
- region_from_surface_series(series_of_surfaces: collections.abc.Sequence[openmc.Surface | tuple[openmc.Surface, openmc.ZTorus | None] | None], vertices_array: numpy.typing.NDArray, *, control_id: bool = False) openmc.Intersection
Switch between choose_region() and choose_region_from_tuple_of_surfaces() depending on the type of each element in the series_of_surfaces.
- Parameters:
series_of_surfaces (collections.abc.Sequence[openmc.Surface | tuple[openmc.Surface, openmc.ZTorus | None] | None]) – Each of them can be a None, a 1-tuple of surface, a 2-tuple of surfaces, or a surface. For the last 3 options, see
choose_region()for more.vertices_array (numpy.typing.NDArray) – array of shape (?, 3), where every single point should be included by, or at least on the edge of the returned Region.
control_id (bool) – Passed as argument onto
choose_region_cone()
- Returns:
openmc.Intersection of a list of [(openmc.Halfspace) or (openmc.Union of openmc.Halfspace)]
- Return type:
intersection_region
- class bluemira.codes.openmc.make_csg.BlanketCell(exterior_surface: openmc.Surface, ccw_surface: openmc.Surface, cw_surface: openmc.Surface, interior_surface: openmc.Surface | None, vertices: bluemira.geometry.coordinates.Coordinates, csg: BluemiraNeutronicsCSG, cell_id: int | None = None, name: str = '', fill: openmc.Material | None = None)
Bases:
openmc.CellA generic blanket cell that forms the base class for the five specialised types of blanket cells.
It’s a special case of openmc.Cell, in that it has 3 to 4 surfaces (mandatory surfaces: exterior_surface, ccw_surface, cw_surface; optional surface: interior_surface), and it is more wieldy because we don’t have to specify the relevant half-space for each surface; instead the corners of the cell is provided by the user, such that the appropriate regions are chosen.
- Parameters:
exterior_surface (openmc.Surface)
ccw_surface (openmc.Surface)
cw_surface (openmc.Surface)
interior_surface (openmc.Surface | None)
vertices (bluemira.geometry.coordinates.Coordinates)
csg (BluemiraNeutronicsCSG)
cell_id (int | None)
name (str)
fill (openmc.Material | None)
- exterior_surface
- ccw_surface
- cw_surface
- interior_surface
- vertex
- csg
- volume
- class bluemira.codes.openmc.make_csg.BlanketCellStack(cell_stack: list[BlanketCell])
A stack of openmc.Cells, first cell is closest to the interior and last cell is closest to the exterior. They should all be situated at the same poloidal angle.
- Parameters:
cell_stack (list[BlanketCell])
- cell_stack
- __len__() int
Number of cells in stack
- Return type:
int
- __getitem__(index_or_slice) list[BlanketCell] | BlanketCell
Get cell from stack
- Return type:
list[BlanketCell] | BlanketCell
- __iter__() collections.abc.Iterator[BlanketCell]
Iterator for BlanketCellStack
- Return type:
collections.abc.Iterator[BlanketCell]
- __repr__() str
String representation
- Return type:
str
- static check_cut_point_ordering(cut_point_series: numpy.typing.NDArray[numpy.float64], direction_vector: numpy.typing.NDArray[numpy.float64], location_msg: str = '')
- Parameters:
cut_point_series (numpy.typing.NDArray[numpy.float64]) – array of shape (M+1, 2) where M = number of cells in the blanket cell stack (i.e. number of layers in the blanket). Each point has two dimensions
direction_vector (numpy.typing.NDArray[numpy.float64]) – direction that these points are all supposed to go towards.
location_msg (str)
- Raises:
GeometryError – Crossing surfaces
- property interior_surface
Get interior surface
- property exterior_surface
Get exterior surface
- property ccw_surface
Get counter clockwise surface
- property cw_surface
Get clockwise surface
- property interfaces
All of the radial surfaces, including the innermost (exposed to plasma) and outermost (facing vacuum vessel); arranged in that order (from innermost to outermost).
- get_overall_region(csg: BluemiraNeutronicsCSG, *, control_id: bool = False) openmc.Region
Calculate the region covering the entire cell stack.
- Parameters:
control_id (bool) – Passed as argument onto
region_from_surface_series()csg (BluemiraNeutronicsCSG)
- Raises:
GeometryError – Vertices must be convex
- Return type:
openmc.Region
- classmethod from_pre_cell(pre_cell: bluemira.radiation_transport.neutronics.make_pre_cell.PreCell, ccw_surface: openmc.Surface, cw_surface: openmc.Surface, depth_series: numpy.typing.NDArray, csg: BluemiraNeutronicsCSG, fill_lib: bluemira.codes.openmc.material.MaterialsLibrary, *, inboard: bool, blanket_stack_num: int | None = None)
Create a CellStack using a precell and TWO surfaces that sandwiches that precell.
- Parameters:
pre_cell (bluemira.radiation_transport.neutronics.make_pre_cell.PreCell) – An instance of
PreCellccw_surface (openmc.Surface) – An instance of
openmc.surface.Surfacecw_surface (openmc.Surface) – An instance of
openmc.surface.Surfacedepth_series (numpy.typing.NDArray) – a series of floats corresponding to the N-2 interfaces between the N-1 layers, whereas the N-th layer is the vacuum vessel (and the pre-cell has already stored the thickness for that). Each float represents how deep into the blanket (i.e. how many [cm] into the first wall we need to drill, from the plasma facing surface) to hit that interface layer.
csg (BluemiraNeutronicsCSG) – CSG reactor CAD
fill_lib (bluemira.codes.openmc.material.MaterialsLibrary) –
MaterialsLibraryso that it separates into .inboard, .outboard, .divertor, .tf_coil_windings, etc.inboard (bool) – boolean denoting whether this cell is inboard or outboard
blanket_stack_num (int | None) – An optional number indexing the current stack. Used for labelling. If None: we will not be controlling the cell and surfaces id.
- Raises:
TypeError – Incorrect number of edges on external wire
- class bluemira.codes.openmc.make_csg.BlanketCellArray(blanket_cell_array: list[BlanketCellStack], csg: BluemiraNeutronicsCSG)
An array of BlanketCellStack. Interior and exterior curve are both assumed convex.
- Parameters:
blanket_cell_array (list[BlanketCellStack]) – a list of BlanketCellStack
csg (BluemiraNeutronicsCSG)
- blanket_cell_array
- poloidal_surfaces
- radial_surfaces = []
- csg
- __len__() int
Number of cell stacks
- Return type:
int
- __getitem__(index_or_slice) list[BlanketCellStack] | BlanketCellStack
Get cell stack
- Return type:
list[BlanketCellStack] | BlanketCellStack
- __iter__() collections.abc.Iterator[BlanketCellStack]
Iterator for BlanketCellArray
- Return type:
collections.abc.Iterator[BlanketCellStack]
- __repr__() str
String representation
- Return type:
str
- exterior_vertices() numpy.typing.NDArray
Returns all of the tokamak’s poloidal cross-section’s outside corners’ coordinates, in 3D.
- 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 tokamak’s poloidal cross-section’s inside corners’ coordinates, in 3D.
- Returns:
array of shape (N+1, 3) arranged clockwise (inboard to outboard).
- Return type:
interior_vertices
- interior_surfaces() list[openmc.Surface]
Get all of the innermost (plasm-facing) surface. Runs clockwise.
- Return type:
list[openmc.Surface]
- exterior_surfaces() list[openmc.Surface]
Get all of the outermost (vacuum-vessel-facing) surface. Runs clockwise.
- Return type:
list[openmc.Surface]
- exclusion_zone(*, control_id: bool = False) openmc.Region
Get the exclusion zone AWAY from the plasma. Usage: plasma_region = openmc.Union(…, ~self.exclusion_zone(), …) Assumes that all of the panels (interior surfaces) together forms a convex hull.
- Parameters:
control_id (bool) – Passed as argument onto
region_from_surface_series().- Raises:
GeometryError – Vertices must be convex
- Return type:
openmc.Region
- classmethod from_pre_cell_array(pre_cell_array: bluemira.radiation_transport.neutronics.make_pre_cell.PreCellArray, materials: bluemira.codes.openmc.material.MaterialsLibrary, blanket_dimensions: bluemira.radiation_transport.neutronics.geometry.TokamakDimensions, csg: BluemiraNeutronicsCSG, *, control_id: bool = False) BlanketCellArray
Create a BlanketCellArray from a
PreCellArray. This method assumes itself is the first method to be run to create cells in the- Parameters:
pre_cell_array (bluemira.radiation_transport.neutronics.make_pre_cell.PreCellArray) – PreCellArray
materials (bluemira.codes.openmc.material.MaterialsLibrary) –
MaterialsLibraryso that it separates into .inboard, .outboard, .divertor, .tf_coil_windings, etc.blanket_dimensions (bluemira.radiation_transport.neutronics.geometry.TokamakDimensions) –
bluemira.radiation_transport.neutronics.params.TokamakDimensionsrecording the dimensions of the blanket in SI units (unit: [m]).control_id (bool) – Passed as argument onto
region_from_surface_series().csg (BluemiraNeutronicsCSG)
- Return type:
- class bluemira.codes.openmc.make_csg.DivertorCell(exterior_surfaces: list[tuple[openmc.Surface]], cw_surface: openmc.Surface, ccw_surface: openmc.Surface, interior_surfaces: list[tuple[openmc.Surface]], exterior_wire: bluemira.radiation_transport.neutronics.wires.WireInfoList, interior_wire: bluemira.radiation_transport.neutronics.wires.WireInfoList, csg: BluemiraNeutronicsCSG, subtractive_region: openmc.Region | None = None, cell_id: int | None = None, name: str = '', fill: openmc.Material | None = None)
Bases:
openmc.CellA generic Divertor cell forming either the (inner target’s/outer target’s/ dome’s) (surface/ bulk).
- Parameters:
exterior_surfaces (list[tuple[openmc.Surface]])
cw_surface (openmc.Surface)
ccw_surface (openmc.Surface)
interior_surfaces (list[tuple[openmc.Surface]])
exterior_wire (bluemira.radiation_transport.neutronics.wires.WireInfoList)
interior_wire (bluemira.radiation_transport.neutronics.wires.WireInfoList)
csg (BluemiraNeutronicsCSG)
subtractive_region (openmc.Region | None)
cell_id (int | None)
name (str)
fill (openmc.Material | None)
- exterior_surfaces
- cw_surface
- ccw_surface
- interior_surfaces
- exterior_wire
- interior_wire
- csg
- volume
- property outline
Make the outline into a BluemiraWire. This method is created solely for the purpose of calculating the volume.
This is slow but it is accurate and works well.
- get_volume()
Get the volume using the BluemiraWire of its own outline.
- Raises:
GeometryError – Volume is negative
- get_all_vertices() numpy.typing.NDArray
Get all of the vertices of this cell, which should help us find its convex hull.
- Return type:
numpy.typing.NDArray
- exclusion_zone(*, away_from_plasma: bool = True, control_id: bool = False, additional_test_points: numpy.typing.NDArray | None = None) openmc.Region
Get the exclusion zone of a semi-CONVEX cell.
This can only be validly used:
If away_from_plasma=True, then the interior side of the cell must be convex. If away_from_plasma=False, then the exterior_side of the cell must be convex.
Usage:
next_cell_region = flat_intersection(…, ~this_cell.exclusion_zone())
- Parameters:
control_id (bool) – Passed as argument onto
region_from_surface_series()away_from_plasma (bool)
additional_test_points (numpy.typing.NDArray | None)
- Raises:
GeometryError – Interior and exterior wire vertices must be convex
- Return type:
openmc.Region
- class bluemira.codes.openmc.make_csg.DivertorCellStack(divertor_cell_stack: list[DivertorCell], csg: BluemiraNeutronicsCSG)
A CONVEX object! i.e. all its exterior points together should make a convex hull. A stack of DivertorCells (openmc.Cells), first cell is closest to the interior and last cell is closest to the exterior. They should all be situated on the same poloidal angle.
- Parameters:
divertor_cell_stack (list[DivertorCell])
csg (BluemiraNeutronicsCSG)
- cell_stack
- csg
- property interior_surfaces
Get interior surfaces
- property exterior_surfaces
Get exterior surfaces
- property ccw_surface
Get counter clockwise surface
- property cw_surface
Get clockwise surface
- property exterior_wire
Alias to find the outermost cell’s exterior_wire
- property interior_wire
Alias to find the innermost cell’s interior_wire
- property interfaces
All of the radial surfaces, including the innermost (exposed to plasma) and outermost (facing the vacuum vessel); arranged in that order (from innermost to outermost).
- __len__() int
Length of DivertorCellStack
- Return type:
int
- __getitem__(index_or_slice) list[DivertorCell] | DivertorCell
Get item for DivertorCellStack
- Return type:
list[DivertorCell] | DivertorCell
- __iter__() collections.abc.Iterator[DivertorCell]
Iterator for DivertorCellStack
- Return type:
collections.abc.Iterator[DivertorCell]
- __repr__() str
String representation
- Return type:
str
- get_all_vertices() numpy.typing.NDArray
- Returns:
shape = (N+M, 3)
- Return type:
vertices_array
- get_overall_region(*, control_id: bool = False) openmc.Region
Get the region that this cell-stack encompasses.
- Parameters:
control_id (bool) – Passed as argument onto
region_from_surface_series()- Raises:
GeometryError – All vertices myst be convex
- Return type:
openmc.Region
- classmethod from_divertor_pre_cell(divertor_pre_cell: bluemira.radiation_transport.neutronics.make_pre_cell.DivertorPreCell, cw_surface: openmc.Surface, ccw_surface: openmc.Surface, materials: bluemira.codes.openmc.material.MaterialsLibrary, csg: BluemiraNeutronicsCSG, armour_thickness: float = 0, stack_num: str | int = '') DivertorCellStack
Create a stack from a single pre-cell and two poloidal surfaces sandwiching it.
- Parameters:
stack_num (str | int) – A string or number to identify the cell stack by.
divertor_pre_cell (bluemira.radiation_transport.neutronics.make_pre_cell.DivertorPreCell)
cw_surface (openmc.Surface)
ccw_surface (openmc.Surface)
materials (bluemira.codes.openmc.material.MaterialsLibrary)
csg (BluemiraNeutronicsCSG)
armour_thickness (float)
- Return type:
- class bluemira.codes.openmc.make_csg.DivertorCellArray(cell_array: list[DivertorCellStack])
Turn the divertor into a cell array
- Parameters:
cell_array (list[DivertorCellStack])
- cell_array
- poloidal_surfaces
- radial_surfaces = []
- __len__() int
Length of DivertorCellArray
- Return type:
int
- __getitem__(index_or_slice) list[DivertorCellStack] | DivertorCellStack
Get item for DivertorCellArray
- Return type:
list[DivertorCellStack] | DivertorCellStack
- __iter__() collections.abc.Iterator[DivertorCellStack]
Iterator for DivertorCellArray
- Return type:
collections.abc.Iterator[DivertorCellStack]
- __repr__() str
String representation
- Return type:
str
- interior_surfaces() list[openmc.Surface]
Get all of the innermost (plasm-facing) surface. Runs clockwise.
- Return type:
list[openmc.Surface]
- exterior_surfaces() list[openmc.Surface]
Get all of the outermost (vacuum-vessel-facing) surface. Runs clockwise.
- Return type:
list[openmc.Surface]
- exterior_vertices() numpy.typing.NDArray
Returns all of the tokamak’s poloidal cross-section’s outside corners’ coordinates, in 3D.
- Returns:
exterior_vertices – Arranged counter-clockwise (inboard to outboard).
- Return type:
npt.NDArray of shape (N+1, 3)
- interior_vertices() numpy.typing.NDArray
Returns all of the tokamak’s poloidal cross-section’s inside corners’ coordinates, in 3D.
- Returns:
interior_vertices – Arranged counter-clockwise (inboard to outboard).
- Return type:
npt.NDArray of shape (N+1, 3)
- exclusion_zone(*, control_id: bool = False) openmc.Region
Get the exclusion zone AWAY from the plasma. Usage: plasma_region = openmc.Union(…, ~self.exclusion_zone(), …) Assumes every single cell-stack is made of an interior surface which itself forms a convex hull.
- Parameters:
control_id (bool) – Passed as argument onto
region_from_surface_series()- Return type:
openmc.Region
- classmethod from_pre_cell_array(pre_cell_array: bluemira.radiation_transport.neutronics.make_pre_cell.DivertorPreCellArray, materials: bluemira.codes.openmc.material.MaterialsLibrary, divertor_thickness: bluemira.radiation_transport.neutronics.geometry.DivertorThickness, csg: BluemiraNeutronicsCSG, override_start_end_surfaces: tuple[openmc.Surface, openmc.Surface] | None = None) DivertorCellArray
Create the entire divertor from the pre-cell array.
- Parameters:
pre_cell_array (bluemira.radiation_transport.neutronics.make_pre_cell.DivertorPreCellArray) – The array of divertor pre-cells.
materials (bluemira.codes.openmc.material.MaterialsLibrary) – container of openmc.Material
divertor_thickness (bluemira.radiation_transport.neutronics.geometry.DivertorThickness) – A parameter
bluemira.radiation_transport.neutronics.params.DivertorThickness. For now it only has one scalar value stating how thick the divertor armour should be.override_start_end_surfaces (tuple[openmc.Surface, openmc.Surface] | None) – openmc.Surfaces that would be used as the first cw_surface and last ccw_surface
csg (BluemiraNeutronicsCSG)
- Return type:
- get_hollow_merged_cells() list[openmc.Cell]
Returns a list of cells (unnamed, unspecified-ID) where each corresponds to a cell-stack.
- Return type:
list[openmc.Cell]