Python API reference#

Assemblies#

paramak.tokamak(radial_build, vertical_build, triangularity=0.55, rotation_angle=180.0, extra_cut_shapes=None, extra_intersect_shapes=None, colors=None, poloidal_build=None, toroidal_build=None, rotation_start_angle=0.0)[source]#

Creates a tokamak fusion reactor from a radial and vertical build.

Parameters:
  • radial_build (Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]) – sequence of tuples containing the radial build of the reactor. Each tuple should contain a LayerType, a float and the string is optional.

  • vertical_build (Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]) – sequence of tuples containing the vertical build of the reactor. Each tuple should contain a LayerType, a float and the string is optional. Entries are ordered from the top of the reactor to the bottom, so the entries before the plasma are above it. There must be at least one entry above and below the plasma for each radial_build entry after the plasma.

  • triangularity (float) – The triangularity of the plasma. Defaults to 0.55.

  • rotation_angle (float) – The rotation angle of the plasma. Defaults to 180.0.

  • rotation_start_angle (float) – The angle in degrees the reactor starts from, measured around the Z axis from the XZ plane in the direction the reactor is revolved, so the reactor covers rotation_start_angle to rotation_start_angle + rotation_angle. extra_cut_shapes and extra_intersect_shapes are used where they are and are not rotated. Must be between -360 and 360. Defaults to 0.

  • extra_cut_shapes (Optional[Sequence[Workplane]]) – A list of extra shapes to cut the reactor with. Defaults to [].

  • extra_intersect_shapes (Optional[Sequence[Workplane]]) – A list of extra shapes to intersect the reactor with. Defaults to [].

  • colors (dict | None) – the colors to assign to the assembly parts. Defaults to {}. Each dictionary entry should be a key that matches the assembly part name (e.g. ‘plasma’, or ‘layer_1’) and a tuple of 3 or 4 floats between 0 and 1 representing the RGB or RGBA values.

  • poloidal_build (Optional[Sequence[Optional[Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]]]]) – optional poloidal segmentation of the layers. A list with one entry per radial_build entry after the plasma, ordered from the plasma outwards, so each entry covers the matching inboard and outboard layer pair. Entries are None for layers that are not segmented (and must be None for LayerType.GAP entries), otherwise a list of segments in the same format as radial_build entries: (paramak.LayerType.SOLID, arc_length, name) for a solid segment (the name is optional) or (paramak.LayerType.GAP, arc_length) for a gap that produces no solid. Arc lengths are measured along the plasma facing surface (the inner surface of the first solid layer after the plasma) for every layer, starting at the outboard midplane and proceeding counter clockwise (upwards on the outboard side). Each entry must sum to the arc length returned by paramak.poloidal_arc_length (within 0.1 percent). Cuts between segments follow the normal to the plasma surface, so layers given the same segments line up. Solid segments are named “<layer name>_<segment name>”, unnamed solid segments are called “segment”, and repeated names within a layer get a “_1”, “_2” suffix. Defaults to None.

  • toroidal_build (Optional[Sequence[Optional[Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]]]]) – optional toroidal segmentation of the layers, for example into sectors separated by assembly gaps. A list with one entry per radial_build entry after the plasma, ordered from the plasma outwards, like poloidal_build. Entries are None for layers that are not segmented (and must be None for LayerType.GAP entries), otherwise a list of segments: (paramak.LayerType.SOLID, arc_length, name) for a sector (the name is optional) or (paramak.LayerType.GAP, width) for a gap. Arc lengths are measured around the plasma facing surface at the outboard midplane, starting at rotation_start_angle (the XZ plane by default) and going in the direction the reactor is revolved, and each entry must sum to the arc length returned by paramak.toroidal_arc_length (within 0.1 percent). Gaps are slots with parallel sides, so a gap has the same width at every radius. Sectors are named “<layer name>_<sector name>”, or “<layer name>_<poloidal segment name>_<sector name>” when the layer also has a poloidal_build entry. Defaults to None.

Returns:

A CadQuery Assembly object representing the tokamak fusion reactor.

Return type:

Assembly

paramak.tokamak_from_plasma(radial_build, elongation=2.0, triangularity=0.55, rotation_angle=180.0, extra_cut_shapes=None, extra_intersect_shapes=None, colors=None, poloidal_build=None, toroidal_build=None, rotation_start_angle=0.0)[source]#

Creates a tokamak fusion reactor from a radial build and plasma parameters.

Parameters:
  • radial_build (Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]) – sequence of tuples containing the radial build of the reactor. Each tuple should contain a LayerType, a float and a string.

  • elongation (float) – The elongation of the plasma. Defaults to 2.0.

  • triangularity (float) – The triangularity of the plasma. Defaults to 0.55.

  • rotation_angle (float) – The rotation angle of the plasma. Defaults to 180.0.

  • rotation_start_angle (float) – The angle in degrees the reactor starts from, measured around the Z axis from the XZ plane in the direction the reactor is revolved, so the reactor covers rotation_start_angle to rotation_start_angle + rotation_angle. extra_cut_shapes and extra_intersect_shapes are used where they are and are not rotated. Must be between -360 and 360. Defaults to 0.

  • extra_cut_shapes (Optional[Sequence[Workplane]]) – A list of extra shapes to cut the reactor with. Defaults to [].

  • extra_intersect_shapes (Optional[Sequence[Workplane]]) – A list of extra shapes to intersect the reactor with. Defaults to [].

  • colors (dict | None) – the colors to assign to the assembly parts. Defaults to {}. Each dictionary entry should be a key that matches the assembly part name (e.g. ‘plasma’, or ‘layer_1’) and a tuple of 3 or 4 floats between 0 and 1 representing the RGB or RGBA values.

  • poloidal_build (Optional[Sequence[Optional[Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]]]]) – optional poloidal segmentation of the layers. A list with one entry per radial_build entry after the plasma, ordered from the plasma outwards, so each entry covers the matching inboard and outboard layer pair. Entries are None for layers that are not segmented (and must be None for LayerType.GAP entries), otherwise a list of segments in the same format as radial_build entries: (paramak.LayerType.SOLID, arc_length, name) for a solid segment (the name is optional) or (paramak.LayerType.GAP, arc_length) for a gap that produces no solid. Arc lengths are measured along the plasma facing surface (the inner surface of the first solid layer after the plasma) for every layer, starting at the outboard midplane and proceeding counter clockwise (upwards on the outboard side). Each entry must sum to the arc length returned by paramak.poloidal_arc_length (within 0.1 percent). Cuts between segments follow the normal to the plasma surface, so layers given the same segments line up. Solid segments are named “<layer name>_<segment name>”, unnamed solid segments are called “segment”, and repeated names within a layer get a “_1”, “_2” suffix. Defaults to None.

  • toroidal_build (Optional[Sequence[Optional[Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]]]]) – optional toroidal segmentation of the layers, for example into sectors separated by assembly gaps. A list with one entry per radial_build entry after the plasma, ordered from the plasma outwards, like poloidal_build. Entries are None for layers that are not segmented (and must be None for LayerType.GAP entries), otherwise a list of segments: (paramak.LayerType.SOLID, arc_length, name) for a sector (the name is optional) or (paramak.LayerType.GAP, width) for a gap. Arc lengths are measured around the plasma facing surface at the outboard midplane, starting at rotation_start_angle (the XZ plane by default) and going in the direction the reactor is revolved, and each entry must sum to the arc length returned by paramak.toroidal_arc_length (within 0.1 percent). Gaps are slots with parallel sides, so a gap has the same width at every radius. Sectors are named “<layer name>_<sector name>”, or “<layer name>_<poloidal segment name>_<sector name>” when the layer also has a poloidal_build entry. Defaults to None.

Returns:

A CadQuery Assembly object representing the tokamak fusion reactor.

Return type:

Assembly

paramak.spherical_tokamak(radial_build, vertical_build, triangularity=0.55, rotation_angle=180.0, extra_cut_shapes=None, extra_intersect_shapes=None, colors=None, poloidal_build=None, toroidal_build=None, rotation_start_angle=0.0)[source]#

Creates a spherical tokamak fusion reactor from a radial build and vertical build.

Parameters:
  • radial_build (Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]) – sequence of tuples containing the radial build of the reactor. Each tuple should contain a LayerType, a float and the string is optional.

  • vertical_build (Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]) – sequence of tuples containing the vertical build of the reactor. Each tuple should contain a LayerType, a float and the string is optional. Entries are ordered from the top of the reactor to the bottom, so the entries before the plasma are above it. There must be at least one entry above and below the plasma for each radial_build entry after the plasma.

  • triangularity (float) – The triangularity of the plasma. Defaults to 0.55.

  • rotation_angle (float) – The rotation angle of the reactor in degrees. Defaults to 180.0.

  • rotation_start_angle (float) – The angle in degrees the reactor starts from, measured around the Z axis from the XZ plane in the direction the reactor is revolved, so the reactor covers rotation_start_angle to rotation_start_angle + rotation_angle. extra_cut_shapes and extra_intersect_shapes are used where they are and are not rotated. Must be between -360 and 360. Defaults to 0.

  • extra_cut_shapes (Optional[Sequence[Workplane]]) – A list of extra shapes to cut the reactor with. Defaults to [].

  • extra_intersect_shapes (Optional[Sequence[Workplane]]) – A list of extra shapes to intersect the reactor with. Defaults to [].

  • colors (dict | None) – the colors to assign to the assembly parts. Defaults to {}. Each dictionary entry should be a key that matches the assembly part name (e.g. ‘plasma’, or ‘layer_1’) and a tuple of 3 or 4 floats between 0 and 1 representing the RGB or RGBA values.

  • poloidal_build (Optional[Sequence[Optional[Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]]]]) – optional poloidal segmentation of the layers after the plasma. A list with one entry per radial_build entry after the plasma, ordered from the plasma outwards. Entries are None for layers that are not segmented (and must be None for LayerType.GAP entries), otherwise a list of segments in the same format as radial_build entries: (paramak.LayerType.SOLID, arc_length, name) for a solid segment (the name is optional) or (paramak.LayerType.GAP, arc_length) for a gap that produces no solid. Arc lengths are measured along the plasma facing surface (the inner surface of the first solid layer after the plasma) for every layer, starting where the layer meets the centre column at the bottom and going along the bottom, up the outboard side and along the top back to the centre column. Each entry must sum to the arc length returned by paramak.spherical_poloidal_arc_length (within 0.1 percent). Cuts between segments are vertical along the top and bottom and follow the normal to the plasma surface on the outboard side, so layers given the same segments line up. Solid segments are named “<layer name>_<segment name>”, unnamed solid segments are called “segment”, and repeated names within a layer get a “_1”, “_2” suffix. Defaults to None.

  • toroidal_build (Optional[Sequence[Optional[Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]]]]) – optional toroidal segmentation of the layers, for example into sectors separated by assembly gaps. A list with one entry per radial_build entry after the plasma, ordered from the plasma outwards, like poloidal_build. Entries are None for layers that are not segmented (and must be None for LayerType.GAP entries), otherwise a list of segments: (paramak.LayerType.SOLID, arc_length, name) for a sector (the name is optional) or (paramak.LayerType.GAP, width) for a gap. Arc lengths are measured around the plasma facing surface at the outboard midplane, starting at rotation_start_angle (the XZ plane by default) and going in the direction the reactor is revolved, and each entry must sum to the arc length returned by paramak.toroidal_arc_length (within 0.1 percent). Gaps are slots with parallel sides, so a gap has the same width at every radius. Sectors are named “<layer name>_<sector name>”, or “<layer name>_<poloidal segment name>_<sector name>” when the layer also has a poloidal_build entry. Defaults to None.

Returns:

A CadQuery Assembly object representing the spherical tokamak fusion reactor.

Return type:

Assembly

paramak.spherical_tokamak_from_plasma(radial_build, elongation=2.0, triangularity=0.55, rotation_angle=180.0, extra_cut_shapes=None, extra_intersect_shapes=None, colors=None, poloidal_build=None, toroidal_build=None, rotation_start_angle=0.0)[source]#

Creates a spherical tokamak fusion reactor from a radial build and plasma parameters.

Parameters:
  • radial_build (Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]) – sequence of tuples containing the radial build of the reactor. Each tuple should contain a LayerType, a float and the string is optional.

  • elongation (float) – The elongation of the plasma. Defaults to 2.0.

  • triangularity (float) – The triangularity of the plasma. Defaults to 0.55.

  • rotation_angle (float) – The rotation angle of the reactor in degrees. Defaults to 180.0.

  • rotation_start_angle (float) – The angle in degrees the reactor starts from, measured around the Z axis from the XZ plane in the direction the reactor is revolved, so the reactor covers rotation_start_angle to rotation_start_angle + rotation_angle. extra_cut_shapes and extra_intersect_shapes are used where they are and are not rotated. Must be between -360 and 360. Defaults to 0.

  • extra_cut_shapes (Optional[Sequence[Workplane]]) – A list of extra shapes to cut the reactor with. Defaults to [].

  • colors (dict | None) – the colors to assign to the assembly parts. Defaults to {}. Each dictionary entry should be a key that matches the assembly part name (e.g. ‘plasma’, or ‘layer_1’) and a tuple of 3 or 4 floats between 0 and 1 representing the RGB or RGBA values.

  • poloidal_build (Optional[Sequence[Optional[Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]]]]) – optional poloidal segmentation of the layers after the plasma. A list with one entry per radial_build entry after the plasma, ordered from the plasma outwards. Entries are None for layers that are not segmented (and must be None for LayerType.GAP entries), otherwise a list of segments in the same format as radial_build entries: (paramak.LayerType.SOLID, arc_length, name) for a solid segment (the name is optional) or (paramak.LayerType.GAP, arc_length) for a gap that produces no solid. Arc lengths are measured along the plasma facing surface (the inner surface of the first solid layer after the plasma) for every layer, starting where the layer meets the centre column at the bottom and going along the bottom, up the outboard side and along the top back to the centre column. Each entry must sum to the arc length returned by paramak.spherical_poloidal_arc_length (within 0.1 percent). Cuts between segments are vertical along the top and bottom and follow the normal to the plasma surface on the outboard side, so layers given the same segments line up. Solid segments are named “<layer name>_<segment name>”, unnamed solid segments are called “segment”, and repeated names within a layer get a “_1”, “_2” suffix. Defaults to None.

  • toroidal_build (Optional[Sequence[Optional[Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]]]]) – optional toroidal segmentation of the layers, for example into sectors separated by assembly gaps. A list with one entry per radial_build entry after the plasma, ordered from the plasma outwards, like poloidal_build. Entries are None for layers that are not segmented (and must be None for LayerType.GAP entries), otherwise a list of segments: (paramak.LayerType.SOLID, arc_length, name) for a sector (the name is optional) or (paramak.LayerType.GAP, width) for a gap. Arc lengths are measured around the plasma facing surface at the outboard midplane, starting at rotation_start_angle (the XZ plane by default) and going in the direction the reactor is revolved, and each entry must sum to the arc length returned by paramak.toroidal_arc_length (within 0.1 percent). Gaps are slots with parallel sides, so a gap has the same width at every radius. Sectors are named “<layer name>_<sector name>”, or “<layer name>_<poloidal segment name>_<sector name>” when the layer also has a poloidal_build entry. Defaults to None.

Returns:

A CadQuery Assembly object representing the spherical tokamak fusion reactor.

Return type:

Assembly

Reactors from papers#

paramak.sparc_from_2020_paper(rotation_angle=180.0, number_of_tf_coils=18, pf_coil_case_thickness=3.0, colors=None)[source]#

Creates a simplified SPARC reactor from a figure in a published paper.

The geometry is based on Figure 4 of A. J. Creely et al., “Overview of the SPARC tokamak”, Journal of Plasma Physics, 86(5), 865860502 (2020), doi:10.1017/S0022377820001257. The coordinates were read off the figure, so they are approximate and the model does not exactly match the reactor.

The assembly contains the plasma, the central solenoid, the poloidal field coils (each a winding pack inside a case), the divertor and vertical stability coils, the ICRF antenna, the vacuum vessel, the inner vessel components and the toroidal field coils.

Parameters:
  • rotation_angle (float) – the angle in degrees of the sector to build, between 0 (exclusive) and 360.

  • number_of_tf_coils (int) – the number of toroidal field coils, equally spaced around 360 degrees. Only the coils inside the sector are kept.

  • pf_coil_case_thickness (float) – the thickness (cm) of the case around each poloidal field coil winding pack. The outer size of each coil (with its case) is taken from the paper figure.

  • colors (dict | None) – optional dictionary of RGB(A) colors keyed by part name, used in place of the default colors.

Return type:

Assembly

Returns:

A paramak Assembly with a named part for each component.

paramak.iter_from_2020_paper(rotation_angle=180.0, number_of_tf_coils=18, pf_coil_case_thickness=10.0, colors=None)[source]#

Creates a simplified ITER reactor from a figure in a published paper.

The geometry is based on the diagram in “ITER Project: International Cooperation and Energy Investment” (2020), doi:10.1007/978-3-030-42913-3_26. Several parts use paramak parametric shapes, so the model does not exactly match the diagram or the reactor.

The assembly contains the plasma, a blanket that follows the plasma, a single null divertor, the vacuum vessel, the central solenoid, the poloidal field coils (each a winding pack inside a case) and the toroidal field coils.

Parameters:
  • rotation_angle (float) – the angle in degrees of the sector to build, between 0 (exclusive) and 360.

  • number_of_tf_coils (int) – the number of toroidal field coils, equally spaced around 360 degrees. Only the coils inside the sector are kept.

  • pf_coil_case_thickness (float) – the thickness (cm) of the case around each poloidal field coil winding pack. The outer size of each coil (with its case) is taken from the paper figure.

  • colors (dict | None) – optional dictionary of RGB(A) colors keyed by part name, used in place of the default colors.

Return type:

Assembly

Returns:

A paramak Assembly with a named part for each component.

paramak.eu_demo_from_2015_paper(rotation_angle=180.0, number_of_tf_coils=16, pf_coil_case_thickness=10.0, colors=None)[source]#

Creates a simplified EU DEMO reactor from a figure in a published paper.

The geometry is based on Figure 2 of R. Kemp et al., “Definition of the basic DEMO tokamak geometry based on systems code studies”, Fusion Engineering and Design (2015), doi:10.1016/j.fusengdes.2015.06.097. The coordinates were read off the figure, so they are approximate and the model does not exactly match the reactor.

The assembly contains the plasma, the blanket, a single null divertor, the vacuum vessel, the central solenoid, the poloidal field coils (each a winding pack inside a case) and the toroidal field coil casings.

Parameters:
  • rotation_angle (float) – the angle in degrees of the sector to build, between 0 (exclusive) and 360.

  • number_of_tf_coils (int) – the number of toroidal field coils, equally spaced around 360 degrees. Only the coils inside the sector are kept.

  • pf_coil_case_thickness (float) – the thickness (cm) of the case around each poloidal field coil winding pack. The outer size of each coil (with its case) is taken from the paper figure.

  • colors (dict | None) – optional dictionary of RGB(A) colors keyed by part name, used in place of the default colors.

Return type:

Assembly

Returns:

A paramak Assembly with a named part for each component.

Utilities#

paramak.poloidal_arc_length(radial_build, elongation=None, triangularity=0.55, vertical_build=None)[source]#

Returns the poloidal arc length that the segments in a poloidal_build must sum to.

The arc length is measured around the full poloidal loop of the plasma facing surface, which is the inner surface of the first solid layer after the plasma. All poloidal_build entries are measured on this surface, so layers given the same segments line up.

Parameters:
  • radial_build (Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]) – the radial build of the reactor, as passed to tokamak_from_plasma or tokamak.

  • elongation (float | None) – the elongation of the plasma, as passed to tokamak_from_plasma. Defaults to 2.0. Must not be set when a vertical_build is provided, as the elongation is then calculated from the builds.

  • triangularity (float) – the triangularity of the plasma. Defaults to 0.55.

  • vertical_build (Optional[Sequence[tuple[LayerType, float]]]) – the vertical build of the reactor, as passed to tokamak. Leave as None for tokamak_from_plasma.

Returns:

the poloidal arc length of the plasma facing surface.

Return type:

float

paramak.spherical_poloidal_arc_length(radial_build, elongation=None, triangularity=0.55, vertical_build=None)[source]#

Returns the arc length that the segments in a spherical tokamak poloidal_build must sum to.

The arc length is measured along the plasma facing surface, which is the inner surface of the first solid layer after the plasma. This surface runs from the centre column along the bottom of the layer, around the outboard side of the plasma and back along the top of the layer to the centre column. All poloidal_build entries are measured on this surface, so layers given the same segments line up.

Parameters:
  • radial_build (Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]) – the radial build of the reactor, as passed to spherical_tokamak_from_plasma or spherical_tokamak.

  • elongation (float | None) – the elongation of the plasma, as passed to spherical_tokamak_from_plasma. Defaults to 2.0. Must not be set when a vertical_build is provided, as the elongation is then calculated from the builds.

  • triangularity (float) – the triangularity of the plasma. Defaults to 0.55.

  • vertical_build (Optional[Sequence[tuple[LayerType, float]]]) – the vertical build of the reactor, as passed to spherical_tokamak. Leave as None for spherical_tokamak_from_plasma.

Returns:

the arc length of the plasma facing surface.

Return type:

float

paramak.toroidal_arc_length(radial_build, rotation_angle=180.0)[source]#

Returns the toroidal arc length that the segments in a toroidal_build must sum to.

The arc length is measured around the plasma facing surface (the inner surface of the first solid layer after the plasma) at the outboard midplane, over the rotation_angle of the reactor. This works for all the reactor types, as the outboard midplane radius only depends on the radial_build.

Parameters:
  • radial_build (Sequence[Union[tuple[LayerType, float], tuple[LayerType, float, str]]]) – the radial build of the reactor, as passed to the reactor function.

  • rotation_angle (float) – the rotation angle of the reactor in degrees, as passed to the reactor function. Defaults to 180.0.

Returns:

the toroidal arc length.

Return type:

float

Workplanes#

paramak.blanket_from_plasma(thickness, start_angle, stop_angle, minor_radius=150.0, major_radius=450.0, triangularity=0.55, elongation=2.0, vertical_displacement=0.0, offset_from_plasma=0.0, num_points=200, name='blanket_from_plasma', color=(0.333, 0.0, 0.0), rotation_angle=90.0, plane='XZ', origin=(0, 0, 0), obj=None, allow_overlapping_shape=False, connect_to_center=False, rotation_start_angle=0.0)[source]#

A blanket volume created from plasma parameters. It might be necessary to increase the num_points when making long but thin geometry with this component.

Parameters:
  • thickness (float or [float] or callable or [(float), (float)]) – the thickness of the blanket (cm). If the thickness is a float then this produces a blanket of constant thickness. If the thickness is a tuple of floats, blanket thickness will vary linearly between the two values. If thickness is callable, then the blanket thickness will be a function of poloidal angle (in degrees). If thickness is a list of two lists (angles and thicknesses) then these will be used together with linear interpolation.

  • start_angle (float) – the angle in degrees to start the blanket, measured anti clockwise from 3 o’clock.

  • stop_angle (float) – the angle in degrees to stop the blanket, measured anti clockwise from 3 o’clock.

  • minor_radius (float) – the minor radius of the plasma (cm).

  • major_radius (float) – the major radius of the plasma (cm).

  • triangularity (float) – the triangularity of the plasma.

  • elongation (float) – the elongation of the plasma.

  • vertical_displacement (float) – the vertical_displacement of the plasma (cm).

  • offset_from_plasma (Union[float, Iterable[float]]) – the distance between the plasma and the blanket (cm). If float, constant offset. If list of floats, offset will vary linearly between the values. If callable, offset will be a function of poloidal angle (in degrees). If a list of two lists (angles and offsets) then these will be used together with linear interpolation.

  • num_points (int) – number of points that will describe the shape.

  • allow_overlapping_shape – if False (the default) a warning is given when the offset makes some points of the profile reach past the Z axis (a negative R). Those points are always left out of the profile, setting this to True only stops the warning.

  • rotation_start_angle (float) – the angle in degrees the revolution starts from, measured around the revolve axis from the workplane. The shape covers rotation_start_angle to rotation_start_angle + rotation_angle. Must be between -360 and 360. Defaults to 0.

paramak.center_column_shield_cylinder(height, inner_radius, thickness, reference_point=('center', 0), name='center_column_shield_cylinder', color=(0.0, 0.333, 0.0), rotation_angle=90, plane='XZ', origin=(0, 0, 0), obj=None, rotation_start_angle=0.0)[source]#

A cylindrical center column shield volume with constant thickness.

Parameters:
  • height (float) – height of the center column shield.

  • inner_radius (float) – the inner radius of the center column shield.

  • thickness (float) – the radial thickness of the center column shield, so the outer radius is inner_radius + thickness.

  • reference_point (tuple) – the vertical coordinates to build the vessel from and description of the reference point. Can be either the ‘center’ with a numerical value or ‘lower’ with a numerical value.

  • rotation_start_angle (float) – the angle in degrees the revolution starts from, measured around the revolve axis from the workplane. The shape covers rotation_start_angle to rotation_start_angle + rotation_angle. Must be between -360 and 360. Defaults to 0.

paramak.constant_thickness_dome(thickness=10, chord_center_height=0, chord_width=100, chord_height=20, upper_or_lower='upper', name='constant_thickness_dome', plane='XZ', color=(0.0, 0.333, 0.0), origin=(0, 0, 0), rotation_angle=90, obj=None, rotation_start_angle=0.0)[source]#

A cylindrical vessel volume with constant thickness with a simple dished head. This style of tank head has no knuckle radius or straight flange. The dished shape is made from a chord of a circle.

Parameters:
  • thickness (float) – the radial thickness of the dome.

  • chord_center_height (float) – the vertical position of the chord center

  • chord_width (float) – the width of the chord base

  • chord_height (float) – the height of the chord which is also distance between the chord_center_height and the inner surface of the dome

  • upper_or_lower (str) – Curves the dish with a positive or negative direction to allow the upper section or lower section of vacuum vessel domes to be made.

  • name (str) – the name of the shape, used in the graph legend and as a filename prefix when exporting.

  • rotation_start_angle (float) – the angle in degrees the revolution starts from, measured around the revolve axis from the workplane. The shape covers rotation_start_angle to rotation_start_angle + rotation_angle. Must be between -360 and 360. Defaults to 0.

paramak.cutting_wedge(height, radius, rotation_angle=180.0, plane='XZ', origin=(0, 0, 0), obj=None, color=(0.0, 0.333, 0.0), name='cutting_wedge', rotation_start_angle=0.0)[source]#

Creates a wedge from height, radius and rotation angle arguments than can be useful for cutting sector models.

Parameters:
  • height (float) – the vertical (z axis) height of the coil (cm).

  • radius (float) – the horizontal (x axis) width of the coil (cm).

  • rotation_angle (float) – Defaults to 180.0.

  • rotation_start_angle (float) – the angle in degrees the revolution starts from, measured around the revolve axis from the workplane. The shape covers rotation_start_angle to rotation_start_angle + rotation_angle. Must be between -360 and 360. Defaults to 0.

paramak.dished_vacuum_vessel(radius=300, reference_point=('center', 0), dish_height=(20, 50), cylinder_height=400, thickness=15, rotation_angle=90, name='dished_vessel', plane='XZ', color=(0.0, 0.333, 0.0), origin=(0, 0, 0), rotation_start_angle=0.0)[source]#

A cylindrical vessel volume with constant thickness with a simple dished head. This style of tank head has no knuckle radius or straight flange.

Parameters:
  • radius (float) – the radius from which the centres of the vessel meets the outer circumference.

  • reference_point (tuple) – the x,z coordinates to build the vessel from. Can be either the ‘center’ with a value or ‘lower’ with a value. For example

  • dish_height (tuple[float, float]) – the height of the lower and upper dish sections.

  • cylinder_height (float) – the height of the cylindrical section of the vacuum vessel.

  • thickness (float) – the radial thickness of the vessel in cm.

  • color (tuple[float, float, float, float | None]) – the RGB(A) color of the parts. Defaults to (0.0, 0.333, 0.0).

  • origin – the origin of the workplane, which moves all the parts. Defaults to (0, 0, 0).

  • rotation_start_angle (float) – the angle in degrees the revolution starts from, measured around the revolve axis from the workplane. The shape covers rotation_start_angle to rotation_start_angle + rotation_angle. Must be between -360 and 360. Defaults to 0.

Returns:

the lower dome, cylinder and upper dome as three CadQuery Workplanes. They are kept separate as fusing them can fail.

Return type:

tuple

paramak.plasma_simplified(elongation=2.0, major_radius=450.0, minor_radius=150.0, triangularity=0.55, vertical_displacement=0.0, num_points=200, name='tokamak_plasma', color=(0.333, 0.0, 0.0), rotation_angle=90, plane='XZ', origin=(0, 0, 0), obj=None, rotation_start_angle=0.0)[source]#

Creates a double null tokamak plasma shape that is controlled by 4 shaping parameters.

Parameters:
  • elongation (float) – the elongation of the plasma.

  • major_radius (float) – the major radius of the plasma (cm).

  • minor_radius (float) – the minor radius of the plasma (cm).

  • triangularity (float) – the triangularity of the plasma.

  • vertical_displacement (float) – the vertical_displacement of the plasma (cm)..

  • num_points (int) – number of points to describe the shape.

  • rotation_start_angle (float) – the angle in degrees the revolution starts from, measured around the revolve axis from the workplane. The shape covers rotation_start_angle to rotation_start_angle + rotation_angle. Must be between -360 and 360. Defaults to 0.

paramak.poloidal_field_coil_case(coil_height, coil_width, casing_thickness, center_point, name='poloidal_field_coil_case', color=(1.0, 1.0, 0.498), rotation_angle=90, plane='XZ', origin=(0, 0, 0), obj=None, rotation_start_angle=0.0)[source]#

Constant thickness casing for a rectangular poloidal coil.

Parameters:
  • coil_height (float) – the vertical (z axis) height of the coil (cm).

  • coil_width (float) – the horizontal (x axis) width of the coil (cm).

  • center_point (tuple[float, float]) – the center of the coil (x,z) values (cm).

  • casing_thickness (float) – the thickness of the coil casing (cm).

  • rotation_start_angle (float) – the angle in degrees the revolution starts from, measured around the revolve axis from the workplane. The shape covers rotation_start_angle to rotation_start_angle + rotation_angle. Must be between -360 and 360. Defaults to 0.

paramak.poloidal_field_coil(height, width, center_point, name='poloidal_field_coil', color=(0.0, 0.333, 0.0), rotation_angle=90, plane='XZ', origin=(0, 0, 0), obj=None, rotation_start_angle=0.0)[source]#

A rectangular poloidal field coil.

Parameters:
  • height (float) – the vertical (z axis) height of the coil.

  • width (float) – the horizontal (x axis) width of the coil.

  • center_point (tuple[float, float]) – the center of the coil (x,z) values.

  • rotation_start_angle (float) – the angle in degrees the revolution starts from, measured around the revolve axis from the workplane. The shape covers rotation_start_angle to rotation_start_angle + rotation_angle. Must be between -360 and 360. Defaults to 0.

paramak.revolved_shape(points, rotation_angle=360.0, name='revolved_shape', color=(0.5, 0.5, 0.5), plane='XZ', origin=(0, 0, 0), obj=None, rotation_start_angle=0.0)[source]#

Creates a solid by revolving an arbitrary closed 2D profile around the axis.

The profile is described by a list of points where each point is a (R, Z, connection) tuple. connection is one of "straight", "spline" or "circle" and describes how that point joins to the next one. This is the same profile description used internally by paramak’s blanket and dome components, so splines and arcs produce smooth curved profiles rather than blocky polylines.

The profile is closed automatically, so the first point should not be repeated at the end of the list. This is convenient for building custom shapes to pass to the extra_intersect_shapes or extra_cut_shapes arguments of the reactor assemblies, for example a curved divertor.

Parameters:
  • points (Sequence[tuple[float, float, str]]) – the profile points as (R, Z, connection) tuples, ordered around the outline. Do not repeat the first point; the profile is closed automatically.

  • rotation_angle (float) – the angle in degrees to revolve the profile around the axis. Defaults to 360.

  • rotation_start_angle (float) – the angle in degrees the revolution starts from, measured around the revolve axis from the workplane. The shape covers rotation_start_angle to rotation_start_angle + rotation_angle. Must be between -360 and 360. Defaults to 0.

  • name (str) – the name assigned to the resulting solid.

  • color (tuple[float, float, float, float | None]) – the RGB(A) color assigned to the resulting solid.

  • plane (str) – the plane to build the profile on, e.g. “XZ”.

  • origin (tuple[float, float, float]) – the origin of the workplane.

  • obj – an optional existing CadQuery object to build upon.

Return type:

Workplane

Returns:

A CadQuery Workplane containing the revolved solid.

paramak.toroidal_field_coil_rectangle(horizontal_start_point=(20, 200), vertical_mid_point=(350, 0), thickness=30, distance=20, rotation_angle=360.0, name='toroidal_field_coil', with_inner_leg=True, azimuthal_placement_angles=None, vertical_displacement=0.0, color=(0.0, 0.0, 1.0), plane='XZ', origin=(0.0, 0.0, 0.0), obj=None, rotation_start_angle=0.0)[source]#

Creates a rectangular shaped toroidal field coil.

Parameters:
  • horizontal_start_point (tuple[float, float]) – the (x,z) coordinates of the inner upper point (cm).

  • vertical_mid_point (tuple[float, float]) – the (x,z) coordinates of the mid point of the vertical section (cm). The coil is symmetric about this height, so the bottom is the horizontal_start_point mirrored about it.

  • thickness (float) – the thickness of the toroidal field coil.

  • distance (float) – the extrusion distance.

  • rotation_angle (float) – angle of rotation in degrees, this cuts the resulting shape with a wedge. Useful for sector models.

  • rotation_start_angle (float) – the angle in degrees the wedge that cuts the shape starts from, measured around the Z axis from the XZ plane, so the sector kept covers rotation_start_angle to rotation_start_angle + rotation_angle. The coils are still placed at azimuthal_placement_angles. Must be between -360 and 360. Defaults to 0.

  • name (str) – the name of the coil. Defaults to “toroidal_field_coil”.

  • with_inner_leg (bool) – include the inner tf leg. Defaults to True.

  • azimuthal_placement_angles (Optional[Sequence[float]]) – the angles in degrees around the Z axis to place a coil at. Defaults to [0].

  • vertical_displacement (float) – the vertical distance to move the coil (cm). Defaults to 0.

  • color (tuple[float, float, float, float | None]) – the RGB(A) color of the coil. Defaults to (0.0, 0.0, 1.0).

  • plane (str) – the plane the coil profile is drawn on. Defaults to “XZ”.

  • origin (tuple[float, float, float]) – the origin of the workplane. Defaults to (0.0, 0.0, 0.0).

  • obj – an optional existing CadQuery object to build upon.

paramak.u_shaped_dome(radius=310, reference_point=('lower', 0), dish_height=50, cylinder_height=400, thickness=16, rotation_angle=180, name='u_shaped_dome', plane='XZ', upper_or_lower='upper', color=(0.0, 0.333, 0.0), origin=(0, 0, 0), rotation_start_angle=0.0)[source]#

A cylindrical u shaped dome with constant thickness.

Parameters:
  • radius (float) – the radius from which the centres of the vessel meets the outer circumference.

  • reference_point (tuple) – the vertical position to build the vessel from, either (“center”, z) for the middle of the cylinder or (“lower”, z) for the lowest point of the shape (the bottom of the cylinder for an upper dome, the bottom of the dish for a lower dome).

  • dish_height (float) – the height of the dish section.

  • cylinder_height (float) – the height of the cylindrical section of the vacuum vessel.

  • thickness (float) – the radial thickness of the vessel in cm.

  • color (tuple[float, float, float, float | None]) – the RGB(A) color of the parts. Defaults to (0.0, 0.333, 0.0).

  • origin – the origin of the workplane, which moves all the parts. Defaults to (0, 0, 0).

  • rotation_start_angle (float) – the angle in degrees the revolution starts from, measured around the revolve axis from the workplane. The shape covers rotation_start_angle to rotation_start_angle + rotation_angle. Must be between -360 and 360. Defaults to 0.

Returns:

the dome and cylinder as two CadQuery Workplanes.

Return type:

tuple