From cbba3e7f9a956cfb12b6f340dd58906574edb70a Mon Sep 17 00:00:00 2001 From: Keir Date: Mon, 5 Jul 2021 14:25:52 +0100 Subject: [PATCH 01/12] updated docs --- docs/source/paramak.parametric_shapes.rst | 267 ++++++++++++++++++---- 1 file changed, 219 insertions(+), 48 deletions(-) diff --git a/docs/source/paramak.parametric_shapes.rst b/docs/source/paramak.parametric_shapes.rst index 811d305cb..5b538e244 100644 --- a/docs/source/paramak.parametric_shapes.rst +++ b/docs/source/paramak.parametric_shapes.rst @@ -6,10 +6,22 @@ Parametric Shapes RotateStraightShape() ^^^^^^^^^^^^^^^^^^^^^ -.. image:: https://user-images.githubusercontent.com/8583900/86246786-767a2080-bba3-11ea-90e7-22d816690caa.png - :width: 250 - :height: 200 - :align: center +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.RotateStraightShape( + points=[ + (400, 100), + (400, 200), + (600, 200), + (600, 100) + ], + rotation_angle = 180 + ) + + cadquery_object = my_component.solid .. automodule:: paramak.parametric_shapes.rotate_straight_shape :members: @@ -18,10 +30,26 @@ RotateStraightShape() RotateSplineShape() ^^^^^^^^^^^^^^^^^^^ -.. image:: https://user-images.githubusercontent.com/8583900/86246785-7548f380-bba3-11ea-90b7-03249be41a00.png - :width: 250 - :height: 240 - :align: center +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.RotateSplineShape( + points=[ + (500, 0), + (500, -20), + (400, -300), + (300, -300), + (400, 0), + (300, 300), + (400, 300), + (500, 20), + ], + rotation_angle = 180 + ) + + cadquery_object = my_component.solid .. automodule:: paramak.parametric_shapes.rotate_spline_shape :members: @@ -30,10 +58,26 @@ RotateSplineShape() RotateMixedShape() ^^^^^^^^^^^^^^^^^^ -.. image:: https://user-images.githubusercontent.com/8583900/86258771-17240c80-bbb3-11ea-990f-e87de26b1589.png - :width: 250 - :height: 230 - :align: center +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.RotateMixedShape( + points=[ + (100, 0, 'straight'), + (200, 0, 'circle'), + (250, 50, 'circle'), + (200, 100, 'straight'), + (150, 100, 'spline'), + (140, 75, 'spline'), + (110, 45, 'spline'), + ], + rotation_angle = 180 + ) + + + cadquery_object = my_component.solid .. automodule:: paramak.parametric_shapes.rotate_mixed_shape :members: @@ -42,10 +86,18 @@ RotateMixedShape() RotateCircleShape() ^^^^^^^^^^^^^^^^^^^ -.. image:: https://user-images.githubusercontent.com/56687624/98713427-868ae380-237f-11eb-87af-cf6b5fe032b2.png - :width: 250 - :height: 200 - :align: center +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.RotateCircleShape( + points=[(50, 0)], + radius=5, + rotation_angle=180 + ) + + cadquery_object = my_component.solid .. automodule:: paramak.parametric_shapes.rotate_circle_shape :members: @@ -54,10 +106,24 @@ RotateCircleShape() ExtrudeStraightShape() ^^^^^^^^^^^^^^^^^^^^^^ -.. image:: https://user-images.githubusercontent.com/8583900/86246776-724e0300-bba3-11ea-91c9-0fd239225206.png - :width: 200 - :height: 270 - :align: center +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.ExtrudeStraightShape( + points=[ + (300, -300), + (400, 0), + (300, 300), + (400, 300), + (500, 0), + (400, -300), + ], + distance=200 + ) + + cadquery_object = my_component.solid .. automodule:: paramak.parametric_shapes.extruded_straight_shape :members: @@ -66,10 +132,27 @@ ExtrudeStraightShape() ExtrudeSplineShape() ^^^^^^^^^^^^^^^^^^^^ -.. image:: https://user-images.githubusercontent.com/56687624/98713431-87bc1080-237f-11eb-9075-01bca99b7018.png - :width: 200 - :height: 280 - :align: center +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.ExtrudeSplineShape( + points=[ + (500, 0), + (500, -20), + (400, -300), + (300, -300), + (400, 0), + (300, 300), + (400, 300), + (500, 20), + ], + distance=200, + + ) + + cadquery_object = my_component.solid .. automodule:: paramak.parametric_shapes.extruded_spline_shape :members: @@ -78,10 +161,25 @@ ExtrudeSplineShape() ExtrudeMixedShape() ^^^^^^^^^^^^^^^^^^^ -.. image:: https://user-images.githubusercontent.com/8583900/86261239-34a6a580-bbb6-11ea-812c-ac6fa6a8f0e2.png - :width: 200 - :height: 200 - :align: center +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.ExtrudeMixedShape( + points=[ + (100, 0, 'straight'), + (200, 0, 'circle'), + (250, 50, 'circle'), + (200, 100, 'straight'), + (150, 100, 'spline'), + (140, 75, 'spline'), + (110, 45, 'spline'), + ], + distance=200 + ) + + cadquery_object = my_component.solid .. automodule:: paramak.parametric_shapes.extruded_mixed_shape :members: @@ -90,10 +188,19 @@ ExtrudeMixedShape() ExtrudeCircleShape() ^^^^^^^^^^^^^^^^^^^^ -.. image:: https://user-images.githubusercontent.com/8583900/86246768-6feba900-bba3-11ea-81a8-0d77a843b943.png - :width: 250 - :height: 180 - :align: center +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.ExtrudeCircleShape( + points=[(50, 0)], + radius=5, + distance=15 + ) + + + cadquery_object = my_component.solid .. automodule:: paramak.parametric_shapes.extruded_circle_shape :members: @@ -102,10 +209,26 @@ ExtrudeCircleShape() SweepStraightShape() ^^^^^^^^^^^^^^^^^^^^ -.. image:: https://user-images.githubusercontent.com/56687624/98713447-8c80c480-237f-11eb-8615-c090e93138f6.png - :width: 300 - :height: 230 - :align: center +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.SweepStraightShape( + points=[ + (500, 0), + (500, -20), + (400, -300), + (300, -300), + (400, 0), + (300, 300), + (400, 300), + (500, 20), + ], + rotation_angle = 180 + ) + + cadquery_object = my_component.solid .. automodule:: paramak.parametric_shapes.sweep_straight_shape :members: @@ -114,10 +237,26 @@ SweepStraightShape() SweepSplineShape() ^^^^^^^^^^^^^^^^^^ -.. image:: https://user-images.githubusercontent.com/56687624/98713443-8b4f9780-237f-11eb-83bb-38ca7f222073.png - :width: 300 - :height: 230 - :align: center +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.SweepSplineShape( + points=[ + (500, 0), + (500, -20), + (400, -300), + (300, -300), + (400, 0), + (300, 300), + (400, 300), + (500, 20), + ], + rotation_angle = 180 + ) + + cadquery_object = my_component.solid .. automodule:: paramak.parametric_shapes.sweep_spline_shape :members: @@ -126,10 +265,26 @@ SweepSplineShape() SweepMixedShape() ^^^^^^^^^^^^^^^^^ -.. image:: https://user-images.githubusercontent.com/56687624/98713440-8a1e6a80-237f-11eb-9eed-12b9d7731090.png - :width: 300 - :height: 230 - :align: center +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.SweepMixedShape( + points=[ + (500, 0), + (500, -20), + (400, -300), + (300, -300), + (400, 0), + (300, 300), + (400, 300), + (500, 20), + ], + rotation_angle = 180 + ) + + cadquery_object = my_component.solid .. automodule:: paramak.parametric_shapes.sweep_mixed_shape :members: @@ -138,10 +293,26 @@ SweepMixedShape() SweepCircleShape() ^^^^^^^^^^^^^^^^^^ -.. image:: https://user-images.githubusercontent.com/56687624/98713436-88ed3d80-237f-11eb-99cd-27dcb4f313b1.png - :width: 300 - :height: 230 - :align: center +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.SweepCircleShape( + points=[ + (500, 0), + (500, -20), + (400, -300), + (300, -300), + (400, 0), + (300, 300), + (400, 300), + (500, 20), + ], + rotation_angle = 180 + ) + + cadquery_object = my_component.solid .. automodule:: paramak.parametric_shapes.sweep_circle_shape :members: From 350441dc37f4557212acc25502d56a4850fe999d Mon Sep 17 00:00:00 2001 From: Mate Date: Mon, 5 Jul 2021 14:25:53 +0100 Subject: [PATCH 02/12] added 3D renders --- docs/source/paramak.parametric_components.rst | 149 ++++++++++++++++++ 1 file changed, 149 insertions(+) diff --git a/docs/source/paramak.parametric_components.rst b/docs/source/paramak.parametric_components.rst index 1775f077f..0c5603a80 100644 --- a/docs/source/paramak.parametric_components.rst +++ b/docs/source/paramak.parametric_components.rst @@ -37,6 +37,21 @@ BlanketConstantThicknessArcH() BlanketConstantThicknessArcV() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.BlanketConstantThicknessArcV( + inner_lower_point=(300, -200), + inner_mid_point=(500, 0), + inner_upper_point=(300, 200), + thickness=100, + rotation_angle=180 + ) + + cadquery_object = my_component.solid + |BlanketConstantThicknessArcVstp| |BlanketConstantThicknessArcVsvg| .. |BlanketConstantThicknessArcVstp| image:: https://user-images.githubusercontent.com/8583900/86365020-dee30380-bc70-11ea-8258-5e591c6c3235.png @@ -67,6 +82,19 @@ BlanketCutterParallels() BlanketCutterStar() ^^^^^^^^^^^^^^^^^^^ +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.BlanketCutterStar( + height=2000, + width=2000, + distance=100 + ) + + cadquery_object = my_component.solid + |BlanketCutterStarstp| |BlanketCutterStarsvg| .. |BlanketCutterStarstp| image:: https://user-images.githubusercontent.com/8583900/97103699-0178ac80-16a6-11eb-8e5a-ec3575d265fe.png @@ -82,6 +110,21 @@ BlanketCutterStar() BlanketFP() ^^^^^^^^^^^ +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.BlanketFP( + thickness=100, + stop_angle=-80, + start_angle=250, + offset_from_plasma=30, + rotation_angle=180 + ) + + cadquery_object = my_component.solid + |BlanketFPstp| |BlanketFPsvg| .. |BlanketFPstp| image:: https://user-images.githubusercontent.com/8583900/87254778-fe520b80-c47c-11ea-845f-470991d74874.png @@ -97,6 +140,20 @@ BlanketFP() BlanketFPPoloidalSegments() ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.PoloidalSegments( + number_of_segments=10, + center_point=(500, 50), + rotation_angle=180 + ) + + cadquery_object = my_component.solid + + |BlanketFPPoloidalSegmentsstp| |BlanketFPPoloidalSegmentssvg| .. |BlanketFPPoloidalSegmentsstp| image:: https://user-images.githubusercontent.com/8583900/98735027-af6ca200-239a-11eb-9a59-4a570f91a1fc.png @@ -112,6 +169,20 @@ BlanketFPPoloidalSegments() CenterColumnShieldCylinder() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.CenterColumnShieldCylinder( + inner_radius=80, + outer_radius=100, + height=300, + rotation_angle=90, + ) + + cadquery_object = my_component.solid + |CenterColumnShieldCylinderstp| |CenterColumnShieldCylindersvg| .. |CenterColumnShieldCylinderstp| image:: https://user-images.githubusercontent.com/56687624/86241438-caccd280-bb9a-11ea-9548-b199759a6dbc.png @@ -126,6 +197,21 @@ CenterColumnShieldCylinder() CenterColumnShieldHyperbola() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.CenterColumnShieldHyperbola( + inner_radius=50, + mid_radius=75, + outer_radius=100, + height=300, + rotation_angle=90 + ) + + cadquery_object = my_component.solid + |CenterColumnShieldHyperbolastp| |CenterColumnShieldHyperbolasvg| .. |CenterColumnShieldHyperbolastp| image:: https://user-images.githubusercontent.com/56687624/86241456-d0c2b380-bb9a-11ea-9728-88fe4081345f.png @@ -140,6 +226,22 @@ CenterColumnShieldHyperbola() CenterColumnShieldFlatTopHyperbola() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.CenterColumnShieldFlatTopHyperbola( + inner_radius=50, + mid_radius=75, + outer_radius=100, + arc_height=220, + height=300, + rotation_angle=90 + ) + + cadquery_object = my_component.solid + |CenterColumnShieldFlatTopHyperbolastp| |CenterColumnShieldFlatTopHyperbolasvg| .. |CenterColumnShieldFlatTopHyperbolastp| image:: https://user-images.githubusercontent.com/56687624/86241446-cdc7c300-bb9a-11ea-8310-d54397338da8.png @@ -154,6 +256,22 @@ CenterColumnShieldFlatTopHyperbola() CenterColumnShieldFlatTopCircular() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.CenterColumnShieldFlatTopCircular( + inner_radius=50, + mid_radius=75, + outer_radius=100, + arc_height=220, + height=300, + rotation_angle=90 + ) + + cadquery_object = my_component.solid + |CenterColumnShieldFlatTopCircularstp| |CenterColumnShieldFlatTopCircularsvg| .. |CenterColumnShieldFlatTopCircularstp| image:: https://user-images.githubusercontent.com/56687624/86241446-cdc7c300-bb9a-11ea-8310-d54397338da8.png @@ -168,6 +286,21 @@ CenterColumnShieldFlatTopCircular() CenterColumnShieldPlasmaHyperbola() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.CenterColumnShieldPlasmaHyperbola( + inner_radius=150, + mid_offset=50, + edge_offset=40, + height=800, + rotation_angle=90 + ) + + cadquery_object = my_component.solid + .. image:: https://user-images.githubusercontent.com/56687624/86241464-d3bda400-bb9a-11ea-83b4-a3ff0bf630c4.png :width: 180px :align: center @@ -179,6 +312,22 @@ CenterColumnShieldPlasmaHyperbola() CoolantChannelRingStraight() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. cadquery:: + :select: cadquery_object + :gridsize: 0 + + import paramak + my_component = paramak.CoolantChannelRingStraight( + height=200, + channel_radius=10, + ring_radius=70, + number_of_coolant_channels=8, + workplane="XY", + rotation_axis="Z", + ) + + cadquery_object = my_component.solid + |CoolantChannelRingStraightallstp| |CoolantChannelRingStraightsvg| |CoolantChannelRingStraightstp| .. |CoolantChannelRingStraightallstp| image:: https://user-images.githubusercontent.com/56687624/99049969-6467b000-258f-11eb-93b2-73e533b366c0.png From 050fff229d330aa58343fe55492397eca3e53dd2 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Mon, 5 Jul 2021 14:59:46 +0100 Subject: [PATCH 03/12] using token instead of user/pass --- .github/workflows/python-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index b27c72c00..c52a302e7 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -26,8 +26,8 @@ jobs: pip install setuptools wheel twine - name: Build and publish env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} # TODO change to token - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} run: | python setup.py sdist bdist_wheel twine upload dist/* From ca4a0bf388f8cc24d0da7debbaff8134cdba1f83 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Mon, 5 Jul 2021 15:03:17 +0100 Subject: [PATCH 04/12] version bump --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d8be00e25..57d0cb34a 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="paramak", - version="0.2.5", + version="0.2.6", author="The Paramak Development Team", author_email="mail@jshimwell.com", description="Create 3D fusion reactor CAD models based on input parameters", From 775821e7116994dd21805ed865da1dc36088e1d7 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Mon, 5 Jul 2021 21:52:06 +0100 Subject: [PATCH 05/12] moved neutronics examples to paramak neutronics --- .../ball_reactor.ipynb | 108 ----- .../ball_reactor_minimal.ipynb | 101 ----- .../ball_reactor_source_plot.ipynb | 153 ------- .../center_column_study_reactor.ipynb | 113 ----- .../center_column_study_reactor_minimal.ipynb | 98 ----- .../component_based_mesh_simulation.py | 47 -- .../component_based_parameter_study.ipynb | 110 ----- .../dagmc_logo.ipynb | 407 ------------------ .../heating_on_unstructured_mesh_shape.py | 23 - .../make_unstructured_mesh.py | 139 ------ .../openmc_logo_example.ipynb | 181 -------- .../segmented_blanket_ball_reactor.py | 250 ----------- .../shape_with_gas_production.py | 50 --- .../shape_with_spectra_cell_tally.py | 114 ----- .../submersion_reactor.ipynb | 152 ------- .../submersion_reactor_minimal.py | 66 --- .../text_example.ipynb | 84 ---- 17 files changed, 2196 deletions(-) delete mode 100644 examples/example_neutronics_simulations/ball_reactor.ipynb delete mode 100644 examples/example_neutronics_simulations/ball_reactor_minimal.ipynb delete mode 100644 examples/example_neutronics_simulations/ball_reactor_source_plot.ipynb delete mode 100644 examples/example_neutronics_simulations/center_column_study_reactor.ipynb delete mode 100644 examples/example_neutronics_simulations/center_column_study_reactor_minimal.ipynb delete mode 100644 examples/example_neutronics_simulations/component_based_mesh_simulation.py delete mode 100644 examples/example_neutronics_simulations/component_based_parameter_study.ipynb delete mode 100644 examples/example_neutronics_simulations/dagmc_logo.ipynb delete mode 100644 examples/example_neutronics_simulations/heating_on_unstructured_mesh_shape.py delete mode 100644 examples/example_neutronics_simulations/make_unstructured_mesh.py delete mode 100644 examples/example_neutronics_simulations/openmc_logo_example.ipynb delete mode 100644 examples/example_neutronics_simulations/segmented_blanket_ball_reactor.py delete mode 100644 examples/example_neutronics_simulations/shape_with_gas_production.py delete mode 100644 examples/example_neutronics_simulations/shape_with_spectra_cell_tally.py delete mode 100644 examples/example_neutronics_simulations/submersion_reactor.ipynb delete mode 100644 examples/example_neutronics_simulations/submersion_reactor_minimal.py delete mode 100644 examples/example_neutronics_simulations/text_example.ipynb diff --git a/examples/example_neutronics_simulations/ball_reactor.ipynb b/examples/example_neutronics_simulations/ball_reactor.ipynb deleted file mode 100644 index be32cff5d..000000000 --- a/examples/example_neutronics_simulations/ball_reactor.ipynb +++ /dev/null @@ -1,108 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This example makes a reactor geometry and a neutronics model. A homogenised material made of enriched lithium lead and eurofer is being used as the blanket material for this simulation in order to demonstrate the use of more complex materials." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import neutronics_material_maker as nmm\n", - "import openmc\n", - "import paramak\n", - "\n", - "# makes the 3d geometry\n", - "my_reactor = paramak.BallReactor(\n", - " inner_bore_radial_thickness=1,\n", - " inboard_tf_leg_radial_thickness=30,\n", - " center_column_shield_radial_thickness=60,\n", - " divertor_radial_thickness=50,\n", - " inner_plasma_gap_radial_thickness=30,\n", - " plasma_radial_thickness=300,\n", - " outer_plasma_gap_radial_thickness=30,\n", - " firstwall_radial_thickness=3,\n", - " blanket_radial_thickness=100,\n", - " blanket_rear_wall_radial_thickness=3,\n", - " elongation=2.75,\n", - " triangularity=0.5,\n", - " number_of_tf_coils=16,\n", - " rotation_angle=359.9, # when using trelis method this can be set to 360\n", - ")\n", - "\n", - "# method is set to Trelis or Cubit by default to avoid overlaps in the geometry\n", - "# pymoab is used as it is open source and can be tested in the CI\n", - "# if you have Trelis or Cubit then this line can be deleted\n", - "my_reactor.method='pymoab'\n", - "\n", - "# makes a homogenised material for the blanket from lithium lead and\n", - "# eurofer\n", - "blanket_material = nmm.Material.from_mixture(\n", - " fracs=[0.8, 0.2],\n", - " materials=[\n", - " nmm.Material.from_library(\n", - " name='Pb842Li158',\n", - " enrichment=90,\n", - " temperature=500),\n", - " nmm.Material.from_library(name='eurofer')\n", - " ])\n", - "\n", - "source = openmc.Source()\n", - "# sets the location of the source to x=0 y=0 z=0\n", - "source.space = openmc.stats.Point((my_reactor.major_radius, 0, 0))\n", - "# sets the direction to isotropic\n", - "source.angle = openmc.stats.Isotropic()\n", - "# sets the energy distribution to 100% 14MeV neutrons\n", - "source.energy = openmc.stats.Discrete([14e6], [1])\n", - "\n", - "# makes the neutronics material\n", - "neutronics_model = paramak.NeutronicsModel(\n", - " geometry=my_reactor,\n", - " source=source,\n", - " materials={\n", - " 'inboard_tf_coils_mat': 'copper',\n", - " 'center_column_shield_mat': 'WC',\n", - " 'divertor_mat': 'eurofer',\n", - " 'firstwall_mat': 'eurofer',\n", - " 'blanket_mat': blanket_material, # use of homogenised material\n", - " 'blanket_rear_wall_mat': 'eurofer'},\n", - " cell_tallies=['TBR'],\n", - " simulation_batches=2,\n", - " simulation_particles_per_batch=10, # this will need increasing to obtain accurate results\n", - ")\n", - "\n", - "# starts the neutronics simulation\n", - "neutronics_model.simulate()\n", - "\n", - "# prints the results to screen\n", - "print('TBR', neutronics_model.results['TBR'])" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.3" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/examples/example_neutronics_simulations/ball_reactor_minimal.ipynb b/examples/example_neutronics_simulations/ball_reactor_minimal.ipynb deleted file mode 100644 index e3da51869..000000000 --- a/examples/example_neutronics_simulations/ball_reactor_minimal.ipynb +++ /dev/null @@ -1,101 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This is a minimal example that obtains the TBR (Tritium Breeding Ratio) for a parametric ball reactor" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import openmc\n", - "import paramak\n", - "\n", - "\n", - "# makes the 3d geometry from input parameters\n", - "my_reactor = paramak.BallReactor(\n", - " inner_bore_radial_thickness=50,\n", - " inboard_tf_leg_radial_thickness=200,\n", - " center_column_shield_radial_thickness=50,\n", - " divertor_radial_thickness=50,\n", - " inner_plasma_gap_radial_thickness=50,\n", - " plasma_radial_thickness=100,\n", - " outer_plasma_gap_radial_thickness=50,\n", - " firstwall_radial_thickness=1,\n", - " blanket_radial_thickness=100,\n", - " blanket_rear_wall_radial_thickness=10,\n", - " elongation=2,\n", - " triangularity=0.55,\n", - " number_of_tf_coils=16,\n", - " rotation_angle=359.9, # when using trelis method this can be set to 360\n", - ")\n", - "\n", - "# method is set to Trelis or Cubit by default to avoid overlaps in the geometry\n", - "# pymoab is used as it is open source and can be tested in the CI\n", - "# if you have Trelis or Cubit then this line can be deleted\n", - "my_reactor.method='pymoab'\n", - "\n", - "source = openmc.Source()\n", - "# sets the location of the source to x=0 y=0 z=0\n", - "source.space = openmc.stats.Point((my_reactor.major_radius, 0, 0))\n", - "# sets the direction to isotropic\n", - "source.angle = openmc.stats.Isotropic()\n", - "# sets the energy distribution to 100% 14MeV neutrons\n", - "source.energy = openmc.stats.Discrete([14e6], [1])\n", - "\n", - "# makes the neutronics model from the geometry and material allocations\n", - "neutronics_model = paramak.NeutronicsModel(\n", - " geometry=my_reactor,\n", - " source=source,\n", - " materials={\n", - " 'inboard_tf_coils_mat': 'eurofer',\n", - " 'center_column_shield_mat': 'eurofer',\n", - " 'divertor_mat': 'eurofer',\n", - " 'firstwall_mat': 'eurofer',\n", - " 'blanket_rear_wall_mat': 'eurofer',\n", - " 'blanket_mat': 'Li4SiO4'},\n", - " cell_tallies=['TBR', 'heating'],\n", - " simulation_batches=2,\n", - " simulation_particles_per_batch=10, # this will need increasing to obtain accurate results\n", - ")\n", - "\n", - "# simulate the neutronics model\n", - "neutronics_model.simulate()\n", - "print(neutronics_model.results)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.3" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/examples/example_neutronics_simulations/ball_reactor_source_plot.ipynb b/examples/example_neutronics_simulations/ball_reactor_source_plot.ipynb deleted file mode 100644 index 0226bafcb..000000000 --- a/examples/example_neutronics_simulations/ball_reactor_source_plot.ipynb +++ /dev/null @@ -1,153 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This example makes a reactor geometry and a neutronics model. A homogenised material made of enriched lithium lead and eurofer is being used as the blanket material for this simulation in order to demonstrate the use of more complex materials." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import neutronics_material_maker as nmm\n", - "import openmc\n", - "import paramak\n", - "\n", - "\n", - "# makes the 3d geometry\n", - "my_reactor = paramak.BallReactor(\n", - " inner_bore_radial_thickness=10,\n", - " inboard_tf_leg_radial_thickness=30,\n", - " center_column_shield_radial_thickness=60,\n", - " divertor_radial_thickness=150,\n", - " inner_plasma_gap_radial_thickness=30,\n", - " plasma_radial_thickness=300,\n", - " outer_plasma_gap_radial_thickness=30,\n", - " firstwall_radial_thickness=30,\n", - " blanket_radial_thickness=50,\n", - " blanket_rear_wall_radial_thickness=30,\n", - " elongation=2,\n", - " triangularity=0.55,\n", - " outboard_tf_coil_radial_thickness=100,\n", - " outboard_tf_coil_poloidal_thickness=50,\n", - " rotation_angle=90,\n", - ")\n", - "\n", - "# method is set to Trelis or Cubit by default to avoid overlaps in the geometry\n", - "# pymoab is used as it is open source and can be tested in the CI\n", - "# if you have Trelis or Cubit then this line can be deleted\n", - "my_reactor.method='pymoab'\n", - "\n", - "my_reactor.show()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "source = openmc.Source()\n", - "radius = openmc.stats.Discrete([300], [1]) # at the major radius\n", - "z_values = openmc.stats.Discrete([0], [1]) # middle of the plasma (vertically)\n", - "angle = openmc.stats.Uniform(a=0., b=2 * 3.14159265359) # 360 degrees\n", - "source.space = openmc.stats.CylindricalIndependent(\n", - " r=radius,\n", - " phi=angle,\n", - " z=z_values,\n", - " origin=(0.0, 0.0, 0.0)\n", - ")\n", - "source.angle = openmc.stats.Isotropic()\n", - "source.energy = openmc.stats.Discrete([14_060_000], [1])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# makes the neutronics material\n", - "neutronics_model = paramak.NeutronicsModel(\n", - " geometry=my_reactor,\n", - " source=source,\n", - " materials={\n", - " 'inboard_tf_coils_mat': 'copper',\n", - " 'center_column_shield_mat': 'WC',\n", - " 'divertor_mat': 'eurofer',\n", - " 'firstwall_mat': 'eurofer',\n", - " 'blanket_mat': 'eurofer',\n", - " 'blanket_rear_wall_mat': 'eurofer'},\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# exports the geometry and source in 2d (RZ) viewplane where R stands for\n", - "# radius\n", - "neutronics_model.export_html(\n", - " filename='2d_source.html',\n", - " view_plane='RZ',\n", - " number_of_source_particles=100\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# exports the geometry and source in 3d (XYZ) viewplane\n", - "neutronics_model.export_html(\n", - " filename='3d_source.html',\n", - " view_plane='XYZ',\n", - " number_of_source_particles=100\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.3" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/examples/example_neutronics_simulations/center_column_study_reactor.ipynb b/examples/example_neutronics_simulations/center_column_study_reactor.ipynb deleted file mode 100644 index d5b3af0ff..000000000 --- a/examples/example_neutronics_simulations/center_column_study_reactor.ipynb +++ /dev/null @@ -1,113 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "\"\"\"This example makes a reactor geometry and a neutronics model, the addition\n", - "of a Python for loop allow a parameter sweep of the neutronics results for\n", - "different geometries. The distance between the plasma and center column is\n", - "varried while simulating the impact on the heat depositied in the center\n", - "column.\"\"\"\n", - "\n", - "import matplotlib.pyplot as plt\n", - "import openmc\n", - "import paramak\n", - "\n", - "\n", - "total_heats_in_MW = []\n", - "plasma_to_center_column_gaps = []\n", - "\n", - "# this will take a few mins to perform 3 simulations at\n", - "for plasma_to_center_column_gap in [50, 100, 150]:\n", - "\n", - " # makes the 3d geometry\n", - " my_reactor = paramak.CenterColumnStudyReactor(\n", - " inner_bore_radial_thickness=20,\n", - " inboard_tf_leg_radial_thickness=50,\n", - " center_column_shield_radial_thickness_mid=50,\n", - " center_column_shield_radial_thickness_upper=100,\n", - " inboard_firstwall_radial_thickness=2,\n", - " divertor_radial_thickness=100,\n", - " inner_plasma_gap_radial_thickness=plasma_to_center_column_gap,\n", - " plasma_radial_thickness=200,\n", - " outer_plasma_gap_radial_thickness=90,\n", - " elongation=2.75,\n", - " triangularity=0.5,\n", - " plasma_gap_vertical_thickness=40,\n", - " center_column_arc_vertical_thickness=520,\n", - " rotation_angle=360\n", - " )\n", - " \n", - " # method is set to Trelis or Cubit by default to avoid overlaps in the geometry\n", - " # pymoab is used as it is open source and can be tested in the CI\n", - " # if you have Trelis or Cubit then this line can be deleted\n", - " my_reactor.method='pymoab'\n", - "\n", - " source = openmc.Source()\n", - " # sets the location of the source to x=0 y=0 z=0\n", - " source.space = openmc.stats.Point((my_reactor.major_radius, 0, 0))\n", - " # sets the direction to isotropic\n", - " source.angle = openmc.stats.Isotropic()\n", - " # sets the energy distribution to 100% 14MeV neutrons\n", - " source.energy = openmc.stats.Discrete([14e6], [1])\n", - "\n", - " # makes the neutronics model and assigns basic materials to each\n", - " # component\n", - " neutronics_model = paramak.NeutronicsModel(\n", - " geometry=my_reactor,\n", - " source=source,\n", - " materials={\n", - " 'DT_plasma': 'DT_plasma',\n", - " 'inboard_tf_coils_mat': 'eurofer',\n", - " 'center_column_shield_mat': 'eurofer',\n", - " 'divertor_mat': 'eurofer',\n", - " 'firstwall_mat': 'eurofer',\n", - " 'blanket_mat': 'Li4SiO4'},\n", - " cell_tallies=['heating'],\n", - " simulation_batches=2,\n", - " simulation_particles_per_batch=10, # this will need increasing to obtain accurate results\n", - " )\n", - "\n", - " # starts the neutronics simulation\n", - " neutronics_model.simulate()\n", - "\n", - " # converts the results to mega watts\n", - " total_heat_in_MW = neutronics_model.results['firstwall_mat_heating']['Watts']['result'] / 1e6\n", - "\n", - " # adds the results and inputs to a list\n", - " total_heats_in_MW.append(total_heat_in_MW)\n", - " plasma_to_center_column_gaps.append(plasma_to_center_column_gap)\n", - "\n", - "# plots the results\n", - "plt.scatter(plasma_to_center_column_gaps, total_heats_in_MW)\n", - "plt.xlabel('plasma_to_center_column_gap (cm)')\n", - "plt.ylabel('Heat on the inboard (MW)')\n", - "plt.show()" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.3" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/examples/example_neutronics_simulations/center_column_study_reactor_minimal.ipynb b/examples/example_neutronics_simulations/center_column_study_reactor_minimal.ipynb deleted file mode 100644 index ac5a14c28..000000000 --- a/examples/example_neutronics_simulations/center_column_study_reactor_minimal.ipynb +++ /dev/null @@ -1,98 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "\"\"\"This is a minimal example that obtains the center column heating for a\n", - "parametric reactor.\"\"\"\n", - "\n", - "import openmc\n", - "import paramak\n", - "\n", - "\n", - "# makes the 3d geometry\n", - "my_reactor = paramak.CenterColumnStudyReactor(\n", - " inner_bore_radial_thickness=20,\n", - " inboard_tf_leg_radial_thickness=50,\n", - " center_column_shield_radial_thickness_mid=50,\n", - " center_column_shield_radial_thickness_upper=100,\n", - " inboard_firstwall_radial_thickness=20,\n", - " divertor_radial_thickness=100,\n", - " inner_plasma_gap_radial_thickness=80,\n", - " plasma_radial_thickness=200,\n", - " outer_plasma_gap_radial_thickness=90,\n", - " elongation=2.75,\n", - " triangularity=0.5,\n", - " plasma_gap_vertical_thickness=40,\n", - " center_column_arc_vertical_thickness=520,\n", - " rotation_angle=360\n", - ")\n", - "\n", - "# method is set to Trelis or Cubit by default to avoid overlaps in the geometry\n", - "# pymoab is used as it is open source and can be tested in the CI\n", - "# if you have Trelis or Cubit then this line can be deleted\n", - "my_reactor.method='pymoab'\n", - "\n", - "source = openmc.Source()\n", - "# sets the location of the source to x=0 y=0 z=0\n", - "source.space = openmc.stats.Point((my_reactor.major_radius, 0, 0))\n", - "# sets the direction to isotropic\n", - "source.angle = openmc.stats.Isotropic()\n", - "# sets the energy distribution to 100% 14MeV neutrons\n", - "source.energy = openmc.stats.Discrete([14e6], [1])\n", - "\n", - "# creates a neutronics model from the geometry and assigned materials\n", - "neutronics_model = paramak.NeutronicsModel(\n", - " geometry=my_reactor,\n", - " source=source,\n", - " materials={\n", - " 'inboard_tf_coils_mat': 'eurofer',\n", - " 'center_column_shield_mat': 'eurofer',\n", - " 'divertor_mat': 'eurofer',\n", - " 'firstwall_mat': 'eurofer',\n", - " 'blanket_mat': 'Li4SiO4'},\n", - " cell_tallies=['heating'],\n", - " simulation_batches=2,\n", - " simulation_particles_per_batch=10, # this will need increasing to obtain accurate results\n", - ")\n", - "\n", - "# starts the neutronics simulation\n", - "neutronics_model.simulate()\n", - "\n", - "# prints the results\n", - "print(neutronics_model.results)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.3" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/examples/example_neutronics_simulations/component_based_mesh_simulation.py b/examples/example_neutronics_simulations/component_based_mesh_simulation.py deleted file mode 100644 index b90ea1633..000000000 --- a/examples/example_neutronics_simulations/component_based_mesh_simulation.py +++ /dev/null @@ -1,47 +0,0 @@ -"""This example creates a curved center column with a few different sizes. -The shape is then converted into a neutronics geometry and the heat deposited -is simulated for a few different sizes of ceter column""" - -import matplotlib.pyplot as plt -import openmc -import paramak - - -def main(): - - # makes the component with a few different size mid radius values - my_shape = paramak.CenterColumnShieldHyperbola( - height=500, - inner_radius=50, - mid_radius=70, - outer_radius=100, - material_tag='center_column_shield_mat', - method='pymoab', - ) - - my_shape.export_stp('my_shape.stp') - - # makes the openmc neutron source at x,y,z 0, 0, 0 with isotropic - # diections - source = openmc.Source() - source.space = openmc.stats.Point((0, 0, 0)) - source.angle = openmc.stats.Isotropic() - - # converts the geometry into a neutronics geometry - my_model = paramak.NeutronicsModel( - geometry=my_shape, - source=source, - materials={'center_column_shield_mat': 'WB'}, # WB is tungsten boride - cell_tallies=['heating', 'TBR'], - mesh_tally_2d=['heating'], - mesh_tally_3d=['heating'], - simulation_batches=10, # should be increased for more accurate result - simulation_particles_per_batch=10, # settings are low to reduce time required - ) - - # performs an openmc simulation on the model - my_model.simulate() - - -if __name__ == "__main__": - main() diff --git a/examples/example_neutronics_simulations/component_based_parameter_study.ipynb b/examples/example_neutronics_simulations/component_based_parameter_study.ipynb deleted file mode 100644 index 0e35c0b66..000000000 --- a/examples/example_neutronics_simulations/component_based_parameter_study.ipynb +++ /dev/null @@ -1,110 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This example creates a curved center column with a few different sizes.\n", - "The shape is then converted into a neutronics geometry and the heat deposited\n", - "is simulated for a few different sizes of ceter column." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import matplotlib.pyplot as plt\n", - "import openmc\n", - "import paramak\n", - "\n", - "\n", - "simulation_values = []\n", - "for mid_radius in [60, 70, 80]:\n", - "\n", - " # makes the component with a few different size mid radius values\n", - " my_shape = paramak.CenterColumnShieldHyperbola(\n", - " height=500,\n", - " inner_radius=50,\n", - " mid_radius=mid_radius,\n", - " outer_radius=100,\n", - " material_tag='center_column_shield_mat',\n", - " method='pymoab',\n", - " )\n", - "\n", - " my_shape.export_stp('my_shape' + str(mid_radius) + '.stp')\n", - "\n", - " # makes the openmc neutron source at x,y,z 0, 0, 0 with isotropic\n", - " # diections\n", - " source = openmc.Source()\n", - " source.space = openmc.stats.Point((0, 0, 0))\n", - " source.angle = openmc.stats.Isotropic()\n", - "\n", - " # converts the geometry into a neutronics geometry\n", - " my_model = paramak.NeutronicsModel(\n", - " geometry=my_shape,\n", - " source=source,\n", - " materials={\n", - " 'center_column_shield_mat': 'WB'},\n", - " # WB is tungsten boride\n", - " cell_tallies=['heating'],\n", - " simulation_batches=10, # should be increased for more accurate result\n", - " simulation_particles_per_batch=10, # settings are low to reduce time required\n", - " )\n", - "\n", - " # performs an openmc simulation on the model\n", - " my_model.simulate()\n", - "\n", - " # extracts the heat from the results dictionary\n", - " heat = my_model.results['center_column_shield_mat_heating']['Watts']['result']\n", - "\n", - " # adds the heat and the mid radius value to a list\n", - " simulation_values.append((mid_radius, heat))\n", - "\n", - "# plots the simualtion results vs the mid_radius used for the simulation\n", - "plt.plot(\n", - " [i[0] for i in simulation_values],\n", - " [i[1] for i in simulation_values],\n", - " '-p'\n", - ")\n", - "\n", - "# adds labels to the graph\n", - "plt.title(\"heating vs thickness\")\n", - "plt.xlabel(\"thickness (cm)\")\n", - "plt.ylabel(\"heating (watts)\")\n", - "\n", - "plt.savefig('heating_vs_thickness.svg')\n", - "plt.show()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.3" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/examples/example_neutronics_simulations/dagmc_logo.ipynb b/examples/example_neutronics_simulations/dagmc_logo.ipynb deleted file mode 100644 index ba5600009..000000000 --- a/examples/example_neutronics_simulations/dagmc_logo.ipynb +++ /dev/null @@ -1,407 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "import paramak" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Overwriting auto display for cadquery Workplane and Shape\n" - ] - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "ef616b44bad94747a1dc335b245c0e41", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "white_part_1 = paramak.CenterColumnShieldCylinder(\n", - " inner_radius=0,\n", - " outer_radius=50,\n", - " height=10,\n", - " color=(1,1,1)\n", - ")\n", - "\n", - "white_part_1.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "ef885bb494b24c93968c1094df163c73", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "blue_part_1 = paramak.CenterColumnShieldCylinder(\n", - " inner_radius=50,\n", - " outer_radius=50+82,\n", - " height=10,\n", - " rotation_angle=360*(2/3),\n", - " color=(0.09,0.212,0.365)\n", - ")\n", - "\n", - "blue_part_1.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "ec067ff0f2f74ff996843396ee012fb7", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "red_part_1 = paramak.CenterColumnShieldCylinder(\n", - " inner_radius=50+82,\n", - " outer_radius=50+82+140,\n", - " height=10,\n", - " rotation_angle=360*(2/3),\n", - " color=(0.753, 0, 0)\n", - ")\n", - "\n", - "red_part_1.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "76e1b4207b6a4067bcc7329fcdd2bcc9", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "yellow_part_1 = paramak.CenterColumnShieldCylinder(\n", - " inner_radius=50,\n", - " outer_radius=50+82+140,\n", - " height=10,\n", - " rotation_angle=360*(1/3),\n", - " azimuth_placement_angle=360-(360*(1/3)),\n", - " color=(0.463, 0.573, 0.235)\n", - ")\n", - "\n", - "yellow_part_1.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "c5db0af75cb14018a31d3dc2f0e4a20a", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "white_part_2 = paramak.CenterColumnShieldCylinder(\n", - " inner_radius=50+82+140,\n", - " outer_radius=50+82+140+64,\n", - " height=10,\n", - " color=(1,1,1)\n", - ")\n", - "\n", - "white_part_2.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "f9fe455134504df4a3534d51e3c844e2", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "red_part_2 = paramak.CenterColumnShieldCylinder(\n", - " inner_radius=50+82+140+64,\n", - " outer_radius=50+82+140+64+111,\n", - " height=10,\n", - " rotation_angle=360*(1/4),\n", - " azimuth_placement_angle=170,\n", - " color=(1,0,0)\n", - ")\n", - "\n", - "red_part_2.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "be38cb5d079544ba982ae1006ac388c7", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "yellow_part_2 = paramak.CenterColumnShieldCylinder(\n", - " inner_radius=50+82+140+64,\n", - " outer_radius=50+82+140+64+111,\n", - " height=10,\n", - " rotation_angle=360*(1/4),\n", - " azimuth_placement_angle=0,\n", - " color=(0.463, 0.573, 0.235)\n", - ")\n", - "\n", - "yellow_part_2.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "38ee6893f28d4a69a04bfbf47e427bee", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "white_part_3 = paramak.CenterColumnShieldCylinder(\n", - " inner_radius=50+82+140+64,\n", - " outer_radius=50+82+140+64+111,\n", - " height=10,\n", - " rotation_angle=360*(1/4),\n", - " azimuth_placement_angle=80,\n", - " color=(1,1,1),\n", - " name='white_part_3'\n", - ")\n", - "\n", - "white_part_3.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "2fd1caf0e87a4025bd8a17d31754b73b", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "blue_part_2 = paramak.CenterColumnShieldCylinder(\n", - " inner_radius=50+82+140+64,\n", - " outer_radius=50+82+140+64+111,\n", - " height=10,\n", - " rotation_angle=360*(1/4),\n", - " azimuth_placement_angle=-10,\n", - " color=(0.09,0.212,0.365),\n", - " name='blue_part_2'\n", - ")\n", - "\n", - "blue_part_2.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "5bd23ac314e0417baee8228d4c5322e0", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "yellow_part_2 = paramak.CenterColumnShieldCylinder(\n", - " inner_radius=50+82+140+64,\n", - " outer_radius=50+82+140+64+111,\n", - " height=10,\n", - " rotation_angle=360*(1/4),\n", - " azimuth_placement_angle=260,\n", - " color=(0.463, 0.573, 0.235),\n", - " name='yellow_part_2'\n", - ")\n", - "\n", - "yellow_part_2.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "8363e794e6204fb39f95c0ffa32bb69b", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "all_parts = paramak.Reactor([yellow_part_1, yellow_part_2, white_part_1, white_part_2, white_part_3, red_part_1, red_part_2, blue_part_1, blue_part_2])\n", - "all_parts.show()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.3" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/examples/example_neutronics_simulations/heating_on_unstructured_mesh_shape.py b/examples/example_neutronics_simulations/heating_on_unstructured_mesh_shape.py deleted file mode 100644 index 85fe8a368..000000000 --- a/examples/example_neutronics_simulations/heating_on_unstructured_mesh_shape.py +++ /dev/null @@ -1,23 +0,0 @@ - -import paramak - - -rotated_spline = paramak.RotateSplineShape( - rotation_angle=180, - method='trelis', - points=[ - (500, 0), - (500, -20), - (400, -300), - (300, -300), - (400, 0), - (300, 300), - (400, 300), - (500, 20), - ], - tet_mesh=) - -rotated_spline.export_h5m( - # merge_tolerance, - # faceting_tolerance=, -) diff --git a/examples/example_neutronics_simulations/make_unstructured_mesh.py b/examples/example_neutronics_simulations/make_unstructured_mesh.py deleted file mode 100644 index 2f72faa63..000000000 --- a/examples/example_neutronics_simulations/make_unstructured_mesh.py +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/env/python3 -import json -import os - - -def byteify(input): - if isinstance(input, dict): - return {byteify(key): byteify(value) - for key, value in input.iteritems()} - elif isinstance(input, list): - return [byteify(element) for element in input] - elif isinstance(input, unicode): - return input.encode("utf-8") - else: - return input - - -def save_tet_details_to_json_file( - geometry_details, - filename="mesh_details.json"): - for entry in geometry_details: - material = entry["material"] - tets_in_volumes = cubit.parse_cubit_list( - "tet", " in volume " + " ".join(entry["volumes"]) - ) - print("material ", material, " has ", len(tets_in_volumes), " tets") - entry["tet_ids"] = tets_in_volumes - with open(filename, "w") as outfile: - json.dump(geometry_details, outfile, indent=4) - - -def find_number_of_volumes_in_each_step_file(input_locations, basefolder): - body_ids = "" - volumes_in_each_step_file = [] - # all_groups=cubit.parse_cubit_list("group","all") - # starting_group_id = len(all_groups) - for entry in input_locations: - # starting_group_id = starting_group_id +1 - current_vols = cubit.parse_cubit_list("volume", "all") - print(os.path.join(basefolder, entry["stp_filename"])) - if entry["stp_filename"].endswith(".sat"): - import_type = "acis" - if entry["stp_filename"].endswith( - ".stp") or entry["stp_filename"].endswith(".step"): - import_type = "step" - short_file_name = os.path.split(entry["stp_filename"])[-1] - # print('short_file_name',short_file_name) - # cubit.cmd('import '+import_type+' "' + entry['stp_filename'] + '" separate_bodies no_surfaces no_curves no_vertices group "'+str(short_file_name)+'"') - cubit.cmd( - "import " - + import_type - + ' "' - + os.path.join(basefolder, entry["stp_filename"]) - + '" separate_bodies no_surfaces no_curves no_vertices ' - ) - all_vols = cubit.parse_cubit_list("volume", "all") - new_vols = set(current_vols).symmetric_difference(set(all_vols)) - new_vols = map(str, new_vols) - print("new_vols", new_vols, type(new_vols)) - current_bodies = cubit.parse_cubit_list("body", "all") - print("current_bodies", current_bodies) - # volumes_in_group = cubit.cmd('volume in group '+str(starting_group_id)) - # print('volumes_in_group',volumes_in_group,type(volumes_in_group)) - if len(new_vols) > 1: - cubit.cmd( - "unite vol " + - " ".join(new_vols) + - " with vol " + - " ".join(new_vols)) - all_vols = cubit.parse_cubit_list("volume", "all") - new_vols_after_unite = set( - current_vols).symmetric_difference(set(all_vols)) - new_vols_after_unite = map(str, new_vols_after_unite) - # cubit.cmd('group '+str(starting_group_id)+' copy rotate 45 about z repeat 7') - entry["volumes"] = new_vols_after_unite - cubit.cmd( - 'group "' + - short_file_name + - '" add volume ' + - " ".join( - entry["volumes"])) - # cubit.cmd('volume in group '+str(starting_group_id)+' copy rotate 45 about z repeat 7') - cubit.cmd("separate body all") - return input_locations - - -def imprint_and_merge_geometry(tolerance="1e-4"): - cubit.cmd("imprint body all") - cubit.cmd("merge tolerance " + tolerance) # optional as there is a default - cubit.cmd("merge vol all group_results") - cubit.cmd("graphics tol angle 3") - - -cubit.cmd("reset") - -cubit.cmd("set attribute on") - -with open("manifest.json") as json_file: - data = byteify(json.load(json_file)) - -input_locations = [] -for entry in data: - if "tet_mesh" in entry.keys(): - input_locations.append(entry) -geometry_details = find_number_of_volumes_in_each_step_file( - input_locations, str(os.path.abspath(".")) -) - -imprint_and_merge_geometry() - -current_vols = cubit.parse_cubit_list("volume", "all") - -cubit.cmd("Trimesher volume gradation 1.3") - -cubit.cmd("volume all size auto factor 5") -print(geometry_details) -for entry in geometry_details: - for volume in entry["volumes"]: - cubit.cmd( - "volume " + str(volume) + " size auto factor 6" - ) # this number is the size of the mesh 1 is small 10 is large - cubit.cmd( - "volume all scheme tetmesh proximity layers off geometric sizing on") - if "size" in entry["mesh"]: - cubit.cmd("volume " + str(volume) + " " + - entry["tet_mesh"]) # ' size 0.5' - else: - cubit.cmd("volume " + str(volume)) - cubit.cmd("mesh volume " + str(volume)) - - -cubit.cmd('export mesh "tet_mesh.exo" overwrite') -# cubit.cmd('export abaqus "tet_mesh.inp" overwrite') # asci format, not goood for large meshes -# cubit.cmd('save as "tet_mesh.cub" overwrite') # mbconvert code is older -# than the exo equivilent - -print("unstrutured mesh saved as tet_mesh.exo") - -save_tet_details_to_json_file(geometry_details) diff --git a/examples/example_neutronics_simulations/openmc_logo_example.ipynb b/examples/example_neutronics_simulations/openmc_logo_example.ipynb deleted file mode 100644 index ab0924326..000000000 --- a/examples/example_neutronics_simulations/openmc_logo_example.ipynb +++ /dev/null @@ -1,181 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This example creates a couple of CAD volumes, combines them into a reactor and then performs an OpenMC / DAGMC simulation on the geometry. The geometry made is the OpenMC logo. \n", - "\n", - "There is a corresponding video fro this example\n", - "https://youtu.be/40VARwD44FA" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import paramak" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "These two code blocks create a geometry and adds relevent meta data tags that are used in the neutronics simulation." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "red_part = paramak.ExtrudeMixedShape(\n", - " points=[\n", - " (-89.0, -50.0, 'straight'),\n", - " (-18.0, -50.0, 'straight'),\n", - " (30.0, 30.0, 'straight'),\n", - " (-12.0, 100.0, 'circle'),\n", - " (88.0, -50.0, 'circle'),\n", - " ],\n", - " distance=10,\n", - " color=(1,0,0),\n", - " name='red_part',\n", - " material_tag='red_part_material',\n", - " stp_filename='red_part.stp',\n", - " stl_filename='red_part.stl',\n", - ")\n", - "red_part.show()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "grey_part = paramak.ExtrudeMixedShape(\n", - " points=[\n", - " (-96.5, -27.0, 'straight'),\n", - " (-30.0, -27.0, 'straight'),\n", - " (3.0, 30.0, 'straight'),\n", - " (-30.0, 87.0, 'straight'),\n", - " (-50.0, 87.0, 'straight'),\n", - " (-30.0, 87.0, 'circle'),\n", - " (-97.0, 30.0, 'circle'),\n", - " ],\n", - " distance=10,\n", - " color=(0.5,0.5,0.5),\n", - " material_tag='grey_part_material',\n", - " stp_filename='grey_part.stp',\n", - " stl_filename='grey_part.stl',\n", - ")\n", - "\n", - "grey_part.show()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This combines the two volumes into a single Reactor object" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "both_parts = paramak.Reactor([red_part, grey_part])\n", - "both_parts.show()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This defines the neutron source used in the simulation" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import openmc\n", - "source = openmc.Source()\n", - "source.space = openmc.stats.Point((0, 50, 0))\n", - "source.energy = openmc.stats.Discrete([14e6], [1])\n", - "source.angle = openmc.stats.Isotropic()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This combines the geometry withthe neutron source and materials to make a model. The specifies three types of tallies (cell, mesh 2d, mesh 3d) and the reaction to tally (tritium production and heating). Output png and vtk files will be produced for the mesh tallies." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "my_model = paramak.NeutronicsModel(\n", - " geometry=both_parts,\n", - " source=source,\n", - " simulation_batches=2, # this should be increased to get a better mesh tally result\n", - " simulation_particles_per_batch=10, # this should be increased to get a better mesh tally result\n", - " materials = {'red_part_material':'P91', 'grey_part_material':'Li4SiO4'},\n", - " mesh_tally_3d=['(n,Xt)','heating'],\n", - " mesh_tally_2d=['(n,Xt)','heating'],\n", - " cell_tallies=['(n,Xt)','heating', 'spectra'],\n", - ")\n", - "\n", - "my_model.simulate()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This shows the cell tally results" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "my_model.results" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.3" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/examples/example_neutronics_simulations/segmented_blanket_ball_reactor.py b/examples/example_neutronics_simulations/segmented_blanket_ball_reactor.py deleted file mode 100644 index f8040504c..000000000 --- a/examples/example_neutronics_simulations/segmented_blanket_ball_reactor.py +++ /dev/null @@ -1,250 +0,0 @@ -"""This example makes a reactor geometry, neutronics model and performs a TBR -simulation. A selection of materials are used from refrenced sources to -complete the neutronics model.""" - -import neutronics_material_maker as nmm -import openmc -import paramak - - -def make_model_and_simulate(): - """Makes a neutronics Reactor model and simulates the TBR with specified materials""" - - # based on - # http://www.euro-fusionscipub.org/wp-content/uploads/WPBBCP16_15535_submitted.pdf - firstwall_radial_thickness = 3.0 - firstwall_armour_material = "tungsten" - firstwall_coolant_material = "He" - firstwall_structural_material = "eurofer" - firstwall_armour_fraction = 0.106305 - firstwall_coolant_fraction = 0.333507 - firstwall_coolant_temperature_k = 400 - firstwall_coolant_pressure_Pa = 8e6 - firstwall_structural_fraction = 0.560188 - - firstwall_material = nmm.Material.from_mixture( - name="firstwall_mat", - materials=[ - nmm.Material.from_library( - name=firstwall_coolant_material, - temperature=firstwall_coolant_temperature_k, - pressure=firstwall_coolant_pressure_Pa, - ), - nmm.Material.from_library(name=firstwall_structural_material), - nmm.Material.from_library(name=firstwall_armour_material), - ], - fracs=[ - firstwall_coolant_fraction, - firstwall_structural_fraction, - firstwall_armour_fraction, - ], - percent_type="vo" - ) - - # based on - # https://www.sciencedirect.com/science/article/pii/S2352179118300437 - blanket_rear_wall_coolant_material = "H2O" - blanket_rear_wall_structural_material = "eurofer" - blanket_rear_wall_coolant_fraction = 0.3 - blanket_rear_wall_structural_fraction = 0.7 - # units of Kelvin, equivalent 200 degrees C - blanket_rear_wall_coolant_temperature = 473.15 - blanket_rear_wall_coolant_pressure = 1e6 # units of Pa - - blanket_rear_wall_material = nmm.Material.from_mixture( - name="blanket_rear_wall_mat", - materials=[ - nmm.Material.from_library( - name=blanket_rear_wall_coolant_material, - temperature=blanket_rear_wall_coolant_temperature, - pressure=blanket_rear_wall_coolant_pressure, - ), - nmm.Material.from_library( - name=blanket_rear_wall_structural_material), - ], - fracs=[ - blanket_rear_wall_coolant_fraction, - blanket_rear_wall_structural_fraction, - ], - percent_type="vo") - - # based on - # https://www.sciencedirect.com/science/article/pii/S2352179118300437 - blanket_lithium6_enrichment_percent = 60 - blanket_breeder_material = "Li4SiO4" - blanket_coolant_material = "He" - blanket_multiplier_material = "Be" - blanket_structural_material = "eurofer" - blanket_breeder_fraction = 0.15 - blanket_coolant_fraction = 0.05 - blanket_multiplier_fraction = 0.6 - blanket_structural_fraction = 0.2 - blanket_breeder_packing_fraction = 0.64 - blanket_multiplier_packing_fraction = 0.64 - blanket_coolant_temperature_k = 773.15 - blanket_coolant_pressure_Pa = 1e6 - blanket_breeder_temperature_k = 873.15 - blanket_breeder_pressure_Pa = 8e6 - - blanket_material = nmm.Material.from_mixture( - name="blanket_mat", - materials=[ - nmm.Material.from_library( - name=blanket_coolant_material, - temperature=blanket_coolant_temperature_k, - pressure=blanket_coolant_pressure_Pa, - ), - nmm.Material.from_library(name=blanket_structural_material), - nmm.Material.from_library( - name=blanket_multiplier_material, - packing_fraction=blanket_multiplier_packing_fraction, - ), - nmm.Material.from_library( - name=blanket_breeder_material, - enrichment=blanket_lithium6_enrichment_percent, - packing_fraction=blanket_breeder_packing_fraction, - temperature=blanket_breeder_temperature_k, - pressure=blanket_breeder_pressure_Pa, - ), - ], - fracs=[ - blanket_coolant_fraction, - blanket_structural_fraction, - blanket_multiplier_fraction, - blanket_breeder_fraction, - ], - percent_type="vo" - ) - - # based on - # https://www.sciencedirect.com/science/article/pii/S2352179118300437 - divertor_coolant_fraction = 0.57195798876 - divertor_structural_fraction = 0.42804201123 - divertor_coolant_material = "H2O" - divertor_structural_material = "tungsten" - divertor_coolant_temperature_k = 423.15 # equivalent to 150 degrees C - divertor_coolant_pressure_Pa = 5e6 - - divertor_material = nmm.Material.from_mixture( - name="divertor_mat", - materials=[ - nmm.Material.from_library( - name=divertor_coolant_material, - temperature=divertor_coolant_temperature_k, - pressure=divertor_coolant_pressure_Pa, - ), - nmm.Material.from_library(name=divertor_structural_material), - ], - fracs=[divertor_coolant_fraction, divertor_structural_fraction], - percent_type="vo" - ) - - # based on - # https://pdfs.semanticscholar.org/95fa/4dae7d82af89adf711b97e75a241051c7129.pdf - center_column_shield_coolant_fraction = 0.13 - center_column_shield_structural_fraction = 0.57 - center_column_shield_coolant_material = "H2O" - center_column_shield_structural_material = "tungsten" - center_column_shield_coolant_temperature_k = 423.15 # equivalent to 150 degrees C - center_column_shield_coolant_pressure_Pa = 5e6 - - center_column_shield_material = nmm.Material.from_mixture( - name="center_column_shield_mat", - materials=[ - nmm.Material.from_library( - name=center_column_shield_coolant_material, - temperature=center_column_shield_coolant_temperature_k, - pressure=center_column_shield_coolant_pressure_Pa, - ), - nmm.Material.from_library( - name=center_column_shield_structural_material), - ], - fracs=[ - center_column_shield_coolant_fraction, - center_column_shield_structural_fraction, - ], - percent_type="vo") - - # based on - # https://pdfs.semanticscholar.org/95fa/4dae7d82af89adf711b97e75a241051c7129.pdf - inboard_tf_coils_conductor_fraction = 0.57 - inboard_tf_coils_coolant_fraction = 0.05 - inboard_tf_coils_structure_fraction = 0.38 - inboard_tf_coils_conductor_material = "copper" - inboard_tf_coils_coolant_material = "He" - inboard_tf_coils_structure_material = "SS_316L_N_IG" - inboard_tf_coils_coolant_temperature_k = 303.15 # equivalent to 30 degrees C - inboard_tf_coils_coolant_pressure_Pa = 8e6 - - inboard_tf_coils_material = nmm.Material.from_mixture( - name="inboard_tf_coils_mat", - materials=[ - nmm.Material.from_library( - name=inboard_tf_coils_coolant_material, - temperature=inboard_tf_coils_coolant_temperature_k, - pressure=inboard_tf_coils_coolant_pressure_Pa, - ), - nmm.Material.from_library( - name=inboard_tf_coils_conductor_material), - nmm.Material.from_library( - name=inboard_tf_coils_structure_material), - ], - fracs=[ - inboard_tf_coils_coolant_fraction, - inboard_tf_coils_conductor_fraction, - inboard_tf_coils_structure_fraction, - ], - percent_type="vo") - - # makes the 3d geometry - my_reactor = paramak.BallReactor( - inner_bore_radial_thickness=1, - inboard_tf_leg_radial_thickness=30, - center_column_shield_radial_thickness=60, - divertor_radial_thickness=50, - inner_plasma_gap_radial_thickness=30, - plasma_radial_thickness=300, - outer_plasma_gap_radial_thickness=30, - firstwall_radial_thickness=firstwall_radial_thickness, - # http://www.euro-fusionscipub.org/wp-content/uploads/WPBBCP16_15535_submitted.pdf - blanket_radial_thickness=100, - blanket_rear_wall_radial_thickness=3, - elongation=2.75, - triangularity=0.5, - number_of_tf_coils=16, - rotation_angle=360, - ) - - source = openmc.Source() - # sets the location of the source to x=0 y=0 z=0 - source.space = openmc.stats.Point((my_reactor.major_radius, 0, 0)) - # sets the direction to isotropic - source.angle = openmc.stats.Isotropic() - # sets the energy distribution to 100% 14MeV neutrons - source.energy = openmc.stats.Discrete([14e6], [1]) - - # makes the neutronics material - neutronics_model = paramak.NeutronicsModel( - geometry=my_reactor, - source=source, - materials={ - 'inboard_tf_coils_mat': inboard_tf_coils_material, - 'center_column_shield_mat': center_column_shield_material, - 'divertor_mat': divertor_material, - 'firstwall_mat': firstwall_material, - 'blanket_mat': blanket_material, - 'blanket_rear_wall_mat': blanket_rear_wall_material}, - cell_tallies=['TBR'], - simulation_batches=5, - simulation_particles_per_batch=1e4, - ) - - # starts the neutronics simulation - neutronics_model.simulate() - - # prints the simulation results to screen - print('TBR', neutronics_model.results['TBR']) - - -if __name__ == "__main__": - make_model_and_simulate() diff --git a/examples/example_neutronics_simulations/shape_with_gas_production.py b/examples/example_neutronics_simulations/shape_with_gas_production.py deleted file mode 100644 index 1894172fb..000000000 --- a/examples/example_neutronics_simulations/shape_with_gas_production.py +++ /dev/null @@ -1,50 +0,0 @@ -"""Demonstrates the use of reaction rates in the cell tally. -(n,Xp) is MT number 203 and scores all proton (hydrogen) production -(n,Xt) is MT number 205 and scores all tritium production -(n,Xa) is MT number 207 and scores all alpha paticle (helium) production -https://docs.openmc.org/en/latest/usersguide/tallies.html#scores -""" - - -import openmc -import paramak - - -def main(): - my_shape = paramak.CenterColumnShieldHyperbola( - height=500, - inner_radius=50, - mid_radius=60, - outer_radius=100, - material_tag='center_column_shield_mat', - method='pymoab' - ) - - # makes the openmc neutron source at x,y,z 0, 0, 0 with isotropic - # directions - source = openmc.Source() - source.space = openmc.stats.Point((0, 0, 0)) - source.energy = openmc.stats.Discrete([14e6], [1]) - source.angle = openmc.stats.Isotropic() - - # converts the geometry into a neutronics geometry - my_model = paramak.NeutronicsModel( - geometry=my_shape, - source=source, - materials={'center_column_shield_mat': 'Be'}, - cell_tallies=['(n,Xa)', '(n,Xt)', '(n,Xp)'], - mesh_tally_3d=['(n,Xa)', '(n,Xt)', '(n,Xp)'], - mesh_tally_2d=['(n,Xa)', '(n,Xt)', '(n,Xp)'], - simulation_batches=2, - simulation_particles_per_batch=10, - ) - - # performs an openmc simulation on the model - my_model.simulate() - - # this extracts the values from the results dictionary - print(my_model.results) - - -if __name__ == "__main__": - main() diff --git a/examples/example_neutronics_simulations/shape_with_spectra_cell_tally.py b/examples/example_neutronics_simulations/shape_with_spectra_cell_tally.py deleted file mode 100644 index e9e37728a..000000000 --- a/examples/example_neutronics_simulations/shape_with_spectra_cell_tally.py +++ /dev/null @@ -1,114 +0,0 @@ - -import openmc -import paramak -import plotly.graph_objects as go - - -def main(): - my_shape = paramak.CenterColumnShieldHyperbola( - height=500, - inner_radius=50, - mid_radius=60, - outer_radius=100, - material_tag='center_column_shield_mat', - method='pymoab' - ) - - # makes the openmc neutron source at x,y,z 0, 0, 0 with isotropic - # directions - source = openmc.Source() - source.space = openmc.stats.Point((0, 0, 0)) - source.energy = openmc.stats.Discrete([14e6], [1]) - source.angle = openmc.stats.Isotropic() - - # converts the geometry into a neutronics geometry - my_model = paramak.NeutronicsModel( - geometry=my_shape, - source=source, - materials={'center_column_shield_mat': 'Be'}, - cell_tallies=['heating', 'flux', 'TBR', 'spectra'], - simulation_batches=2, - simulation_particles_per_batch=20, - ) - - # performs an openmc simulation on the model - output_filename = my_model.simulate() - - # this extracts the values from the results dictionary - energy_bins = my_model.results['center_column_shield_mat_photon_spectra']['Flux per source particle']['energy'] - neutron_spectra = my_model.results['center_column_shield_mat_neutron_spectra']['Flux per source particle']['result'] - photon_spectra = my_model.results['center_column_shield_mat_photon_spectra']['Flux per source particle']['result'] - - fig = go.Figure() - - # this sets the axis titles and range - fig.update_layout( - xaxis={'title': 'Energy (eV)', - 'range': (0, 14.1e6)}, - yaxis={'title': 'Neutrons per cm2 per source neutron'} - ) - - # this adds the neutron spectra line to the plot - fig.add_trace(go.Scatter( - x=energy_bins[:-85], # trims off the high energy range - y=neutron_spectra[:-85], # trims off the high energy range - name='neutron spectra', - line=dict(shape='hv') - ) - ) - - # this adds the photon spectra line to the plot - fig.add_trace(go.Scatter( - x=energy_bins[:-85], # trims off the high energy range - y=photon_spectra[:-85], # trims off the high energy range - name='photon spectra', - line=dict(shape='hv') - ) - ) - - # this adds the drop down menu fo log and linear scales - fig.update_layout( - updatemenus=[ - go.layout.Updatemenu( - buttons=list([ - dict( - args=[{ - "xaxis.type": 'lin', "yaxis.type": 'lin', - 'xaxis.range': (0, 14.1e6) - }], - label="linear(x) , linear(y)", - method="relayout" - ), - dict( - args=[{"xaxis.type": 'log', "yaxis.type": 'log'}], - label="log(x) , log(y)", - method="relayout" - ), - dict( - args=[{"xaxis.type": 'log', "yaxis.type": 'lin'}], - label="log(x) , linear(y)", - method="relayout" - ), - dict( - args=[{"xaxis.type": 'lin', "yaxis.type": 'log', - 'xaxis.range': (0, 14.1e6) - }], - label="linear(x) , log(y)", - method="relayout" - ) - ]), - pad={"r": 10, "t": 10}, - showactive=True, - x=0.5, - xanchor="left", - y=1.1, - yanchor="top" - ), - ] - ) - - fig.show() - - -if __name__ == "__main__": - main() diff --git a/examples/example_neutronics_simulations/submersion_reactor.ipynb b/examples/example_neutronics_simulations/submersion_reactor.ipynb deleted file mode 100644 index 09f280cb5..000000000 --- a/examples/example_neutronics_simulations/submersion_reactor.ipynb +++ /dev/null @@ -1,152 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This is a example that obtains the tritium breeding ratio (TBR)\n", - "for a parametric submersion reactor and specified the faceting and merge\n", - "tolerance when creating the dagmc model." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import matplotlib.pyplot as plt\n", - "import neutronics_material_maker as nmm\n", - "import openmc\n", - "import paramak\n", - "\n", - "\n", - "# makes the 3d geometry from input parameters\n", - "my_reactor = paramak.SubmersionTokamak(\n", - " inner_bore_radial_thickness=30,\n", - " inboard_tf_leg_radial_thickness=30,\n", - " center_column_shield_radial_thickness=30,\n", - " divertor_radial_thickness=80,\n", - " inner_plasma_gap_radial_thickness=50,\n", - " plasma_radial_thickness=200,\n", - " outer_plasma_gap_radial_thickness=50,\n", - " firstwall_radial_thickness=30,\n", - " blanket_rear_wall_radial_thickness=30,\n", - " rotation_angle=359.9, # if method is changed to Trelis then this can be changed to 360\n", - " support_radial_thickness=50,\n", - " inboard_blanket_radial_thickness=30,\n", - " outboard_blanket_radial_thickness=30,\n", - " elongation=2.75,\n", - " triangularity=0.5,\n", - ")\n", - "\n", - "# pymoab is used as it is open source and can be tested in the CI\n", - "# if you have Trelis or Cubit then this line can be changed\n", - "my_reactor.export_h5m(method='pymoab')" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This section remakes the blankt material (FLiBe) for a range of temperatures and obtains the TBR for each one." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "def make_model_and_simulate(temperature):\n", - " \"\"\"Makes a neutronics Reactor model and simulates the flux\n", - "\n", - " Arguments:\n", - " temperature: the temperature of the submersion blanket in Kelivin\n", - " \"\"\"\n", - "\n", - " # this can just be set as a string as temperature is needed for this\n", - " # material\n", - " flibe = nmm.Material.from_library(name='FLiBe', temperature=temperature, temperature_to_neutronics_code=False)\n", - "\n", - " source = openmc.Source()\n", - " # sets the location of the source to x=0 y=0 z=0\n", - " source.space = openmc.stats.Point((my_reactor.major_radius, 0, 0))\n", - " # sets the direction to isotropic\n", - " source.angle = openmc.stats.Isotropic()\n", - " # sets the energy distribution to 100% 14MeV neutrons\n", - " source.energy = openmc.stats.Discrete([14e6], [1])\n", - "\n", - " # makes the neutronics model from the geometry and material allocations\n", - " neutronics_model = paramak.NeutronicsModel(\n", - " geometry=my_reactor,\n", - " source=source,\n", - " materials={\n", - " 'inboard_tf_coils_mat': 'eurofer',\n", - " 'center_column_shield_mat': 'eurofer',\n", - " 'divertor_mat': 'eurofer',\n", - " 'firstwall_mat': 'eurofer',\n", - " 'blanket_rear_wall_mat': 'eurofer',\n", - " 'blanket_mat': flibe,\n", - " 'supports_mat': 'eurofer'},\n", - " cell_tallies=['TBR'],\n", - " simulation_batches=2,\n", - " simulation_particles_per_batch=10, # to get more accurate results this will need increasing\n", - " )\n", - "\n", - " # simulate the neutronics model\n", - " neutronics_model.simulate(export_h5m=False) # uising dagmc.h5m previous created\n", - " return neutronics_model.results['TBR']['result']\n", - "\n", - "\n", - "# loops through different temperatures finding the TBR value at each one\n", - "tbr_values = []\n", - "temperature_values = [32, 100, 300, 500]\n", - "for temperature in temperature_values:\n", - " tbr = make_model_and_simulate(temperature)\n", - " tbr_values.append(tbr)\n", - "\n", - "# plots the results\n", - "plt.scatter(temperature_values, tbr_values)\n", - "plt.xlabel('FLiBe Temperature (degrees C)')\n", - "plt.ylabel('TBR')\n", - "plt.show()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.3" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/examples/example_neutronics_simulations/submersion_reactor_minimal.py b/examples/example_neutronics_simulations/submersion_reactor_minimal.py deleted file mode 100644 index 0644ffe1d..000000000 --- a/examples/example_neutronics_simulations/submersion_reactor_minimal.py +++ /dev/null @@ -1,66 +0,0 @@ -"""This is a minimal example that obtains the particle flux in each component -for a parametric submersion reactor""" - -import neutronics_material_maker as nmm -import openmc -import paramak - - -def make_model_and_simulate(): - """Makes a neutronics Reactor model and simulates the flux""" - - # makes the 3d geometry from input parameters - my_reactor = paramak.SubmersionTokamak( - inner_bore_radial_thickness=30, - inboard_tf_leg_radial_thickness=30, - center_column_shield_radial_thickness=30, - divertor_radial_thickness=80, - inner_plasma_gap_radial_thickness=50, - plasma_radial_thickness=200, - outer_plasma_gap_radial_thickness=50, - firstwall_radial_thickness=30, - blanket_rear_wall_radial_thickness=30, - rotation_angle=180, - support_radial_thickness=50, - inboard_blanket_radial_thickness=30, - outboard_blanket_radial_thickness=30, - elongation=2.75, - triangularity=0.5, - ) - - # this can just be set as a string as temperature is needed for this - # material - flibe = nmm.Material.from_library(name='FLiBe', temperature=773.15) - - source = openmc.Source() - # sets the location of the source to x=0 y=0 z=0 - source.space = openmc.stats.Point((my_reactor.major_radius, 0, 0)) - # sets the direction to isotropic - source.angle = openmc.stats.Isotropic() - # sets the energy distribution to 100% 14MeV neutrons - source.energy = openmc.stats.Discrete([14e6], [1]) - - # makes the neutronics model from the geometry and material allocations - neutronics_model = paramak.NeutronicsModel( - geometry=my_reactor, - source=source, - materials={ - 'inboard_tf_coils_mat': 'eurofer', - 'center_column_shield_mat': 'eurofer', - 'divertor_mat': 'eurofer', - 'firstwall_mat': 'eurofer', - 'blanket_rear_wall_mat': 'eurofer', - 'blanket_mat': flibe, - 'supports_mat': 'eurofer'}, - cell_tallies=['flux'], - simulation_batches=5, - simulation_particles_per_batch=1e4, - ) - - # simulate the neutronics model - neutronics_model.simulate() - print(neutronics_model.results) - - -if __name__ == "__main__": - make_model_and_simulate() diff --git a/examples/example_neutronics_simulations/text_example.ipynb b/examples/example_neutronics_simulations/text_example.ipynb deleted file mode 100644 index 629801a63..000000000 --- a/examples/example_neutronics_simulations/text_example.ipynb +++ /dev/null @@ -1,84 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "A simple example of text being " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import cadquery as cq\n", - "import openmc\n", - "import paramak\n", - "\n", - "text = cq.Workplane().text( \n", - " txt=\"The Paramak can easily convert CAD\\nto neutronics models for simulations.\",\n", - " fontsize=0.5,\n", - " distance=-1,\n", - " cut=True,\n", - " halign=\"left\",\n", - " valign=\"bottom\",\n", - " font=\"Sans\"\n", - ")\n", - "\n", - "# this creates an empty Shape and populates it with the CQ object\n", - "my_shape = paramak.Shape()\n", - "my_shape.solid = text\n", - "my_shape.method = 'pymoab'\n", - "my_shape.stl_filename = 'text.stl'\n", - "my_shape.material_tag = 'my_material'\n", - "my_shape.export_stp('text_cad.stp')\n", - "\n", - "coords = openmc.stats.Point((4, 1, 0.5))\n", - "energy = openmc.stats.Discrete([1.41E7], [1.0])\n", - "source = openmc.Source(space=coords, energy=energy)\n", - "\n", - "my_model = paramak.NeutronicsModel(\n", - " geometry=my_shape,\n", - " source=source,\n", - " materials={'my_material': 'Li4SiO4'},\n", - " mesh_tally_3d=['heating', '(n,Xt)'],\n", - " simulation_batches=2, # to get a good mesh tally result with will need increasing\n", - " mesh_3d_resolution=(850, 350, 10),\n", - " mesh_3d_corners=[(0, -1, -1), (8.5, 2.5, 0.5)],\n", - ")\n", - "\n", - "my_model.simulate()\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.3" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} From caaa230d9091f7063c876ffd1e615f8a5769cc86 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Mon, 5 Jul 2021 21:52:36 +0100 Subject: [PATCH 06/12] added link to paramak-neutronics module --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bebef63b7..41373c4e8 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,9 @@ 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. The paramak can created geometry in standard CAD formats such as STP, STL. It can also create h5m files for -[DAGMC](https://svalinn.github.io/DAGMC/) based neutronics simulations. +[DAGMC](https://svalinn.github.io/DAGMC/) and carry out neutronics simulations +when used with the optional [paramak-neutronics](https://github.com/fusion-energy/paramak-neutronics) +module. :point_right: [Documentation](https://paramak.readthedocs.io) @@ -23,6 +25,9 @@ STL. It can also create h5m files for :point_right: [Publication](https://f1000research.com/articles/10-27/v1) +:point_right: [Docker images](https://github.com/fusion-energy/paramak/pkgs/container/paramak) + + ## Citing From 58346e6ae78f2c42d501310d4edb50d3366f99c2 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Mon, 5 Jul 2021 21:53:09 +0100 Subject: [PATCH 07/12] moved neutronics examples to paramak neutronics --- .../source/example_neutronics_simulations.rst | 62 ------------------- docs/source/index.rst | 6 +- docs/source/paramak.parametric_neutronics.rst | 59 ------------------ 3 files changed, 4 insertions(+), 123 deletions(-) delete mode 100644 docs/source/example_neutronics_simulations.rst delete mode 100644 docs/source/paramak.parametric_neutronics.rst diff --git a/docs/source/example_neutronics_simulations.rst b/docs/source/example_neutronics_simulations.rst deleted file mode 100644 index 4bbc00b0f..000000000 --- a/docs/source/example_neutronics_simulations.rst +++ /dev/null @@ -1,62 +0,0 @@ -Examples - Neutronics Simulations -================================= - -These are minimal examples of neutronics simulations that demonstrate the core -functionality of the neutronics features. In general it easy to export geomtry -in h5m format for use in DAGMC enabled simulations. There are two options for -this export. The Trelis method of converting geometry imprints and merges -surfaces while the PyMoab converts the geoemtry without imprinting and merging -surfaces. - -The resulting h5m files can be used in DAGMC enabled neutronics codes such as -OpenMC and MCNP. There is also a class (NeutronicsModel) that facilitates -adding tallies, materials and a source to the geoemtry to create a complete -OpenMC neutronics model which can be simulated. The simulated results are also -extracted from the statepoint.h5 file that OpenMC produces and converted to -vtk, png and JSON files depending on the tally. - - -ball_reactor.ipynb -^^^^^^^^^^^^^^^^^^ - -`Link to notebook `__ - - -ball_reactor_minimal.ipynb -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -`Link to notebook `__ - - -ball_reactor_source_plot.ipynb -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -`Link to notebook `__ - - -center_column_study_reactor.ipynb -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -`Link to notebook `__ - - -center_column_study_reactor_minimal.ipynb -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -`Link to notebook `__ - - -OpenMC logo simulation -^^^^^^^^^^^^^^^^^^^^^^ - -`Link to notebook `__ - -.. raw:: html - - - - -text_example.ipynb -^^^^^^^^^^^^^^^^^^ - -`Link to notebook `__ diff --git a/docs/source/index.rst b/docs/source/index.rst index bc56f9e9c..aabdd314a 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -28,6 +28,10 @@ means a finished product. Contributions are welcome. CadQuery functions provide the majority of the features, and incorporating additional capabilities is straightforward for developers with Python knowledge. +You might also be interested in the `paramak-neutronics `_ +which is a separate module that adds neutronics capabilties. + + .. raw:: html @@ -40,14 +44,12 @@ straightforward for developers with Python knowledge. paramak.parametric_shapes paramak.parametric_components paramak.parametric_reactors - paramak.parametric_neutronics paramak.shape paramak.reactor paramak.utils example_parametric_shapes example_parametric_components example_parametric_reactors - example_neutronics_simulations tests History diff --git a/docs/source/paramak.parametric_neutronics.rst b/docs/source/paramak.parametric_neutronics.rst deleted file mode 100644 index fe73fbee7..000000000 --- a/docs/source/paramak.parametric_neutronics.rst +++ /dev/null @@ -1,59 +0,0 @@ -Parametric Neutronics -===================== - -The Paramak supports automated neutronics model creation and subsequent -simulation. - -The neutronics models created are DAGMC models and are therefore compatible -with a suite of neutronics codes (MCNP, Fluka, Geant4, OpenMC). - -The automated simulations supported within the paramak are via OpenMC however -one could also carry out simulations in other neutronics codes using the -dagmc.h5m file created. Moab can be used to inspect the dagmc.h5 file and file -the material tag names. - -.. code-block:: bash - - mbsize -ll dagmc.h5m | grep 'mat:' - -The creation of the dagmc.h5m file can be carried out via three routes. - -Option 1. Use of `PyMoab `_ which is -distributed with MOAB. Thus method can not imprint or merge the surfaces of the -geometry that touch. Therefore this method should only be used for single -components or components that touch on flat surfaces. Curved surfaces converted -via this method can potentially overlap and cause errors with the particle -tracking. - -Option 2. Use of `Trelis `_ by -Coreform along with the DAGMC -`plugin `_ / This method -can support imprinting and merging of shared surfaces between components and is -therefore suitable for converting more complex CAD geometry to the PyMoab -method. - -Option 3. Use of the `PPP `_ -and `OCC_Faceter `_ . This option -has not yet been fully demonstrated but is partly included to test the -promising new method. - -To create a model it is also necessary to define the source and the materials -used. - -For fusion simulations you might want to used the parametric-plasma-source -`Git repository `_ - -Details of the Neutronics Material Maker are available from the -`documentation `_ -and the `source code repository `_ -. However openmc.Materials can also be used directly. - -The `OpenMC workshop `_ also has -some Paramak with DAGMC and OpenMC based tasks that might be of interest. - -NeutronicsModel() -^^^^^^^^^^^^^^^^^ - -.. automodule:: paramak.parametric_neutronics.neutronics_model - :members: - :show-inheritance: From 7cffc559a7c152910d4fb8357601fc3bd2dcf483 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Mon, 5 Jul 2021 21:53:35 +0100 Subject: [PATCH 08/12] added missing path_points arg --- docs/source/paramak.parametric_shapes.rst | 53 ++++------------------- 1 file changed, 9 insertions(+), 44 deletions(-) diff --git a/docs/source/paramak.parametric_shapes.rst b/docs/source/paramak.parametric_shapes.rst index 5b538e244..0c430a95f 100644 --- a/docs/source/paramak.parametric_shapes.rst +++ b/docs/source/paramak.parametric_shapes.rst @@ -215,17 +215,8 @@ SweepStraightShape() import paramak my_component = paramak.SweepStraightShape( - points=[ - (500, 0), - (500, -20), - (400, -300), - (300, -300), - (400, 0), - (300, 300), - (400, 300), - (500, 20), - ], - rotation_angle = 180 + points=[(-10, 10), (10, 10), (10, -10), (-10, -10)], + path_points=[(50, 0), (30, 50), (70, 100), (50, 150)] ) cadquery_object = my_component.solid @@ -243,17 +234,8 @@ SweepSplineShape() import paramak my_component = paramak.SweepSplineShape( - points=[ - (500, 0), - (500, -20), - (400, -300), - (300, -300), - (400, 0), - (300, 300), - (400, 300), - (500, 20), - ], - rotation_angle = 180 + points=[(-10, 10), (10, 10), (10, -10), (-10, -10)], + path_points=[(50, 0), (30, 50), (70, 100), (50, 150)] ) cadquery_object = my_component.solid @@ -271,17 +253,9 @@ SweepMixedShape() import paramak my_component = paramak.SweepMixedShape( - points=[ - (500, 0), - (500, -20), - (400, -300), - (300, -300), - (400, 0), - (300, 300), - (400, 300), - (500, 20), - ], - rotation_angle = 180 + points=[(-10, -10, "straight"), (-10, 10, "spline"), (0, 20, "spline"), + (10, 10, "circle"), (0, 0, "circle"), (10, -10, "straight")], + path_points=[(50, 0), (30, 50), (70, 100), (50, 150)] ) cadquery_object = my_component.solid @@ -299,17 +273,8 @@ SweepCircleShape() import paramak my_component = paramak.SweepCircleShape( - points=[ - (500, 0), - (500, -20), - (400, -300), - (300, -300), - (400, 0), - (300, 300), - (400, 300), - (500, 20), - ], - rotation_angle = 180 + radius=10, + path_points=[(50, 0), (30, 50), (70, 100), (50, 150)] ) cadquery_object = my_component.solid From a55f67d9699809ddaf673ad5b3a7851d27e5bed7 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Mon, 5 Jul 2021 21:54:35 +0100 Subject: [PATCH 09/12] using standard naming --- docs/{make_docs_from_rst.sh => build-docs.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/{make_docs_from_rst.sh => build-docs.sh} (100%) diff --git a/docs/make_docs_from_rst.sh b/docs/build-docs.sh similarity index 100% rename from docs/make_docs_from_rst.sh rename to docs/build-docs.sh From 5fd67f16bc84a4fcecb394ae1d84222de0ada981 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Mon, 5 Jul 2021 22:38:28 +0100 Subject: [PATCH 10/12] corrected link --- docs/source/paramak.install.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/paramak.install.rst b/docs/source/paramak.install.rst index 09509dc13..4c5ae9b97 100644 --- a/docs/source/paramak.install.rst +++ b/docs/source/paramak.install.rst @@ -53,7 +53,7 @@ Alternatively you can download the repository using the `download link Date: Mon, 5 Jul 2021 22:38:58 +0100 Subject: [PATCH 11/12] added example segmented blanket model --- docs/source/paramak.parametric_components.rst | 90 +++++-------------- .../make_components_blankets.ipynb | 22 ++++- 2 files changed, 43 insertions(+), 69 deletions(-) diff --git a/docs/source/paramak.parametric_components.rst b/docs/source/paramak.parametric_components.rst index 0c5603a80..112578d40 100644 --- a/docs/source/paramak.parametric_components.rst +++ b/docs/source/paramak.parametric_components.rst @@ -23,11 +23,7 @@ BlanketConstantThicknessArcH() cadquery_object = my_component.solid -|BlanketConstantThicknessArcHstp| |BlanketConstantThicknessArcHsvg| - -.. |BlanketConstantThicknessArcHstp| image:: https://user-images.githubusercontent.com/8583900/86519778-32eb1500-be36-11ea-9794-0383b66624c5.png - :width: 250 -.. |BlanketConstantThicknessArcHsvg| image:: https://user-images.githubusercontent.com/56687624/88293663-38c86d80-ccf3-11ea-9bfa-c166fc99c52c.png +.. image:: https://user-images.githubusercontent.com/56687624/88293663-38c86d80-ccf3-11ea-9bfa-c166fc99c52c.png :width: 300 .. automodule:: paramak.parametric_components.blanket_constant_thickness_arc_h @@ -52,11 +48,7 @@ BlanketConstantThicknessArcV() cadquery_object = my_component.solid -|BlanketConstantThicknessArcVstp| |BlanketConstantThicknessArcVsvg| - -.. |BlanketConstantThicknessArcVstp| image:: https://user-images.githubusercontent.com/8583900/86365020-dee30380-bc70-11ea-8258-5e591c6c3235.png - :width: 250 -.. |BlanketConstantThicknessArcVsvg| image:: https://user-images.githubusercontent.com/56687624/88293666-39f99a80-ccf3-11ea-8c8d-84275fd0e0ce.png +.. image:: https://user-images.githubusercontent.com/56687624/88293666-39f99a80-ccf3-11ea-8c8d-84275fd0e0ce.png :width: 350 .. automodule:: paramak.parametric_components.blanket_constant_thickness_arc_v @@ -67,11 +59,7 @@ BlanketConstantThicknessArcV() BlanketCutterParallels() ^^^^^^^^^^^^^^^^^^^^^^^^ -|BlanketCutterParallelsstp| |BlanketCutterParallelssvg| - -.. |BlanketCutterParallelsstp| image:: https://user-images.githubusercontent.com/8583900/97328431-eb1d4d00-186d-11eb-9f5d-4bbee9e3b17d.png - :width: 250 -.. |BlanketCutterParallelssvg| image:: https://user-images.githubusercontent.com/8583900/97329670-32580d80-186f-11eb-8b1a-b7712ddb0e83.png +.. image:: https://user-images.githubusercontent.com/8583900/97329670-32580d80-186f-11eb-8b1a-b7712ddb0e83.png :width: 400 .. automodule:: paramak.parametric_components.blanket_cutter_parallels @@ -95,11 +83,7 @@ BlanketCutterStar() cadquery_object = my_component.solid -|BlanketCutterStarstp| |BlanketCutterStarsvg| - -.. |BlanketCutterStarstp| image:: https://user-images.githubusercontent.com/8583900/97103699-0178ac80-16a6-11eb-8e5a-ec3575d265fe.png - :width: 250 -.. |BlanketCutterStarsvg| image:: https://user-images.githubusercontent.com/8583900/97103794-b0b58380-16a6-11eb-86f0-fb5530d630af.png +.. image:: https://user-images.githubusercontent.com/8583900/97103794-b0b58380-16a6-11eb-86f0-fb5530d630af.png :width: 400 .. automodule:: paramak.parametric_components.blanket_cutters_star @@ -125,11 +109,7 @@ BlanketFP() cadquery_object = my_component.solid -|BlanketFPstp| |BlanketFPsvg| - -.. |BlanketFPstp| image:: https://user-images.githubusercontent.com/8583900/87254778-fe520b80-c47c-11ea-845f-470991d74874.png - :width: 220 -.. |BlanketFPsvg| image:: https://user-images.githubusercontent.com/8583900/94867319-f0d36e80-0438-11eb-8516-7b8f2a7cc7ee.png +.. image:: https://user-images.githubusercontent.com/8583900/94867319-f0d36e80-0438-11eb-8516-7b8f2a7cc7ee.png :width: 350 .. automodule:: paramak.parametric_components.blanket_fp @@ -145,20 +125,18 @@ BlanketFPPoloidalSegments() :gridsize: 0 import paramak - my_component = paramak.PoloidalSegments( - number_of_segments=10, - center_point=(500, 50), - rotation_angle=180 + my_component = paramak.BlanketFPPoloidalSegments( + num_segments=7, + segments_gap = 10, + thickness=100, + stop_angle=250, + start_angle=-90, + rotation_angle=180 ) cadquery_object = my_component.solid - -|BlanketFPPoloidalSegmentsstp| |BlanketFPPoloidalSegmentssvg| - -.. |BlanketFPPoloidalSegmentsstp| image:: https://user-images.githubusercontent.com/8583900/98735027-af6ca200-239a-11eb-9a59-4a570f91a1fc.png - :width: 220 -.. |BlanketFPPoloidalSegmentssvg| image:: https://user-images.githubusercontent.com/8583900/98870151-ca0e4c00-246a-11eb-8a37-e7620344d8c1.png +.. image:: https://user-images.githubusercontent.com/8583900/98870151-ca0e4c00-246a-11eb-8a37-e7620344d8c1.png :width: 350 .. automodule:: paramak.parametric_components.blanket_poloidal_segment @@ -178,16 +156,12 @@ CenterColumnShieldCylinder() inner_radius=80, outer_radius=100, height=300, - rotation_angle=90, + rotation_angle=180, ) cadquery_object = my_component.solid -|CenterColumnShieldCylinderstp| |CenterColumnShieldCylindersvg| - -.. |CenterColumnShieldCylinderstp| image:: https://user-images.githubusercontent.com/56687624/86241438-caccd280-bb9a-11ea-9548-b199759a6dbc.png - :width: 160px -.. |CenterColumnShieldCylindersvg| image:: https://user-images.githubusercontent.com/56687624/88293674-3c5bf480-ccf3-11ea-8197-8db75358ff36.png +.. image:: https://user-images.githubusercontent.com/56687624/88293674-3c5bf480-ccf3-11ea-8197-8db75358ff36.png :width: 370px .. automodule:: paramak.parametric_components.center_column_cylinder @@ -207,16 +181,12 @@ CenterColumnShieldHyperbola() mid_radius=75, outer_radius=100, height=300, - rotation_angle=90 + rotation_angle=180 ) cadquery_object = my_component.solid -|CenterColumnShieldHyperbolastp| |CenterColumnShieldHyperbolasvg| - -.. |CenterColumnShieldHyperbolastp| image:: https://user-images.githubusercontent.com/56687624/86241456-d0c2b380-bb9a-11ea-9728-88fe4081345f.png - :width: 170px -.. |CenterColumnShieldHyperbolasvg| image:: https://user-images.githubusercontent.com/56687624/88293672-3b2ac780-ccf3-11ea-9907-b1c8fd1ba0f0.png +.. image:: https://user-images.githubusercontent.com/56687624/88293672-3b2ac780-ccf3-11ea-9907-b1c8fd1ba0f0.png :width: 410px .. automodule:: paramak.parametric_components.center_column_hyperbola @@ -237,16 +207,12 @@ CenterColumnShieldFlatTopHyperbola() outer_radius=100, arc_height=220, height=300, - rotation_angle=90 + rotation_angle=180 ) cadquery_object = my_component.solid -|CenterColumnShieldFlatTopHyperbolastp| |CenterColumnShieldFlatTopHyperbolasvg| - -.. |CenterColumnShieldFlatTopHyperbolastp| image:: https://user-images.githubusercontent.com/56687624/86241446-cdc7c300-bb9a-11ea-8310-d54397338da8.png - :width: 170px -.. |CenterColumnShieldFlatTopHyperbolasvg| image:: https://user-images.githubusercontent.com/56687624/88293680-3ebe4e80-ccf3-11ea-8603-b7a290e6bfb4.png +.. image:: https://user-images.githubusercontent.com/56687624/88293680-3ebe4e80-ccf3-11ea-8603-b7a290e6bfb4.png :width: 370px .. automodule:: paramak.parametric_components.center_column_flat_top_hyperbola @@ -267,16 +233,12 @@ CenterColumnShieldFlatTopCircular() outer_radius=100, arc_height=220, height=300, - rotation_angle=90 + rotation_angle=180 ) cadquery_object = my_component.solid -|CenterColumnShieldFlatTopCircularstp| |CenterColumnShieldFlatTopCircularsvg| - -.. |CenterColumnShieldFlatTopCircularstp| image:: https://user-images.githubusercontent.com/56687624/86241446-cdc7c300-bb9a-11ea-8310-d54397338da8.png - :width: 170px -.. |CenterColumnShieldFlatTopCircularsvg| image:: https://user-images.githubusercontent.com/56687624/88293678-3d8d2180-ccf3-11ea-97f7-da9a46beddbf.png +.. image:: https://user-images.githubusercontent.com/56687624/88293678-3d8d2180-ccf3-11ea-97f7-da9a46beddbf.png :width: 370px .. automodule:: paramak.parametric_components.center_column_flat_top_circular @@ -296,7 +258,7 @@ CenterColumnShieldPlasmaHyperbola() mid_offset=50, edge_offset=40, height=800, - rotation_angle=90 + rotation_angle=180 ) cadquery_object = my_component.solid @@ -328,14 +290,8 @@ CoolantChannelRingStraight() cadquery_object = my_component.solid -|CoolantChannelRingStraightallstp| |CoolantChannelRingStraightsvg| |CoolantChannelRingStraightstp| - -.. |CoolantChannelRingStraightallstp| image:: https://user-images.githubusercontent.com/56687624/99049969-6467b000-258f-11eb-93b2-73e533b366c0.png - :width: 200 -.. |CoolantChannelRingStraightsvg| image:: https://user-images.githubusercontent.com/56687624/99048848-ff5f8a80-258d-11eb-9073-123185d7a4fb.png +.. image:: https://user-images.githubusercontent.com/56687624/99048848-ff5f8a80-258d-11eb-9073-123185d7a4fb.png :width: 230 -.. |CoolantChannelRingStraightstp| image:: https://user-images.githubusercontent.com/56687624/99049922-574ac100-258f-11eb-8cb9-a57cef2b8086.png - :width: 100 .. automodule:: paramak.parametric_components.coolant_channel_ring_straight :members: diff --git a/examples/example_parametric_components/make_components_blankets.ipynb b/examples/example_parametric_components/make_components_blankets.ipynb index 67cd69b34..d1d357594 100644 --- a/examples/example_parametric_components/make_components_blankets.ipynb +++ b/examples/example_parametric_components/make_components_blankets.ipynb @@ -119,6 +119,24 @@ "component.show()" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "component = paramak.BlanketFPPoloidalSegments(\n", + " num_segments=7,\n", + " segments_gap = 10,\n", + " thickness=100,\n", + " stop_angle=250,\n", + " start_angle=-90,\n", + " rotation_angle=180\n", + ")\n", + "\n", + "component.show()" + ] + }, { "cell_type": "code", "execution_count": null, @@ -129,7 +147,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -143,7 +161,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.3" + "version": "3.8.5" } }, "nbformat": 4, From d8a03b462199b794d0221336eeb58082a96b4cb5 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Tue, 6 Jul 2021 00:01:30 +0100 Subject: [PATCH 12/12] clearer install instructions --- docs/source/index.rst | 2 +- docs/source/paramak.install.rst | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index aabdd314a..9ad822ce8 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -73,7 +73,7 @@ The code has been professionally reviewed by and inline `suggestions `_. The Paramak source code is distributed with a permissive open-source license -(MIT) and is avaialbe from the GitHub repository +(MIT) and is available from the GitHub repository `https://github.com/fusion-energy/paramak `_ Publications and Presentations diff --git a/docs/source/paramak.install.rst b/docs/source/paramak.install.rst index 4c5ae9b97..5f9a79d2b 100644 --- a/docs/source/paramak.install.rst +++ b/docs/source/paramak.install.rst @@ -20,21 +20,27 @@ Python 3 and CadQuery can be installed using Conda or Miniconda Once you have Conda or MiniConda installed then CadQuery can be installed into a new enviroment and that environment can be activated using Anaconda or Miniconda. -Cadquery 2 can be installed in a Conda environment via conda-forge. +First create a new enviroment. .. code-block:: python - conda create -n paramak_env -c conda-forge -c cadquery python=3.8 cadquery=2.1 + conda create --name paramak_env python=3.8 -Once you have activated a conda environment, Cadquery 2 can be installed -using the command: +Then activate the new enviroment. .. code-block:: python conda activate paramak_env +Then install CadQuery. + + .. code-block:: python + + conda install -c conda-forge -c cadquery cadquery=2.1 + + A more detailed description of installing Cadquery 2 can be found here: * `Cadquery 2 installation `_ @@ -72,11 +78,7 @@ You can also install optional dependencies that add some neutronics capabilities to the paramak. This will install neutronics_material_maker and parametric_plasma_source. In addition to this you would need DAGMC, OpenMC, MOAB and Trelis / Cubit. -`More details `_ - -.. code-block:: bash - - pip install .[neutronics] +`More details `_ You could consider installing [jupyter-cadquery](https://github.com/bernhard-42/jupyter-cadquery) which adds