From 324de735db67278ecaef2b3bac6432cd36b9e3a7 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Thu, 24 Mar 2022 12:07:44 +0000 Subject: [PATCH 1/2] moved from paramak develop to paramak --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 510b66b9..5d8abf19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -259,9 +259,7 @@ RUN pip install neutronics_material_maker[density] \ openmc_source_plotter \ openmc_mesh_tally_to_vtk -# installing a development version of the paramak that allows exporting to h5m files -RUN conda install -c fusion-energy -c cadquery -c conda-forge paramak_develop - +RUN conda install -c fusion-energy -c cadquery -c conda-forge paramak # an older version of openmc is need to provide an older executable # this particular exectuable allows an inital_source.h5 to be written From 6b56ff93d3bdb252c306579320fe515f098b0bad Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Mon, 28 Mar 2022 09:35:01 +0100 Subject: [PATCH 2/2] removed mat prefix --- .../1_make_CAD_shapes_from_points.ipynb | 118 +-- ..._make_CAD_components_from_parameters.ipynb | 2 +- .../3_make_CAD_reactors.ipynb | 2 +- ...ronics_geometry_with_cell_tally_heat.ipynb | 6 +- ...aking_shapes_for_a_3d_mesh_tally_vtk.ipynb | 186 +---- ...g_components_for_a_2d_mesh_tally_vtk.ipynb | 671 +----------------- ...r_a_2d_mesh_tally_and_matplotlib_png.ipynb | 320 +++++++-- 7 files changed, 354 insertions(+), 951 deletions(-) diff --git a/tasks/task_10_making_CAD_geometry/1_make_CAD_shapes_from_points.ipynb b/tasks/task_10_making_CAD_geometry/1_make_CAD_shapes_from_points.ipynb index 2535c268..2da039f4 100644 --- a/tasks/task_10_making_CAD_geometry/1_make_CAD_shapes_from_points.ipynb +++ b/tasks/task_10_making_CAD_geometry/1_make_CAD_shapes_from_points.ipynb @@ -2,6 +2,7 @@ "cells": [ { "cell_type": "markdown", + "metadata": {}, "source": [ "# Part 1 - Making a parametric shape\n", "\n", @@ -20,53 +21,54 @@ " Documented: https://paramak.readthedocs.io\n", " Published: https://f1000research.com/articles/10-27\n", " Video presentation: https://www.youtube.com/watch?v=fXboew3U7rw" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": 9, - "source": [ - "from IPython.display import HTML\n", - "HTML('')" - ], + "metadata": {}, "outputs": [ { - "output_type": "stream", "name": "stderr", + "output_type": "stream", "text": [ "/home/jshim/miniconda3/envs/openmc-dagmc/lib/python3.8/site-packages/IPython/core/display.py:724: UserWarning: Consider using IPython.display.IFrame instead\n", " warnings.warn(\"Consider using IPython.display.IFrame instead\")\n" ] }, { - "output_type": "execute_result", "data": { - "text/plain": [ - "" - ], "text/html": [ "" + ], + "text/plain": [ + "" ] }, + "execution_count": 9, "metadata": {}, - "execution_count": 9 + "output_type": "execute_result" } ], - "metadata": {} + "source": [ + "from IPython.display import HTML\n", + "HTML('')" + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "3D shapes can be made using coordinates and CAD opperations such as extrude, rotate and sweep.\n", "\n", "This first example shows 4 points connected by straight edges and rotated by 180 degrees." - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import paramak\n", "my_shape = paramak.RotateStraightShape(\n", @@ -80,20 +82,20 @@ ")\n", "\n", "my_shape.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "This second example shows 4 points connected by spline edges and rotated by 180 degrees." - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "my_shape = paramak.RotateSplineShape(\n", " points=[\n", @@ -106,20 +108,20 @@ ")\n", "\n", "my_shape.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "This second example shows 4 points connected by straight edges and extruded by by 20." - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "my_shape = paramak.ExtrudeStraightShape(\n", " points=[\n", @@ -132,20 +134,20 @@ ")\n", "\n", "my_shape.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "This second example shows 4 points connected by spline edges and extruded by by 20." - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "my_shape = paramak.ExtrudeSplineShape(\n", " points=[\n", @@ -158,22 +160,22 @@ ")\n", "\n", "my_shape.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "Boolean opperations like cut, union and intersection are also supported.\n", "\n", "The following example makes two shapes and cuts the first one away from the second." - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "small_Shape = paramak.ExtrudeStraightShape(\n", " points=[\n", @@ -197,41 +199,41 @@ ")\n", "\n", "my_shape.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "The 3D volumes produced can then be:\n", "- exported to stp files.\n", "- exported to stl files." - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "my_shape.export_stp('example_shape.stp')\n", "my_shape.export_stl('example_shape.stl')" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "The geometry can also be converted into a DAGMC h5m file and used in neutronics simulations.\n", "\n", "To visualize the h5m file it can be converted into a vtk file" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "from stl_to_h5m import stl_to_h5m\n", "\n", @@ -242,42 +244,40 @@ "\n", "import os\n", "os.system('mbconvert dagmc.h5m dagmc.vtk')" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "The geometry produced can be downloaded and viewed in FreeCAD (stp and stl) or Paraview (stl, vtk)" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "from IPython.display import FileLink\n", "display(FileLink('example_shape.stp'))\n", "display(FileLink('example_shape.stl'))\n", "display(FileLink('dagmc.vtk'))" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "There are additional Shape attributes that allow more complex shapes to be made. For more details take a look at the Documented: https://paramak.readthedocs.io" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, - "source": [], + "metadata": {}, "outputs": [], - "metadata": {} + "source": [] } ], "metadata": { @@ -296,9 +296,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.11" + "version": "3.9.7" } }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/tasks/task_10_making_CAD_geometry/2_make_CAD_components_from_parameters.ipynb b/tasks/task_10_making_CAD_geometry/2_make_CAD_components_from_parameters.ipynb index 8cca901d..da45e41a 100644 --- a/tasks/task_10_making_CAD_geometry/2_make_CAD_components_from_parameters.ipynb +++ b/tasks/task_10_making_CAD_geometry/2_make_CAD_components_from_parameters.ipynb @@ -248,7 +248,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.7" } }, "nbformat": 4, diff --git a/tasks/task_10_making_CAD_geometry/3_make_CAD_reactors.ipynb b/tasks/task_10_making_CAD_geometry/3_make_CAD_reactors.ipynb index 4fdaed84..b4d0e9a7 100644 --- a/tasks/task_10_making_CAD_geometry/3_make_CAD_reactors.ipynb +++ b/tasks/task_10_making_CAD_geometry/3_make_CAD_reactors.ipynb @@ -143,7 +143,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.7" } }, "nbformat": 4, diff --git a/tasks/task_11_CAD_cell_tally_heat/1_simulate_CAD_neutronics_geometry_with_cell_tally_heat.ipynb b/tasks/task_11_CAD_cell_tally_heat/1_simulate_CAD_neutronics_geometry_with_cell_tally_heat.ipynb index dea8dedc..52ba3b0b 100644 --- a/tasks/task_11_CAD_cell_tally_heat/1_simulate_CAD_neutronics_geometry_with_cell_tally_heat.ipynb +++ b/tasks/task_11_CAD_cell_tally_heat/1_simulate_CAD_neutronics_geometry_with_cell_tally_heat.ipynb @@ -108,8 +108,8 @@ "materials = odw.Materials(\n", " h5m_filename='dagmc.h5m',\n", " correspondence_dict={\n", - " 'mat_blanket':'Li4SiO4',\n", - " 'mat_plasma': 'DT_plasma'\n", + " 'blanket':'Li4SiO4',\n", + " 'plasma': 'DT_plasma'\n", " }\n", ")\n", "\n", @@ -251,7 +251,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.7" } }, "nbformat": 4, diff --git a/tasks/task_12_CAD_mesh_fast_flux/1_making_shapes_for_a_3d_mesh_tally_vtk.ipynb b/tasks/task_12_CAD_mesh_fast_flux/1_making_shapes_for_a_3d_mesh_tally_vtk.ipynb index b29a583c..09d18dd5 100644 --- a/tasks/task_12_CAD_mesh_fast_flux/1_making_shapes_for_a_3d_mesh_tally_vtk.ipynb +++ b/tasks/task_12_CAD_mesh_fast_flux/1_making_shapes_for_a_3d_mesh_tally_vtk.ipynb @@ -22,7 +22,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -49,7 +49,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -79,54 +79,9 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Overwriting auto display for cadquery Workplane and Shape\n", - " \n" - ] - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "42977dbd73294681b2a0d1dec58f47be", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "CadViewerWidget(anchor=None, cad_width=800, height=600, pinning=False, theme='light', title=None, tree_width=2…" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "my_reactor = paramak.Reactor([blanket, center_column])\n", "\n", @@ -142,116 +97,9 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Info : Meshing 1D...\n", - "Info : [ 0%] Meshing curve 1 (Circle)\n", - "Info : [ 10%] Meshing curve 2 (Circle)\n", - "Info : [ 10%] Meshing curve 3 (Circle)\n", - "Info : [ 10%] Meshing curve 4 (BSpline)\n", - "Info : [ 20%] Meshing curve 5 (Circle)\n", - "Info : [ 20%] Meshing curve 6 (Line)\n", - "Info : [ 20%] Meshing curve 7 (Circle)\n", - "Info : [ 30%] Meshing curve 8 (BSpline)\n", - "Info : [ 30%] Meshing curve 9 (BSpline)\n", - "Info : [ 30%] Meshing curve 10 (Circle)\n", - "Info : [ 40%] Meshing curve 11 (BSpline)\n", - "Info : [ 40%] Meshing curve 12 (BSpline)\n", - "Info : [ 40%] Meshing curve 13 (Circle)\n", - "Info : [ 50%] Meshing curve 14 (BSpline)\n", - "Info : [ 50%] Meshing curve 15 (BSpline)\n", - "Info : [ 50%] Meshing curve 16 (Circle)\n", - "Info : [ 60%] Meshing curve 17 (BSpline)\n", - "Info : [ 60%] Meshing curve 18 (BSpline)\n", - "Info : [ 60%] Meshing curve 19 (Circle)\n", - "Info : [ 70%] Meshing curve 20 (BSpline)\n", - "Info : [ 70%] Meshing curve 21 (BSpline)\n", - "Info : [ 70%] Meshing curve 22 (Circle)\n", - "Info : [ 80%] Meshing curve 23 (BSpline)\n", - "Info : [ 80%] Meshing curve 24 (BSpline)\n", - "Info : [ 80%] Meshing curve 25 (Circle)\n", - "Info : [ 90%] Meshing curve 26 (BSpline)\n", - "Info : [ 90%] Meshing curve 27 (BSpline)\n", - "Info : [ 90%] Meshing curve 28 (Circle)\n", - "Info : [100%] Meshing curve 29 (BSpline)\n", - "Info : [100%] Meshing curve 30 (BSpline)\n", - "Info : Done meshing 1D (Wall 0.448653s, CPU 0.458886s)\n", - "Info : Meshing 2D...\n", - "Info : [ 0%] Meshing surface 1 (Plane, MeshAdapt)\n", - "Info : [ 10%] Meshing surface 2 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 10%] Meshing surface 3 (Plane, MeshAdapt)\n", - "Info : [ 20%] Meshing surface 4 (Cylinder, MeshAdapt)\n", - "Info : [ 20%] Meshing surface 5 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 20%] Meshing surface 6 (Plane, MeshAdapt)\n", - "Info : [ 30%] Meshing surface 7 (Plane, MeshAdapt)\n", - "Info : [ 30%] Meshing surface 8 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 30%] Meshing surface 9 (Plane, MeshAdapt)\n", - "Info : [ 40%] Meshing surface 10 (Plane, MeshAdapt)\n", - "Info : [ 40%] Meshing surface 11 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 40%] Meshing surface 12 (Plane, MeshAdapt)\n", - "Info : [ 50%] Meshing surface 13 (Plane, MeshAdapt)\n", - "Info : [ 50%] Meshing surface 14 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 50%] Meshing surface 15 (Plane, MeshAdapt)\n", - "Info : [ 60%] Meshing surface 16 (Plane, MeshAdapt)\n", - "Info : [ 60%] Meshing surface 17 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 70%] Meshing surface 18 (Plane, MeshAdapt)\n", - "Info : [ 70%] Meshing surface 19 (Plane, MeshAdapt)\n", - "Info : [ 70%] Meshing surface 20 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 80%] Meshing surface 21 (Plane, MeshAdapt)\n", - "Info : [ 80%] Meshing surface 22 (Plane, MeshAdapt)\n", - "Info : [ 80%] Meshing surface 23 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 90%] Meshing surface 24 (Plane, MeshAdapt)\n", - "Info : [ 90%] Meshing surface 25 (Plane, MeshAdapt)\n", - "Info : [ 90%] Meshing surface 26 (Surface of Revolution, MeshAdapt)\n", - "Info : [100%] Meshing surface 27 (Plane, MeshAdapt)\n", - "Info : [100%] Meshing surface 28 (Plane, MeshAdapt)\n", - "Info : Done meshing 2D (Wall 33.936s, CPU 33.9505s)\n", - "Info : 24134 nodes 49889 elements\n", - "Info : Writing '/tmp/volume_1bq63o79p.stl'...\n", - "Info : Done writing '/tmp/volume_1bq63o79p.stl'\n", - "Info : Writing '/tmp/volume_2_ejip4ld.stl'...\n", - "Info : Done writing '/tmp/volume_2_ejip4ld.stl'\n", - "Info : Writing '/tmp/volume_3hmrogdya.stl'...\n", - "Info : Done writing '/tmp/volume_3hmrogdya.stl'\n", - "Info : Writing '/tmp/volume_4kf38_giy.stl'...\n", - "Info : Done writing '/tmp/volume_4kf38_giy.stl'\n", - "Info : Writing '/tmp/volume_5bbgo9yyp.stl'...\n", - "Info : Done writing '/tmp/volume_5bbgo9yyp.stl'\n", - "Info : Writing '/tmp/volume_6_enepmdf.stl'...\n", - "Info : Done writing '/tmp/volume_6_enepmdf.stl'\n", - "Info : Writing '/tmp/volume_7txd91h1s.stl'...\n", - "Info : Done writing '/tmp/volume_7txd91h1s.stl'\n", - "Info : Writing '/tmp/volume_81iai3es_.stl'...\n", - "Info : Done writing '/tmp/volume_81iai3es_.stl'\n", - "Info : Writing '/tmp/volume_94ilp2wwx.stl'...\n", - "Info : Done writing '/tmp/volume_94ilp2wwx.stl'\n", - "file /tmp/volume_1bq63o79p.stl is watertight True\n", - "file /tmp/volume_2_ejip4ld.stl is watertight True\n", - "file /tmp/volume_3hmrogdya.stl is watertight True\n", - "file /tmp/volume_4kf38_giy.stl is watertight True\n", - "file /tmp/volume_5bbgo9yyp.stl is watertight True\n", - "file /tmp/volume_6_enepmdf.stl is watertight True\n", - "file /tmp/volume_7txd91h1s.stl is watertight True\n", - "file /tmp/volume_81iai3es_.stl is watertight True\n", - "file /tmp/volume_94ilp2wwx.stl is watertight True\n" - ] - }, - { - "data": { - "text/plain": [ - "'dagmc.h5m'" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "my_reactor.export_dagmc_h5m(filename='dagmc.h5m')" ] @@ -265,23 +113,11 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "ename": "ModuleNotFoundError", - "evalue": "No module named 'openmc_dagmc_wrapper'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", - "Input \u001b[0;32mIn [5]\u001b[0m, in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# makes use of the previously created neutronics geometry (h5m file) and assigns\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;66;03m# actual materials to the material tags. \u001b[39;00m\n\u001b[0;32m----> 4\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mopenmc_dagmc_wrapper\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01modw\u001b[39;00m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mneutronics_material_maker\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mnmm\u001b[39;00m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;66;03m# this links the material tags in the dagmc h5m file with materials.\u001b[39;00m\n\u001b[1;32m 9\u001b[0m \u001b[38;5;66;03m# these materials are input as strings so they will be looked up in the\u001b[39;00m\n\u001b[1;32m 10\u001b[0m \u001b[38;5;66;03m# neutronics material maker package\u001b[39;00m\n", - "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'openmc_dagmc_wrapper'" - ] - } - ], + "outputs": [], "source": [ "# makes use of the previously created neutronics geometry (h5m file) and assigns\n", "# actual materials to the material tags. \n", @@ -294,8 +130,8 @@ "# these materials are input as strings so they will be looked up in the\n", "# neutronics material maker package\n", "material_tag_to_material_dict = {\n", - " 'mat_blanket': nmm.Material.from_library(name='DT_plasma'),\n", - " 'mat_center_column': nmm.Material.from_library(name='Li4SiO4'),\n", + " 'blanket': nmm.Material.from_library(name='DT_plasma'),\n", + " 'center_column': nmm.Material.from_library(name='Li4SiO4'),\n", "}\n", "\n", "geometry = odw.Geometry(h5m_filename='dagmc.h5m')\n", @@ -441,7 +277,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.10" + "version": "3.9.7" } }, "nbformat": 4, diff --git a/tasks/task_12_CAD_mesh_fast_flux/2_making_components_for_a_2d_mesh_tally_vtk.ipynb b/tasks/task_12_CAD_mesh_fast_flux/2_making_components_for_a_2d_mesh_tally_vtk.ipynb index 4e64b5f9..543a02bc 100644 --- a/tasks/task_12_CAD_mesh_fast_flux/2_making_components_for_a_2d_mesh_tally_vtk.ipynb +++ b/tasks/task_12_CAD_mesh_fast_flux/2_making_components_for_a_2d_mesh_tally_vtk.ipynb @@ -22,13 +22,12 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import paramak\n", "\n", - "\n", "pf_coil = paramak. PoloidalFieldCoil(\n", " height=50,\n", " width=50,\n", @@ -46,7 +45,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -68,7 +67,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -92,226 +91,9 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "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": "ecdb600c1f354e3ba931520b5c5e7764", - "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" - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "my_reactor = paramak.Reactor([blanket, pf_coil,center_column])\n", "\n", @@ -327,37 +109,9 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\u001b[32;1m\n", - "*******************************************************************\n", - "****** Statistics on Transfer (Write) ******\u001b[0m\n", - "\u001b[32;1m\n", - "*******************************************************************\n", - "****** Transfer Mode = 0 I.E. As Is ******\u001b[0m\n", - "\u001b[32;1m****** Transferring Shape, ShapeType = 0 ******\u001b[0m\n", - "\u001b[32;1m** WorkSession : Sending all data\u001b[0m\n", - "\u001b[32;1m Step File Name : my_reactor.stp(3447 ents) Write Done\u001b[0m\n" - ] - }, - { - "data": { - "text/html": [ - "my_reactor.stp
" - ], - "text/plain": [ - "/home/jshim/neutronics-workshop/tasks/task_12_CAD_mesh_fast_flux/my_reactor.stp" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "my_reactor.export_stp('my_reactor.stp')\n", "\n", @@ -374,215 +128,9 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Info : Meshing 1D...\n", - "Info : [ 0%] Meshing curve 1 (Circle)\n", - "Info : [ 10%] Meshing curve 2 (Circle)\n", - "Info : [ 10%] Meshing curve 3 (Line)\n", - "Info : [ 10%] Meshing curve 4 (Circle)\n", - "Info : [ 10%] Meshing curve 5 (Circle)\n", - "Info : [ 10%] Meshing curve 6 (Line)\n", - "Info : [ 10%] Meshing curve 7 (Circle)\n", - "Info : [ 10%] Meshing curve 8 (Line)\n", - "Info : [ 10%] Meshing curve 9 (Circle)\n", - "Info : [ 10%] Meshing curve 10 (Circle)\n", - "Info : [ 10%] Meshing curve 11 (Circle)\n", - "Info : [ 20%] Meshing curve 12 (BSpline)\n", - "Info : [ 20%] Meshing curve 13 (Circle)\n", - "Info : [ 20%] Meshing curve 14 (Circle)\n", - "Info : [ 20%] Meshing curve 15 (Circle)\n", - "Info : [ 20%] Meshing curve 16 (Circle)\n", - "Info : [ 20%] Meshing curve 17 (Circle)\n", - "Info : [ 20%] Meshing curve 18 (Line)\n", - "Info : [ 20%] Meshing curve 19 (Line)\n", - "Info : [ 20%] Meshing curve 20 (Circle)\n", - "Info : [ 20%] Meshing curve 21 (Circle)\n", - "Info : [ 20%] Meshing curve 22 (Circle)\n", - "Info : [ 30%] Meshing curve 23 (Line)\n", - "Info : [ 30%] Meshing curve 24 (Line)\n", - "Info : [ 30%] Meshing curve 25 (Circle)\n", - "Info : [ 30%] Meshing curve 26 (Circle)\n", - "Info : [ 30%] Meshing curve 27 (Circle)\n", - "Info : [ 30%] Meshing curve 28 (Circle)\n", - "Info : [ 30%] Meshing curve 29 (Circle)\n", - "Info : [ 30%] Meshing curve 30 (Line)\n", - "Info : [ 30%] Meshing curve 31 (Line)\n", - "Info : [ 30%] Meshing curve 32 (Circle)\n", - "Info : [ 30%] Meshing curve 33 (Circle)\n", - "Info : [ 40%] Meshing curve 34 (Circle)\n", - "Info : [ 40%] Meshing curve 35 (Line)\n", - "Info : [ 40%] Meshing curve 36 (Line)\n", - "Info : [ 40%] Meshing curve 37 (Circle)\n", - "Info : [ 40%] Meshing curve 38 (Circle)\n", - "Info : [ 40%] Meshing curve 39 (Circle)\n", - "Info : [ 40%] Meshing curve 40 (Circle)\n", - "Info : [ 40%] Meshing curve 41 (Circle)\n", - "Info : [ 40%] Meshing curve 42 (Line)\n", - "Info : [ 40%] Meshing curve 43 (Line)\n", - "Info : [ 40%] Meshing curve 44 (Circle)\n", - "Info : [ 50%] Meshing curve 45 (Circle)\n", - "Info : [ 50%] Meshing curve 46 (Circle)\n", - "Info : [ 50%] Meshing curve 47 (Line)\n", - "Info : [ 50%] Meshing curve 48 (Line)\n", - "Info : [ 50%] Meshing curve 49 (Circle)\n", - "Info : [ 50%] Meshing curve 50 (Circle)\n", - "Info : [ 50%] Meshing curve 51 (Circle)\n", - "Info : [ 50%] Meshing curve 52 (Circle)\n", - "Info : [ 50%] Meshing curve 53 (Circle)\n", - "Info : [ 50%] Meshing curve 54 (Line)\n", - "Info : [ 50%] Meshing curve 55 (Line)\n", - "Info : [ 60%] Meshing curve 56 (Circle)\n", - "Info : [ 60%] Meshing curve 57 (Circle)\n", - "Info : [ 60%] Meshing curve 58 (Circle)\n", - "Info : [ 60%] Meshing curve 59 (Line)\n", - "Info : [ 60%] Meshing curve 60 (Line)\n", - "Info : [ 60%] Meshing curve 61 (Circle)\n", - "Info : [ 60%] Meshing curve 62 (Circle)\n", - "Info : [ 60%] Meshing curve 63 (Circle)\n", - "Info : [ 60%] Meshing curve 64 (Circle)\n", - "Info : [ 60%] Meshing curve 65 (Circle)\n", - "Info : [ 70%] Meshing curve 66 (Line)\n", - "Info : [ 70%] Meshing curve 67 (Line)\n", - "Info : [ 70%] Meshing curve 68 (Circle)\n", - "Info : [ 70%] Meshing curve 69 (Circle)\n", - "Info : [ 70%] Meshing curve 70 (Circle)\n", - "Info : [ 70%] Meshing curve 71 (Line)\n", - "Info : [ 70%] Meshing curve 72 (Line)\n", - "Info : [ 70%] Meshing curve 73 (Circle)\n", - "Info : [ 70%] Meshing curve 74 (Circle)\n", - "Info : [ 70%] Meshing curve 75 (Circle)\n", - "Info : [ 70%] Meshing curve 76 (Circle)\n", - "Info : [ 80%] Meshing curve 77 (Circle)\n", - "Info : [ 80%] Meshing curve 78 (Line)\n", - "Info : [ 80%] Meshing curve 79 (Line)\n", - "Info : [ 80%] Meshing curve 80 (Circle)\n", - "Info : [ 80%] Meshing curve 81 (Circle)\n", - "Info : [ 80%] Meshing curve 82 (Circle)\n", - "Info : [ 80%] Meshing curve 83 (Line)\n", - "Info : [ 80%] Meshing curve 84 (Line)\n", - "Info : [ 80%] Meshing curve 85 (Circle)\n", - "Info : [ 80%] Meshing curve 86 (Circle)\n", - "Info : [ 80%] Meshing curve 87 (Circle)\n", - "Info : [ 90%] Meshing curve 88 (Circle)\n", - "Info : [ 90%] Meshing curve 89 (Circle)\n", - "Info : [ 90%] Meshing curve 90 (Line)\n", - "Info : [ 90%] Meshing curve 91 (Line)\n", - "Info : [ 90%] Meshing curve 92 (Circle)\n", - "Info : [ 90%] Meshing curve 93 (Circle)\n", - "Info : [ 90%] Meshing curve 94 (Circle)\n", - "Info : [ 90%] Meshing curve 95 (Line)\n", - "Info : [ 90%] Meshing curve 96 (Line)\n", - "Info : [ 90%] Meshing curve 97 (Circle)\n", - "Info : [ 90%] Meshing curve 98 (Circle)\n", - "Info : [100%] Meshing curve 99 (Circle)\n", - "Info : [100%] Meshing curve 100 (Circle)\n", - "Info : [100%] Meshing curve 101 (Circle)\n", - "Info : [100%] Meshing curve 102 (Line)\n", - "Info : [100%] Meshing curve 103 (Line)\n", - "Info : [100%] Meshing curve 104 (Circle)\n", - "Info : [100%] Meshing curve 105 (Circle)\n", - "Info : [100%] Meshing curve 106 (Circle)\n", - "Info : [100%] Meshing curve 107 (Line)\n", - "Info : [100%] Meshing curve 108 (Line)\n", - "Info : Done meshing 1D (Wall 0.0162452s, CPU 0.026592s)\n", - "Info : Meshing 2D...\n", - "Info : [ 0%] Meshing surface 1 (Cylinder, MeshAdapt)\n", - "Info : [ 10%] Meshing surface 2 (Plane, MeshAdapt)\n", - "Info : [ 10%] Meshing surface 3 (Cylinder, MeshAdapt)\n", - "Info : [ 10%] Meshing surface 4 (Plane, MeshAdapt)\n", - "Info : [ 10%] Meshing surface 5 (Cylinder, MeshAdapt)\n", - "Info : [ 10%] Meshing surface 6 (Plane, MeshAdapt)\n", - "Info : [ 20%] Meshing surface 7 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 20%] Meshing surface 8 (Plane, MeshAdapt)\n", - "Info : [ 20%] Meshing surface 9 (Sphere, MeshAdapt)\n", - "Info : [ 20%] Meshing surface 10 (Plane, MeshAdapt)\n", - "Info : [ 20%] Meshing surface 11 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 20%] Meshing surface 12 (Plane, MeshAdapt)\n", - "Info : [ 30%] Meshing surface 13 (Plane, MeshAdapt)\n", - "Info : [ 30%] Meshing surface 14 (Plane, MeshAdapt)\n", - "Info : [ 30%] Meshing surface 15 (Sphere, MeshAdapt)\n", - "Info : [ 30%] Meshing surface 16 (Plane, MeshAdapt)\n", - "Info : [ 30%] Meshing surface 17 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 40%] Meshing surface 18 (Plane, MeshAdapt)\n", - "Info : [ 40%] Meshing surface 19 (Plane, MeshAdapt)\n", - "Info : [ 40%] Meshing surface 20 (Plane, MeshAdapt)\n", - "Info : [ 40%] Meshing surface 21 (Sphere, MeshAdapt)\n", - "Info : [ 40%] Meshing surface 22 (Plane, MeshAdapt)\n", - "Info : [ 40%] Meshing surface 23 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 50%] Meshing surface 24 (Plane, MeshAdapt)\n", - "Info : [ 50%] Meshing surface 25 (Plane, MeshAdapt)\n", - "Info : [ 50%] Meshing surface 26 (Plane, MeshAdapt)\n", - "Info : [ 50%] Meshing surface 27 (Sphere, MeshAdapt)\n", - "Info : [ 50%] Meshing surface 28 (Plane, MeshAdapt)\n", - "Info : [ 50%] Meshing surface 29 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 60%] Meshing surface 30 (Plane, MeshAdapt)\n", - "Info : [ 60%] Meshing surface 31 (Plane, MeshAdapt)\n", - "Info : [ 60%] Meshing surface 32 (Plane, MeshAdapt)\n", - "Info : [ 60%] Meshing surface 33 (Sphere, MeshAdapt)\n", - "Info : [ 60%] Meshing surface 34 (Plane, MeshAdapt)\n", - "Info : [ 70%] Meshing surface 35 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 70%] Meshing surface 36 (Plane, MeshAdapt)\n", - "Info : [ 70%] Meshing surface 37 (Plane, MeshAdapt)\n", - "Info : [ 70%] Meshing surface 38 (Plane, MeshAdapt)\n", - "Info : [ 70%] Meshing surface 39 (Sphere, MeshAdapt)\n", - "Info : [ 70%] Meshing surface 40 (Plane, MeshAdapt)\n", - "Info : [ 80%] Meshing surface 41 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 80%] Meshing surface 42 (Plane, MeshAdapt)\n", - "Info : [ 80%] Meshing surface 43 (Plane, MeshAdapt)\n", - "Info : [ 80%] Meshing surface 44 (Plane, MeshAdapt)\n", - "Info : [ 80%] Meshing surface 45 (Sphere, MeshAdapt)\n", - "Info : [ 90%] Meshing surface 46 (Plane, MeshAdapt)\n", - "Info : [ 90%] Meshing surface 47 (Surface of Revolution, MeshAdapt)\n", - "Info : [ 90%] Meshing surface 48 (Plane, MeshAdapt)\n", - "Info : [ 90%] Meshing surface 49 (Plane, MeshAdapt)\n", - "Info : [ 90%] Meshing surface 50 (Plane, MeshAdapt)\n", - "Info : [ 90%] Meshing surface 51 (Sphere, MeshAdapt)\n", - "Info : [100%] Meshing surface 52 (Plane, MeshAdapt)\n", - "Info : [100%] Meshing surface 53 (Surface of Revolution, MeshAdapt)\n", - "Info : [100%] Meshing surface 54 (Plane, MeshAdapt)\n", - "Info : [100%] Meshing surface 55 (Plane, MeshAdapt)\n", - "Info : [100%] Meshing surface 56 (Plane, MeshAdapt)\n", - "Info : Done meshing 2D (Wall 14.475s, CPU 14.4766s)\n", - "Info : 24024 nodes 50983 elements\n", - "Info : Writing '/tmp/volume_1ya905d6y.stl'...\n", - "Info : Done writing '/tmp/volume_1ya905d6y.stl'\n", - "Info : Writing '/tmp/volume_21713jqj7.stl'...\n", - "Info : Done writing '/tmp/volume_21713jqj7.stl'\n", - "Info : Writing '/tmp/volume_3fm04kflt.stl'...\n", - "Info : Done writing '/tmp/volume_3fm04kflt.stl'\n", - "Info : Writing '/tmp/volume_4ozp3ns7u.stl'...\n", - "Info : Done writing '/tmp/volume_4ozp3ns7u.stl'\n", - "Info : Writing '/tmp/volume_5vc_dm549.stl'...\n", - "Info : Done writing '/tmp/volume_5vc_dm549.stl'\n", - "Info : Writing '/tmp/volume_6xl62nv5j.stl'...\n", - "Info : Done writing '/tmp/volume_6xl62nv5j.stl'\n", - "Info : Writing '/tmp/volume_7p3fuo6bj.stl'...\n", - "Info : Done writing '/tmp/volume_7p3fuo6bj.stl'\n", - "Info : Writing '/tmp/volume_8fiwr678_.stl'...\n", - "Info : Done writing '/tmp/volume_8fiwr678_.stl'\n", - "Info : Writing '/tmp/volume_9i4o02pff.stl'...\n", - "Info : Done writing '/tmp/volume_9i4o02pff.stl'\n", - "Info : Writing '/tmp/volume_10qy8o513g.stl'...\n", - "Info : Done writing '/tmp/volume_10qy8o513g.stl'\n", - "file /tmp/volume_1ya905d6y.stl is watertight True\n", - "file /tmp/volume_21713jqj7.stl is watertight True\n", - "file /tmp/volume_3fm04kflt.stl is watertight True\n", - "file /tmp/volume_4ozp3ns7u.stl is watertight True\n", - "file /tmp/volume_5vc_dm549.stl is watertight True\n", - "file /tmp/volume_6xl62nv5j.stl is watertight True\n", - "file /tmp/volume_7p3fuo6bj.stl is watertight True\n", - "file /tmp/volume_8fiwr678_.stl is watertight True\n", - "file /tmp/volume_9i4o02pff.stl is watertight True\n", - "file /tmp/volume_10qy8o513g.stl is watertight True\n" - ] - } - ], + "outputs": [], "source": [ "my_reactor.export_dagmc_h5m('dagmc.h5m')\n", "\n", @@ -603,20 +151,9 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/jshim/openmc-1/openmc/mixin.py:67: IDWarning: Another Surface instance already exists with id=9999.\n", - " warn(msg, IDWarning)\n", - "/home/jshim/openmc-1/openmc/mixin.py:67: IDWarning: Another Cell instance already exists with id=9999.\n", - " warn(msg, IDWarning)\n" - ] - } - ], + "outputs": [], "source": [ "# makes use of the previously created neutronics geometry (h5m file) and assigns\n", "# actual materials to the material tags. \n", @@ -628,9 +165,9 @@ "# these materials are input as strings so they will be looked up in the\n", "# neutronics material maker package\n", "material_tag_to_material_dict = {\n", - " 'mat_pf_coil': nmm.Material.from_library(name='copper'),\n", - " 'mat_blanket': nmm.Material.from_library(name='Li4SiO4'),\n", - " 'mat_center_column': nmm.Material.from_library(name='copper'),\n", + " 'pf_coil': nmm.Material.from_library(name='copper'),\n", + " 'blanket': nmm.Material.from_library(name='Li4SiO4'),\n", + " 'center_column': nmm.Material.from_library(name='copper'),\n", "}\n", "\n", "geometry = odw.Geometry(h5m_filename='dagmc.h5m')\n", @@ -650,7 +187,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -678,7 +215,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -706,112 +243,9 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " %%%%%%%%%%%%%%%\n", - " %%%%%%%%%%%%%%%%%%%%%%%%\n", - " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n", - " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n", - " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n", - " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n", - " %%%%%%%%%%%%%%%%%%%%%%%%\n", - " %%%%%%%%%%%%%%%%%%%%%%%%\n", - " ############### %%%%%%%%%%%%%%%%%%%%%%%%\n", - " ################## %%%%%%%%%%%%%%%%%%%%%%%\n", - " ################### %%%%%%%%%%%%%%%%%%%%%%%\n", - " #################### %%%%%%%%%%%%%%%%%%%%%%\n", - " ##################### %%%%%%%%%%%%%%%%%%%%%\n", - " ###################### %%%%%%%%%%%%%%%%%%%%\n", - " ####################### %%%%%%%%%%%%%%%%%%\n", - " ####################### %%%%%%%%%%%%%%%%%\n", - " ###################### %%%%%%%%%%%%%%%%%\n", - " #################### %%%%%%%%%%%%%%%%%\n", - " ################# %%%%%%%%%%%%%%%%%\n", - " ############### %%%%%%%%%%%%%%%%\n", - " ############ %%%%%%%%%%%%%%%\n", - " ######## %%%%%%%%%%%%%%\n", - " %%%%%%%%%%%\n", - "\n", - " | The OpenMC Monte Carlo Code\n", - " Copyright | 2011-2021 MIT and OpenMC contributors\n", - " License | https://docs.openmc.org/en/latest/license.html\n", - " Version | 0.13.0-dev\n", - " Git SHA1 | 209fdd86ed14a16d4b73e9c44de8a9710a898e64\n", - " Date/Time | 2022-01-26 23:10:24\n", - " MPI Processes | 1\n", - " OpenMP Threads | 8\n", - "\n", - " Reading settings XML file...\n", - " Reading cross sections XML file...\n", - " Reading materials XML file...\n", - " Reading geometry XML file...\n", - "Using the DOUBLE-DOWN interface to Embree.\n", - "Loading file dagmc.h5m\n", - "Initializing the GeomQueryTool...\n", - "Using faceting tolerance: 0\n", - "Building acceleration data structures...\n", - "Implicit Complement assumed to be Vacuum\n", - " Reading Cu65 from\n", - " /home/jshim/nuc_data/cross_section_data/ENDFB-7.1-NNDC_Cu65.h5\n", - " Reading Cu63 from\n", - " /home/jshim/nuc_data/cross_section_data/ENDFB-7.1-NNDC_Cu63.h5\n", - " Reading Li6 from /home/jshim/nuc_data/cross_section_data/ENDFB-7.1-NNDC_Li6.h5\n", - " Reading Li7 from /home/jshim/nuc_data/cross_section_data/ENDFB-7.1-NNDC_Li7.h5\n", - " Reading Si28 from\n", - " /home/jshim/nuc_data/cross_section_data/ENDFB-7.1-NNDC_Si28.h5\n", - " Reading Si29 from\n", - " /home/jshim/nuc_data/cross_section_data/ENDFB-7.1-NNDC_Si29.h5\n", - " Reading Si30 from\n", - " /home/jshim/nuc_data/cross_section_data/ENDFB-7.1-NNDC_Si30.h5\n", - " Reading O16 from /home/jshim/nuc_data/cross_section_data/ENDFB-7.1-NNDC_O16.h5\n", - " Reading O18 from /home/jshim/nuc_data/cross_section_data/TENDL-2019_O18.h5\n", - " Reading O17 from /home/jshim/nuc_data/cross_section_data/ENDFB-7.1-NNDC_O17.h5\n", - " Minimum neutron data temperature: 294.0 K\n", - " Maximum neutron data temperature: 294.0 K\n", - " Reading tallies XML file...\n", - " Preparing distributed cell instances...\n", - " Writing summary.h5 file...\n", - " Maximum neutron transport energy: 20000000.0 eV for Li6\n", - "\n", - " ===============> FIXED SOURCE TRANSPORT SIMULATION <===============\n", - "\n", - " Simulating batch 1\n", - " Simulating batch 2\n", - " Simulating batch 3\n", - " Simulating batch 4\n", - " Simulating batch 5\n", - " Simulating batch 6\n", - " Simulating batch 7\n", - " Simulating batch 8\n", - " Simulating batch 9\n", - " Simulating batch 10\n", - " Creating state point statepoint.10.h5...\n", - "\n", - " =======================> TIMING STATISTICS <=======================\n", - "\n", - " Total time for initialization = 9.6893e-01 seconds\n", - " Reading cross sections = 8.6679e-01 seconds\n", - " Total time in simulation = 7.1340e-01 seconds\n", - " Time in transport only = 6.7301e-01 seconds\n", - " Time in active batches = 7.1340e-01 seconds\n", - " Time accumulating tallies = 1.8198e-02 seconds\n", - " Time writing statepoints = 2.0861e-02 seconds\n", - " Total time for finalization = 9.6260e-01 seconds\n", - " Total time elapsed = 2.6586e+00 seconds\n", - " Calculation Rate (active) = 28034.7 particles/second\n", - "\n", - " ============================> RESULTS <============================\n", - "\n", - " Leakage Fraction = 0.51210 +/- 0.00313\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "import openmc_plasma_source as ops\n", "\n", @@ -824,7 +258,6 @@ "# https://github.com/fusion-energy/openmc-plasma-source/\n", "settings.source = ops.FusionRingSource(fuel=\"DT\", radius=350)\n", "\n", - "\n", "my_model = openmc.Model(\n", " materials=materials,\n", " geometry=geometry,\n", @@ -848,41 +281,13 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{1: Tally\n", - "\tID =\t1\n", - "\tName =\t(n,Xa)_on_3D_mesh\n", - "\tFilters =\tMeshFilter\n", - "\tNuclides =\ttotal\n", - "\tScores =\t['(n,Xa)']\n", - "\tEstimator =\ttracklength}\n", - "tally.size 1000000\n", - "tally [0. 0. 0. ... 0. 0. 0.]\n", - "Writing n_Xa_on_3D_mesh.vtk\n" - ] - }, - { - "data": { - "text/plain": [ - "'n_Xa_on_3D_mesh.vtk'" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "from openmc_mesh_tally_to_vtk import write_mesh_tally_to_vtk\n", "# importing a package for converting regular mesh tallies to vtk files\n", "# more details here https://github.com/fusion-energy/openmc_mesh_tally_to_vtk\n", - "\n", + "from openmc_mesh_tally_to_vtk import write_mesh_tally_to_vtk\n", "\n", "# assumes you have a statepoint file from the OpenMC simulation\n", "statepoint = openmc.StatePoint(statepoint_file)\n", @@ -904,38 +309,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The code block below provides a download link for a VTK which can be opened with Paraview\n" + "The output file vtk file called \"n_Xa_on_3D_mesh.vtk\" should now appear in the left hand side sidebar. The file can be downloaded to your local computer by right mouse clicking on the file and selecting download." ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "n_Xa_on_3D_mesh.vtk
" - ], - "text/plain": [ - "/home/jshim/neutronics-workshop/tasks/task_12_CAD_mesh_fast_flux/n_Xa_on_3D_mesh.vtk" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "from IPython.display import FileLink\n", - "display(FileLink('n_Xa_on_3D_mesh.vtk'))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -954,7 +329,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.7" } }, "nbformat": 4, diff --git a/tasks/task_12_CAD_mesh_fast_flux/3_making_reactor_for_a_2d_mesh_tally_and_matplotlib_png.ipynb b/tasks/task_12_CAD_mesh_fast_flux/3_making_reactor_for_a_2d_mesh_tally_and_matplotlib_png.ipynb index 717ef647..cf389b75 100644 --- a/tasks/task_12_CAD_mesh_fast_flux/3_making_reactor_for_a_2d_mesh_tally_and_matplotlib_png.ipynb +++ b/tasks/task_12_CAD_mesh_fast_flux/3_making_reactor_for_a_2d_mesh_tally_and_matplotlib_png.ipynb @@ -1,12 +1,5 @@ { "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# This task is not quite ready as we don't have an open source route for simulating geometry that requires imprinting and merging. However this simulation can be carried out using Trelis." - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -29,9 +22,53 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " \n" + ] + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0a2f80318d5d4b4684f6cdfb7f48302f", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "CadViewerWidget(anchor=None, cad_width=800, height=600, pinning=False, theme='light', title=None, tree_width=2…" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import paramak\n", "\n", @@ -49,7 +86,15 @@ " elongation=2,\n", " triangularity=0.55,\n", " number_of_tf_coils=16,\n", - " rotation_angle=180,\n", + " pf_coil_case_thicknesses=[10, 10, 10, 10],\n", + " pf_coil_radial_thicknesses=[20, 50, 50, 20],\n", + " pf_coil_vertical_thicknesses=[20, 50, 50, 20],\n", + " pf_coil_radial_position=[440, 550, 550, 440],\n", + " pf_coil_vertical_position=[230, 100, -100, -230],\n", + " rear_blanket_to_tf_gap=5,\n", + " outboard_tf_coil_radial_thickness=30,\n", + " outboard_tf_coil_poloidal_thickness=30,\n", + " rotation_angle=90,\n", ")\n", "\n", "# TF and PF coils can be added with additional arguments.\n", @@ -72,7 +117,8 @@ "metadata": {}, "outputs": [], "source": [ - "my_reactor.export_dagmc_h5m('dagmc_3.h5m', exclude='plasma')" + "# creates a dagmc h5m file of the geometry with material tags automatically assigned\n", + "my_reactor.export_dagmc_h5m(filename=\"dagmc.h5m\", min_mesh_size=5, max_mesh_size=20)" ] }, { @@ -90,20 +136,100 @@ "source": [ "from neutronics_material_maker import Material\n", "\n", - "mat1 = Material.from_library(name='Li4SiO4')\n", + "# Names of material tags can be found with the command line tool\n", + "# mbsize -ll dagmc.h5m | grep 'NAME = mat:'\n", + "\n", + "# simplified material definitions have been used to keen this example minimal\n", + "mat_pf_coil_1 = Material.from_library(name='copper')\n", + "\n", + "mat_pf_coil_2 = Material.from_library(name='copper')\n", + "\n", + "mat_pf_coil_3 = Material.from_library(name='copper')\n", + "\n", + "mat_pf_coil_4 = Material.from_library(name='copper')\n", + "\n", + "mat_pf_coil_case_1 = openmc.Material(name=\"pf_coil_case_1\")\n", + "mat_pf_coil_case_1.add_element(\"Fe\", 1, \"ao\")\n", + "mat_pf_coil_case_1.set_density(\"g/cm3\", 8.96)\n", + "\n", + "mat_pf_coil_case_2 = openmc.Material(name=\"pf_coil_case_2\")\n", + "mat_pf_coil_case_2.add_element(\"Fe\", 1, \"ao\")\n", + "mat_pf_coil_case_2.set_density(\"g/cm3\", 8.96)\n", + "\n", + "mat_pf_coil_case_3 = openmc.Material(name=\"pf_coil_case_3\")\n", + "mat_pf_coil_case_3.add_element(\"Fe\", 1, \"ao\")\n", + "mat_pf_coil_case_3.set_density(\"g/cm3\", 8.96)\n", + "\n", + "mat_pf_coil_case_4 = openmc.Material(name=\"pf_coil_case_4\")\n", + "mat_pf_coil_case_4.add_element(\"Fe\", 1, \"ao\")\n", + "mat_pf_coil_case_4.set_density(\"g/cm3\", 8.96)\n", "\n", - "mat2 = Material.from_library(name='copper')\n", + "mat_plasma = openmc.Material(name=\"plasma\")\n", + "mat_plasma.add_element(\"H\", 1, \"ao\")\n", + "mat_plasma.set_density(\"g/cm3\", 0.00001)\n", "\n", - "mat3 = Material.from_library(name='WC')\n", + "mat_center_column_shield = openmc.Material(name=\"center_column_shield\")\n", + "mat_center_column_shield.add_element(\"W\", 1, \"ao\")\n", + "mat_center_column_shield.set_density(\"g/cm3\", 19.3)\n", "\n", - "mat4 = Material.from_library(name='eurofer')" + "mat_outboard_firstwall = openmc.Material(name=\"outboard_firstwall\")\n", + "mat_outboard_firstwall.add_element(\"Fe\", 1, \"ao\")\n", + "mat_outboard_firstwall.set_density(\"g/cm3\", 7.7)\n", + "\n", + "mat_blanket = openmc.Material(name=\"blanket\")\n", + "mat_blanket.add_elements_from_formula(\"Pb842Li158\")\n", + "mat_blanket.set_density(\"g/cm3\", 19.)\n", + "\n", + "mat_divertor_upper = openmc.Material(name=\"divertor_upper\")\n", + "mat_divertor_upper.add_element(\"W\", 1, \"ao\")\n", + "mat_divertor_upper.set_density(\"g/cm3\", 19.3)\n", + "\n", + "mat_divertor_lower = openmc.Material(name=\"divertor_lower\")\n", + "mat_divertor_lower.add_element(\"W\", 1, \"ao\")\n", + "mat_divertor_lower.set_density(\"g/cm3\", 19.3)\n", + "\n", + "mat_supports = openmc.Material(name=\"supports\")\n", + "mat_supports.add_element(\"Fe\", 1, \"ao\")\n", + "mat_supports.set_density(\"g/cm3\", 7.7)\n", + "\n", + "mat_outboard_rear_blanket_wall = openmc.Material(name=\"outboard_rear_blanket_wall\")\n", + "mat_outboard_rear_blanket_wall.add_element(\"Fe\", 1, \"ao\")\n", + "mat_outboard_rear_blanket_wall.set_density(\"g/cm3\", 7.7)\n", + "\n", + "mat_inboard_tf_coils = Material.from_library(name='copper')\n", + "\n", + "mat_tf_coils = Material.from_library(name='copper')\n", + "\n", + "\n", + "materials = openmc.Materials(\n", + " [\n", + " mat_pf_coil_1,\n", + " mat_pf_coil_2,\n", + " mat_pf_coil_3,\n", + " mat_pf_coil_4,\n", + " mat_pf_coil_case_1,\n", + " mat_pf_coil_case_2,\n", + " mat_pf_coil_case_3,\n", + " mat_pf_coil_case_4,\n", + " mat_plasma,\n", + " mat_center_column_shield,\n", + " mat_outboard_firstwall,\n", + " mat_blanket,\n", + " mat_divertor_upper,\n", + " mat_divertor_lower,\n", + " mat_supports,\n", + " mat_outboard_rear_blanket_wall,\n", + " mat_inboard_tf_coils,\n", + " mat_tf_coils,\n", + " ]\n", + ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "This next section combines the geometry with the materials and specifies a few mesh tallies" + "This next section builds the geometry, this is achieved using a filled CSG geometry with reflecting surfaces for the 90 degree wedge" ] }, { @@ -112,32 +238,41 @@ "metadata": {}, "outputs": [], "source": [ - "# makes use of the previously created neutronics geometry (h5m file) and assigns\n", - "# actual materials to the material tags. \n", - "\n", - "import openmc_dagmc_wrapper as odw\n", - "import neutronics_material_maker as nmm\n", - "\n", - "# this links the material tags in the dagmc h5m file with materials.\n", - "# these materials are input as strings so they will be looked up in the\n", - "# neutronics material maker package\n", - "material_tag_to_material_dict = {\n", - " 'mat_blanket': mat1,\n", - " 'mat_blanket_rear_wall':mat4,\n", - " 'mat_center_column_shield':mat3,\n", - " 'mat_divertor_lower':mat4,\n", - " 'mat_divertor_upper':mat4,\n", - " 'mat_firstwall':mat4,\n", - " 'mat_inboard_tf_coils':mat2,\n", - " 'mat_plasma':mat2 # todo remove\n", - "}\n", - "\n", - "geometry = odw.Geometry(h5m_filename='dagmc_3.h5m')\n", - "\n", - "materials = odw.Materials(\n", - " h5m_filename='dagmc_3.h5m',\n", - " correspondence_dict=material_tag_to_material_dict\n", - ")" + "import openmc\n", + "\n", + "# makes use of the dagmc geometry\n", + "dag_univ = openmc.DAGMCUniverse(\"dagmc.h5m\")\n", + "\n", + "# creates an edge of universe boundary surface\n", + "vac_surf = openmc.Sphere(r=10000, surface_id=9999, boundary_type=\"vacuum\")\n", + "\n", + "# adds reflective surface for the sector model at 0 degrees\n", + "reflective_1 = openmc.Plane(\n", + " a=math.sin(0),\n", + " b=-math.cos(0),\n", + " c=0.0,\n", + " d=0.0,\n", + " surface_id=9991,\n", + " boundary_type=\"reflective\",\n", + ")\n", + "\n", + "# adds reflective surface for the sector model at 90 degrees\n", + "reflective_2 = openmc.Plane(\n", + " a=math.sin(math.radians(90)),\n", + " b=-math.cos(math.radians(90)),\n", + " c=0.0,\n", + " d=0.0,\n", + " surface_id=9990,\n", + " boundary_type=\"reflective\",\n", + ")\n", + "\n", + "# specifies the region as below the universe boundary and inside the reflective surfaces\n", + "region = -vac_surf & -reflective_1 & +reflective_2\n", + "\n", + "# creates a cell from the region and fills the cell with the dagmc geometry\n", + "containing_cell = openmc.Cell(cell_id=9999, region=region, fill=dag_univ)\n", + "\n", + "geometry = openmc.Geometry(root=[containing_cell])\n" ] }, { @@ -153,20 +288,42 @@ "metadata": {}, "outputs": [], "source": [ + "# creates a simple isotropic neutron source in the center with 14MeV neutrons\n", + "my_source = openmc.Source()\n", "\n", - "import openmc\n", + "# the distribution of radius is just a single value at the plasma major radius\n", + "radius = openmc.stats.Discrete([293.], [1])\n", + "\n", + "# the distribution of source z values is just a single value\n", + "z_values = openmc.stats.Discrete([0], [1])\n", "\n", - "# initialises a new source object\n", - "source = openmc.Source()\n", + "# the distribution of source azimuthal angles values is a uniform distribution between 0 and 0.5 Pi\n", + "# these angles must be the same as the reflective angles\n", + "angle = openmc.stats.Uniform(a=0., b=math.radians(90))\n", "\n", - "# sets the location of the source to x=0 y=0 z=0\n", - "source.space = openmc.stats.Point((100, 0, 0))\n", + "# this makes the ring source using the three distributions and a radius\n", + "my_source.space = openmc.stats.CylindricalIndependent(r=radius, phi=angle, z=z_values, origin=(0.0, 0.0, 0.0))\n", "\n", "# sets the direction to isotropic\n", - "source.angle = openmc.stats.Isotropic()\n", + "my_source.angle = openmc.stats.Isotropic()\n", "\n", - "# sets the energy distribution to 100% 14MeV neutrons\n", - "source.energy = openmc.stats.Discrete([14e6], [1])" + "# sets the energy distribution to a Muir distribution neutrons\n", + "my_source.energy = openmc.stats.Muir(e0=14080000.0, m_rat=5.0, kt=20000.0)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# specifies the simulation computational intensity\n", + "settings = openmc.Settings()\n", + "settings.batches = 10\n", + "settings.particles = 10000\n", + "settings.inactive = 0\n", + "settings.run_mode = \"fixed source\"\n", + "settings.source = my_source" ] }, { @@ -181,7 +338,23 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "# creates a mesh that covers the geometry\n", + "mesh = openmc.RegularMesh()\n", + "mesh.dimension = [100, 100, 100]\n", + "mesh.lower_left = [0, 0, -350] # x,y,z coordinates start at 0 as this is a sector model\n", + "mesh.upper_right = [650, 650, 350]\n", + "\n", + "\n", + "# makes a mesh tally using the previously created mesh and records heating on the mesh\n", + "mesh_tally = openmc.Tally(name=\"heating_on_mesh\")\n", + "mesh_filter = openmc.MeshFilter(mesh)\n", + "mesh_tally.filters = [mesh_filter]\n", + "mesh_tally.scores = [\"heating\"]\n", + "\n", + "# groups the two tallies\n", + "tallies = openmc.Tallies([mesh_tally])" + ] }, { "cell_type": "markdown", @@ -195,7 +368,15 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "# builds the openmc model\n", + "my_model = openmc.Model(\n", + " materials=materials, geometry=geometry, settings=settings, tallies=tallies\n", + ")\n", + "\n", + "# starts the simulation\n", + "my_model.run()" + ] }, { "cell_type": "markdown", @@ -210,20 +391,31 @@ "metadata": {}, "outputs": [], "source": [ - "# from openmc_mesh_tally_to_vtk import write_mesh_tally_to_vtk\n", - "# import openmc\n", + "# this is a small package that facilitates saving of mesh tallies as vtk files\n", + "# https://github.com/fusion-energy/openmc_mesh_tally_to_vtk\n", + "from openmc_mesh_tally_to_vtk import write_mesh_tally_to_vtk\n", + "\n", "\n", - "# # assumes you have a statepoint file from the OpenMC simulation\n", - "# statepoint = openmc.StatePoint('statepoint.3.h5')\n", + "# open the results file\n", + "sp = openmc.StatePoint(\"statepoint.10.h5\")\n", "\n", - "# # assumes the statepoint file has a RegularMesh tally with a certain name\n", - "# my_tally = statepoint.get_tally(name='tally_on_regular_mesh')\n", + "# access the tally using pandas dataframes\n", + "heating_tally = sp.get_tally(name=\"heating\")\n", "\n", - "# # converts the tally result into a VTK file\n", - "# write_mesh_tally_to_vtk(\n", - "# tally=my_tally,\n", - "# filename = \"vtk_file_from_openmc_mesh.vtk\",\n", - "# )" + "# print cell tally results with unit conversion\n", + "# raw tally result is multipled by 4 as this is a sector model of 1/4 of the total model (90 degrees from 360)\n", + "# raw tally result is divided by 1e6 to convert the standard units of eV to MeV\n", + "print(f\"The heating of {4*heating_tally.mean.sum()/1e6} MeV per source particle is deposited\")\n", + "print(f\"Standard deviation on the heating tally is {heating_tally.std_dev.sum()}\")\n", + "\n", + "# extracts the mesh tally result\n", + "tbr_mesh_tally = sp.get_tally(name=\"heating_on_mesh\")\n", + "\n", + "# writes the mesh tally as a vtk file\n", + "write_mesh_tally_to_vtk(\n", + " tally=tbr_mesh_tally,\n", + " filename=\"vtk_file_from_openmc_mesh.vtk\",\n", + ")" ] }, { @@ -270,7 +462,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.7" } }, "nbformat": 4,