mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
add flux_3d.png
This commit is contained in:
parent
61fe30709f
commit
388daec1aa
2 changed files with 18 additions and 15 deletions
|
|
@ -151,7 +151,7 @@
|
|||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"PosixPath('/mnt/d/MIT_CRPG/openmc_develop/openmc/examples/jupyter/statepoint.210.h5')"
|
||||
"0.30282347701347406+/-0.0006325501096712208"
|
||||
]
|
||||
},
|
||||
"execution_count": 7,
|
||||
|
|
@ -160,7 +160,7 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"model.run(output=False)"
|
||||
"sp_file = model.run(output=False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -176,7 +176,7 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with openmc.StatePoint('statepoint.210.h5') as sp:\n",
|
||||
"with openmc.StatePoint(sp_file) as sp:\n",
|
||||
" df = sp.tallies[flux_tally.id].get_pandas_dataframe()"
|
||||
]
|
||||
},
|
||||
|
|
@ -444,15 +444,18 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Alternatively, Zernike polynomials provided in OepnMC to represent continuous functions of space or angle can be reconstructed from the tallied moments.\n",
|
||||
"## Zernike polynomials\n",
|
||||
"\n",
|
||||
"In this example, we will determine the spatial dependence of the flux along the radial direction $r'$ and / or azimuthal angle $\\theta$ by making a Zernike polynomial expansion. Let us represent the flux along the radial and azimuthal direction, $\\phi(r', \\theta)$, by the function\n",
|
||||
"Now let's look at an example of functional expansion tallies using Zernike polynomials as the basis functions.\n",
|
||||
"\n",
|
||||
"In this example, we will determine the spatial dependence of the flux along the radial direction $r'$ and $/$ or azimuthal angle $\\theta$ by making a Zernike polynomial expansion. Let us represent the flux along the radial and azimuthal direction, $\\phi(r', \\theta)$, by the function\n",
|
||||
"\n",
|
||||
"$$ \\phi(r', \\theta) = \\sum\\limits_{n=0}^N \\sum\\limits_{m=-n}^n a_n^m Z_n^m(r', \n",
|
||||
"\\theta) $$\n",
|
||||
"\n",
|
||||
"where $r'$ is the position normalized to the range [0, r], and the azimuthal lies within the range [0, $ 2\\pi$]. \n",
|
||||
"Since $Z_n^m(r', \\theta)$ are known functions, what we need to do is to determine the expansion coefficients, $a_n^m$. By the orthogonality properties of the Zernike polynomials, one can deduce that the coefficients, $a_n^m$, are given by\n",
|
||||
"\n",
|
||||
"Since $Z_n^m(r', \\theta)$ are known functions, we need to determine the expansion coefficients, $a_n^m$. By the orthogonality properties of the Zernike polynomials, one can deduce that the coefficients, $a_n^m$, are given by\n",
|
||||
"\n",
|
||||
"$$ a_n^m = k_n^m \\int_{0}^r dr' \\int_{0}^{2\\pi} d\\theta Z_n^m(r',\\theta) \\phi(r', \\theta).$$\n",
|
||||
"$$ k_n^m = \\frac{2n + 2}{\\pi}, m \\ne 0. $$\n",
|
||||
|
|
@ -465,7 +468,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"To begin, let us first create a simple model. The model will be a pin-cell fuel material with vacuum boundary condition in both radial direction and axial direction."
|
||||
"To begin with, let us first create a simple model. The model will be a pin-cell fuel material with vacuum boundary condition in both radial direction and axial direction."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -596,7 +599,7 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"model.run(output=False)"
|
||||
"sp_file = model.run(output=False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -612,7 +615,7 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with openmc.StatePoint('statepoint.100.h5') as sp:\n",
|
||||
"with openmc.StatePoint(sp_file) as sp:\n",
|
||||
" df1 = sp.tallies[flux_tally_legendre.id].get_pandas_dataframe()"
|
||||
]
|
||||
},
|
||||
|
|
@ -789,7 +792,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Since the scaling factors for expansion coefficients will be given in Python API, thus, we do not need to multiply the moments by scaling factors."
|
||||
"Since the scaling factors for expansion coefficients will be provided by the Python API, thus, we do not need to multiply the moments by scaling factors."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -864,7 +867,7 @@
|
|||
"metadata": {},
|
||||
"source": [
|
||||
"A rough cosine shape is obtained. \n",
|
||||
"One can also conduct numerically integrating using the trapezoidal rule."
|
||||
"One can also numerically integrate the function using the trapezoidal rule."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -900,7 +903,7 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with openmc.StatePoint('statepoint.100.h5') as sp:\n",
|
||||
"with openmc.StatePoint(sp_file) as sp:\n",
|
||||
" df2 = sp.tallies[flux_tally_zernike.id].get_pandas_dataframe()"
|
||||
]
|
||||
},
|
||||
|
|
@ -1166,7 +1169,7 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with openmc.StatePoint('statepoint.100.h5') as sp:\n",
|
||||
"with openmc.StatePoint(sp_file) as sp:\n",
|
||||
" df3 = sp.tallies[flux_tally_zernike1d.id].get_pandas_dataframe()"
|
||||
]
|
||||
},
|
||||
|
|
@ -1437,7 +1440,7 @@
|
|||
" phi = np.arctan2(y, x)\n",
|
||||
" return(rho, phi)\n",
|
||||
"\n",
|
||||
"# reconstruct 3-D flux based on azimuthal Zernike and Legendre polynomials\n",
|
||||
"# Reconstruct 3-D flux based on azimuthal Zernike and Legendre polynomials\n",
|
||||
"z_n = np.array(df2['mean'])\n",
|
||||
"zz = openmc.Zernike(z_n, radius=radius) \n",
|
||||
"#\n",
|
||||
|
|
@ -1539,7 +1542,7 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"f1 = plt.imread('flux3d.png')\n",
|
||||
"f1 = plt.imread('./images/flux3d.png')\n",
|
||||
"plt.imshow(f1, cmap='jet')"
|
||||
]
|
||||
},
|
||||
|
|
|
|||
BIN
examples/jupyter/images/flux3d.png
Normal file
BIN
examples/jupyter/images/flux3d.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 98 KiB |
Loading…
Add table
Add a link
Reference in a new issue