Skip to main content

Create 3D fusion reactor CAD models based on input parameters

Project description

N|Python CircleCI codecov PyPI version Documentation Status Docker Cloud Build Status

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. It is possible to use the created geometry in engineering and neutronics studies as the STP or STL files produced can be automatically converted to DAGMC compatible neutronics models or meshed and used in finite element analysis codes.

:point_right: Documentation

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 Authors.md and in the github contributions.

System Installation

To install the Paramak you need to have Conda, Cadquery 2 and Pip. If you have these three dependencies already then you can install the Paramak using Pip:

pip install paramak

Detailed installation instructions can be found in the User's Guide.

Docker Image Installation

Another option is to use the Docker image which contains all the required dependencies.

  1. Install Docker CE for Ubuntu, Mac OS, or Windows, including the part where you enable docker use as a non-root user.

  2. Pull the docker image from the store by typing the following command in a terminal window, or Windows users might prefer PowerShell.

    docker pull ukaea/paramak

  3. Now that you have the docker image you can enable graphics linking between your os and docker, and then run the docker container by typing the following commands in a terminal window.

    sudo docker run -p 8888:8888 ukaea/paramak /bin/bash -c "jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser" --allow-root

  4. A URL should be displayed in the terminal and can now be opened in the internet browser of your choice. This will load up the examples folder where you can view the 3D objects created. Alternatively the Docker imag can be run in terminal mode docker run -it ukaea/paramak

Alternatively the Docker image can be run in terminal mode . docker run -it ukaea/paramak

You may also want to make use of the --volume flag when running Docker so that you can retrieve files from the Docker enviroment to your base system.

Docker can also be used to run the tests using the command docker run -rm ukaea/parama pytest tests

Features

In general the Paramak takes points and connection information in 2D space (XY) and performs operations on them to create 3D volumes. The points and connections can be provided by the user or when using parametric components the points and connections are calculated by the software.

Once points and connections between the points are provided the user has options to perform CAD operations (rotate or extrude on different orientations) to create a 3D volume and boolean operations like cut, union and intersection.

The different families of shapes that can be made with the Paramak are shown in the table below. The CadQuery objects created can be combined and modified (e.g. fillet corners) using CadQueries powerful filtering capabilties to create more complex models (e.g. a Tokamak). The Tokamak images below are coloured based on the shape family that the component is made from. There are also parametric components which provide convenient fusion relevant shapes for common reactor components.

Selection Of Parametric Reactors

Selection Of Parametric Components

Selection Of Parametric Shapes

Rotate Extrude Sweep
Points connected with straight lines

RotateStraightShape()

ExtrudeStraightShape()

SweepStraightShape()
Points connected with spline curves

RotateSplineShape()

ExtrudeSplineShape()

SweepSplineShape()
Points connected with a mixture (splines, straights and circles)

RotateMixedShape()

ExtrudeMixedShape()

SweepMixedShape()
Circular shapes

RotateCircleShape()

ExtrudeCircleShape()

SweepCircleShape()

Example Scripts

There are several example scripts for making shapes, components, reactors and neutronics models in the examples folder. The following examples are minimal examples to demonstrate some basic usage.

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) coordinates. 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 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,
    number_of_tf_coils = 16,
    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')

Usage - Neutronics Model Creation

It is possible to convert a parametric Reactor model into a neutronics model.

To install two additional python packages needed to run neutronics with a modified pip install

pip install .[neutronics]

More information is avaialbe in the documentation.

There are several examples in the examples folder.

To create the neutronics model you will need Trelis and the DAGMC plugin installed DAGMC plugin.

Further information on DAGMC neutronics can be found here and information on OpenMC can be found here. The two codes can be used together to simulate neutron transport on the h5m file created. The UKAEA openmc workshop also has two tasks that might be of interest task 10 and task 12.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paramak-0.1.0.tar.gz (106.4 kB view details)

Uploaded Source

Built Distribution

paramak-0.1.0-py3-none-any.whl (178.7 kB view details)

Uploaded Python 3

File details

Details for the file paramak-0.1.0.tar.gz.

File metadata

  • Download URL: paramak-0.1.0.tar.gz
  • Upload date:
  • Size: 106.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.9.0

File hashes

Hashes for paramak-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7dd0db190d20b16c7605c308a4d873d7c9a6d01843807c18c17c866a34c0e7c6
MD5 5c6d954a24d50621882dc7279a22106c
BLAKE2b-256 068be925955e301899cf13187cc62d87b20e011a9d20e155447f05e096ddc803

See more details on using hashes here.

File details

Details for the file paramak-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: paramak-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 178.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.9.0

File hashes

Hashes for paramak-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19517f3a6c20741b22c54e016466df8b2b14c2a97d222cb4acdef59f0c442bd2
MD5 844ea6c27ca66cf1e0b37b5b11823096
BLAKE2b-256 0ebd7f7d93baf133377c2bf920ad2552ae9e65a7502cc2c983998be314cce043

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page