Skip to content

Commit

Permalink
find replace radial_builds
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Oct 1, 2024
1 parent 9ecfc66 commit 4a8c2b1
Show file tree
Hide file tree
Showing 15 changed files with 207 additions and 262 deletions.
152 changes: 73 additions & 79 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Tokamak from plasma

import paramak
result = paramak.tokamak_from_plasma(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 30),
(paramak.LayerType.SOLID, 50),
Expand All @@ -78,7 +78,7 @@ Tokamak from plasma
import paramak
result = paramak.tokamak_from_plasma(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 30),
(paramak.LayerType.SOLID, 50),
Expand Down Expand Up @@ -115,7 +115,7 @@ Spherical tokamak from plasma

import paramak
result = paramak.spherical_tokamak_from_plasma(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 20),
Expand All @@ -136,7 +136,7 @@ Spherical tokamak from plasma
import paramak
result = paramak.spherical_tokamak_from_plasma(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 20),
Expand Down Expand Up @@ -172,7 +172,7 @@ Tokamak
import paramak

result = paramak.tokamak(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 30),
(paramak.LayerType.SOLID, 50),
Expand Down Expand Up @@ -206,7 +206,7 @@ Tokamak
import paramak
result = paramak.tokamak(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 30),
(paramak.LayerType.SOLID, 50),
Expand Down Expand Up @@ -256,18 +256,16 @@ Spherical tokamak
import paramak

result = paramak.spherical_tokamak(
radial_builds=[
[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(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),
]
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(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),
],
vertical_build=[
(paramak.LayerType.SOLID, 15),
Expand All @@ -289,8 +287,7 @@ Spherical tokamak
import paramak
result = paramak.spherical_tokamak(
radial_builds=[
[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 10),
Expand All @@ -300,7 +297,6 @@ Spherical tokamak
(paramak.LayerType.SOLID, 10),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
]
],
vertical_build=[
(paramak.LayerType.SOLID, 15),
Expand Down Expand Up @@ -332,49 +328,51 @@ Reactor with divertor(s)
:width: 100%
:height: 600px

# makes a rectangle that overlaps the lower blanket under the plasma
# the intersection of this and the layers will form the lower divertor
points = [(300, -700), (300, 0), (400, 0), (400, -700)]
divertor_lower = Workplane('XZ', origin=(0,0,0)).polyline(points).close().revolve(180)
result = paramak.spherical_tokamak_from_plasma(
radial_builds=[
[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.GAP, 50),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
],
[(paramak.LayerType.GAP, 75), ("lower_divertor", 100)], # this divertor connects to the center column
[(paramak.LayerType.GAP, 120), ("upper_divertor", 100)], # this divertor has some blanket between the center colum and itself
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.GAP, 50),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
],
elongation=2,
triangularity=0.55,
rotation_angle=180,
extra_intersect_shapes=[divertor_lower]
).toCompound()


.. code-block:: python
# makes a rectangle that overlaps the lower blanket under the plasma
# the intersection of this and the layers will form the lower divertor
points = [(300, -700), (300, 0), (400, 0), (400, -700)]
divertor_lower = Workplane('XZ', origin=(0,0,0)).polyline(points).close().revolve(180)
result = paramak.spherical_tokamak_from_plasma(
radial_builds=[
[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.GAP, 50),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
],
[(paramak.LayerType.GAP, 75), ("lower_divertor", 100)], # this divertor connects to the center column
[(paramak.LayerType.GAP, 120), ("upper_divertor", 140)], # this divertor has some blanket between the center colum and itself
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.GAP, 50),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
],
elongation=2,
triangularity=0.55,
rotation_angle=180,
extra_intersect_shapes=[divertor_lower]
)
result.save('reactor.step')
Expand Down Expand Up @@ -415,7 +413,7 @@ Reactor with poloidal field coils
)

result = paramak.spherical_tokamak_from_plasma(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
Expand Down Expand Up @@ -458,7 +456,7 @@ Reactor with poloidal field coils
)
result = paramak.spherical_tokamak_from_plasma(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
Expand Down Expand Up @@ -506,7 +504,7 @@ Reactor with toroidal field coils
)

result = paramak.spherical_tokamak_from_plasma(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 70),
(paramak.LayerType.SOLID, 10),
(paramak.LayerType.SOLID, 10),
Expand Down Expand Up @@ -537,7 +535,7 @@ Reactor with toroidal field coils
)
result = paramak.spherical_tokamak_from_plasma(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 70),
(paramak.LayerType.SOLID, 10),
(paramak.LayerType.SOLID, 10),
Expand Down Expand Up @@ -573,7 +571,7 @@ Tokamak with negative triangularity
import paramak

result = paramak.tokamak(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 30),
(paramak.LayerType.SOLID, 50),
Expand Down Expand Up @@ -607,7 +605,7 @@ Tokamak with negative triangularity
import paramak
result = paramak.tokamak(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 30),
(paramak.LayerType.SOLID, 50),
Expand Down Expand Up @@ -656,18 +654,16 @@ Spherical tokamak with negative triangularity
import paramak

result = paramak.spherical_tokamak(
radial_builds=[
[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.GAP, 50),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 40),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
]
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.GAP, 50),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 40),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
],
vertical_build=[
(paramak.LayerType.SOLID, 15),
Expand All @@ -689,18 +685,16 @@ Spherical tokamak with negative triangularity
import paramak
result = paramak.spherical_tokamak(
radial_builds=[
[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.GAP, 50),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 10),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
]
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.GAP, 50),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 10),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
],
vertical_build=[
(paramak.LayerType.SOLID, 15),
Expand Down
22 changes: 10 additions & 12 deletions examples/spherical_tokamak_from_plasma_minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@
import paramak

my_reactor = paramak.spherical_tokamak_from_plasma(
radial_builds=[
[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.GAP, 50),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
]
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.GAP, 50),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
],
elongation=2,
triangularity=0.55,
Expand Down
34 changes: 19 additions & 15 deletions examples/spherical_tokamak_from_plasma_with_divertor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,35 @@
from example_util_functions import transport_particles_on_h5m_geometry

import paramak
from cadquery import Workplane, vis


# makes a rectangle that overlaps the lower blanket under the plasma
# the intersection of this and the layers will form the lower divertor
points = [(150, -700), (150, 0), (270, 0), (270, -700)]
divertor_lower = Workplane('XZ', origin=(0,0,0)).polyline(points).close().revolve(180)

my_reactor = paramak.spherical_tokamak_from_plasma(
radial_builds=[
[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.GAP, 50),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
],
[(paramak.LayerType.GAP, 75), ("lower_divertor", 100)], # this divertor connects to the center column
[(paramak.LayerType.GAP, 120), ("upper_divertor", 140)], # this divertor has some blanket between the center colum and itself
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.GAP, 50),
(paramak.LayerType.PLASMA, 300),
(paramak.LayerType.GAP, 60),
(paramak.LayerType.SOLID, 15),
(paramak.LayerType.SOLID, 60),
(paramak.LayerType.SOLID, 10),
],
elongation=2,
triangularity=0.55,
rotation_angle=180,
extra_intersect_shapes=[divertor_lower]
)
my_reactor.save("spherical_tokamak_from_plasma_with_divertor.step")
print('written spherical_tokamak_from_plasma_with_divertor.step')


vis.show(my_reactor)
# my_model = CadToDagmc()
# material_tags = ["mat1"] * 21 # the two divertors split the 3 blanket layers into 9 and the magnets also splt the blanket.
# my_model.add_cadquery_object(cadquery_object=my_reactor, material_tags=material_tags)
Expand Down
2 changes: 1 addition & 1 deletion examples/spherical_tokamak_from_plasma_with_pf_magnets.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


my_reactor = paramak.spherical_tokamak_from_plasma(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 50),
(paramak.LayerType.SOLID, 15),
Expand Down
Loading

0 comments on commit 4a8c2b1

Please sign in to comment.