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

Update "Gambling with Physics" workshop for OpenMC 0.13.0 #9

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
114 changes: 61 additions & 53 deletions Part1/Part1-Blank.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"import openmc"
"import openmc\n",
"print(openmc.__version__)"
]
},
{
Expand All @@ -30,12 +29,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"#TODO: Define the uo2 Material here."
"# TODO: Define the uo2 Material here.\n",
"uo2 = "
]
},
{
Expand All @@ -46,8 +44,8 @@
},
"outputs": [],
"source": [
"#TODO: Add 0.03 of 'U235' and 0.97 of 'U238'.\n",
"#TODO: Add 2.0 of 'O' and set the density to 10.0 'g/cm3'."
"# TODO: Add 0.03 of 'U235' and 0.97 of 'U238'.\n",
"# TODO: Add 2.0 of 'O' and set the density to 10.0 'g/cm3'."
]
},
{
Expand All @@ -60,9 +58,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"zirconium = openmc.Material()\n",
Expand All @@ -71,7 +67,7 @@
"\n",
"water = openmc.Material()\n",
"water.add_element('H', 2.0)\n",
"water.add_element('O', 1.0)\n",
"water.add_nuclide('O16', 1.0)\n",
"water.set_density('g/cm3', 0.7)"
]
},
Expand All @@ -86,6 +82,27 @@
"#TODO: Add an s_alpha_beta table for 'c_H_in_H2O'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"OpenMC needs **cross section libraries** to run. If one is specified in the materials XML file, OpenMC will use that for your simulation. If you do not, but have an environment variable `$OPENMC_CROSS_SECTIONS` set, OpenMC will default to that at runtime.\n",
"\n",
"It is often better to set the particular cross section library you want to use. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"jeff33 = \"/projects/openmc/data/jeff33_hdf5/cross_sections.xml\"\n",
"endfb71 = \"/projects/openmc/data/endfb71_hdf5/cross_sections.xml\"\n",
"endfb80 = \"/projects/openmc/data/endfb80_hdf5/cross_sections.xml\"\n",
"xs = None # Set to one of the provided libraries above"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -96,12 +113,14 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"#TODO: Define Materials and export_to_xml()."
"#TODO: Define Materials\n",
"mats = None\n",
"if xs:\n",
" mats.cross_sections = xs\n",
"# Export to xml."
]
},
{
Expand All @@ -121,12 +140,13 @@
},
"outputs": [],
"source": [
"#TODO: Define fuel_or with R=0.39 cm.\n",
"clad_ir = openmc.ZCylinder(R=0.40)\n",
"clad_or = openmc.ZCylinder(R=0.46)\n",
"# TODO: Define fuel_or with radius = 0.39 cm.\n",
"fuel_or = None\n",
"clad_ir = openmc.ZCylinder(r=0.40)\n",
"clad_or = openmc.ZCylinder(r=0.46)\n",
"\n",
"#TODO: Define a pitch of 1.26 cm.\n",
"#TODO: Define the left XPlane.\n",
"pitch = 0.0 # TODO: Define a pitch of 1.26 cm.\n",
"left = None # TODO: Define the left XPlane.\n",
"right = openmc.XPlane(x0=pitch/2, boundary_type='reflective')\n",
"bottom = openmc.YPlane(y0=-pitch/2, boundary_type='reflective')\n",
"top = openmc.YPlane(y0=pitch/2, boundary_type='reflective')"
Expand All @@ -142,12 +162,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"#TODO: Define the fuel_region and gap_region.\n",
"# TODO: Define the fuel_region and gap_region.\n",
"fuel_region = None\n",
"gap_region = None\n",
"clad_region = +clad_ir & -clad_or\n",
"water_region = +left & -right & +bottom & -top & +clad_or"
]
Expand All @@ -167,7 +187,10 @@
},
"outputs": [],
"source": [
"#TODO: Define fuel and gap Cell objects.\n",
"# TODO: Define fuel and gap Cell objects. Do not fill the gap.\n",
"fuel = None\n",
"\n",
"gap = None\n",
"\n",
"clad = openmc.Cell()\n",
"clad.fill = zirconium\n",
Expand All @@ -188,9 +211,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"#TODO: Define the root Universe.\n",
Expand Down Expand Up @@ -224,9 +245,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"#TODO: Give it a width of [pitch, pitch].\n",
Expand All @@ -247,9 +266,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"openmc.plot_inline(p)"
Expand Down Expand Up @@ -309,9 +326,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"settings.export_to_xml()\n",
Expand Down Expand Up @@ -341,9 +356,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"#TODO: Make a CellFilter for the fuel cell.\n",
Expand All @@ -363,9 +376,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"tallies = openmc.Tallies([t])\n",
Expand All @@ -386,7 +397,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [],
Expand All @@ -397,9 +407,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!cat tallies.out"
Expand All @@ -408,7 +416,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -422,9 +430,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
"version": "3.10.4"
}
},
"nbformat": 4,
"nbformat_minor": 0
"nbformat_minor": 1
}
Loading