mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
adding back files to be reviewed
This commit is contained in:
parent
ae28233110
commit
bc09d1ef55
1244 changed files with 301904 additions and 0 deletions
BIN
examples/jupyter/c5g7.h5
Normal file
BIN
examples/jupyter/c5g7.h5
Normal file
Binary file not shown.
764
examples/jupyter/cad-based-geometry.ipynb
Normal file
764
examples/jupyter/cad-based-geometry.ipynb
Normal file
File diff suppressed because one or more lines are too long
1115
examples/jupyter/candu.ipynb
Normal file
1115
examples/jupyter/candu.ipynb
Normal file
File diff suppressed because one or more lines are too long
1
examples/jupyter/chain_simple.xml
Symbolic link
1
examples/jupyter/chain_simple.xml
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/home/romano/openmc/tests/chain_simple.xml
|
||||
463
examples/jupyter/expansion-filters.ipynb
Normal file
463
examples/jupyter/expansion-filters.ipynb
Normal file
File diff suppressed because one or more lines are too long
372
examples/jupyter/hexagonal-lattice.ipynb
Normal file
372
examples/jupyter/hexagonal-lattice.ipynb
Normal file
|
|
@ -0,0 +1,372 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"In this example, we will create a hexagonal lattice and show how the orientation can be changed via the cell rotation property. Let's first just set up some materials and universes that we will use to fill the lattice."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%matplotlib inline\n",
|
||||
"import openmc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"fuel = openmc.Material(name='fuel')\n",
|
||||
"fuel.add_nuclide('U235', 1.0)\n",
|
||||
"fuel.set_density('g/cm3', 10.0)\n",
|
||||
"\n",
|
||||
"fuel2 = openmc.Material(name='fuel2')\n",
|
||||
"fuel2.add_nuclide('U238', 1.0)\n",
|
||||
"fuel2.set_density('g/cm3', 10.0)\n",
|
||||
"\n",
|
||||
"water = openmc.Material(name='water')\n",
|
||||
"water.add_nuclide('H1', 2.0)\n",
|
||||
"water.add_nuclide('O16', 1.0)\n",
|
||||
"water.set_density('g/cm3', 1.0)\n",
|
||||
"\n",
|
||||
"mats = openmc.Materials((fuel, fuel2, water))\n",
|
||||
"mats.export_to_xml()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"With our three materials, we will set up two universes that represent pin-cells: one with a small pin and one with a big pin. Since we will be using these universes in a lattice, it's always a good idea to have an \"outer\" universe as well that is applied outside the defined lattice."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"r_pin = openmc.ZCylinder(r=0.25)\n",
|
||||
"fuel_cell = openmc.Cell(fill=fuel, region=-r_pin)\n",
|
||||
"water_cell = openmc.Cell(fill=water, region=+r_pin)\n",
|
||||
"pin_universe = openmc.Universe(cells=(fuel_cell, water_cell))\n",
|
||||
"\n",
|
||||
"r_big_pin = openmc.ZCylinder(r=0.5)\n",
|
||||
"fuel2_cell = openmc.Cell(fill=fuel2, region=-r_big_pin)\n",
|
||||
"water2_cell = openmc.Cell(fill=water, region=+r_big_pin)\n",
|
||||
"big_pin_universe = openmc.Universe(cells=(fuel2_cell, water2_cell))\n",
|
||||
"\n",
|
||||
"all_water_cell = openmc.Cell(fill=water)\n",
|
||||
"outer_universe = openmc.Universe(cells=(all_water_cell,))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now let's create a hexagonal lattice using the `HexLattice` class:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"lat = openmc.HexLattice()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"We need to set the `center` of the lattice, the `pitch`, an `outer` universe (which is applied to all lattice elements outside of those that are defined), and a list of `universes`. Let's start with the easy ones first. Note that for a 2D lattice, we only need to specify a single number for the pitch."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"lat.center = (0., 0.)\n",
|
||||
"lat.pitch = (1.25,)\n",
|
||||
"lat.outer = outer_universe"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now we need to set the `universes` property on our lattice. It needs to be set to a list of lists of Universes, where each list of Universes corresponds to a ring of the lattice. The rings are ordered from outermost to innermost, and within each ring the indexing starts at the \"top\". To help visualize the proper indices, we can use the `show_indices()` helper method."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" (0, 0)\n",
|
||||
" (0,11) (0, 1)\n",
|
||||
"(0,10) (1, 0) (0, 2)\n",
|
||||
" (1, 5) (1, 1)\n",
|
||||
"(0, 9) (2, 0) (0, 3)\n",
|
||||
" (1, 4) (1, 2)\n",
|
||||
"(0, 8) (1, 3) (0, 4)\n",
|
||||
" (0, 7) (0, 5)\n",
|
||||
" (0, 6)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(lat.show_indices(num_rings=3))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's set up a lattice where the first element in each ring is the big pin universe and all other elements are regular pin universes. From the diagram above, we see that the outer ring has 12 elements, the middle ring has 6, and the innermost degenerate ring has a single element."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"HexLattice\n",
|
||||
"\tID =\t4\n",
|
||||
"\tName =\t\n",
|
||||
"\tOrientation =\ty\n",
|
||||
"\t# Rings =\t3\n",
|
||||
"\t# Axial =\tNone\n",
|
||||
"\tCenter =\t(0.0, 0.0)\n",
|
||||
"\tPitch =\t(1.25,)\n",
|
||||
"\tOuter =\t3\n",
|
||||
"\tUniverses \n",
|
||||
" 2\n",
|
||||
" 1 1\n",
|
||||
"1 2 1\n",
|
||||
" 1 1\n",
|
||||
"1 2 1\n",
|
||||
" 1 1\n",
|
||||
"1 1 1\n",
|
||||
" 1 1\n",
|
||||
" 1\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"outer_ring = [big_pin_universe] + [pin_universe]*11\n",
|
||||
"middle_ring = [big_pin_universe] + [pin_universe]*5\n",
|
||||
"inner_ring = [big_pin_universe]\n",
|
||||
"lat.universes = [outer_ring, middle_ring, inner_ring]\n",
|
||||
"print(lat)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now let's put our lattice inside a circular cell that will serve as the top-level cell for our geometry."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"outer_surface = openmc.ZCylinder(r=4.0, boundary_type='vacuum')\n",
|
||||
"main_cell = openmc.Cell(fill=lat, region=-outer_surface)\n",
|
||||
"geom = openmc.Geometry([main_cell])\n",
|
||||
"geom.export_to_xml()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now let's create a plot to see what our geometry looks like."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQAgMAAAD90d5fAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///8AAP///wCAgACerKf2AAAAAWJLR0QAiAUdSAAAAAd0SU1FB+MGCAIxFif9eE4AAAhVSURBVHja7Z3LdeM4EEXlBUJgPgyBC9E8xxvtlQSj6BBmMc5HoWjZR2OLlkVK9Xn1IeRRd626DdDXVQ8ECiAIbjYmK/3ZOttVJutnVgGxEualv7M2m1F6wrpcRtOTtq3ASKWUnrW0iAmMNMpLL1qbAukVy2A0GiRB/KIxMmTRGfGAqcFKCNgLwoi2MIwRCxigelx7lBFxBXYk4grO8LticMTvioXhdcXkiNcVG8PnitERnyuNFeLowcBea27t+o44XHE4YnfFLLtHeg/D2opd0bLGyyH7p9mk9zFs8SpeiEV6Z7RM8XLK/mm49O5oWeLljpYhXoFo4fEKRAuPVyBacLxC0ULjFYoWGq9QtNB4xRhY/xWUBBMlGC0sXlEGEi8tWq/v77/C8SoqQ6XojViRZP8J+TcqCuCI6kpQkrcJ8k9MFEWS9y+LiSJL8nqByPHSRIGipcYrJMn+AlHalywKKElMlCYHIosiX/t6hfzyi4LdJcE7pWRBJFEUSfZXSKD76rMggijaWPL+jjYvQZSSB+FFafIgvCh9HqT3Ql7nkF9OCJBD4BBO+ZIJ4ZRvMiGc8n0mhBFFTYJtkPZxkJILoZVvciG08tpVRkjvg5i6FRoCzLBsEEr5kg2hlG+yIVsfxDD8MhD9KiOEUB6ZWeMp0dnax0AKcBWepp7tvnk1wFVwwj3Z9jEQ5Cp4EvRlHt3x6dyXtS4IODHlIEWou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EaUAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTktMDYtMDhUMDc6NDk6MjItMDU6MDA/X9I4AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE5LTA2LTA4VDA3OjQ5OjIyLTA1OjAwTgJqhAAAAABJRU5ErkJggg==\n",
|
||||
"text/plain": [
|
||||
"<IPython.core.display.Image object>"
|
||||
]
|
||||
},
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"p = openmc.Plot.from_geometry(geom)\n",
|
||||
"p.color_by = 'material'\n",
|
||||
"p.colors = colors = {\n",
|
||||
" water: 'blue',\n",
|
||||
" fuel: 'olive',\n",
|
||||
" fuel2: 'yellow'\n",
|
||||
"}\n",
|
||||
"p.to_ipython_image()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"At this point, if we wanted to simulate the model, we would need to create an instance of `openmc.Settings`, export it to XML, and run."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Lattice orientation\n",
|
||||
"\n",
|
||||
"Now let's say we want our hexagonal lattice orientated such that two sides of the lattice are parallel to the x-axis. This can be achieved by two means: either we can rotate the cell that contains the lattice, or we can can change the `HexLattice.orientation` attribute. By default, the `orientation` is set to \"y\", indicating that two sides of the lattice are parallel to the y-axis, but we can also change it to \"x\" to make them parallel to the x-axis."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQAgMAAAD90d5fAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///8AAP+AgAD//w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htLy2yR7Ycwb/at/EVxmhScjpTGJbQBu8hW8jKb4uue1fzb+yteiPFC9nOug8gxGDIHeihOiAlARA5Z2c+ZNDJH+Cg+iAlCRI5VEjkgSuaoK8UFMRGIyPFjIgepyRwJp3ggJgoROaZP5MBBmaMTFQfEJCAix1mKHMwpc8SoqoekJBE69lXkAFuZo3hFDhUWOR5Z5qBnVQdJN2AGUbIkkTlGXOZAdJGj3UUOqa/JV262qvKVna2KfOVnqyJf+dl6K++/KIzSfFGyVSw9QfbyfNEYZdKTZC/NFzFbRdLTZC8MhRxIQSj0QAqkp8p+NSqkhEENpSgQaihlDFoohYHQQillUEIpDoQSSjkjP5SKQPJDqWHk9mBdFSSvByvptcgJq2XkaG+qIemEVScrJ2EcjFQL61ggcVkMDyNKYWNExGcRPUFhZQQyxpirm3naWMfNeNteLw0QiGmEuJgqEuM/rS4lqiAX++MAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTktMDYtMDhUMDc6NDk6MjItMDU6MDA/X9I4AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE5LTA2LTA4VDA3OjQ5OjIyLTA1OjAwTgJqhAAAAABJRU5ErkJggg==\n",
|
||||
"text/plain": [
|
||||
"<IPython.core.display.Image object>"
|
||||
]
|
||||
},
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Change the orientation of the lattice and re-export the geometry\n",
|
||||
"lat.orientation = 'x'\n",
|
||||
"geom.export_to_xml()\n",
|
||||
"\n",
|
||||
"# Run OpenMC in plotting mode\n",
|
||||
"p.to_ipython_image()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"When we change the orientation to 'x', you can see that the first universe in each ring starts to the right along the x-axis. As before, the universes are defined in a clockwise fashion around each ring. To see the proper indices for a hexagonal lattice in this orientation, we can again call `show_indices` but pass an extra orientation argument:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" (0, 8) (0, 9) (0,10)\n",
|
||||
"\n",
|
||||
" (0, 7) (1, 4) (1, 5) (0,11)\n",
|
||||
"\n",
|
||||
"(0, 6) (1, 3) (2, 0) (1, 0) (0, 0)\n",
|
||||
"\n",
|
||||
" (0, 5) (1, 2) (1, 1) (0, 1)\n",
|
||||
"\n",
|
||||
" (0, 4) (0, 3) (0, 2)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(lat.show_indices(3, orientation='x'))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Hexagonal prisms\n",
|
||||
"\n",
|
||||
"OpenMC also contains a convenience function that can create a hexagonal prism representing the interior region of six surfaces defining a hexagon. This can be useful as a bounding surface of a hexagonal lattice. For example, if we wanted the outer boundary of our geometry to be hexagonal, we could change the `region` of the main cell:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQBAMAAABykSv/AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAElBMVEX///+TUVD//wCAgAA4vPIAAP/pte6jAAAAAWJLR0QAiAUdSAAAAAd0SU1FB+MGCAIxFif9eE4AAAn2SURBVHja7d3tceM4DAbgsANJHVh0BVIFl7E7WPffymV346wlEh8UCVDGAP9u3jkvHhP+JCN/fHh5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5WatRtPQcQRYyOKS0ZB16syW8IHpLYgYi7VCbLSuQIA8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8vLy8vLy8vLy8vLy8lOp/nb6TXPV6EWgAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTktMDYtMDhUMDc6NDk6MjItMDU6MDA/X9I4AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE5LTA2LTA4VDA3OjQ5OjIyLTA1OjAwTgJqhAAAAABJRU5ErkJggg==\n",
|
||||
"text/plain": [
|
||||
"<IPython.core.display.Image object>"
|
||||
]
|
||||
},
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"main_cell.region = openmc.model.hexagonal_prism(\n",
|
||||
" edge_length=3*lat.pitch[0],\n",
|
||||
" orientation='x',\n",
|
||||
" boundary_type='vacuum'\n",
|
||||
")\n",
|
||||
"geom.export_to_xml()\n",
|
||||
"\n",
|
||||
"# Run OpenMC in plotting mode\n",
|
||||
"p.color_by = 'cell'\n",
|
||||
"p.to_ipython_image()"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"anaconda-cloud": {},
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 1
|
||||
}
|
||||
BIN
examples/jupyter/images/cylinder_mesh.png
Normal file
BIN
examples/jupyter/images/cylinder_mesh.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.7 KiB |
BIN
examples/jupyter/images/mdgxs.png
Normal file
BIN
examples/jupyter/images/mdgxs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
examples/jupyter/images/mgxs.png
Normal file
BIN
examples/jupyter/images/mgxs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
BIN
examples/jupyter/images/teapot.jpg
Normal file
BIN
examples/jupyter/images/teapot.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 101 KiB |
1494
examples/jupyter/mdgxs-part-i.ipynb
Normal file
1494
examples/jupyter/mdgxs-part-i.ipynb
Normal file
File diff suppressed because one or more lines are too long
1178
examples/jupyter/mdgxs-part-ii.ipynb
Normal file
1178
examples/jupyter/mdgxs-part-ii.ipynb
Normal file
File diff suppressed because one or more lines are too long
701
examples/jupyter/mg-mode-part-i.ipynb
Normal file
701
examples/jupyter/mg-mode-part-i.ipynb
Normal file
File diff suppressed because one or more lines are too long
1539
examples/jupyter/mg-mode-part-ii.ipynb
Normal file
1539
examples/jupyter/mg-mode-part-ii.ipynb
Normal file
File diff suppressed because one or more lines are too long
1425
examples/jupyter/mg-mode-part-iii.ipynb
Normal file
1425
examples/jupyter/mg-mode-part-iii.ipynb
Normal file
File diff suppressed because one or more lines are too long
1138
examples/jupyter/mgxs-part-i.ipynb
Normal file
1138
examples/jupyter/mgxs-part-i.ipynb
Normal file
File diff suppressed because one or more lines are too long
2744
examples/jupyter/mgxs-part-ii.ipynb
Normal file
2744
examples/jupyter/mgxs-part-ii.ipynb
Normal file
File diff suppressed because one or more lines are too long
1667
examples/jupyter/mgxs-part-iii.ipynb
Normal file
1667
examples/jupyter/mgxs-part-iii.ipynb
Normal file
File diff suppressed because one or more lines are too long
962
examples/jupyter/nuclear-data-resonance-covariance.ipynb
Normal file
962
examples/jupyter/nuclear-data-resonance-covariance.ipynb
Normal file
File diff suppressed because one or more lines are too long
1503
examples/jupyter/nuclear-data.ipynb
Normal file
1503
examples/jupyter/nuclear-data.ipynb
Normal file
File diff suppressed because one or more lines are too long
2516
examples/jupyter/pandas-dataframes.ipynb
Normal file
2516
examples/jupyter/pandas-dataframes.ipynb
Normal file
File diff suppressed because one or more lines are too long
1564
examples/jupyter/pincell.ipynb
Normal file
1564
examples/jupyter/pincell.ipynb
Normal file
File diff suppressed because one or more lines are too long
996
examples/jupyter/pincell_depletion.ipynb
Normal file
996
examples/jupyter/pincell_depletion.ipynb
Normal file
File diff suppressed because one or more lines are too long
985
examples/jupyter/post-processing.ipynb
Normal file
985
examples/jupyter/post-processing.ipynb
Normal file
File diff suppressed because one or more lines are too long
352
examples/jupyter/search.ipynb
Normal file
352
examples/jupyter/search.ipynb
Normal file
File diff suppressed because one or more lines are too long
1753
examples/jupyter/tally-arithmetic.ipynb
Normal file
1753
examples/jupyter/tally-arithmetic.ipynb
Normal file
File diff suppressed because it is too large
Load diff
365
examples/jupyter/triso.ipynb
Normal file
365
examples/jupyter/triso.ipynb
Normal file
File diff suppressed because one or more lines are too long
121
examples/python/basic/build-xml.py
Normal file
121
examples/python/basic/build-xml.py
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
import openmc
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
###############################################################################
|
||||
|
||||
# OpenMC simulation parameters
|
||||
batches = 15
|
||||
inactive = 5
|
||||
particles = 10000
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate some Materials and register the appropriate Nuclides
|
||||
moderator = openmc.Material(material_id=41, name='moderator')
|
||||
moderator.set_density('g/cc', 1.0)
|
||||
moderator.add_element('H', 2.)
|
||||
moderator.add_element('O', 1.)
|
||||
moderator.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
fuel = openmc.Material(material_id=40, name='fuel')
|
||||
fuel.set_density('g/cc', 4.5)
|
||||
fuel.add_nuclide('U235', 1.)
|
||||
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([moderator, fuel])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate ZCylinder surfaces
|
||||
surf1 = openmc.ZCylinder(surface_id=1, x0=0, y0=0, r=7, name='surf 1')
|
||||
surf2 = openmc.ZCylinder(surface_id=2, x0=0, y0=0, r=9, name='surf 2')
|
||||
surf3 = openmc.ZCylinder(surface_id=3, x0=0, y0=0, r=11, name='surf 3')
|
||||
surf3.boundary_type = 'vacuum'
|
||||
|
||||
# Instantiate Cells
|
||||
cell1 = openmc.Cell(cell_id=1, name='cell 1')
|
||||
cell2 = openmc.Cell(cell_id=100, name='cell 2')
|
||||
cell3 = openmc.Cell(cell_id=101, name='cell 3')
|
||||
cell4 = openmc.Cell(cell_id=2, name='cell 4')
|
||||
|
||||
# Use surface half-spaces to define regions
|
||||
cell1.region = -surf2
|
||||
cell2.region = -surf1
|
||||
cell3.region = +surf1
|
||||
cell4.region = +surf2 & -surf3
|
||||
|
||||
# Register Materials with Cells
|
||||
cell2.fill = fuel
|
||||
cell3.fill = moderator
|
||||
cell4.fill = moderator
|
||||
|
||||
# Instantiate Universes
|
||||
universe1 = openmc.Universe(universe_id=37)
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
cell1.fill = universe1
|
||||
|
||||
# Register Cells with Universes
|
||||
universe1.add_cells([cell2, cell3])
|
||||
root.add_cells([cell1, cell4])
|
||||
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry(root)
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
bounds = [-4., -4., -4., 4., 4., 4.]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC tallies.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate some tally Filters
|
||||
cell_filter = openmc.CellFilter(cell2)
|
||||
energy_filter = openmc.EnergyFilter([0., 20.e6])
|
||||
energyout_filter = openmc.EnergyoutFilter([0., 20.e6])
|
||||
|
||||
# Instantiate the first Tally
|
||||
first_tally = openmc.Tally(tally_id=1, name='first tally')
|
||||
first_tally.filters = [cell_filter]
|
||||
scores = ['total', 'scatter', 'nu-scatter',
|
||||
'absorption', 'fission', 'nu-fission']
|
||||
first_tally.scores = scores
|
||||
|
||||
# Instantiate the second Tally
|
||||
second_tally = openmc.Tally(tally_id=2, name='second tally')
|
||||
second_tally.filters = [cell_filter, energy_filter]
|
||||
second_tally.scores = scores
|
||||
|
||||
# Instantiate the third Tally
|
||||
third_tally = openmc.Tally(tally_id=3, name='third tally')
|
||||
third_tally.filters = [cell_filter, energy_filter, energyout_filter]
|
||||
third_tally.scores = ['scatter', 'nu-scatter', 'nu-fission']
|
||||
|
||||
# Instantiate a Tallies collection and export to XML
|
||||
tallies_file = openmc.Tallies((first_tally, second_tally, third_tally))
|
||||
tallies_file.export_to_xml()
|
||||
125
examples/python/boxes/build-xml.py
Normal file
125
examples/python/boxes/build-xml.py
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
import numpy as np
|
||||
import openmc
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
###############################################################################
|
||||
|
||||
# OpenMC simulation parameters
|
||||
batches = 15
|
||||
inactive = 5
|
||||
particles = 10000
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml File
|
||||
###############################################################################
|
||||
|
||||
# Instantiate some Materials and register the appropriate Nuclides
|
||||
fuel1 = openmc.Material(material_id=1, name='fuel')
|
||||
fuel1.set_density('g/cc', 4.5)
|
||||
fuel1.add_nuclide('U235', 1.)
|
||||
|
||||
fuel2 = openmc.Material(material_id=2, name='depleted fuel')
|
||||
fuel2.set_density('g/cc', 4.5)
|
||||
fuel2.add_nuclide('U238', 1.)
|
||||
|
||||
moderator = openmc.Material(material_id=3, name='moderator')
|
||||
moderator.set_density('g/cc', 1.0)
|
||||
moderator.add_element('H', 2.)
|
||||
moderator.add_element('O', 1.)
|
||||
moderator.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([fuel1, fuel2, moderator])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate planar surfaces
|
||||
x1 = openmc.XPlane(surface_id=1, x0=-10)
|
||||
x2 = openmc.XPlane(surface_id=2, x0=-7)
|
||||
x3 = openmc.XPlane(surface_id=3, x0=-4)
|
||||
x4 = openmc.XPlane(surface_id=4, x0=4)
|
||||
x5 = openmc.XPlane(surface_id=5, x0=7)
|
||||
x6 = openmc.XPlane(surface_id=6, x0=10)
|
||||
y1 = openmc.YPlane(surface_id=11, y0=-10)
|
||||
y2 = openmc.YPlane(surface_id=12, y0=-7)
|
||||
y3 = openmc.YPlane(surface_id=13, y0=-4)
|
||||
y4 = openmc.YPlane(surface_id=14, y0=4)
|
||||
y5 = openmc.YPlane(surface_id=15, y0=7)
|
||||
y6 = openmc.YPlane(surface_id=16, y0=10)
|
||||
z1 = openmc.ZPlane(surface_id=21, z0=-10)
|
||||
z2 = openmc.ZPlane(surface_id=22, z0=-7)
|
||||
z3 = openmc.ZPlane(surface_id=23, z0=-4)
|
||||
z4 = openmc.ZPlane(surface_id=24, z0=4)
|
||||
z5 = openmc.ZPlane(surface_id=25, z0=7)
|
||||
z6 = openmc.ZPlane(surface_id=26, z0=10)
|
||||
|
||||
# Set vacuum boundary conditions on outside
|
||||
for surface in [x1, x6, y1, y6, z1, z6]:
|
||||
surface.boundary_type = 'vacuum'
|
||||
|
||||
# Instantiate Cells
|
||||
inner_box = openmc.Cell(cell_id=1, name='inner box')
|
||||
middle_box = openmc.Cell(cell_id=2, name='middle box')
|
||||
outer_box = openmc.Cell(cell_id=3, name='outer box')
|
||||
|
||||
# Use each set of six planes to create solid cube regions. We can then use these
|
||||
# to create cubic shells.
|
||||
inner_cube = +x3 & -x4 & +y3 & -y4 & +z3 & -z4
|
||||
middle_cube = +x2 & -x5 & +y2 & -y5 & +z2 & -z5
|
||||
outer_cube = +x1 & -x6 & +y1 & -y6 & +z1 & -z6
|
||||
outside_inner_cube = -x3 | +x4 | -y3 | +y4 | -z3 | +z4
|
||||
|
||||
# Use surface half-spaces to define regions
|
||||
inner_box.region = inner_cube
|
||||
middle_box.region = middle_cube & outside_inner_cube
|
||||
outer_box.region = outer_cube & ~middle_cube
|
||||
|
||||
# Register Materials with Cells
|
||||
inner_box.fill = fuel1
|
||||
middle_box.fill = fuel2
|
||||
outer_box.fill = moderator
|
||||
|
||||
# Instantiate root universe
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
root.add_cells([inner_box, middle_box, outer_box])
|
||||
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry(root)
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml File
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
uniform_dist = openmc.stats.Box(*outer_cube.bounding_box, only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.export_to_xml()
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC plots.xml File
|
||||
###############################################################################
|
||||
|
||||
plot = openmc.Plot(plot_id=1)
|
||||
plot.origin = [0, 0, 0]
|
||||
plot.width = [20, 20]
|
||||
plot.pixels = [200, 200]
|
||||
plot.color_by = 'cell'
|
||||
|
||||
# Instantiate a Plots collection and export to XML
|
||||
plot_file = openmc.Plots([plot])
|
||||
plot_file.export_to_xml()
|
||||
161
examples/python/lattice/hexagonal/build-xml.py
Normal file
161
examples/python/lattice/hexagonal/build-xml.py
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
import openmc
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
###############################################################################
|
||||
|
||||
# OpenMC simulation parameters
|
||||
batches = 20
|
||||
inactive = 10
|
||||
particles = 10000
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml File
|
||||
###############################################################################
|
||||
|
||||
# Instantiate some Materials and register the appropriate Nuclides
|
||||
fuel = openmc.Material(material_id=1, name='fuel')
|
||||
fuel.set_density('g/cc', 4.5)
|
||||
fuel.add_nuclide('U235', 1.)
|
||||
|
||||
moderator = openmc.Material(material_id=2, name='moderator')
|
||||
moderator.set_density('g/cc', 1.0)
|
||||
moderator.add_element('H', 2.)
|
||||
moderator.add_element('O', 1.)
|
||||
moderator.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
iron = openmc.Material(material_id=3, name='iron')
|
||||
iron.set_density('g/cc', 7.9)
|
||||
iron.add_element('Fe', 1.)
|
||||
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([moderator, fuel, iron])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate Surfaces
|
||||
left = openmc.XPlane(surface_id=1, x0=-3, name='left')
|
||||
right = openmc.XPlane(surface_id=2, x0=3, name='right')
|
||||
bottom = openmc.YPlane(surface_id=3, y0=-4, name='bottom')
|
||||
top = openmc.YPlane(surface_id=4, y0=4, name='top')
|
||||
fuel_surf = openmc.ZCylinder(surface_id=5, x0=0, y0=0, r=0.4)
|
||||
|
||||
left.boundary_type = 'vacuum'
|
||||
right.boundary_type = 'vacuum'
|
||||
top.boundary_type = 'vacuum'
|
||||
bottom.boundary_type = 'vacuum'
|
||||
|
||||
# Instantiate Cells
|
||||
cell1 = openmc.Cell(cell_id=1, name='Cell 1')
|
||||
cell2 = openmc.Cell(cell_id=101, name='cell 2')
|
||||
cell3 = openmc.Cell(cell_id=102, name='cell 3')
|
||||
cell4 = openmc.Cell(cell_id=500, name='cell 4')
|
||||
cell5 = openmc.Cell(cell_id=600, name='cell 5')
|
||||
cell6 = openmc.Cell(cell_id=601, name='cell 6')
|
||||
|
||||
# Use surface half-spaces to define regions
|
||||
cell1.region = +left & -right & +bottom & -top
|
||||
cell2.region = -fuel_surf
|
||||
cell3.region = +fuel_surf
|
||||
cell5.region = -fuel_surf
|
||||
cell6.region = +fuel_surf
|
||||
|
||||
# Register Materials with Cells
|
||||
cell2.fill = fuel
|
||||
cell3.fill = moderator
|
||||
cell4.fill = moderator
|
||||
cell5.fill = iron
|
||||
cell6.fill = moderator
|
||||
|
||||
# Instantiate Universe
|
||||
univ1 = openmc.Universe(universe_id=1)
|
||||
univ2 = openmc.Universe(universe_id=3)
|
||||
univ3 = openmc.Universe(universe_id=4)
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
||||
# Register Cells with Universe
|
||||
univ1.add_cells([cell2, cell3])
|
||||
univ2.add_cells([cell4])
|
||||
univ3.add_cells([cell5, cell6])
|
||||
root.add_cell(cell1)
|
||||
|
||||
# Instantiate a Lattice
|
||||
lattice = openmc.HexLattice(lattice_id=5)
|
||||
lattice.center = [0., 0., 0.]
|
||||
lattice.pitch = [1., 2.]
|
||||
lattice.universes = \
|
||||
[ [ [univ2] + [univ3]*11, [univ2] + [univ3]*5, [univ3] ],
|
||||
[ [univ2] + [univ1]*11, [univ2] + [univ1]*5, [univ1] ],
|
||||
[ [univ2] + [univ3]*11, [univ2] + [univ3]*5, [univ3] ] ]
|
||||
lattice.outer = univ2
|
||||
|
||||
# Fill Cell with the Lattice
|
||||
cell1.fill = lattice
|
||||
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry(root)
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
bounds = [-1, -1, -1, 1, 1, 1]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.keff_trigger = {'type' : 'std_dev', 'threshold' : 5E-4}
|
||||
settings_file.trigger_active = True
|
||||
settings_file.trigger_max_batches = 100
|
||||
settings_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC plots.xml file
|
||||
###############################################################################
|
||||
|
||||
plot_xy = openmc.Plot(plot_id=1)
|
||||
plot_xy.filename = 'plot_xy'
|
||||
plot_xy.origin = [0, 0, 0]
|
||||
plot_xy.width = [6, 6]
|
||||
plot_xy.pixels = [400, 400]
|
||||
plot_xy.color_by = 'material'
|
||||
|
||||
plot_yz = openmc.Plot(plot_id=2)
|
||||
plot_yz.filename = 'plot_yz'
|
||||
plot_yz.basis = 'yz'
|
||||
plot_yz.origin = [0, 0, 0]
|
||||
plot_yz.width = [8, 8]
|
||||
plot_yz.pixels = [400, 400]
|
||||
plot_yz.color_by = 'material'
|
||||
|
||||
# Instantiate a Plots collection, add plots, and export to XML
|
||||
plot_file = openmc.Plots((plot_xy, plot_yz))
|
||||
plot_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC tallies.xml File
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a distribcell Tally
|
||||
tally = openmc.Tally(tally_id=1)
|
||||
tally.filters = [openmc.DistribcellFilter(cell2)]
|
||||
tally.scores = ['total']
|
||||
|
||||
# Instantiate a Tallies collection and export to XML
|
||||
tallies_file = openmc.Tallies([tally])
|
||||
tallies_file.export_to_xml()
|
||||
169
examples/python/lattice/nested/build-xml.py
Normal file
169
examples/python/lattice/nested/build-xml.py
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
import openmc
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
###############################################################################
|
||||
|
||||
# OpenMC simulation parameters
|
||||
batches = 20
|
||||
inactive = 10
|
||||
particles = 10000
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate some Materials and register the appropriate Nuclides
|
||||
fuel = openmc.Material(material_id=1, name='fuel')
|
||||
fuel.set_density('g/cc', 4.5)
|
||||
fuel.add_nuclide('U235', 1.)
|
||||
|
||||
moderator = openmc.Material(material_id=2, name='moderator')
|
||||
moderator.set_density('g/cc', 1.0)
|
||||
moderator.add_element('H', 2.)
|
||||
moderator.add_element('O', 1.)
|
||||
moderator.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials((moderator, fuel))
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate Surfaces
|
||||
left = openmc.XPlane(surface_id=1, x0=-2, name='left')
|
||||
right = openmc.XPlane(surface_id=2, x0=2, name='right')
|
||||
bottom = openmc.YPlane(surface_id=3, y0=-2, name='bottom')
|
||||
top = openmc.YPlane(surface_id=4, y0=2, name='top')
|
||||
fuel1 = openmc.ZCylinder(surface_id=5, x0=0, y0=0, r=0.4)
|
||||
fuel2 = openmc.ZCylinder(surface_id=6, x0=0, y0=0, r=0.3)
|
||||
fuel3 = openmc.ZCylinder(surface_id=7, x0=0, y0=0, r=0.2)
|
||||
|
||||
left.boundary_type = 'vacuum'
|
||||
right.boundary_type = 'vacuum'
|
||||
top.boundary_type = 'vacuum'
|
||||
bottom.boundary_type = 'vacuum'
|
||||
|
||||
# Instantiate Cells
|
||||
cell1 = openmc.Cell(cell_id=1, name='Cell 1')
|
||||
cell2 = openmc.Cell(cell_id=2, name='Cell 2')
|
||||
cell3 = openmc.Cell(cell_id=101, name='cell 3')
|
||||
cell4 = openmc.Cell(cell_id=102, name='cell 4')
|
||||
cell5 = openmc.Cell(cell_id=201, name='cell 5')
|
||||
cell6 = openmc.Cell(cell_id=202, name='cell 6')
|
||||
cell7 = openmc.Cell(cell_id=301, name='cell 7')
|
||||
cell8 = openmc.Cell(cell_id=302, name='cell 8')
|
||||
|
||||
# Use surface half-space to define regions
|
||||
cell1.region = +left & -right & +bottom & -top
|
||||
cell2.region = +left & -right & +bottom & -top
|
||||
cell3.region = -fuel1
|
||||
cell4.region = +fuel1
|
||||
cell5.region = -fuel2
|
||||
cell6.region = +fuel2
|
||||
cell7.region = -fuel3
|
||||
cell8.region = +fuel3
|
||||
|
||||
# Register Materials with Cells
|
||||
cell3.fill = fuel
|
||||
cell4.fill = moderator
|
||||
cell5.fill = fuel
|
||||
cell6.fill = moderator
|
||||
cell7.fill = fuel
|
||||
cell8.fill = moderator
|
||||
|
||||
# Instantiate Universe
|
||||
univ1 = openmc.Universe(universe_id=1)
|
||||
univ2 = openmc.Universe(universe_id=2)
|
||||
univ3 = openmc.Universe(universe_id=3)
|
||||
univ4 = openmc.Universe(universe_id=5)
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
||||
# Register Cells with Universe
|
||||
univ1.add_cells([cell3, cell4])
|
||||
univ2.add_cells([cell5, cell6])
|
||||
univ3.add_cells([cell7, cell8])
|
||||
root.add_cell(cell1)
|
||||
univ4.add_cell(cell2)
|
||||
|
||||
# Instantiate nested Lattices
|
||||
lattice1 = openmc.RectLattice(lattice_id=4, name='4x4 assembly')
|
||||
lattice1.lower_left = [-1., -1.]
|
||||
lattice1.pitch = [1., 1.]
|
||||
lattice1.universes = [[univ1, univ2],
|
||||
[univ2, univ3]]
|
||||
|
||||
lattice2 = openmc.RectLattice(lattice_id=6, name='4x4 core')
|
||||
lattice2.lower_left = [-2., -2.]
|
||||
lattice2.pitch = [2., 2.]
|
||||
lattice2.universes = [[univ4, univ4],
|
||||
[univ4, univ4]]
|
||||
|
||||
# Fill Cell with the Lattice
|
||||
cell1.fill = lattice2
|
||||
cell2.fill = lattice1
|
||||
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry(root)
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
bounds = [-1, -1, -1, 1, 1, 1]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC plots.xml file
|
||||
###############################################################################
|
||||
|
||||
plot = openmc.Plot(plot_id=1)
|
||||
plot.origin = [0, 0, 0]
|
||||
plot.width = [4, 4]
|
||||
plot.pixels = [400, 400]
|
||||
plot.color_by = 'material'
|
||||
|
||||
# Instantiate a Plots object and export to XML
|
||||
plot_file = openmc.Plots([plot])
|
||||
plot_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC tallies.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a tally mesh
|
||||
mesh = openmc.RegularMesh(mesh_id=1)
|
||||
mesh.dimension = [4, 4]
|
||||
mesh.lower_left = [-2, -2]
|
||||
mesh.width = [1, 1]
|
||||
|
||||
# Instantiate tally Filter
|
||||
mesh_filter = openmc.MeshFilter(mesh)
|
||||
|
||||
# Instantiate the Tally
|
||||
tally = openmc.Tally(tally_id=1)
|
||||
tally.filters = [mesh_filter]
|
||||
tally.scores = ['total']
|
||||
|
||||
# Instantiate a Tallies collection, register Tally/RegularMesh, and export to
|
||||
# XML
|
||||
tallies_file = openmc.Tallies([tally])
|
||||
tallies_file.export_to_xml()
|
||||
166
examples/python/lattice/simple/build-xml.py
Normal file
166
examples/python/lattice/simple/build-xml.py
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
import openmc
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
###############################################################################
|
||||
|
||||
# OpenMC simulation parameters
|
||||
batches = 20
|
||||
inactive = 10
|
||||
particles = 10000
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate some Materials and register the appropriate Nuclides
|
||||
fuel = openmc.Material(material_id=1, name='fuel')
|
||||
fuel.set_density('g/cc', 4.5)
|
||||
fuel.add_nuclide('U235', 1.)
|
||||
|
||||
moderator = openmc.Material(material_id=2, name='moderator')
|
||||
moderator.set_density('g/cc', 1.0)
|
||||
moderator.add_element('H', 2.)
|
||||
moderator.add_element('O', 1.)
|
||||
moderator.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([moderator, fuel])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate Surfaces
|
||||
left = openmc.XPlane(surface_id=1, x0=-2, name='left')
|
||||
right = openmc.XPlane(surface_id=2, x0=2, name='right')
|
||||
bottom = openmc.YPlane(surface_id=3, y0=-2, name='bottom')
|
||||
top = openmc.YPlane(surface_id=4, y0=2, name='top')
|
||||
fuel1 = openmc.ZCylinder(surface_id=5, x0=0, y0=0, r=0.4)
|
||||
fuel2 = openmc.ZCylinder(surface_id=6, x0=0, y0=0, r=0.3)
|
||||
fuel3 = openmc.ZCylinder(surface_id=7, x0=0, y0=0, r=0.2)
|
||||
|
||||
left.boundary_type = 'vacuum'
|
||||
right.boundary_type = 'vacuum'
|
||||
top.boundary_type = 'vacuum'
|
||||
bottom.boundary_type = 'vacuum'
|
||||
|
||||
# Instantiate Cells
|
||||
cell1 = openmc.Cell(cell_id=1, name='Cell 1')
|
||||
cell2 = openmc.Cell(cell_id=101, name='cell 2')
|
||||
cell3 = openmc.Cell(cell_id=102, name='cell 3')
|
||||
cell4 = openmc.Cell(cell_id=201, name='cell 4')
|
||||
cell5 = openmc.Cell(cell_id=202, name='cell 5')
|
||||
cell6 = openmc.Cell(cell_id=301, name='cell 6')
|
||||
cell7 = openmc.Cell(cell_id=302, name='cell 7')
|
||||
|
||||
# Use surface half-spaces to define regions
|
||||
cell1.region = +left & -right & +bottom & -top
|
||||
cell2.region = -fuel1
|
||||
cell3.region = +fuel1
|
||||
cell4.region = -fuel2
|
||||
cell5.region = +fuel2
|
||||
cell6.region = -fuel3
|
||||
cell7.region = +fuel3
|
||||
|
||||
# Register Materials with Cells
|
||||
cell2.fill = fuel
|
||||
cell3.fill = moderator
|
||||
cell4.fill = fuel
|
||||
cell5.fill = moderator
|
||||
cell6.fill = fuel
|
||||
cell7.fill = moderator
|
||||
|
||||
# Instantiate Universe
|
||||
univ1 = openmc.Universe(universe_id=1)
|
||||
univ2 = openmc.Universe(universe_id=2)
|
||||
univ3 = openmc.Universe(universe_id=3)
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
||||
# Register Cells with Universe
|
||||
univ1.add_cells([cell2, cell3])
|
||||
univ2.add_cells([cell4, cell5])
|
||||
univ3.add_cells([cell6, cell7])
|
||||
root.add_cell(cell1)
|
||||
|
||||
# Instantiate a Lattice
|
||||
lattice = openmc.RectLattice(lattice_id=5)
|
||||
lattice.lower_left = [-2., -2.]
|
||||
lattice.pitch = [1., 1.]
|
||||
lattice.universes = [[univ1, univ2, univ1, univ2],
|
||||
[univ2, univ3, univ2, univ3],
|
||||
[univ1, univ2, univ1, univ2],
|
||||
[univ2, univ3, univ2, univ3]]
|
||||
|
||||
# Fill Cell with the Lattice
|
||||
cell1.fill = lattice
|
||||
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry(root)
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
bounds = [-1, -1, -1, 1, 1, 1]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.trigger_active = True
|
||||
settings_file.trigger_max_batches = 100
|
||||
settings_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC plots.xml file
|
||||
###############################################################################
|
||||
|
||||
plot = openmc.Plot(plot_id=1)
|
||||
plot.origin = [0, 0, 0]
|
||||
plot.width = [4, 4]
|
||||
plot.pixels = [400, 400]
|
||||
plot.color_by = 'material'
|
||||
|
||||
# Instantiate a Plots collection and export to XML
|
||||
plot_file = openmc.Plots([plot])
|
||||
plot_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC tallies.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a tally mesh
|
||||
mesh = openmc.RegularMesh(mesh_id=1)
|
||||
mesh.dimension = [4, 4]
|
||||
mesh.lower_left = [-2, -2]
|
||||
mesh.width = [1, 1]
|
||||
|
||||
# Instantiate tally Filter
|
||||
mesh_filter = openmc.MeshFilter(mesh)
|
||||
|
||||
# Instantiate tally Trigger
|
||||
trigger = openmc.Trigger(trigger_type='rel_err', threshold=1E-2)
|
||||
trigger.scores = ['all']
|
||||
|
||||
# Instantiate the Tally
|
||||
tally = openmc.Tally(tally_id=1)
|
||||
tally.filters = [mesh_filter]
|
||||
tally.scores = ['total']
|
||||
tally.triggers = [trigger]
|
||||
|
||||
# Instantiate a Tallies collection and export to XML
|
||||
tallies_file = openmc.Tallies([tally])
|
||||
tallies_file.export_to_xml()
|
||||
138
examples/python/pincell/build-xml.py
Normal file
138
examples/python/pincell/build-xml.py
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
import openmc
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
###############################################################################
|
||||
|
||||
# OpenMC simulation parameters
|
||||
batches = 100
|
||||
inactive = 10
|
||||
particles = 1000
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
|
||||
# Instantiate some Materials and register the appropriate Nuclides
|
||||
uo2 = openmc.Material(material_id=1, name='UO2 fuel at 2.4% wt enrichment')
|
||||
uo2.set_density('g/cm3', 10.29769)
|
||||
uo2.add_element('U', 1., enrichment=2.4)
|
||||
uo2.add_element('O', 2.)
|
||||
|
||||
helium = openmc.Material(material_id=2, name='Helium for gap')
|
||||
helium.set_density('g/cm3', 0.001598)
|
||||
helium.add_element('He', 2.4044e-4)
|
||||
|
||||
zircaloy = openmc.Material(material_id=3, name='Zircaloy 4')
|
||||
zircaloy.set_density('g/cm3', 6.55)
|
||||
zircaloy.add_element('Sn', 0.014 , 'wo')
|
||||
zircaloy.add_element('Fe', 0.00165, 'wo')
|
||||
zircaloy.add_element('Cr', 0.001 , 'wo')
|
||||
zircaloy.add_element('Zr', 0.98335, 'wo')
|
||||
|
||||
borated_water = openmc.Material(material_id=4, name='Borated water')
|
||||
borated_water.set_density('g/cm3', 0.740582)
|
||||
borated_water.add_element('B', 4.0e-5)
|
||||
borated_water.add_element('H', 5.0e-2)
|
||||
borated_water.add_element('O', 2.4e-2)
|
||||
borated_water.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([uo2, helium, zircaloy, borated_water])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate ZCylinder surfaces
|
||||
fuel_or = openmc.ZCylinder(surface_id=1, x0=0, y0=0, r=0.39218, name='Fuel OR')
|
||||
clad_ir = openmc.ZCylinder(surface_id=2, x0=0, y0=0, r=0.40005, name='Clad IR')
|
||||
clad_or = openmc.ZCylinder(surface_id=3, x0=0, y0=0, r=0.45720, name='Clad OR')
|
||||
left = openmc.XPlane(surface_id=4, x0=-0.62992, name='left')
|
||||
right = openmc.XPlane(surface_id=5, x0=0.62992, name='right')
|
||||
bottom = openmc.YPlane(surface_id=6, y0=-0.62992, name='bottom')
|
||||
top = openmc.YPlane(surface_id=7, y0=0.62992, name='top')
|
||||
|
||||
left.boundary_type = 'reflective'
|
||||
right.boundary_type = 'reflective'
|
||||
top.boundary_type = 'reflective'
|
||||
bottom.boundary_type = 'reflective'
|
||||
|
||||
# Instantiate Cells
|
||||
fuel = openmc.Cell(cell_id=1, name='cell 1')
|
||||
gap = openmc.Cell(cell_id=2, name='cell 2')
|
||||
clad = openmc.Cell(cell_id=3, name='cell 3')
|
||||
water = openmc.Cell(cell_id=4, name='cell 4')
|
||||
|
||||
# Use surface half-spaces to define regions
|
||||
fuel.region = -fuel_or
|
||||
gap.region = +fuel_or & -clad_ir
|
||||
clad.region = +clad_ir & -clad_or
|
||||
water.region = +clad_or & +left & -right & +bottom & -top
|
||||
|
||||
# Register Materials with Cells
|
||||
fuel.fill = uo2
|
||||
gap.fill = helium
|
||||
clad.fill = zircaloy
|
||||
water.fill = borated_water
|
||||
|
||||
# Instantiate Universe
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
||||
# Register Cells with Universe
|
||||
root.add_cells([fuel, gap, clad, water])
|
||||
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry(root)
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
bounds = [-0.62992, -0.62992, -1, 0.62992, 0.62992, 1]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
entropy_mesh = openmc.RegularMesh()
|
||||
entropy_mesh.lower_left = [-0.39218, -0.39218, -1.e50]
|
||||
entropy_mesh.upper_right = [0.39218, 0.39218, 1.e50]
|
||||
entropy_mesh.dimension = [10, 10, 1]
|
||||
settings_file.entropy_mesh = entropy_mesh
|
||||
settings_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC tallies.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a tally mesh
|
||||
mesh = openmc.RegularMesh()
|
||||
mesh.dimension = [100, 100, 1]
|
||||
mesh.lower_left = [-0.62992, -0.62992, -1.e50]
|
||||
mesh.upper_right = [0.62992, 0.62992, 1.e50]
|
||||
|
||||
# Instantiate some tally Filters
|
||||
energy_filter = openmc.EnergyFilter([0., 4., 20.e6])
|
||||
mesh_filter = openmc.MeshFilter(mesh)
|
||||
|
||||
# Instantiate the Tally
|
||||
tally = openmc.Tally(tally_id=1, name='tally 1')
|
||||
tally.filters = [energy_filter, mesh_filter]
|
||||
tally.scores = ['flux', 'fission', 'nu-fission']
|
||||
|
||||
# Instantiate a Tallies collection and export to XML
|
||||
tallies_file = openmc.Tallies([tally])
|
||||
tallies_file.export_to_xml()
|
||||
49
examples/python/pincell_depletion/chain_simple.xml
Normal file
49
examples/python/pincell_depletion/chain_simple.xml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0"?>
|
||||
<depletion_chain>
|
||||
<nuclide name="I135" decay_modes="1" reactions="1" half_life="2.36520E+04">
|
||||
<decay type="beta" target="Xe135" branching_ratio="1.0" />
|
||||
<reaction type="(n,gamma)" Q="0.0" target="Xe136" /> <!-- Not precisely true, but whatever -->
|
||||
</nuclide>
|
||||
<nuclide name="Xe135" decay_modes="1" reactions="1" half_life="3.29040E+04">
|
||||
<decay type=" beta" target="Cs135" branching_ratio="1.0" />
|
||||
<reaction type="(n,gamma)" Q="0.0" target="Xe136" />
|
||||
</nuclide>
|
||||
<nuclide name="Xe136" decay_modes="0" reactions="0" />
|
||||
<nuclide name="Cs135" decay_modes="0" reactions="0" />
|
||||
<nuclide name="Gd157" decay_modes="0" reactions="1" >
|
||||
<reaction type="(n,gamma)" Q="0.0" target="Nothing" />
|
||||
</nuclide>
|
||||
<nuclide name="Gd156" decay_modes="0" reactions="1">
|
||||
<reaction type="(n,gamma)" Q="0.0" target="Gd157" />
|
||||
</nuclide>
|
||||
<nuclide name="U234" decay_modes="0" reactions="1">
|
||||
<reaction type="fission" Q="191840000."/>
|
||||
<neutron_fission_yields>
|
||||
<energies>2.53000e-02</energies>
|
||||
<fission_yields energy="2.53000e-02">
|
||||
<products>Gd157 Gd156 I135 Xe135 Xe136 Cs135</products>
|
||||
<data>1.093250e-04 2.087260e-04 2.780820e-02 6.759540e-03 2.392300e-02 4.356330e-05</data>
|
||||
</fission_yields>
|
||||
</neutron_fission_yields>
|
||||
</nuclide>
|
||||
<nuclide name="U235" decay_modes="0" reactions="1">
|
||||
<reaction type="fission" Q="193410000."/>
|
||||
<neutron_fission_yields>
|
||||
<energies>2.53000e-02</energies>
|
||||
<fission_yields energy="2.53000e-02">
|
||||
<products>Gd157 Gd156 I135 Xe135 Xe136 Cs135</products>
|
||||
<data>6.142710e-5 1.483250e-04 0.0292737 0.002566345 0.0219242 4.9097e-6</data>
|
||||
</fission_yields>
|
||||
</neutron_fission_yields>
|
||||
</nuclide>
|
||||
<nuclide name="U238" decay_modes="0" reactions="1">
|
||||
<reaction type="fission" Q="197790000."/>
|
||||
<neutron_fission_yields>
|
||||
<energies>2.53000e-02</energies>
|
||||
<fission_yields energy="2.53000e-02">
|
||||
<products>Gd157 Gd156 I135 Xe135 Xe136 Cs135</products>
|
||||
<data>4.141120e-04 7.605360e-04 0.0135457 0.00026864 0.0024432 3.7100E-07</data>
|
||||
</fission_yields>
|
||||
</neutron_fission_yields>
|
||||
</nuclide>
|
||||
</depletion_chain>
|
||||
104
examples/python/pincell_depletion/restart_depletion.py
Normal file
104
examples/python/pincell_depletion/restart_depletion.py
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
import openmc
|
||||
import openmc.deplete
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
###############################################################################
|
||||
|
||||
# OpenMC simulation parameters
|
||||
batches = 100
|
||||
inactive = 10
|
||||
particles = 1000
|
||||
|
||||
# Depletion simulation parameters
|
||||
time_step = 1*24*60*60 # s
|
||||
final_time = 5*24*60*60 # s
|
||||
time_steps = np.full(final_time // time_step, time_step)
|
||||
|
||||
chain_file = './chain_simple.xml'
|
||||
power = 174 # W/cm, for 2D simulations only (use W for 3D)
|
||||
|
||||
###############################################################################
|
||||
# Load previous simulation results
|
||||
###############################################################################
|
||||
|
||||
# Load geometry from statepoint
|
||||
statepoint = 'statepoint.100.h5'
|
||||
with openmc.StatePoint(statepoint) as sp:
|
||||
geometry = sp.summary.geometry
|
||||
|
||||
# Load previous depletion results
|
||||
previous_results = openmc.deplete.ResultsList("depletion_results.h5")
|
||||
|
||||
###############################################################################
|
||||
# Transport calculation settings
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Settings object, set all runtime parameters
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
bounds = [-0.62992, -0.62992, -1, 0.62992, 0.62992, 1]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
entropy_mesh = openmc.RegularMesh()
|
||||
entropy_mesh.lower_left = [-0.39218, -0.39218, -1.e50]
|
||||
entropy_mesh.upper_right = [0.39218, 0.39218, 1.e50]
|
||||
entropy_mesh.dimension = [10, 10, 1]
|
||||
settings_file.entropy_mesh = entropy_mesh
|
||||
|
||||
###############################################################################
|
||||
# Initialize and run depletion calculation
|
||||
###############################################################################
|
||||
|
||||
op = openmc.deplete.Operator(geometry, settings_file, chain_file,
|
||||
previous_results)
|
||||
|
||||
# Perform simulation using the predictor algorithm
|
||||
integrator = openmc.deplete.PredictorIntegrator(op, time_steps, power)
|
||||
integrator.integrate()
|
||||
|
||||
###############################################################################
|
||||
# Read depletion calculation results
|
||||
###############################################################################
|
||||
|
||||
# Open results file
|
||||
results = openmc.deplete.ResultsList.from_hdf5("depletion_results.h5")
|
||||
|
||||
# Obtain K_eff as a function of time
|
||||
time, keff = results.get_eigenvalue()
|
||||
|
||||
# Obtain U235 concentration as a function of time
|
||||
time, n_U235 = results.get_atoms('1', 'U235')
|
||||
|
||||
# Obtain Xe135 absorption as a function of time
|
||||
time, Xe_gam = results.get_reaction_rate('1', 'Xe135', '(n,gamma)')
|
||||
|
||||
###############################################################################
|
||||
# Generate plots
|
||||
###############################################################################
|
||||
|
||||
plt.figure()
|
||||
plt.plot(time/(24*60*60), keff, label="K-effective")
|
||||
plt.xlabel("Time (days)")
|
||||
plt.ylabel("Keff")
|
||||
plt.show()
|
||||
|
||||
plt.figure()
|
||||
plt.plot(time/(24*60*60), n_U235, label="U 235")
|
||||
plt.xlabel("Time (days)")
|
||||
plt.ylabel("n U5 (-)")
|
||||
plt.show()
|
||||
|
||||
plt.figure()
|
||||
plt.plot(time/(24*60*60), Xe_gam, label="Xe135 absorption")
|
||||
plt.xlabel("Time (days)")
|
||||
plt.ylabel("RR (-)")
|
||||
plt.show()
|
||||
plt.close('all')
|
||||
175
examples/python/pincell_depletion/run_depletion.py
Normal file
175
examples/python/pincell_depletion/run_depletion.py
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
import openmc
|
||||
import openmc.deplete
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
###############################################################################
|
||||
|
||||
# OpenMC simulation parameters
|
||||
batches = 100
|
||||
inactive = 10
|
||||
particles = 1000
|
||||
|
||||
# Depletion simulation parameters
|
||||
time_step = 1*24*60*60 # s
|
||||
final_time = 5*24*60*60 # s
|
||||
time_steps = np.full(final_time // time_step, time_step)
|
||||
chain_file = './chain_simple.xml'
|
||||
power = 174 # W/cm, for 2D simulations only (use W for 3D)
|
||||
|
||||
###############################################################################
|
||||
# Define materials
|
||||
###############################################################################
|
||||
|
||||
# Instantiate some Materials and register the appropriate Nuclides
|
||||
uo2 = openmc.Material(material_id=1, name='UO2 fuel at 2.4% wt enrichment')
|
||||
uo2.set_density('g/cm3', 10.29769)
|
||||
uo2.add_element('U', 1., enrichment=2.4)
|
||||
uo2.add_element('O', 2.)
|
||||
uo2.depletable = True
|
||||
|
||||
helium = openmc.Material(material_id=2, name='Helium for gap')
|
||||
helium.set_density('g/cm3', 0.001598)
|
||||
helium.add_element('He', 2.4044e-4)
|
||||
|
||||
zircaloy = openmc.Material(material_id=3, name='Zircaloy 4')
|
||||
zircaloy.set_density('g/cm3', 6.55)
|
||||
zircaloy.add_element('Sn', 0.014 , 'wo')
|
||||
zircaloy.add_element('Fe', 0.00165, 'wo')
|
||||
zircaloy.add_element('Cr', 0.001 , 'wo')
|
||||
zircaloy.add_element('Zr', 0.98335, 'wo')
|
||||
|
||||
borated_water = openmc.Material(material_id=4, name='Borated water')
|
||||
borated_water.set_density('g/cm3', 0.740582)
|
||||
borated_water.add_element('B', 4.0e-5)
|
||||
borated_water.add_element('H', 5.0e-2)
|
||||
borated_water.add_element('O', 2.4e-2)
|
||||
borated_water.add_s_alpha_beta('c_H_in_H2O')
|
||||
|
||||
###############################################################################
|
||||
# Create geometry
|
||||
###############################################################################
|
||||
|
||||
# Instantiate ZCylinder surfaces
|
||||
fuel_or = openmc.ZCylinder(surface_id=1, x0=0, y0=0, r=0.39218, name='Fuel OR')
|
||||
clad_ir = openmc.ZCylinder(surface_id=2, x0=0, y0=0, r=0.40005, name='Clad IR')
|
||||
clad_or = openmc.ZCylinder(surface_id=3, x0=0, y0=0, r=0.45720, name='Clad OR')
|
||||
left = openmc.XPlane(surface_id=4, x0=-0.62992, name='left')
|
||||
right = openmc.XPlane(surface_id=5, x0=0.62992, name='right')
|
||||
bottom = openmc.YPlane(surface_id=6, y0=-0.62992, name='bottom')
|
||||
top = openmc.YPlane(surface_id=7, y0=0.62992, name='top')
|
||||
|
||||
left.boundary_type = 'reflective'
|
||||
right.boundary_type = 'reflective'
|
||||
top.boundary_type = 'reflective'
|
||||
bottom.boundary_type = 'reflective'
|
||||
|
||||
# Instantiate Cells
|
||||
fuel = openmc.Cell(cell_id=1, name='cell 1')
|
||||
gap = openmc.Cell(cell_id=2, name='cell 2')
|
||||
clad = openmc.Cell(cell_id=3, name='cell 3')
|
||||
water = openmc.Cell(cell_id=4, name='cell 4')
|
||||
|
||||
# Use surface half-spaces to define regions
|
||||
fuel.region = -fuel_or
|
||||
gap.region = +fuel_or & -clad_ir
|
||||
clad.region = +clad_ir & -clad_or
|
||||
water.region = +clad_or & +left & -right & +bottom & -top
|
||||
|
||||
# Register Materials with Cells
|
||||
fuel.fill = uo2
|
||||
gap.fill = helium
|
||||
clad.fill = zircaloy
|
||||
water.fill = borated_water
|
||||
|
||||
# Instantiate Universe
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
||||
# Register Cells with Universe
|
||||
root.add_cells([fuel, gap, clad, water])
|
||||
|
||||
# Instantiate a Geometry, register the root Universe
|
||||
geometry = openmc.Geometry(root)
|
||||
|
||||
###############################################################################
|
||||
# Set volumes of depletable materials
|
||||
###############################################################################
|
||||
|
||||
# Compute cell areas
|
||||
area = {}
|
||||
area[fuel] = np.pi * fuel_or.coefficients['r'] ** 2
|
||||
|
||||
# Set materials volume for depletion. Set to an area for 2D simulations
|
||||
uo2.volume = area[fuel]
|
||||
|
||||
###############################################################################
|
||||
# Transport calculation settings
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
bounds = [-0.62992, -0.62992, -1, 0.62992, 0.62992, 1]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
entropy_mesh = openmc.RegularMesh()
|
||||
entropy_mesh.lower_left = [-0.39218, -0.39218, -1.e50]
|
||||
entropy_mesh.upper_right = [0.39218, 0.39218, 1.e50]
|
||||
entropy_mesh.dimension = [10, 10, 1]
|
||||
settings_file.entropy_mesh = entropy_mesh
|
||||
|
||||
###############################################################################
|
||||
# Initialize and run depletion calculation
|
||||
###############################################################################
|
||||
|
||||
op = openmc.deplete.Operator(geometry, settings_file, chain_file)
|
||||
|
||||
# Perform simulation using the predictor algorithm
|
||||
integrator = openmc.deplete.PredictorIntegrator(op, time_steps, power)
|
||||
integrator.integrate()
|
||||
|
||||
###############################################################################
|
||||
# Read depletion calculation results
|
||||
###############################################################################
|
||||
|
||||
# Open results file
|
||||
results = openmc.deplete.ResultsList.from_hdf5("depletion_results.h5")
|
||||
|
||||
# Obtain K_eff as a function of time
|
||||
time, keff = results.get_eigenvalue()
|
||||
|
||||
# Obtain U235 concentration as a function of time
|
||||
time, n_U235 = results.get_atoms('1', 'U235')
|
||||
|
||||
# Obtain Xe135 absorption as a function of time
|
||||
time, Xe_gam = results.get_reaction_rate('1', 'Xe135', '(n,gamma)')
|
||||
|
||||
###############################################################################
|
||||
# Generate plots
|
||||
###############################################################################
|
||||
|
||||
plt.figure()
|
||||
plt.plot(time/(24*60*60), keff, label="K-effective")
|
||||
plt.xlabel("Time (days)")
|
||||
plt.ylabel("Keff")
|
||||
plt.show()
|
||||
|
||||
plt.figure()
|
||||
plt.plot(time/(24*60*60), n_U235, label="U 235")
|
||||
plt.xlabel("Time (days)")
|
||||
plt.ylabel("n U5 (-)")
|
||||
plt.show()
|
||||
|
||||
plt.figure()
|
||||
plt.plot(time/(24*60*60), Xe_gam, label="Xe135 absorption")
|
||||
plt.xlabel("Time (days)")
|
||||
plt.ylabel("RR (-)")
|
||||
plt.show()
|
||||
plt.close('all')
|
||||
175
examples/python/pincell_multigroup/build-xml.py
Normal file
175
examples/python/pincell_multigroup/build-xml.py
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
import numpy as np
|
||||
|
||||
import openmc
|
||||
import openmc.mgxs
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
###############################################################################
|
||||
|
||||
# OpenMC simulation parameters
|
||||
batches = 100
|
||||
inactive = 10
|
||||
particles = 1000
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC mgxs.h5 file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate the energy group data
|
||||
groups = openmc.mgxs.EnergyGroups(group_edges=[
|
||||
1e-5, 0.0635, 10.0, 1.0e2, 1.0e3, 0.5e6, 1.0e6, 20.0e6])
|
||||
|
||||
# Instantiate the 7-group (C5G7) cross section data
|
||||
uo2_xsdata = openmc.XSdata('UO2', groups)
|
||||
uo2_xsdata.order = 0
|
||||
uo2_xsdata.set_total(
|
||||
[0.1779492, 0.3298048, 0.4803882, 0.5543674, 0.3118013, 0.3951678,
|
||||
0.5644058])
|
||||
uo2_xsdata.set_absorption([8.0248E-03, 3.7174E-03, 2.6769E-02, 9.6236E-02,
|
||||
3.0020E-02, 1.1126E-01, 2.8278E-01])
|
||||
scatter_matrix = np.array(
|
||||
[[[0.1275370, 0.0423780, 0.0000094, 0.0000000, 0.0000000, 0.0000000, 0.0000000],
|
||||
[0.0000000, 0.3244560, 0.0016314, 0.0000000, 0.0000000, 0.0000000, 0.0000000],
|
||||
[0.0000000, 0.0000000, 0.4509400, 0.0026792, 0.0000000, 0.0000000, 0.0000000],
|
||||
[0.0000000, 0.0000000, 0.0000000, 0.4525650, 0.0055664, 0.0000000, 0.0000000],
|
||||
[0.0000000, 0.0000000, 0.0000000, 0.0001253, 0.2714010, 0.0102550, 0.0000000],
|
||||
[0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0012968, 0.2658020, 0.0168090],
|
||||
[0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0085458, 0.2730800]]])
|
||||
scatter_matrix = np.rollaxis(scatter_matrix, 0, 3)
|
||||
uo2_xsdata.set_scatter_matrix(scatter_matrix)
|
||||
uo2_xsdata.set_fission([7.21206E-03, 8.19301E-04, 6.45320E-03,
|
||||
1.85648E-02, 1.78084E-02, 8.30348E-02,
|
||||
2.16004E-01])
|
||||
uo2_xsdata.set_nu_fission([2.005998E-02, 2.027303E-03, 1.570599E-02,
|
||||
4.518301E-02, 4.334208E-02, 2.020901E-01,
|
||||
5.257105E-01])
|
||||
uo2_xsdata.set_chi([5.8791E-01, 4.1176E-01, 3.3906E-04, 1.1761E-07, 0.0000E+00,
|
||||
0.0000E+00, 0.0000E+00])
|
||||
|
||||
h2o_xsdata = openmc.XSdata('LWTR', groups)
|
||||
h2o_xsdata.order = 0
|
||||
h2o_xsdata.set_total([0.15920605, 0.412969593, 0.59030986, 0.58435,
|
||||
0.718, 1.2544497, 2.650379])
|
||||
h2o_xsdata.set_absorption([6.0105E-04, 1.5793E-05, 3.3716E-04,
|
||||
1.9406E-03, 5.7416E-03, 1.5001E-02,
|
||||
3.7239E-02])
|
||||
scatter_matrix = np.array(
|
||||
[[[0.0444777, 0.1134000, 0.0007235, 0.0000037, 0.0000001, 0.0000000, 0.0000000],
|
||||
[0.0000000, 0.2823340, 0.1299400, 0.0006234, 0.0000480, 0.0000074, 0.0000010],
|
||||
[0.0000000, 0.0000000, 0.3452560, 0.2245700, 0.0169990, 0.0026443, 0.0005034],
|
||||
[0.0000000, 0.0000000, 0.0000000, 0.0910284, 0.4155100, 0.0637320, 0.0121390],
|
||||
[0.0000000, 0.0000000, 0.0000000, 0.0000714, 0.1391380, 0.5118200, 0.0612290],
|
||||
[0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0022157, 0.6999130, 0.5373200],
|
||||
[0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.1324400, 2.4807000]]])
|
||||
scatter_matrix = np.rollaxis(scatter_matrix, 0, 3)
|
||||
h2o_xsdata.set_scatter_matrix(scatter_matrix)
|
||||
|
||||
mg_cross_sections_file = openmc.MGXSLibrary(groups)
|
||||
mg_cross_sections_file.add_xsdatas([uo2_xsdata, h2o_xsdata])
|
||||
mg_cross_sections_file.export_to_hdf5()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate some Macroscopic Data
|
||||
uo2_data = openmc.Macroscopic('UO2')
|
||||
h2o_data = openmc.Macroscopic('LWTR')
|
||||
|
||||
# Instantiate some Materials and register the appropriate Macroscopic objects
|
||||
uo2 = openmc.Material(material_id=1, name='UO2 fuel')
|
||||
uo2.set_density('macro', 1.0)
|
||||
uo2.add_macroscopic(uo2_data)
|
||||
|
||||
water = openmc.Material(material_id=2, name='Water')
|
||||
water.set_density('macro', 1.0)
|
||||
water.add_macroscopic(h2o_data)
|
||||
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([uo2, water])
|
||||
materials_file.cross_sections = "./mgxs.h5"
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate ZCylinder surfaces
|
||||
fuel_or = openmc.ZCylinder(surface_id=1, x0=0, y0=0, r=0.54, name='Fuel OR')
|
||||
left = openmc.XPlane(surface_id=4, x0=-0.63, name='left')
|
||||
right = openmc.XPlane(surface_id=5, x0=0.63, name='right')
|
||||
bottom = openmc.YPlane(surface_id=6, y0=-0.63, name='bottom')
|
||||
top = openmc.YPlane(surface_id=7, y0=0.63, name='top')
|
||||
|
||||
left.boundary_type = 'reflective'
|
||||
right.boundary_type = 'reflective'
|
||||
top.boundary_type = 'reflective'
|
||||
bottom.boundary_type = 'reflective'
|
||||
|
||||
# Instantiate Cells
|
||||
fuel = openmc.Cell(cell_id=1, name='cell 1')
|
||||
moderator = openmc.Cell(cell_id=2, name='cell 2')
|
||||
|
||||
# Use surface half-spaces to define regions
|
||||
fuel.region = -fuel_or
|
||||
moderator.region = +fuel_or & +left & -right & +bottom & -top
|
||||
|
||||
# Register Materials with Cells
|
||||
fuel.fill = uo2
|
||||
moderator.fill = water
|
||||
|
||||
# Instantiate Universe
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
||||
# Register Cells with Universe
|
||||
root.add_cells([fuel, moderator])
|
||||
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry(root)
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.energy_mode = "multi-group"
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
bounds = [-0.63, -0.63, -1, 0.63, 0.63, 1]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:])
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.export_to_xml()
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC tallies.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a tally mesh
|
||||
mesh = openmc.RegularMesh(mesh_id=1)
|
||||
mesh.dimension = [100, 100, 1]
|
||||
mesh.lower_left = [-0.63, -0.63, -1.e50]
|
||||
mesh.upper_right = [0.63, 0.63, 1.e50]
|
||||
|
||||
# Instantiate some tally Filters
|
||||
energy_filter = openmc.EnergyFilter([1e-5, 0.0635, 10.0, 1.0e2, 1.0e3, 0.5e6,
|
||||
1.0e6, 20.0e6])
|
||||
mesh_filter = openmc.MeshFilter(mesh)
|
||||
|
||||
# Instantiate the Tally
|
||||
tally = openmc.Tally(tally_id=1, name='tally 1')
|
||||
tally.filters = [energy_filter, mesh_filter]
|
||||
tally.scores = ['flux', 'fission', 'nu-fission']
|
||||
|
||||
# Instantiate a Tallies collection, register all Tallies, and export to XML
|
||||
tallies_file = openmc.Tallies([tally])
|
||||
tallies_file.export_to_xml()
|
||||
82
examples/python/reflective/build-xml.py
Normal file
82
examples/python/reflective/build-xml.py
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
import numpy as np
|
||||
import openmc
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
###############################################################################
|
||||
|
||||
# OpenMC simulation parameters
|
||||
batches = 500
|
||||
inactive = 10
|
||||
particles = 10000
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Material and register the Nuclide
|
||||
fuel = openmc.Material(material_id=1, name='fuel')
|
||||
fuel.set_density('g/cc', 4.5)
|
||||
fuel.add_nuclide('U235', 1.)
|
||||
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([fuel])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate Surfaces
|
||||
surf1 = openmc.XPlane(surface_id=1, x0=-1, name='surf 1')
|
||||
surf2 = openmc.XPlane(surface_id=2, x0=+1, name='surf 2')
|
||||
surf3 = openmc.YPlane(surface_id=3, y0=-1, name='surf 3')
|
||||
surf4 = openmc.YPlane(surface_id=4, y0=+1, name='surf 4')
|
||||
surf5 = openmc.ZPlane(surface_id=5, z0=-1, name='surf 5')
|
||||
surf6 = openmc.ZPlane(surface_id=6, z0=+1, name='surf 6')
|
||||
|
||||
surf1.boundary_type = 'vacuum'
|
||||
surf2.boundary_type = 'vacuum'
|
||||
surf3.boundary_type = 'reflective'
|
||||
surf4.boundary_type = 'reflective'
|
||||
surf5.boundary_type = 'reflective'
|
||||
surf6.boundary_type = 'reflective'
|
||||
|
||||
# Instantiate Cell
|
||||
cell = openmc.Cell(cell_id=1, name='cell 1')
|
||||
|
||||
# Use surface half-spaces to define region
|
||||
cell.region = +surf1 & -surf2 & +surf3 & -surf4 & +surf5 & -surf6
|
||||
|
||||
# Register Material with Cell
|
||||
cell.fill = fuel
|
||||
|
||||
# Instantiate Universes
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
||||
# Register Cell with Universe
|
||||
root.add_cell(cell)
|
||||
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry(root)
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
uniform_dist = openmc.stats.Box(*cell.region.bounding_box,
|
||||
only_fissionable=True)
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.export_to_xml()
|
||||
15
examples/xml/basic/geometry.xml
Normal file
15
examples/xml/basic/geometry.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<!-- Definition of Cells -->
|
||||
<cell id="1" universe="0" fill="37" region="-2" />
|
||||
<cell id="100" universe="37" material="40" region="-1" />
|
||||
<cell id="101" universe="37" material="41" region="1" />
|
||||
<cell id="2" universe="0" material="41" region="2 -3" />
|
||||
|
||||
<!-- Defition of Surfaces -->
|
||||
<surface id="1" type="z-cylinder" coeffs="0 0 7" />
|
||||
<surface id="2" type="z-cylinder" coeffs="0 0 9" />
|
||||
<surface id="3" type="z-cylinder" coeffs="0 0 11" boundary="vacuum" />
|
||||
|
||||
</geometry>
|
||||
16
examples/xml/basic/materials.xml
Normal file
16
examples/xml/basic/materials.xml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<material id="40">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U235" ao="1.0" />
|
||||
</material>
|
||||
|
||||
<material id="41">
|
||||
<density value="1.0" units="g/cc" />
|
||||
<nuclide name="H1" ao="2.0" />
|
||||
<nuclide name="O16" ao="1.0" />
|
||||
<sab name="c_H_in_H2O"/>
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
16
examples/xml/basic/settings.xml
Normal file
16
examples/xml/basic/settings.xml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<batches>15</batches>
|
||||
<inactive>5</inactive>
|
||||
<particles>10000</particles>
|
||||
|
||||
<!-- Starting source -->
|
||||
<source>
|
||||
<space type="box">
|
||||
<parameters>-4 -4 -4 4 4 4</parameters>
|
||||
</space>
|
||||
</source>
|
||||
|
||||
</settings>
|
||||
31
examples/xml/basic/tallies.xml
Normal file
31
examples/xml/basic/tallies.xml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0"?>
|
||||
<tallies>
|
||||
|
||||
<filter id="1" type="cell">
|
||||
<bins>100</bins>
|
||||
</filter>
|
||||
|
||||
<filter id="2" type="energy">
|
||||
<bins>0 20.0e6</bins>
|
||||
</filter>
|
||||
|
||||
<filter id="3" type="energyout">
|
||||
<bins>0 20.0e6</bins>
|
||||
</filter>
|
||||
|
||||
<tally id="1">
|
||||
<filters>1</filters>
|
||||
<scores>total scatter nu-scatter absorption fission nu-fission</scores>
|
||||
</tally>
|
||||
|
||||
<tally id="2">
|
||||
<filters>1 2</filters>
|
||||
<scores>total scatter nu-scatter absorption fission nu-fission</scores>
|
||||
</tally>
|
||||
|
||||
<tally id="3">
|
||||
<filters>1 2 3</filters>
|
||||
<scores>scatter nu-scatter nu-fission</scores>
|
||||
</tally>
|
||||
|
||||
</tallies>
|
||||
39
examples/xml/boxes/geometry.xml
Normal file
39
examples/xml/boxes/geometry.xml
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<!--
|
||||
This example consists of three nested boxes, and is meant to show how to
|
||||
use Boolean operators to construct complex cell regions.
|
||||
-->
|
||||
|
||||
<surface id="1" type="x-plane" coeffs="-10" boundary="vacuum" />
|
||||
<surface id="2" type="x-plane" coeffs="-7" />
|
||||
<surface id="3" type="x-plane" coeffs="-4" />
|
||||
<surface id="4" type="x-plane" coeffs="4" />
|
||||
<surface id="5" type="x-plane" coeffs="7" />
|
||||
<surface id="6" type="x-plane" coeffs="10" boundary="vacuum" />
|
||||
|
||||
<surface id="11" type="y-plane" coeffs="-10" boundary="vacuum" />
|
||||
<surface id="12" type="y-plane" coeffs="-7" />
|
||||
<surface id="13" type="y-plane" coeffs="-4" />
|
||||
<surface id="14" type="y-plane" coeffs="4" />
|
||||
<surface id="15" type="y-plane" coeffs="7" />
|
||||
<surface id="16" type="y-plane" coeffs="10" boundary="vacuum" />
|
||||
|
||||
<surface id="21" type="z-plane" coeffs="-10" boundary="vacuum" />
|
||||
<surface id="22" type="z-plane" coeffs="-7" />
|
||||
<surface id="23" type="z-plane" coeffs="-4" />
|
||||
<surface id="24" type="z-plane" coeffs="4" />
|
||||
<surface id="25" type="z-plane" coeffs="7" />
|
||||
<surface id="26" type="z-plane" coeffs="10" boundary="vacuum" />
|
||||
|
||||
<!-- Innermost cube -->
|
||||
<cell id="1" material="1" region="3 -4 13 -14 23 -24" />
|
||||
|
||||
<!-- Middle cubic shell -->
|
||||
<cell id="2" material="2" region="2 -5 12 -15 22 -25 (-3 | 4 | -13 | 14 | -23 | 24)" />
|
||||
|
||||
<!-- Outermost cubic shell -->
|
||||
<cell id="3" material="3" region="1 -6 11 -16 21 -26 ~(2 -5 12 -15 22 -25)" />
|
||||
|
||||
</geometry>
|
||||
21
examples/xml/boxes/materials.xml
Normal file
21
examples/xml/boxes/materials.xml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<material id="1">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U235" ao="1.0" />
|
||||
</material>
|
||||
|
||||
<material id="2">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U238" ao="1.0" />
|
||||
</material>
|
||||
|
||||
<material id="3">
|
||||
<density value="1.0" units="g/cc" />
|
||||
<nuclide name="O16" ao="1.0" />
|
||||
<nuclide name="H1" ao="2.0" />
|
||||
<sab name="c_H_in_H2O" />
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
9
examples/xml/boxes/plots.xml
Normal file
9
examples/xml/boxes/plots.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
<plots>
|
||||
<plot id="1" type="slice">
|
||||
<color_by>cell</color_by>
|
||||
<origin>0. 0. 0.</origin>
|
||||
<width>20. 20.</width>
|
||||
<pixels>200 200</pixels>
|
||||
</plot>
|
||||
</plots>
|
||||
15
examples/xml/boxes/settings.xml
Normal file
15
examples/xml/boxes/settings.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<!-- Parameters for k-eigenvalue calculation -->
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<batches>15</batches>
|
||||
<inactive>5</inactive>
|
||||
<particles>10000</particles>
|
||||
|
||||
<!-- Starting source -->
|
||||
<source>
|
||||
<space type="box" parameters="-10. -10. -10. 10. 10. 10." />
|
||||
</source>
|
||||
|
||||
</settings>
|
||||
43
examples/xml/lattice/nested/geometry.xml
Normal file
43
examples/xml/lattice/nested/geometry.xml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<cell id="1" fill="6" region="1 -2 3 -4" />
|
||||
<cell id="2" universe="5" fill="4" region="1 -2 3 -4" />
|
||||
<cell id="101" universe="1" material="1" region="-5" />
|
||||
<cell id="102" universe="1" material="2" region="5" />
|
||||
<cell id="201" universe="2" material="1" region="-6" />
|
||||
<cell id="202" universe="2" material="2" region="6" />
|
||||
<cell id="301" universe="3" material="1" region="-7" />
|
||||
<cell id="302" universe="3" material="2" region="7" />
|
||||
|
||||
<!-- 4 x 4 assembly -->
|
||||
<lattice id="4">
|
||||
<dimension>2 2</dimension>
|
||||
<lower_left>-1.0 -1.0</lower_left>
|
||||
<pitch>1.0 1.0</pitch>
|
||||
<universes>
|
||||
1 2
|
||||
2 3
|
||||
</universes>
|
||||
</lattice>
|
||||
|
||||
<!-- 4 x 4 core -->
|
||||
<lattice id="6">
|
||||
<dimension>2 2</dimension>
|
||||
<lower_left>-2.0 -2.0</lower_left>
|
||||
<pitch>2.0 2.0</pitch>
|
||||
<universes>
|
||||
5 5
|
||||
5 5
|
||||
</universes>
|
||||
</lattice>
|
||||
|
||||
<surface id="1" type="x-plane" coeffs="-2.0" boundary="vacuum" />
|
||||
<surface id="2" type="x-plane" coeffs="2.0" boundary="vacuum" />
|
||||
<surface id="3" type="y-plane" coeffs="-2.0" boundary="vacuum" />
|
||||
<surface id="4" type="y-plane" coeffs="2.0" boundary="vacuum" />
|
||||
<surface id="5" type="z-cylinder" coeffs="0.0 0.0 0.4" />
|
||||
<surface id="6" type="z-cylinder" coeffs="0.0 0.0 0.3" />
|
||||
<surface id="7" type="z-cylinder" coeffs="0.0 0.0 0.2" />
|
||||
|
||||
</geometry>
|
||||
17
examples/xml/lattice/nested/materials.xml
Normal file
17
examples/xml/lattice/nested/materials.xml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<!-- Definition of materials -->
|
||||
<material id="1">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U235" ao="1.0" />
|
||||
</material>
|
||||
|
||||
<material id="2">
|
||||
<density value="1.0" units="g/cc" />
|
||||
<nuclide name="H1" ao="2.0" />
|
||||
<nuclide name="O16" ao="1.0" />
|
||||
<sab name="c_H_in_H2O" />
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
10
examples/xml/lattice/nested/plots.xml
Normal file
10
examples/xml/lattice/nested/plots.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<plots>
|
||||
|
||||
<plot id="1" color_by="material">
|
||||
<origin>0. 0. 0.</origin>
|
||||
<width>4.0 4.0</width>
|
||||
<pixels>400 400</pixels>
|
||||
</plot>
|
||||
|
||||
</plots>
|
||||
17
examples/xml/lattice/nested/settings.xml
Normal file
17
examples/xml/lattice/nested/settings.xml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<!-- Parameters for k-eigenvalue calculation -->
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<batches>20</batches>
|
||||
<inactive>10</inactive>
|
||||
<particles>10000</particles>
|
||||
|
||||
<!-- Starting source -->
|
||||
<source>
|
||||
<space type="box">
|
||||
<parameters>-1 -1 -1 1 1 1</parameters>
|
||||
</space>
|
||||
</source>
|
||||
|
||||
</settings>
|
||||
20
examples/xml/lattice/nested/tallies.xml
Normal file
20
examples/xml/lattice/nested/tallies.xml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
<tallies>
|
||||
|
||||
<mesh id="1">
|
||||
<type>regular</type>
|
||||
<dimension>4 4</dimension>
|
||||
<lower_left>-2.0 -2.0</lower_left>
|
||||
<width>1.0 1.0</width>
|
||||
</mesh>
|
||||
|
||||
<filter id="1" type="mesh">
|
||||
<bins>1</bins>
|
||||
</filter>
|
||||
|
||||
<tally id="1">
|
||||
<filters>1</filters>
|
||||
<scores>total</scores>
|
||||
</tally>
|
||||
|
||||
</tallies>
|
||||
32
examples/xml/lattice/simple/geometry.xml
Normal file
32
examples/xml/lattice/simple/geometry.xml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<cell id="1" fill="5" region="1 -2 3 -4" />
|
||||
<cell id="101" universe="1" material="1" region="-5" />
|
||||
<cell id="102" universe="1" material="2" region="5" />
|
||||
<cell id="201" universe="2" material="1" region="-6" />
|
||||
<cell id="202" universe="2" material="2" region="6" />
|
||||
<cell id="301" universe="3" material="1" region="-7" />
|
||||
<cell id="302" universe="3" material="2" region="7" />
|
||||
|
||||
<lattice id="5">
|
||||
<dimension>4 4</dimension>
|
||||
<lower_left>-2.0 -2.0</lower_left>
|
||||
<pitch>1.0 1.0</pitch>
|
||||
<universes>
|
||||
1 2 1 2
|
||||
2 3 2 3
|
||||
1 2 1 2
|
||||
2 3 2 3
|
||||
</universes>
|
||||
</lattice>
|
||||
|
||||
<surface id="1" type="x-plane" coeffs="-2.0" boundary="vacuum" />
|
||||
<surface id="2" type="x-plane" coeffs="2.0" boundary="vacuum" />
|
||||
<surface id="3" type="y-plane" coeffs="-2.0" boundary="vacuum" />
|
||||
<surface id="4" type="y-plane" coeffs="2.0" boundary="vacuum" />
|
||||
<surface id="5" type="z-cylinder" coeffs="0.0 0.0 0.4" />
|
||||
<surface id="6" type="z-cylinder" coeffs="0.0 0.0 0.3" />
|
||||
<surface id="7" type="z-cylinder" coeffs="0.0 0.0 0.2" />
|
||||
|
||||
</geometry>
|
||||
17
examples/xml/lattice/simple/materials.xml
Normal file
17
examples/xml/lattice/simple/materials.xml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<!-- Definition of materials -->
|
||||
<material id="1">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U235" ao="1.0" />
|
||||
</material>
|
||||
|
||||
<material id="2">
|
||||
<density value="1.0" units="g/cc" />
|
||||
<nuclide name="H1" ao="2.0" />
|
||||
<nuclide name="O16" ao="1.0" />
|
||||
<sab name="c_H_in_H2O" />
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
10
examples/xml/lattice/simple/plots.xml
Normal file
10
examples/xml/lattice/simple/plots.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<plots>
|
||||
|
||||
<plot id="1" color_by="material">
|
||||
<origin>0. 0. 0.</origin>
|
||||
<width>4.0 4.0</width>
|
||||
<pixels>400 400</pixels>
|
||||
</plot>
|
||||
|
||||
</plots>
|
||||
17
examples/xml/lattice/simple/settings.xml
Normal file
17
examples/xml/lattice/simple/settings.xml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<!-- Parameters for k-eigenvalue calculation -->
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<batches>20</batches>
|
||||
<inactive>10</inactive>
|
||||
<particles>10000</particles>
|
||||
|
||||
<!-- Starting source -->
|
||||
<source>
|
||||
<space type="box">
|
||||
<parameters>-1 -1 -1 1 1 1</parameters>
|
||||
</space>
|
||||
</source>
|
||||
|
||||
</settings>
|
||||
20
examples/xml/lattice/simple/tallies.xml
Normal file
20
examples/xml/lattice/simple/tallies.xml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
<tallies>
|
||||
|
||||
<mesh id="1">
|
||||
<type>regular</type>
|
||||
<dimension>4 4</dimension>
|
||||
<lower_left>-2.0 -2.0</lower_left>
|
||||
<width>1.0 1.0</width>
|
||||
</mesh>
|
||||
|
||||
<filter id="1" type="mesh">
|
||||
<bins>1</bins>
|
||||
</filter>
|
||||
|
||||
<tally id="1">
|
||||
<filters>1</filters>
|
||||
<scores>total</scores>
|
||||
</tally>
|
||||
|
||||
</tallies>
|
||||
27
examples/xml/pincell/geometry.xml
Normal file
27
examples/xml/pincell/geometry.xml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<!--
|
||||
This is a simple pin cell model based on dimensions from the MIT BEAVRS
|
||||
(Benchmarking for Evaluation and Validation of Reactor Simulations)
|
||||
benchmark.
|
||||
-->
|
||||
|
||||
<!-- Surfaces for fuel, gap, cladding. Dimensions from Figure 2 in BEAVRS -->
|
||||
<surface id="1" type="z-cylinder" coeffs="0. 0. 0.39218" /> <!-- Fuel OR -->
|
||||
<surface id="2" type="z-cylinder" coeffs="0. 0. 0.40005" /> <!-- Clad IR -->
|
||||
<surface id="3" type="z-cylinder" coeffs="0. 0. 0.45720" /> <!-- Clad OR -->
|
||||
|
||||
<!-- Reflective surfaces on outside of pin-cell. The lattice pitch is 1.25984
|
||||
cm (taken from Table 2 in BEAVRS). -->
|
||||
<surface id="4" type="x-plane" coeffs="-0.62992" boundary="reflective" />
|
||||
<surface id="5" type="x-plane" coeffs=" 0.62992" boundary="reflective" />
|
||||
<surface id="6" type="y-plane" coeffs="-0.62992" boundary="reflective" />
|
||||
<surface id="7" type="y-plane" coeffs=" 0.62992" boundary="reflective" />
|
||||
|
||||
<cell id="1" material="1" region=" -1" /> <!-- UO2 Fuel -->
|
||||
<cell id="2" material="2" region="1 -2" /> <!-- Helium gap -->
|
||||
<cell id="3" material="3" region="2 -3" /> <!-- Zircaloy cladding -->
|
||||
<cell id="4" material="4" region="3 4 -5 6 -7" /> <!-- Borated water -->
|
||||
|
||||
</geometry>
|
||||
67
examples/xml/pincell/materials.xml
Normal file
67
examples/xml/pincell/materials.xml
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<!--
|
||||
Since O-18 is not present in ENDF/B-VII, it was necessary to combine the
|
||||
atom densities for O-17 and O-18 in any materials containing Oxygen.
|
||||
-->
|
||||
|
||||
<!-- UO2 fuel at 2.4 wt% enrichment -->
|
||||
<material id="1">
|
||||
<density value="10.29769" units="g/cm3" />
|
||||
<nuclide name="U234" ao="4.4843e-06" />
|
||||
<nuclide name="U235" ao="5.5815e-04" />
|
||||
<nuclide name="U238" ao="2.2408e-02" />
|
||||
<nuclide name="O16" ao="4.5829e-02" />
|
||||
<nuclide name="O17" ao="1.1164e-04" />
|
||||
</material>
|
||||
|
||||
<!-- Helium for gap -->
|
||||
<material id="2">
|
||||
<density value="0.001598" units="g/cm3" />
|
||||
<nuclide name="He4" ao="2.4044e-04" />
|
||||
</material>
|
||||
|
||||
<!-- Zircaloy 4 -->
|
||||
<material id="3">
|
||||
<density value="6.55" units="g/cm3" />
|
||||
<nuclide name="O16" ao="3.0743e-04" />
|
||||
<nuclide name="O17" ao="7.4887e-07" />
|
||||
<nuclide name="Cr50" ao="3.2962e-06" />
|
||||
<nuclide name="Cr52" ao="6.3564e-05" />
|
||||
<nuclide name="Cr53" ao="7.2076e-06" />
|
||||
<nuclide name="Cr54" ao="1.7941e-06" />
|
||||
<nuclide name="Fe54" ao="8.6699e-06" />
|
||||
<nuclide name="Fe56" ao="1.3610e-04" />
|
||||
<nuclide name="Fe57" ao="3.1431e-06" />
|
||||
<nuclide name="Fe58" ao="4.1829e-07" />
|
||||
<nuclide name="Zr90" ao="2.1827e-02" />
|
||||
<nuclide name="Zr91" ao="4.7600e-03" />
|
||||
<nuclide name="Zr92" ao="7.2758e-03" />
|
||||
<nuclide name="Zr94" ao="7.3734e-03" />
|
||||
<nuclide name="Zr96" ao="1.1879e-03" />
|
||||
<nuclide name="Sn112" ao="4.6735e-06" />
|
||||
<nuclide name="Sn114" ao="3.1799e-06" />
|
||||
<nuclide name="Sn115" ao="1.6381e-06" />
|
||||
<nuclide name="Sn116" ao="7.0055e-05" />
|
||||
<nuclide name="Sn117" ao="3.7003e-05" />
|
||||
<nuclide name="Sn118" ao="1.1669e-04" />
|
||||
<nuclide name="Sn119" ao="4.1387e-05" />
|
||||
<nuclide name="Sn120" ao="1.5697e-04" />
|
||||
<nuclide name="Sn122" ao="2.2308e-05" />
|
||||
<nuclide name="Sn124" ao="2.7897e-05" />
|
||||
</material>
|
||||
|
||||
<!-- Borated water at 975 ppm -->
|
||||
<material id="4">
|
||||
<density value="0.740582" units="g/cm3" />
|
||||
<nuclide name="B10" ao="8.0042e-06" />
|
||||
<nuclide name="B11" ao="3.2218e-05" />
|
||||
<nuclide name="H1" ao="4.9457e-02" />
|
||||
<nuclide name="H2" ao="7.4196e-06" />
|
||||
<nuclide name="O16" ao="2.4672e-02" />
|
||||
<nuclide name="O17" ao="6.0099e-05" />
|
||||
<sab name="c_H_in_H2O" />
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
32
examples/xml/pincell/settings.xml
Normal file
32
examples/xml/pincell/settings.xml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<!-- Define how many particles to run and for how many batches -->
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<batches>100</batches>
|
||||
<inactive>10</inactive>
|
||||
<particles>1000</particles>
|
||||
|
||||
<!-- The starting source is a uniform distribution over the entire pin
|
||||
cell. Note that since this is effectively a 2D model, the z coordinates
|
||||
are inconsequential -->
|
||||
<source>
|
||||
<space type="box">
|
||||
<parameters>
|
||||
-0.62992 -0.62992 -1.
|
||||
0.62992 0.62992 1.
|
||||
</parameters>
|
||||
</space>
|
||||
</source>
|
||||
|
||||
<!-- To assess convergence of the source distribution, we need to define the
|
||||
bounds for a mesh over which the Shannon entropy should be
|
||||
calculated. The extent in the z direction is made arbitrarily large. -->
|
||||
<mesh id="1">
|
||||
<lower_left>-0.39218 -0.39218 -1.e50</lower_left>
|
||||
<upper_right>0.39218 0.39218 1.e50</upper_right>
|
||||
<dimension>10 10 1</dimension>
|
||||
</mesh>
|
||||
<entropy_mesh>1</entropy_mesh>
|
||||
|
||||
</settings>
|
||||
23
examples/xml/pincell/tallies.xml
Normal file
23
examples/xml/pincell/tallies.xml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0"?>
|
||||
<tallies>
|
||||
|
||||
<mesh id="2" type="regular">
|
||||
<dimension>100 100 1</dimension>
|
||||
<lower_left>-0.62992 -0.62992 -1.e50</lower_left>
|
||||
<upper_right>0.62992 0.62992 1.e50</upper_right>
|
||||
</mesh>
|
||||
|
||||
<filter id="1" type="mesh">
|
||||
<bins>2</bins>
|
||||
</filter>
|
||||
|
||||
<filter id="2" type="energy">
|
||||
<bins>0. 4. 20.0e6</bins>
|
||||
</filter>
|
||||
|
||||
<tally id="1">
|
||||
<filters>1 2</filters>
|
||||
<scores>flux fission nu-fission</scores>
|
||||
</tally>
|
||||
|
||||
</tallies>
|
||||
10
examples/xml/pincell_multigroup/geometry.xml
Normal file
10
examples/xml/pincell_multigroup/geometry.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<geometry>
|
||||
<cell id="1" material="1" name="cell 1" region="-1" universe="0" />
|
||||
<cell id="2" material="2" name="cell 2" region="1 4 -5 6 -7" universe="0" />
|
||||
<surface coeffs="0 0 0.54" id="1" name="Fuel OR" type="z-cylinder" />
|
||||
<surface boundary="reflective" coeffs="-0.63" id="4" name="left" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="0.63" id="5" name="right" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="-0.63" id="6" name="bottom" type="y-plane" />
|
||||
<surface boundary="reflective" coeffs="0.63" id="7" name="top" type="y-plane" />
|
||||
</geometry>
|
||||
12
examples/xml/pincell_multigroup/materials.xml
Normal file
12
examples/xml/pincell_multigroup/materials.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<materials>
|
||||
<cross_sections>./mgxs.h5</cross_sections>
|
||||
<material id="1" name="UO2 fuel">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="UO2" />
|
||||
</material>
|
||||
<material id="2" name="Water">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="LWTR" />
|
||||
</material>
|
||||
</materials>
|
||||
BIN
examples/xml/pincell_multigroup/mgxs.h5
Normal file
BIN
examples/xml/pincell_multigroup/mgxs.h5
Normal file
Binary file not shown.
28
examples/xml/pincell_multigroup/plots.xml
Normal file
28
examples/xml/pincell_multigroup/plots.xml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0"?>
|
||||
<plots>
|
||||
|
||||
<plot>
|
||||
<id>1</id>
|
||||
<filename>mat</filename>
|
||||
<color_by>material</color_by>
|
||||
<origin>0 0 0</origin>
|
||||
<width>1.26 1.26</width>
|
||||
<type>slice</type>
|
||||
<pixels>1000 1000 </pixels>
|
||||
<color id="1" rgb="255 0 0" />
|
||||
<color id="2" rgb="0 0 0" />
|
||||
<color id="3" rgb="0 255 0" />
|
||||
<color id="4" rgb="0 0 255" />
|
||||
</plot>
|
||||
|
||||
<plot>
|
||||
<id>2</id>
|
||||
<filename>cell</filename>
|
||||
<color_by>cell</color_by>
|
||||
<origin>0 0 0</origin>
|
||||
<width>1.26 1.26</width>
|
||||
<type>slice</type>
|
||||
<pixels>1000 1000 </pixels>
|
||||
</plot>
|
||||
|
||||
</plots>
|
||||
13
examples/xml/pincell_multigroup/settings.xml
Normal file
13
examples/xml/pincell_multigroup/settings.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<settings>
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<particles>1000</particles>
|
||||
<batches>100</batches>
|
||||
<inactive>10</inactive>
|
||||
<source strength="1.0">
|
||||
<space type="box">
|
||||
<parameters>-0.63 -0.63 -1 0.63 0.63 1</parameters>
|
||||
</space>
|
||||
</source>
|
||||
<energy_mode>multi-group</energy_mode>
|
||||
</settings>
|
||||
18
examples/xml/pincell_multigroup/tallies.xml
Normal file
18
examples/xml/pincell_multigroup/tallies.xml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<tallies>
|
||||
<mesh id="1" type="regular">
|
||||
<dimension>100 100 1</dimension>
|
||||
<lower_left>-0.63 -0.63 -1e+50</lower_left>
|
||||
<upper_right>0.63 0.63 1e+50</upper_right>
|
||||
</mesh>
|
||||
<filter id="1" type="energy">
|
||||
<bins>1e-05 0.0635 10.0 100.0 1000.0 500000.0 1000000.0 20000000.0</bins>
|
||||
</filter>
|
||||
<filter id="2" type="mesh">
|
||||
<bins>1</bins>
|
||||
</filter>
|
||||
<tally id="1" name="tally 1">
|
||||
<filters>1 2</filters>
|
||||
<scores>flux fission nu-fission</scores>
|
||||
</tally>
|
||||
</tallies>
|
||||
19
examples/xml/reflective/geometry.xml
Normal file
19
examples/xml/reflective/geometry.xml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<!-- Definition of Cells -->
|
||||
<cell id="1">
|
||||
<universe>0</universe>
|
||||
<material>1</material>
|
||||
<region>1 -2 3 -4 5 -6</region>
|
||||
</cell>
|
||||
|
||||
<!-- Defition of Surfaces -->
|
||||
<surface id="1" type="x-plane" coeffs="-1" boundary="vacuum" />
|
||||
<surface id="2" type="x-plane" coeffs="1" boundary="vacuum" />
|
||||
<surface id="3" type="y-plane" coeffs="-1" boundary="reflective" />
|
||||
<surface id="4" type="y-plane" coeffs="1" boundary="reflective" />
|
||||
<surface id="5" type="z-plane" coeffs="-1" boundary="reflective" />
|
||||
<surface id="6" type="z-plane" coeffs="1" boundary="reflective" />
|
||||
|
||||
</geometry>
|
||||
9
examples/xml/reflective/materials.xml
Normal file
9
examples/xml/reflective/materials.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<material id="1">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U235" ao="1.0" />
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
17
examples/xml/reflective/settings.xml
Normal file
17
examples/xml/reflective/settings.xml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<!-- Parameters for k-eigenvalue calculation -->
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<batches>500</batches>
|
||||
<inactive>10</inactive>
|
||||
<particles>10000</particles>
|
||||
|
||||
<!-- Starting source -->
|
||||
<source>
|
||||
<space type="box">
|
||||
<parameters>-1 -1 -1 1 1 1</parameters>
|
||||
</space>
|
||||
</source>
|
||||
|
||||
</settings>
|
||||
Loading…
Add table
Add a link
Reference in a new issue