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)[source]#

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

Return type:

Assembly

Parameters:
  • radial_build – sequence of tuples containing the radial build of the reactor. Each tuple should contain a LayerType and a float

  • vertical_build – sequence of tuples containing the vertical build of the reactor. Each tuple should contain a LayerType and a float

  • triangularity – The triangularity of the plasma. Defaults to 0.55.

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

  • extra_cut_shapes – A list of extra shapes to cut the reactor with. Defaults to [].

  • extra_intersect_shapes – A list of extra shapes to intersect the reactor with. Defaults to [].

  • colors (dict, optional) – 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.

Returns:

A CadQuery Assembly object representing the tokamak fusion reactor.

Return type:

CadQuery.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)[source]#

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

Return type:

Assembly

Parameters:
  • radial_build – sequence of tuples containing the radial build of the reactor. Each tuple should contain a LayerType and a float

  • elongation – The elongation of the plasma. Defaults to 2.0.

  • triangularity – The triangularity of the plasma. Defaults to 0.55.

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

  • extra_cut_shapes – A list of extra shapes to cut the reactor with. Defaults to [].

  • extra_intersect_shapes – A list of extra shapes to intersect the reactor with. Defaults to [].

  • colors (dict, optional) – 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.

Returns:

A CadQuery Assembly object representing the tokamak fusion reactor.

Return type:

CadQuery.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)[source]#

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

Return type:

Assembly

Parameters:
  • radial_build – sequence of tuples containing the radial build of the reactor. Each tuple should contain a LayerType and a float.

  • vertical_build – sequence of tuples containing the vertical build of the reactor. Each tuple should contain a LayerType and a float.

  • triangularity – The triangularity of the plasma. Defaults to 0.55.

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

  • extra_cut_shapes – A list of extra shapes to cut the reactor with. Defaults to [].

  • extra_intersect_shapes – A list of extra shapes to intersect the reactor with. Defaults to [].

  • colors – 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.

Returns:

A CadQuery Assembly object representing the spherical tokamak fusion reactor.

Return type:

CadQuery.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)[source]#

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

Return type:

Assembly

Parameters:
  • radial_build – sequence of tuples containing the radial build of the reactor. Each tuple should contain a LayerType and a float.

  • elongation – The elongation of the plasma. Defaults to 2.0.

  • triangularity – The triangularity of the plasma. Defaults to 0.55.

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

  • extra_cut_shapes – A list of extra shapes to cut the reactor with. Defaults to [].

  • colors – 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.

Returns:

A CadQuery Assembly object representing the spherical tokamak fusion reactor.

Return type:

CadQuery.Assembly

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)[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 (thicknesses and angles) then these will be used together with linear interpolation.

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

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

  • plasma – If not None, the parameters of the plasma Object will be used.

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

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

  • triangularity – the triangularity of the plasma.

  • elongation – the elongation of the plasma.

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

  • offset_from_plasma – 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 – number of points that will describe the shape.

  • allow_overlapping_shape – allows parameters to create a shape that overlaps itself.

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)[source]#

A cylindrical center column shield volume with constant thickness.

Parameters:
  • height – height of the center column shield.

  • inner_radius – the inner radius of the center column shield.

  • thickness – the outer radius of the center column shield.

  • reference_point – 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.

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, **kwargs)[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 – the radial thickness of the dome.

  • chord_center_height – the vertical position of the chord center

  • chord_width – the width of the chord base

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

  • upper_or_lower – 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 – the name of the shape, used in the graph legend and as a filename prefix when exporting.

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')[source]#

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

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

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

  • rotation_angle – Defaults to 180.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')[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 – the radius from which the centres of the vessel meets the outer circumference.

  • reference_point – 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 – the height of the lower and upper dish sections.

  • cylinder_height – the height of the cylindrical section of the vacuum vessel.

  • thickness – the radial thickness of the vessel in cm.

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)[source]#

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

Parameters:
  • elongation – the elongation of the plasma.

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

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

  • triangularity – the triangularity of the plasma.

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

  • num_points – number of points to describe the shape.

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)[source]#

Constant thickness casing for a rectangular poloidal coil.

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

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

  • center_point – the center of the coil (x,z) values (cm).

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

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)[source]#

A rectangular poloidal field coil.

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

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

  • center_point – the center of the coil (x,z) values.

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)[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.

Return type:

Workplane

Parameters:
  • points – 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 – the angle in degrees to revolve the profile around the axis. Defaults to 360.

  • name – the name assigned to the resulting solid.

  • color – the RGB(A) color assigned to the resulting solid.

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

  • origin – the origin of the workplane.

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

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)[source]#

Creates a rectangular shaped toroidal field coil.

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

  • vertical_mid_point – the (x,z) coordinates of the mid point of the vertical section (cm).

  • thickness – the thickness of the toroidal field coil.

  • distance – the extrusion distance.

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

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

  • azimuth_start_angle – The azimuth angle to for the first TF coil which offsets the placement of coils around the azimuthal angle

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')[source]#

A cylindrical u shaped dome with constant thickness.

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

  • reference_point – 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 – the height of the lower and upper dish sections.

  • cylinder_height – the height of the cylindrical section of the vacuum vessel.

  • thickness – the radial thickness of the vessel in cm.