Skip to content

Commit

Permalink
Merge pull request #81 from fusion-energy/develop
Browse files Browse the repository at this point in the history
moving to openmc develop branch
  • Loading branch information
shimwell authored Mar 28, 2022
2 parents ab971e8 + e697ffd commit 66837e1
Show file tree
Hide file tree
Showing 9 changed files with 358 additions and 957 deletions.
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ RUN wget https://github.com/mit-crpg/WMP_Library/releases/download/v1.1/WMP_Libr

# installs OpenMc from source
RUN cd /opt && \
# switch back to tagged version when 0.13.1 is released
# switch back to tagged version when 0.13.1 is released as develop depletion is used
# git clone --single-branch --branch v0.13.0 --depth 1 https://github.com/openmc-dev/openmc.git && \
git clone --single-branch --branch changing_get_atoms_arg_to_mat_object_try2 --depth 1 https://github.com/shimwell/openmc.git && \
git clone --single-branch --branch develop --depth 1 https://github.com/openmc-dev/openmc.git && \
cd openmc && \
mkdir build && \
cd build && \
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

[![CircleCI](https://circleci.com/gh/fusion-energy/neutronics-workshop/tree/main.svg?style=svg)](https://circleci.com/gh/fusion-energy/neutronics-workshop/tree/main)
<!-- [![CI with install](https://github.com/fusion-energy/neutronics-workshop/actions/workflows/ci_tests.yml/badge.svg)](https://github.com/fusion-energy/neutronics-workshop/actions/workflows/ci_tests.yml) -->
[![CI with install](https://github.com/fusion-energy/neutronics-workshop/actions/workflows/ci_tests.yml/badge.svg)](https://github.com/fusion-energy/neutronics-workshop/actions/workflows/ci_tests.yml)

[![docker-publish-release](https://github.com/fusion-energy/neutronics-workshop/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/fusion-energy/neutronics-workshop/actions/workflows/docker-publish.yml)

Expand Down
118 changes: 59 additions & 59 deletions tasks/task_10_making_CAD_geometry/1_make_CAD_shapes_from_points.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Part 1 - Making a parametric shape\n",
"\n",
Expand All @@ -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('<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/Bn_TcJSOvaA\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>')"
],
"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": [
"<IPython.core.display.HTML object>"
],
"text/html": [
"<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/Bn_TcJSOvaA\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 9,
"metadata": {},
"execution_count": 9
"output_type": "execute_result"
}
],
"metadata": {}
"source": [
"from IPython.display import HTML\n",
"HTML('<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/Bn_TcJSOvaA\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>')"
]
},
{
"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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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": {
Expand All @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.12"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.12"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -251,7 +251,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.12"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 66837e1

Please sign in to comment.