Skip to content

Commit

Permalink
Merge pull request #293 from fusion-energy/adding-nuc-data-path-to-all
Browse files Browse the repository at this point in the history
Adding nuc data path to all
  • Loading branch information
shimwell authored Oct 17, 2024
2 parents a5e9c77 + a3f3cf2 commit f562d3a
Show file tree
Hide file tree
Showing 40 changed files with 708 additions and 101 deletions.
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
2 changes: 1 addition & 1 deletion tasks/task_04_make_sources/5_gamma_source_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"outputs": [],
"source": [
"# remove any other xml files so that openmc reads the correct xml files\n",
"!rm *.xml\n",
"!rm *.xml || true\n",
"\n",
"# number_of_particles can be increased to sample more particles and the histogram resoluton can be changed\n",
"plot_source_energy(\n",
Expand Down
3 changes: 2 additions & 1 deletion tasks/task_04_make_sources/7_strucutured_mesh_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import openmc
import numpy as np

# setting the nuclear data path to the correct location in the docker image
# Setting the nuclear data path to the correct location in the docker image.
# If you are running this outside the docker image you will have to change this path.
openmc.config['cross_sections'] = '/nuclear_data/cross_sections.xml'

# making a minimal geometry
Expand Down
Loading

0 comments on commit f562d3a

Please sign in to comment.