Skip to content

Commit

Permalink
updated 14
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Oct 17, 2024
1 parent ff1873e commit 2df1f0e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,16 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"from matplotlib import pyplot as plt\n",
"from matplotlib.colors import LogNorm # used for plotting log scale graphs\n",
"\n",
"import openmc\n",
"import openmc.lib # this example makes use of openmc lib to run the simulations\n",
"\n",
"from matplotlib import pyplot as plt\n",
"from matplotlib.colors import LogNorm # used for plotting log scale graphs"
"# 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 Expand Up @@ -224,8 +229,8 @@
"model = openmc.Model(my_geometry, my_materials, my_settings, my_tallies)\n",
"\n",
"# deletes old input and output files\n",
"!rm *.xml\n",
"!rm *.h5\n",
"!rm *.xml || true\n",
"!rm *.h5 || true\n",
"\n",
"model.export_to_xml() # this is necessary as openmc.lib loads up the model.xml file"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,35 @@
"spectra tally."
]
},
{
"cell_type": "markdown",
"id": "61ad590c",
"metadata": {},
"source": [
"First we import the packages needed to run the example, including OpenMC. We also configure the nuclear data path."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ecaafb63-bd33-4597-baf3-8e8cccd32f9c",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"import openmc\n",
"# Note this example makes use of OpenMC lib which provides python bindings to\n",
"# the C/C++ methods in OpenMC and allows more direct control of the Monte Carlo\n",
"# simulation. In this example we iterate through the batches and access the\n",
"# tally result each time.\n",
"# Link to openmc.lib documentation https://docs.openmc.org/en/stable/pythonapi/capi.html\n",
"import openmc.lib\n",
"import numpy as np\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

0 comments on commit 2df1f0e

Please sign in to comment.