mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Move C API notebook to examples/jupyter directory
This commit is contained in:
parent
28b37011b0
commit
ec93c74253
2 changed files with 1 additions and 0 deletions
|
|
@ -1,474 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"This notebook shows how to use the OpenMC C/C++ API through the openmc.lib module. This module is particularly useful for multiphysics coupling because it allows you to update the density of materials and the temperatures of cells in memory, without stopping the simulation.\n",
|
||||
"\n",
|
||||
"Warning: these bindings are still somewhat experimental and may be subject to change in future versions of OpenMC."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%matplotlib inline\n",
|
||||
"import openmc\n",
|
||||
"import openmc.lib"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<b>Generate Input Files</b>\n",
|
||||
"\n",
|
||||
"Let's start by creating a fuel rod geometry. We will make 10 zones in the z-direction which will allow us to make changes to each zone. Changes in temperature have to be made on the cell, so will make 10 cells in the axial direction. Changes in density have to be made on the material, so we will make 10 water materials. "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Materials: we will make a fuel, helium, zircaloy, and 10 water materials. "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"material_list = []"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"uo2 = openmc.Material(material_id=1, name='UO2 fuel at 2.4% wt enrichment')\n",
|
||||
"uo2.set_density('g/cm3', 10.29769)\n",
|
||||
"uo2.add_element('U', 1., enrichment=2.4)\n",
|
||||
"uo2.add_element('O', 2.)\n",
|
||||
"material_list.append(uo2)\n",
|
||||
"\n",
|
||||
"helium = openmc.Material(material_id=2, name='Helium for gap')\n",
|
||||
"helium.set_density('g/cm3', 0.001598)\n",
|
||||
"helium.add_element('He', 2.4044e-4)\n",
|
||||
"material_list.append(helium)\n",
|
||||
"\n",
|
||||
"zircaloy = openmc.Material(material_id=3, name='Zircaloy 4')\n",
|
||||
"zircaloy.set_density('g/cm3', 6.55)\n",
|
||||
"zircaloy.add_element('Sn', 0.014, 'wo')\n",
|
||||
"zircaloy.add_element('Fe', 0.00165, 'wo')\n",
|
||||
"zircaloy.add_element('Cr', 0.001, 'wo')\n",
|
||||
"zircaloy.add_element('Zr', 0.98335, 'wo')\n",
|
||||
"material_list.append(zircaloy)\n",
|
||||
"\n",
|
||||
"for i in range(4, 14):\n",
|
||||
" water = openmc.Material(material_id=i)\n",
|
||||
" water.set_density('g/cm3', 0.7)\n",
|
||||
" water.add_element('H', 2.0)\n",
|
||||
" water.add_element('O', 1.0)\n",
|
||||
" water.add_s_alpha_beta('c_H_in_H2O')\n",
|
||||
" material_list.append(water)\n",
|
||||
" \n",
|
||||
"materials_file = openmc.Materials(material_list)\n",
|
||||
"materials_file.export_to_xml()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Cells: we will make a fuel cylinder, a gap cylinder, a cladding cylinder, and a water exterior. Each one will be broken into 10 cells which are the 10 axial zones. The z_list is the list of axial positions that delimit those 10 zones. To keep track of all the cells, we will create lists: fuel_list, gap_list, clad_list, and water_list. "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"pitch = 1.25984\n",
|
||||
"fuel_or = openmc.ZCylinder(r=0.39218)\n",
|
||||
"clad_ir = openmc.ZCylinder(r=0.40005)\n",
|
||||
"clad_or = openmc.ZCylinder(r=0.4572)\n",
|
||||
"left = openmc.XPlane(x0=-pitch/2)\n",
|
||||
"right = openmc.XPlane(x0=pitch/2)\n",
|
||||
"back = openmc.YPlane(y0=-pitch/2)\n",
|
||||
"front = openmc.YPlane(y0=pitch/2)\n",
|
||||
"z = [0., 30., 60., 90., 120., 150., 180., 210., 240., 270., 300.]\n",
|
||||
"z_list = [openmc.ZPlane(z0=z_i) for z_i in z]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"left.boundary_type = 'reflective'\n",
|
||||
"right.boundary_type = 'reflective'\n",
|
||||
"front.boundary_type = 'reflective'\n",
|
||||
"back.boundary_type = 'reflective'\n",
|
||||
"z_list[0].boundary_type = 'vacuum'\n",
|
||||
"z_list[-1].boundary_type = 'vacuum'"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"fuel_list = []\n",
|
||||
"gap_list = []\n",
|
||||
"clad_list = []\n",
|
||||
"water_list = []\n",
|
||||
"for i in range(1, 11):\n",
|
||||
" fuel_list.append(openmc.Cell(cell_id=i))\n",
|
||||
" gap_list.append(openmc.Cell(cell_id=i+10))\n",
|
||||
" clad_list.append(openmc.Cell(cell_id=i+20))\n",
|
||||
" water_list.append(openmc.Cell(cell_id=i+30))\n",
|
||||
" \n",
|
||||
"for j, fuels in enumerate(fuel_list):\n",
|
||||
" fuels.region = -fuel_or & +z_list[j] & -z_list[j+1]\n",
|
||||
" fuels.fill = uo2\n",
|
||||
" fuels.temperature = 800.\n",
|
||||
"\n",
|
||||
"for j, gaps in enumerate(gap_list):\n",
|
||||
" gaps.region = +fuel_or & -clad_ir & +z_list[j] & -z_list[j+1]\n",
|
||||
" gaps.fill = helium\n",
|
||||
" gaps.temperature = 700.\n",
|
||||
"\n",
|
||||
"for j, clads in enumerate(clad_list):\n",
|
||||
" clads.region = +clad_ir & -clad_or & +z_list[j] & -z_list[j+1]\n",
|
||||
" clads.fill = zircaloy\n",
|
||||
" clads.temperature = 600.\n",
|
||||
"\n",
|
||||
"for j, waters in enumerate(water_list):\n",
|
||||
" waters.region = +clad_or & +left & -right & +back & -front & +z_list[j] & -z_list[j+1]\n",
|
||||
" waters.fill = material_list[j+3]\n",
|
||||
" waters.temperature = 500."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"root = openmc.Universe(name='root universe')\n",
|
||||
"root.add_cells(fuel_list)\n",
|
||||
"root.add_cells(gap_list)\n",
|
||||
"root.add_cells(clad_list)\n",
|
||||
"root.add_cells(water_list)\n",
|
||||
"geometry_file = openmc.Geometry(root)\n",
|
||||
"geometry_file.export_to_xml()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"If you are coupling this externally to a heat transfer solver, you will want to know the heat deposited by each fuel cell. So let's create a cell filter for the recoverable fission heat. "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"cell_filter = openmc.CellFilter(fuel_list)\n",
|
||||
"t = openmc.Tally(tally_id=1)\n",
|
||||
"t.filters.append(cell_filter)\n",
|
||||
"t.scores = ['fission-q-recoverable']\n",
|
||||
"tallies = openmc.Tallies([t])\n",
|
||||
"tallies.export_to_xml()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's plot our geometry to make sure it looks like we expect. Since we made new water materials in each axial cell, and we have centered the plot at 150, we should see one color for the water material in the bottom half and a different color for the water material in the top half. "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<matplotlib.image.AxesImage at 0x126d642e0>"
|
||||
]
|
||||
},
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAFcAAAD4CAYAAACZgnpXAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Il7ecAAAACXBIWXMAAAsTAAALEwEAmpwYAAAIMElEQVR4nO3df6jddR3H8ecrh2K41JhL04071CxHueqiEAXSDzWhppU0CwwR1h8O+sNKK1iL9I8U8x8zmBVCxMQ/KsvKoKAWodSdqXOOxXQ2N3/MZURKaXPv/jhf19nd/XE85/u63nPu6wGX7fv9nvO9H54cvjuHe9/7qqoIjze83gsYZYlrlLhGiWuUuEaLXu8FACxZsqTGxsamPf78gV2HbR+7859sP/noVr73O555mX+fcfxh+968aMWMz9myZcv+qjpptnPPi7hjY2NMTExMe3zTvs8etv2uS+7l3V9a1sr3vuumJ3n4pxcdtu/ypT+a8TmS/tbLuXNZMEpco8Q1SlyjxDVKXKPENUpco8Q1SlyjxDVKXKPENUpco8Q1SlyjxDWaNa6kH0jaJ+mRrn0bJO2V9GDzdfGk5yyX9IKkLzoWPSx6eeXeAVw0xf5bqmpV8/XLSce+Dfxq0MUNu1l/hlZVmyWN9XpCSZcAu4AX+1/WaBjkmrtO0sPNZeNEAEnHAdcC35jtyZLWSpqQNPHcc88NsIz5q9+43wVOB1YBTwM3N/s30LlcvDDbCapqY1WNV9X4SSfN+lPqodTXj9ar6tlX/y7pduCeZvM84FOSbgROAA5K+k9V3TroQodRX3ElnVJVTzeblwKP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AAASUVORK5CYII=\n",
|
||||
"text/plain": [
|
||||
"<Figure size 432x288 with 1 Axes>"
|
||||
]
|
||||
},
|
||||
"metadata": {
|
||||
"needs_background": "light"
|
||||
},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"root.plot(basis='yz', width=[2, 10], color_by='material', origin=[0., 0., 150.], pixels=[400, 400])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Settings: everything will be standard except for the temperature settings. Since we will be working with specified temperatures, you will need temperature dependent data. I typically use the endf data found here: https://openmc.org/official-data-libraries/\n",
|
||||
"Make sure your cross sections environment variable is pointing to temperature-dependent data before using the following settings."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"lower_left = [-0.62992, -pitch/2, 0]\n",
|
||||
"upper_right = [+0.62992, +pitch/2, +300]\n",
|
||||
"uniform_dist = openmc.stats.Box(lower_left, upper_right, only_fissionable=True)\n",
|
||||
"\n",
|
||||
"settings_file = openmc.Settings()\n",
|
||||
"settings_file.batches = 100\n",
|
||||
"settings_file.inactive = 10\n",
|
||||
"settings_file.particles = 10000\n",
|
||||
"settings_file.temperature = {'multipole': True, 'method': 'interpolation', 'range': [290, 2500]}\n",
|
||||
"settings_file.source = openmc.source.Source(space=uniform_dist)\n",
|
||||
"settings_file.export_to_xml()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"To run a regular simulation, just use openmc.run(). \n",
|
||||
"However, we want to run a simulation that we can stop in the middle and update the material and cell properties. So we will use openmc.lib."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"openmc.lib.init()\n",
|
||||
"openmc.lib.simulation_init()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"There are 10 inactive batches, so we need to run next_batch() at least 10 times before the tally is activated. "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for _ in range(14):\n",
|
||||
" openmc.lib.next_batch()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's take a look at the tally. There are 10 entries, one for each cell in the fuel."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[[ 4178272.4202991 ]\n",
|
||||
" [ 9595363.82759911]\n",
|
||||
" [12307462.30060902]\n",
|
||||
" [11772927.66594472]\n",
|
||||
" [11892601.29001472]\n",
|
||||
" [12203397.88895767]\n",
|
||||
" [12851791.20965905]\n",
|
||||
" [11760027.45873386]\n",
|
||||
" [ 9293110.94735569]\n",
|
||||
" [ 4511597.61592287]]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"t = openmc.lib.tallies[1]\n",
|
||||
"print(t.mean)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now, let's make some changes to the temperatures. For this, we need to identify each cell by its id. We can use get_temperature() to compare the temperatures of the cells before and after the change. "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"fuel temperature is: \n",
|
||||
"800.0\n",
|
||||
"gap temperature is: \n",
|
||||
"700.0\n",
|
||||
"clad temperature is: \n",
|
||||
"600.0\n",
|
||||
"water temperature is: \n",
|
||||
"500.00000000000006\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(\"fuel temperature is: \")\n",
|
||||
"print(openmc.lib.cells[5].get_temperature())\n",
|
||||
"print(\"gap temperature is: \")\n",
|
||||
"print(openmc.lib.cells[15].get_temperature())\n",
|
||||
"print(\"clad temperature is: \")\n",
|
||||
"print(openmc.lib.cells[25].get_temperature())\n",
|
||||
"print(\"water temperature is: \")\n",
|
||||
"print(openmc.lib.cells[35].get_temperature())"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for i in range(1, 11):\n",
|
||||
" temp = 900.0\n",
|
||||
" openmc.lib.cells[i].set_temperature(temp)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"fuel temperature is: \n",
|
||||
"899.9999999999999\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(\"fuel temperature is: \")\n",
|
||||
"print(openmc.lib.cells[5].get_temperature())"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's make a similar change for the water density. Again, we need to identify each material by its id."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for i in range(4, 14):\n",
|
||||
" density = 0.65\n",
|
||||
" openmc.lib.materials[i].set_density(density, units='g/cm3')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"The new batches we run will use the new material and cell properties."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for _ in range(14):\n",
|
||||
" openmc.lib.next_batch()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"When you're ready to end the simulation, use the following:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"openmc.lib.simulation_finalize()\n",
|
||||
"openmc.lib.finalize()"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"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.9.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
1
docs/source/examples/capi.ipynb
Symbolic link
1
docs/source/examples/capi.ipynb
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../../examples/jupyter/capi.ipynb
|
||||
Loading…
Add table
Add a link
Reference in a new issue