Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added Princeton D toroidal field coil #341

Merged
merged 3 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ The purpose of Paramak is to provide geometry for parameter studies and therefor

Paramak produces [CadQuery](https://github.com/CadQuery/CadQuery) objects which can easily be saved to CAD files in several formats (STEP, STL, BRep) and also readily convertable to DAGMC h5m neutronics geometry using tools such as [Cad-to_DAGMC](https://github.com/fusion-energy/cad_to_dagmc).

:point_right: Please see the [Online documentation](https://fusion-energy.github.io/paramak) for installation, usage and API documentation.
:point_right: Please see the [online documentation](https://fusion-energy.github.io/paramak) for installation, usage and API documentation.
25 changes: 1 addition & 24 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,7 @@ These examples show how to make various reactors with and without different comp
.. toctree::
:maxdepth: 3

usage_vis
usage_tokamak
usage_spherical_tokamak


Visualization options
=====================

The reactors (cadquery.Assembly objects) and components (cadquery.Workplane objects) can be visualized in a number of ways.
First option is to export them to STEP, BREP or STL file then open the file with your favorite CAD software for example `FreeCAD <https://www.freecad.org/>`_.
See the `CadQuery documentation on saving <https://cadquery.readthedocs.io/en/latest/importexport.html#exporting-step>`_ for more information.
Other options include the built in visualization tools in CadQuery

.. code-block:: python

from cadquery.vis import show
show(result) # where result is the returned reactor or component object

or the jupyter_cadquery package which allows for interactive 3D visualization in a web browser.
or the jupyter_cadquery package which allows for interactive 3D visualization in a web browser.

.. code-block:: python

# pip install jupyter_cadquery
# might needed to downgrade pip with ... python -m pip install pip==24.0
from jupyter_cadquery import show
view = show(result) # where result is the returned reactor or component object
view.export_html("3d.html")
201 changes: 132 additions & 69 deletions docs/usage_spherical_tokamak.rst
Original file line number Diff line number Diff line change
@@ -1,61 +1,7 @@
Spherical Tokamak
=================

Spherical tokamak from plasma
-----------------------------

- The spherical_tokamak_from_plasma function provides a parametric tokamak shaped reactor.
- This is characterized by a blanket that only goes around the outboard sides of the plasma.
- This reactor requires few arguments to create as it keeps the vertical build of the blanket layers the same thickness as the radial build.


.. cadquery::
:gridsize: 0
:select: result
:color: #00cd00
:width: 100%
:height: 600px

import paramak
result = paramak.spherical_tokamak_from_plasma(
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 20),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 20),
(paramak.LayerType.SOLID, 120),
(paramak.LayerType.SOLID, 10),
],
elongation=2,
triangularity=0.55,
rotation_angle=90,
).toCompound()


.. code-block:: python

import paramak
result = paramak.spherical_tokamak_from_plasma(
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 20),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 20),
(paramak.LayerType.SOLID, 120),
(paramak.LayerType.SOLID, 10),
],
elongation=2,
triangularity=0.55,
rotation_angle=90,
)
result.save('reactor.step')



- This is characterized by a blanket that only goes around the outboard sides of the plasma and the center column has no inboard breeding.

Spherical tokamak
-----------------
Expand Down Expand Up @@ -133,8 +79,64 @@ Spherical tokamak

result.save(f"spherical_tokamak_minimal.step")

Reactor with divertor(s)
------------------------

Spherical tokamak from plasma
-----------------------------

- The spherical_tokamak_from_plasma function provides a parametric tokamak shaped reactor.
- This reactor requires minimal arguments to create as it keeps the vertical build of the blanket layers the same thickness as the radial build.


.. cadquery::
:gridsize: 0
:select: result
:color: #00cd00
:width: 100%
:height: 600px

import paramak
result = paramak.spherical_tokamak_from_plasma(
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 20),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 20),
(paramak.LayerType.SOLID, 120),
(paramak.LayerType.SOLID, 10),
],
elongation=2,
triangularity=0.55,
rotation_angle=90,
).toCompound()


.. code-block:: python

import paramak
result = paramak.spherical_tokamak_from_plasma(
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 20),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 20),
(paramak.LayerType.SOLID, 120),
(paramak.LayerType.SOLID, 10),
],
elongation=2,
triangularity=0.55,
rotation_angle=90,
)
result.save('reactor.step')


Spherical tokamak with divertor(s)
----------------------------------

- ll reactors support adding additional radial builds for the lower_divertor and or the upper_divertor.
- This example adds two divertors to a spherical_tokamak_from_plasma reactor but and other reactor would also work.
Expand Down Expand Up @@ -198,8 +200,8 @@ Reactor with divertor(s)
)
result.save('reactor.step')

Reactor with poloidal field coils
---------------------------------
Spherical tokamak with poloidal field coils
-------------------------------------------

- All reactors support adding a sequence of CadQuery shapes (e.g. workplanes) to the reactor using the extra_cut_shapes argument
- This example adds PF coils to a spherical_tokamak_from_plasma reactor but and other reactor would also work.
Expand Down Expand Up @@ -298,8 +300,8 @@ Reactor with poloidal field coils
result.save(f"spherical_tokamak_from_plasma_with_pf_magnets.step")


Reactor with toroidal field coils
---------------------------------
Spherical tokamak with toroidal field coils
-------------------------------------------

- In a similar way to adding poloidal field coils one can also add toroidal field coils by making use of the extra_cut_shapes argument.
- All reactors support adding a sequence of CadQuery shapes (e.g. workplanes) to the reactor using the extra_cut_shapes argument
Expand All @@ -316,7 +318,7 @@ Reactor with toroidal field coils

import paramak

tf = paramak.toroidal_field_coil_rectangle(
tf_style_1 = paramak.toroidal_field_coil_rectangle(
horizontal_start_point = (10, 520),
vertical_mid_point = (600, 0),
thickness = 50,
Expand All @@ -325,7 +327,7 @@ Reactor with toroidal field coils
azimuthal_placement_angles = [0, 30, 60, 90, 120, 150, 180],
)

result = paramak.spherical_tokamak_from_plasma(
result1 = paramak.spherical_tokamak_from_plasma(
radial_build=[
(paramak.LayerType.GAP, 70),
(paramak.LayerType.SOLID, 10),
Expand All @@ -340,14 +342,47 @@ Reactor with toroidal field coils
elongation=2.5,
rotation_angle=180,
triangularity=0.55,
extra_cut_shapes=[tf]
).toCompound()
extra_cut_shapes=[tf_style_1]
).toCompound().translate((700, 0, 0))

tf_style_2 = paramak.toroidal_field_coil_princeton_d(
r1=5,
r2=610,
azimuthal_placement_angles = [0, 30, 60, 90, 120, 150, 180],
thickness = 50,
distance = 40
)

result2 = paramak.spherical_tokamak_from_plasma(
radial_build=[
(paramak.LayerType.GAP, 70),
(paramak.LayerType.SOLID, 10),
(paramak.LayerType.SOLID, 10),
(paramak.LayerType.GAP, 50),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 10),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
],
elongation=2.5,
rotation_angle=180,
triangularity=0.55,
extra_cut_shapes=[tf_style_2]
).toCompound().translate((-700, 0, 0))

import cadquery as cq
result = cq.Assembly()
result.add(result1)
result.add(result2)
result = result.toCompound()


.. code-block:: python

import paramak

tf = paramak.toroidal_field_coil_rectangle(
tf_style_1 = paramak.toroidal_field_coil_rectangle(
horizontal_start_point = (10, 520),
vertical_mid_point = (600, 0),
thickness = 50,
Expand All @@ -357,6 +392,34 @@ Reactor with toroidal field coils
)

result = paramak.spherical_tokamak_from_plasma(
radial_build=[
(paramak.LayerType.GAP, 70),
(paramak.LayerType.SOLID, 10),
(paramak.LayerType.SOLID, 10),
(paramak.LayerType.GAP, 50),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 10),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
],
elongation=2.5,
rotation_angle=180,
triangularity=0.55,
extra_cut_shapes=[tf_style_1]
)

result.save(f"spherical_tokamak_with_rectangular_tf.step")

tf_style_2 = paramak.toroidal_field_coil_princeton_d(
r1=5,
r2=610,
azimuthal_placement_angles = [120, 150, 180],
thickness = 50,
distance = 40
)

result2 = paramak.spherical_tokamak_from_plasma(
radial_build=[
(paramak.LayerType.GAP, 70),
(paramak.LayerType.SOLID, 10),
Expand All @@ -374,7 +437,7 @@ Reactor with toroidal field coils
extra_cut_shapes=[tf]
)

result.save(f"spherical_tokamak_minimal.step")
result2.save(f"spherical_tokamak_with_princeton_tf.step")


Spherical tokamak with negative triangularity
Expand Down
Loading