From e23421bf3ec9702e3745103e45f1702dd38608d0 Mon Sep 17 00:00:00 2001 From: shimwell Date: Fri, 4 Oct 2024 16:27:50 +0100 Subject: [PATCH 1/5] trying 3.12 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ee18f4a..26be1350 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.11"] + python-version: ["3.12"] steps: - name: Install system packages From fcae44c96764d1468e8d173fb71059db494656eb Mon Sep 17 00:00:00 2001 From: shimwell Date: Fri, 4 Oct 2024 16:34:00 +0100 Subject: [PATCH 2/5] removed example from ci temp --- .github/workflows/ci.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26be1350..864c70e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,14 +42,3 @@ jobs: shell: bash -el {0} run: | pytest -v - 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_with_divertor.py - python examples/tokamak_minimal.py - python examples/tokamak_from_plasma_minimal.py - From 31f2eb2d1b5731e21081e342c016d0d21e536b9b Mon Sep 17 00:00:00 2001 From: shimwell Date: Fri, 4 Oct 2024 16:46:59 +0100 Subject: [PATCH 3/5] append instead of extend --- .github/workflows/ci.yml | 11 ++++++++ docs/usage_spherical_tokamak.rst | 23 ---------------- docs/usage_tokamak.rst | 23 ---------------- ...rical_tokamak_from_plasma_with_divertor.py | 2 +- examples/tokamak_from_plasma_with_divertor.py | 27 +++++++++---------- src/paramak/assemblies/spherical_tokamak.py | 2 +- src/paramak/assemblies/tokamak.py | 2 +- 7 files changed, 26 insertions(+), 64 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 864c70e0..26be1350 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,3 +42,14 @@ jobs: shell: bash -el {0} run: | pytest -v + 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_with_divertor.py + python examples/tokamak_minimal.py + python examples/tokamak_from_plasma_minimal.py + diff --git a/docs/usage_spherical_tokamak.rst b/docs/usage_spherical_tokamak.rst index 6c2c67d9..90c68d2b 100644 --- a/docs/usage_spherical_tokamak.rst +++ b/docs/usage_spherical_tokamak.rst @@ -1,26 +1,3 @@ -Usage -===== - -There are two main reactors to choose from, Tokamak and Spherical Tokamak. -These can be built with: -- A radial and vertical build -- A radial build and plasma elongation. - -The former gives the user more control of the size of components allowing reactor blankets to vary both radially and vertically. -The later allows reactors to be built with a minimal number of parameters. -In all cases it is possible to add additional components such as divertors, poloidal and toroidal magnets and any self made geometry as a CadQuery Workplane. -The reactors can be varied in terms of their radial build, vertical build, elongation and triangularity which gives a lot of variability. -These examples show how to make various reactors with and without different components, each example is minimal and aims to show a single feature, you will have to combine examples to make a complete model. - - - -.. toctree:: - :maxdepth: 3 - - usage-tokamak - usage-spherical-tokamak - - Spherical tokamak from plasma ----------------------------- diff --git a/docs/usage_tokamak.rst b/docs/usage_tokamak.rst index 391042cb..6e05aa9b 100644 --- a/docs/usage_tokamak.rst +++ b/docs/usage_tokamak.rst @@ -1,26 +1,3 @@ -Usage -===== - -There are two main reactors to choose from, Tokamak and Spherical Tokamak. -These can be built with: -- A radial and vertical build -- A radial build and plasma elongation. - -The former gives the user more control of the size of components allowing reactor blankets to vary both radially and vertically. -The later allows reactors to be built with a minimal number of parameters. -In all cases it is possible to add additional components such as divertors, poloidal and toroidal magnets and any self made geometry as a CadQuery Workplane. -The reactors can be varied in terms of their radial build, vertical build, elongation and triangularity which gives a lot of variability. -These examples show how to make various reactors with and without different components, each example is minimal and aims to show a single feature, you will have to combine examples to make a complete model. - - - -.. toctree:: - :maxdepth: 3 - - usage_tokamak - usage_spherical_tokamak - - Tokamak from plasma ------------------- diff --git a/examples/spherical_tokamak_from_plasma_with_divertor.py b/examples/spherical_tokamak_from_plasma_with_divertor.py index 09b45a96..d0101ec7 100644 --- a/examples/spherical_tokamak_from_plasma_with_divertor.py +++ b/examples/spherical_tokamak_from_plasma_with_divertor.py @@ -32,7 +32,7 @@ my_reactor.save("spherical_tokamak_from_plasma_with_divertor.step") print('written spherical_tokamak_from_plasma_with_divertor.step') -# vis.show(my_reactor) +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) diff --git a/examples/tokamak_from_plasma_with_divertor.py b/examples/tokamak_from_plasma_with_divertor.py index bf7e0065..a6b83d93 100644 --- a/examples/tokamak_from_plasma_with_divertor.py +++ b/examples/tokamak_from_plasma_with_divertor.py @@ -12,21 +12,18 @@ my_reactor = paramak.tokamak_from_plasma( radial_build=[ - [ - (paramak.LayerType.GAP, 10), - (paramak.LayerType.SOLID, 30), - (paramak.LayerType.SOLID, 50), - (paramak.LayerType.SOLID, 10), - (paramak.LayerType.SOLID, 120), - (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), - ], - # [(paramak.LayerType.GAP, 300), ("lower_divertor", 150)], + (paramak.LayerType.GAP, 10), + (paramak.LayerType.SOLID, 30), + (paramak.LayerType.SOLID, 50), + (paramak.LayerType.SOLID, 10), + (paramak.LayerType.SOLID, 120), + (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, diff --git a/src/paramak/assemblies/spherical_tokamak.py b/src/paramak/assemblies/spherical_tokamak.py index 9103b326..5b2ccd96 100644 --- a/src/paramak/assemblies/spherical_tokamak.py +++ b/src/paramak/assemblies/spherical_tokamak.py @@ -235,7 +235,7 @@ def spherical_tokamak( if len(extra_intersect_shapes)>0: all_shapes = [] for shape in inner_radial_build + blanket_layers: - all_shapes.extend(shape) + all_shapes.append(shape) # makes a union of the the radial build to use as a base for the intersect shapes reactor_compound=inner_radial_build[0] diff --git a/src/paramak/assemblies/tokamak.py b/src/paramak/assemblies/tokamak.py index 0a778c43..505ef437 100644 --- a/src/paramak/assemblies/tokamak.py +++ b/src/paramak/assemblies/tokamak.py @@ -262,7 +262,7 @@ def tokamak( if len(extra_intersect_shapes)>0: all_shapes = [] for shape in inner_radial_build + blanket_layers: - all_shapes.extend(shape) + all_shapes.append(shape) # makes a union of the the radial build to use as a base for the intersect shapes reactor_compound=inner_radial_build[0] From 8e14715d4c7b9f1fef9928a20ccbd4c3dbf6bf6c Mon Sep 17 00:00:00 2001 From: shimwell Date: Fri, 4 Oct 2024 16:49:04 +0100 Subject: [PATCH 4/5] remove vis --- examples/spherical_tokamak_from_plasma_with_divertor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/spherical_tokamak_from_plasma_with_divertor.py b/examples/spherical_tokamak_from_plasma_with_divertor.py index d0101ec7..09b45a96 100644 --- a/examples/spherical_tokamak_from_plasma_with_divertor.py +++ b/examples/spherical_tokamak_from_plasma_with_divertor.py @@ -32,7 +32,7 @@ my_reactor.save("spherical_tokamak_from_plasma_with_divertor.step") print('written spherical_tokamak_from_plasma_with_divertor.step') -vis.show(my_reactor) +# 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) From 366547311d065c7a19604755c28574488d1ef9e7 Mon Sep 17 00:00:00 2001 From: shimwell Date: Fri, 4 Oct 2024 17:03:06 +0100 Subject: [PATCH 5/5] added ipython --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b100d61b..57228ae4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,8 @@ docs = [ "numpy<=1.26.4", "mpmath", "sympy", - "scipy" + "scipy", + "ipython" ] [tool.black]