Paramak¶
The Paramak python package allows rapid production of 3D CAD models of fusion reactors. The purpose of the Paramak is to provide geometry for parametric studies in a variety of CAD formats including STL, STP and Brep files.
CadQuery functions provide the majority of the features, and incorporating additional capabilities is straightforward for developers with Python knowledge.
Contributions are welcome.
History¶
The package was originally conceived by Jonathan Shimwell and based on the FreeCAD Python API When CadQuery 2 was released the project started to migrate the code base. Shortly after this migration the project became open-source and has flourished ever since.
The project has grown largely due to two contributors in particular (John Billingsley and Remi Delaporte-Mathurin) and others have also helped, you can see all those who have helped the development in the GitHub contributions.
The code has been professionally reviewed by PullRequest.com who produced a report and inline suggestions.
The Paramak source code is distributed with a permissive open-source license (MIT) and is available from the GitHub repository https://github.com/fusion-energy/paramak
Publications and Presentations¶
Published in F1000 Research. https://f1000research.com/articles/10-27
Presented at the Spanish Fusion HPC Workshop and available in the 3rd video at minute 41. https://hpcfusion2020.bsc.es/media
Slides from first released presentation. Link
Paramak used for geometry creation in an ARC reactor study. https://iopscience.iop.org/article/10.1088/1741-4326/ac5450
Features¶
In general the Paramak takes input arguments and creates 3D objects. This can be accomplished via the use of parametric Shapes, parametric Components and parametric Reactors with each level building upon the level below.
Parametric Shapes are the simplest and accept points and connection information in 2D space (defaults to x,z plane) and performs operations on them to create 3D volumes. The points and connections are provided by the user when making parametric Shapes. Supported CAD operations include (rotate, extrude, sweep) and Boolean operations such as cut, union and intersect. Additionally the CadQuery objects created can be combined and modified using CadQuery’s powerful filtering capabilities to further customise the shapes by performing operations like edge filleting.
Parametric Components build on top of this foundation and will calculate the points and connections for you when provided with input arguments. The inputs differ between components as a center column requires different inputs to a breeder blanket or a magnet.
Parametric Reactors build upon these two lower level objects to create an entire reactor model from input parameters. Linkage between the components is encoded in each parametric Rector design.
The different parametric reactor families are shown below.
A selection of the parametric Components are shown below.
The different families of parametric Shapes that can be made with the Paramak are shown int he table below.
Rotate |
Extrude |
Sweep |
|
---|---|---|---|
Points connected with straight lines |
RotateStraightShape()
|
ExtrudeStraightShape()
|
SweepStraightShape()
|
Points connected with spline curves |
RotateSplineShape()
|
ExtrudeSplineShape()
|
SweepSplineShape()
|
Points connected with a circle |
RotateCircleShape()
|
ExtrudeCircleShape()
|
SweepCircleShape()
|
Points connected with a mixture (splines, straights and circles)
|
RotateMixedShape()
|
ExtrudeMixedShape()
|
SweepMixedShape()
|
Usage - Parametric Shapes¶
There are a collection of Python scripts in the example folder that demonstrate simple shape construction and visualisation. However here is a quick example of a RotateStraightShape.
After importing the class the user then sets the points. By default, points should be a list of (x,z) points. In this case the points are connected with straight lines.
import paramak
my_shape = paramak.RotateStraightShape(points = [(20,0), (20,100), (100,0)])
Once these properties have been set then users can write 3D volumes in CAD STP or STL formats.
my_shape.export_stp('example.stp')
my_shape.export_stl('example.stl')
Usage - Parametric Components¶
Parametric components are wrapped versions of the eight basic shapes where parameters drive the construction of the shape. There are numerous parametric components for a variety of different reactor components such as center columns, blankets, poloidal field coils. This example shows the construction of a plasma. Users could also construct a plasma by using a RotateSplineShape() combined with coordinates for the points. However a parametric component called Plasma can construct a plasma from more convenient parameters. Parametric components also inherit from the Shape object so they have access to the same methods like export_stp() and export_stl().
import paramak
my_plasma = paramak.Plasma(
major_radius=620,
minor_radius=210,
triangularity=0.33,
elongation=1.85
)
my_plasma.export_stp('plasma.stp')
Usage - Parametric Reactors¶
Parametric Reactors() are wrapped versions of a combination of parametric shapes and components that comprise a particular reactor design. Some parametric reactors include a ball reactor and a submersion ball reactor. These allow full reactor models to be constructed by specifying a series of simple parameters. This example shows the construction of a simple ball reactor without the optional outer pf and tf coils.
import paramak
my_reactor = paramak.BallReactor(
inner_bore_radial_thickness = 50,
inboard_tf_leg_radial_thickness = 50,
center_column_shield_radial_thickness= 50,
divertor_radial_thickness = 100,
inner_plasma_gap_radial_thickness = 50,
plasma_radial_thickness = 200,
outer_plasma_gap_radial_thickness = 50,
firstwall_radial_thickness = 50,
blanket_radial_thickness = 100,
blanket_rear_wall_radial_thickness = 50,
elongation = 2,
triangularity = 0.55,
rotation_angle = 180
)
my_reactor.name = 'BallReactor'
my_reactor.export_stp()
Usage - Reactor Object¶
A reactor object provides a container object for all Shape objects created, and allows operations to be performed on the whole collection of Shapes.
import paramak
Initiate a Reactor object and pass a list of all Shape objects to the shapes_and_components parameter.
my_reactor = paramak.Reactor(shapes_and_components = [my_shape, my_plasma])
A html graph of the combined Shapes can be created.
my_reactor.export_html('reactor.html')
An interactive 3D object can be embedded into a portable html file.
my_reactor.export_html_3d('reactor.html')