Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding nuc data path to all #293

Merged
merged 20 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .devcontainer/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ RUN pip install neutronics_material_maker[density] \
RUN pip install git+https://github.com/fusion-energy/openmc-plasma-source

RUN pip install git+https://github.com/CadQuery/cadquery.git@bc82cb04c59668a1369d9ce648361c8786bbd1c8 --no-deps
RUN pip install cadquery-ocp==7.7.1 "multimethod>=1.7<2.0" nlopt typish casadi path ezdxf nptyping==2.0.1
RUN pip install cadquery-ocp==7.7.1 "multimethod>=1.7,<2.0" nlopt typish casadi path ezdxf nptyping==2.0.1

# Python libraries used in the workshop
RUN pip install cmake\
Expand Down Expand Up @@ -170,7 +170,7 @@ RUN if [ "$build_double_down" = "ON" ] ; \
RUN mkdir MOAB && \
cd MOAB && \
# newer versions of moab (5.4.0, 5.4.1) don't produce an importable pymoab package!
# TODO try moab 5.5.0
# TODO try moab 5.5.0 and 5.5.1
git clone --single-branch --branch 5.3.1 --depth 1 https://bitbucket.org/fathomteam/moab.git && \
mkdir build && \
cd build && \
Expand Down Expand Up @@ -249,6 +249,3 @@ RUN download_endf_chain -d nuclear_data -r b8.0
RUN wget https://github.com/mit-crpg/WMP_Library/releases/download/v1.1/WMP_Library_v1.1.tar.gz && \
tar -xf WMP_Library_v1.1.tar.gz -C / && \
rm WMP_Library_v1.1.tar.gz

ENV OPENMC_CROSS_SECTIONS=/nuclear_data/cross_sections.xml
ENV OPENMC_CHAIN_FILE=/nuclear_data/chain-endf-b8.0.xml
21 changes: 20 additions & 1 deletion tasks/task_01_cross_sections/1_isotope_xs_plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@
"IFrame(src=\"https://www.youtube.com/embed/eBZ2lY_2v7IA\", width=560, height=340)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First import OpenMC and configure the nuclear data path"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import openmc\n",
"\n",
"# Setting the cross section path to the correct location in the docker image.\n",
"# If you are running this outside the docker image you will have to change this path to your local cross section path.\n",
"openmc.config['cross_sections'] = '/nuclear_data/cross_sections.xml'"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -50,7 +70,6 @@
"metadata": {},
"outputs": [],
"source": [
"import openmc\n",
"import matplotlib.pyplot as plt\n",
"\n",
"fig = openmc.plotter.plot_xs(\n",
Expand Down
20 changes: 20 additions & 0 deletions tasks/task_01_cross_sections/2_element_xs_plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,26 @@
"IFrame(src=\"https://www.youtube.com/embed/ELZNeIdSuMY\", width=560, height=340)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First import OpenMC and configure the nuclear data path"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import openmc\n",
"\n",
"# Setting the cross section path to the correct location in the docker image.\n",
"# If you are running this outside the docker image you will have to change this path to your local cross section path.\n",
"openmc.config['cross_sections'] = '/nuclear_data/cross_sections.xml'"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
8 changes: 6 additions & 2 deletions tasks/task_01_cross_sections/3_material_xs_plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"This code block imports a function and packages needed for the task."
"First import OpenMC and configure the nuclear data path"
]
},
{
Expand All @@ -46,7 +46,11 @@
"metadata": {},
"outputs": [],
"source": [
"import openmc"
"import openmc\n",
"\n",
"# Setting the cross section path to the correct location in the docker image.\n",
"# If you are running this outside the docker image you will have to change this path to your local cross section path.\n",
"openmc.config['cross_sections'] = '/nuclear_data/cross_sections.xml'"
]
},
{
Expand Down
14 changes: 13 additions & 1 deletion tasks/task_01_cross_sections/4_Doppler_broadening.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,28 @@
"IFrame(src=\"https://www.youtube.com/embed/mkl1mVnTO6g\", width=560, height=340)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First import packages needed for OpenMC and configure the nuclear data path"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"import openmc\n",
"from openmc.data import REACTION_MT\n",
"import matplotlib.pyplot as plt"
"\n",
"# Setting the cross section path to the correct location in the docker image.\n",
"# If you are running this outside the docker image you will have to change this path to your local cross section path.\n",
"openmc.config['cross_sections'] = '/nuclear_data/cross_sections.xml'"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,26 @@
"IFrame(src=\"https://www.youtube.com/embed/-NGnY-1TWCA\", width=560, height=340)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First import OpenMC and configure the nuclear data path"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import openmc\n",
"\n",
"# Setting the cross section path to the correct location in the docker image.\n",
"# If you are running this outside the docker image you will have to change this path to your local cross section path.\n",
"openmc.config['cross_sections'] = '/nuclear_data/cross_sections.xml'"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The following code block is a simple example of creating a material (water H2O) from elements. (Note how Hydrogen and Oxygen elements have been specified rather than each specific isotope)."
"First import OpenMC and configure the nuclear data path"
]
},
{
Expand All @@ -26,6 +26,24 @@
"source": [
"import openmc\n",
"\n",
"# Setting the cross section path to the correct location in the docker image.\n",
"# If you are running this outside the docker image you will have to change this path to your local cross section path.\n",
"openmc.config['cross_sections'] = '/nuclear_data/cross_sections.xml'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The following code block is a simple example of creating a material (water H2O) from elements. (Note how Hydrogen and Oxygen elements have been specified rather than each specific isotope)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Making water from elements\n",
"\n",
"water_mat = openmc.Material()\n",
Expand Down
14 changes: 12 additions & 2 deletions tasks/task_02_making_materials/5_example_materials_mixed.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,25 @@
"This python notebook allows users to make mixed materials using OpenMC and the Neutronics Material Maker."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First import packages needed and configure the OpenMC nuclear data path"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# import the packages needed for the task\n",
"import neutronics_material_maker as nmm\n",
"import openmc\n",
"import neutronics_material_maker as nmm"
"\n",
"# Setting the cross section path to the correct location in the docker image.\n",
"# If you are running this outside the docker image you will have to change this path to your local cross section path.\n",
"openmc.config['cross_sections'] = '/nuclear_data/cross_sections.xml'"
]
},
{
Expand Down
22 changes: 20 additions & 2 deletions tasks/task_03_making_CSG_geometry/1_simple_csg_geometry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,26 @@
"IFrame(src=\"https://www.youtube.com/embed/Ovr7oYukYRw\", width=560, height=340)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First import OpenMC and configure the nuclear data path"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import openmc\n",
"\n",
"# Setting the cross section path to the correct location in the docker image.\n",
"# If you are running this outside the docker image you will have to change this path to your local cross section path.\n",
"openmc.config['cross_sections'] = '/nuclear_data/cross_sections.xml'"
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand All @@ -38,8 +58,6 @@
"metadata": {},
"outputs": [],
"source": [
"import openmc\n",
"\n",
"# example surfaces\n",
"inner_sphere_surface = openmc.Sphere(r=500)\n",
"outer_sphere_surface = openmc.Sphere(r=600)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,33 @@
"\n",
"This python notebook allows users to build upon the geometry constructed in Part 1 by adding a center column to the model.\n",
"\n",
"The center column requires a different surface type. OpenMC has several different surface types in addition to spheres. The documentation contains useful information on all surface types supported: https://openmc.readthedocs.io/en/stable/usersguide/geometry.html#surfaces-and-regions.\n",
"The center column requires a different surface type. OpenMC has several different surface types in addition to spheres. The documentation contains useful information on all surface types supported: https://openmc.readthedocs.io/en/stable/usersguide/geometry.html#surfaces-and-regions."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First import OpenMC and configure the nuclear data path"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import openmc\n",
"\n",
"# Setting the cross section path to the correct location in the docker image.\n",
"# If you are running this outside the docker image you will have to change this path to your local cross section path.\n",
"openmc.config['cross_sections'] = '/nuclear_data/cross_sections.xml'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For the center column we will use a cylinder with Z axis orientation.\n",
"\n",
"The code block below shows how the center column can be defined."
Expand All @@ -22,8 +47,6 @@
"metadata": {},
"outputs": [],
"source": [
"import openmc\n",
"\n",
"# surfaces\n",
"central_column_surface = openmc.ZCylinder(r=100) # note the new surface type\n",
"inner_sphere_surface = openmc.Sphere(r=480)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
"This first code block recreates the simple reactor geometry seen in Part 2, but also assigns materials to each cell."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First import OpenMC and configure the nuclear data path"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -32,6 +39,17 @@
"source": [
"import openmc\n",
"\n",
"# Setting the cross section path to the correct location in the docker image.\n",
"# If you are running this outside the docker image you will have to change this path to your local cross section path.\n",
"openmc.config['cross_sections'] = '/nuclear_data/cross_sections.xml'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"copper = openmc.Material()\n",
"copper.set_density('g/cm3', 8.5)\n",
"copper.add_element('Cu', 1.0) # Note, percent_type does not have to be specified as material is 100% copper\n",
Expand Down
7 changes: 7 additions & 0 deletions tasks/task_04_make_sources/1_point_source_plots.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
"IFrame(src=\"https://www.youtube.com/embed/j9dT1Viqcu4\", width=560, height=340)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First import packages needed"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
15 changes: 11 additions & 4 deletions tasks/task_04_make_sources/2_ring_source.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
"In this example we are going to make use of the Uniform disitrbution by feel free to tinker with the differnt distributions an make your own source."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First import packages needed"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -46,11 +53,11 @@
"source": [
"import openmc\n",
"\n",
"# provides simple source plotting functions\n",
"\n",
"# This package provides simple source plotting functions\n",
"# for more details here is a link to the package repository\n",
"# https://github.com/fusion-energy/openmc_source_plotter\n",
"from openmc_source_plotter import plot_source_position\n",
"\n"
"from openmc_source_plotter import plot_source_position"
]
},
{
Expand Down Expand Up @@ -148,7 +155,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
Loading
Loading