Skip to content

Commit

Permalink
Merge pull request #336 from fusion-energy/divertor_done_without_radi…
Browse files Browse the repository at this point in the history
…al_build

partly working intersect
  • Loading branch information
shimwell authored Oct 4, 2024
2 parents 2540637 + 2a9f45b commit e4842a3
Show file tree
Hide file tree
Showing 19 changed files with 1,184 additions and 873 deletions.
689 changes: 8 additions & 681 deletions docs/usage.rst

Large diffs are not rendered by default.

475 changes: 475 additions & 0 deletions docs/usage_spherical_tokamak.rst

Large diffs are not rendered by default.

417 changes: 417 additions & 0 deletions docs/usage_tokamak.rst

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions examples/run_all_examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
python examples/example_util_functions.py
python examples/plasma.py
python examples/spherical_tokamak_from_plasma_minimal.py
python examples/spherical_tokamak_from_plasma_with_divertor.py
python examples/spherical_tokamak_from_plasma_with_pf_magnets_and_divertors.py
python examples/spherical_tokamak_from_plasma_with_pf_magnets.py
python examples/spherical_tokamak_from_plasma_with_tf_magnets.py
python examples/spherical_tokamak_minimal.py
python examples/tokamak_from_plasma_minimal.py
python examples/tokamak_from_plasma_with_divertor.py
python examples/tokamak_minimal.py
python examples/tokamak_with_pf_magnets.py
python examples/tokamak_with_pf_tf_magnets_divertor.py
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
10 changes: 5 additions & 5 deletions examples/spherical_tokamak_from_plasma_with_pf_magnets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

import paramak

add_extra_cut_shapes = []
extra_cut_shapes = []
for case_thickness, height, width, center_point in zip(
[10, 15, 15, 10], [20, 50, 50, 20], [20, 50, 50, 20],
[(500, 300), (560, 100), (560, -100), (500, -300)]
):
add_extra_cut_shapes.append(
extra_cut_shapes.append(
paramak.poloidal_field_coil(
height=height, width=width, center_point=center_point, rotation_angle=270
)
)
add_extra_cut_shapes.append(
extra_cut_shapes.append(
paramak.poloidal_field_coil_case(
coil_height=height,
coil_width=width,
Expand All @@ -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 All @@ -39,7 +39,7 @@
elongation=2,
triangularity=0.55,
rotation_angle=270,
add_extra_cut_shapes=add_extra_cut_shapes,
extra_cut_shapes=extra_cut_shapes,
)
my_reactor.save(f"spherical_tokamak_from_plasma_with_pf_magnets.step")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,24 @@
)
)


#TODO
# [(paramak.LayerType.GAP, 75), ("lower_divertor", 100)],
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)],
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=rotation_angle,
add_extra_cut_shapes=poloidal_field_coils,
extra_cut_shapes=poloidal_field_coils,
)
my_reactor.save(f"spherical_tokamak_from_plasma_with_pf_magnets_and_divertor.step")

Expand Down
4 changes: 2 additions & 2 deletions examples/spherical_tokamak_from_plasma_with_tf_magnets.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)

result = paramak.spherical_tokamak_from_plasma(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 70),
(paramak.LayerType.SOLID, 10),
(paramak.LayerType.SOLID, 10),
Expand All @@ -29,7 +29,7 @@
elongation=2.5,
rotation_angle=180,
triangularity=0.55,
add_extra_cut_shapes=[tf]
extra_cut_shapes=[tf]
)

result.save(f"spherical_tokamak_minimal.step")
Expand Down
22 changes: 10 additions & 12 deletions examples/spherical_tokamak_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(
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 Down
2 changes: 1 addition & 1 deletion examples/tokamak_from_plasma_minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import paramak

my_reactor = paramak.tokamak_from_plasma(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 30),
(paramak.LayerType.SOLID, 50),
Expand Down
15 changes: 12 additions & 3 deletions examples/tokamak_from_plasma_with_divertor.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@

from example_util_functions import transport_particles_on_h5m_geometry

from paramak.utils import create_wire_workplane_from_points
import paramak
from cadquery import vis, Workplane

# 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)


my_reactor = paramak.tokamak_from_plasma(
radial_builds=[
radial_build=[
[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 30),
Expand All @@ -19,14 +26,16 @@
(paramak.LayerType.SOLID, 120),
(paramak.LayerType.SOLID, 10),
],
[(paramak.LayerType.GAP, 300), ("lower_divertor", 150)],
# [(paramak.LayerType.GAP, 300), ("lower_divertor", 150)],
],
elongation=2,
triangularity=0.55,
rotation_angle=180,
extra_intersect_shapes=[divertor_lower]
)
my_reactor.save(f"tokamak_with_divertor.step")
print(f"Saved as tokamak_with_divertor.step")
# vis.show(my_reactor)

# from cad_to_dagmc import CadToDagmc
# my_model = CadToDagmc()
Expand Down
2 changes: 1 addition & 1 deletion examples/tokamak_minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import paramak

my_reactor = paramak.tokamak(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 30),
(paramak.LayerType.SOLID, 50),
Expand Down
10 changes: 5 additions & 5 deletions examples/tokamak_with_pf_magnets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

import paramak

add_extra_cut_shapes = []
extra_cut_shapes = []
for case_thickness, height, width, center_point in zip(
[10, 15, 15, 10], [20, 50, 50, 20], [20, 50, 50, 20],
[(700, 300), (800, 100), (800, -100), (700, -300)]
):
add_extra_cut_shapes.append(
extra_cut_shapes.append(
paramak.poloidal_field_coil(
height=height, width=width, center_point=center_point, rotation_angle=180
)
)
add_extra_cut_shapes.append(
extra_cut_shapes.append(
paramak.poloidal_field_coil_case(
coil_height=height,
coil_width=width,
Expand All @@ -24,7 +24,7 @@
)

my_reactor = paramak.tokamak(
radial_builds=[
radial_build=[
(paramak.LayerType.GAP, 10),
(paramak.LayerType.SOLID, 30),
(paramak.LayerType.SOLID, 50),
Expand All @@ -51,7 +51,7 @@
],
triangularity=0.55,
rotation_angle=180,
add_extra_cut_shapes=add_extra_cut_shapes,
extra_cut_shapes=extra_cut_shapes,
)

my_reactor.save(f"tokamak_minimal.step")
Expand Down
Loading

0 comments on commit e4842a3

Please sign in to comment.