address minor comments

This commit is contained in:
rockfool 2020-04-06 21:04:39 -04:00
parent d93e459087
commit a9bafd777a

View file

@ -410,7 +410,7 @@
{
"data": {
"text/plain": [
"36.523562389125175"
"36.523562389125146"
]
},
"execution_count": 13,
@ -442,7 +442,7 @@
"$$ \\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",
"where $r'$ is the position normalized to the range [0, r] (r is the radius of cylindrical geometry), and the azimuthal lies within the range [0, $ 2\\pi$]. \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",
@ -537,14 +537,14 @@
"# Create a Zernike azimuthal polynomial expansion filter and add to tally \n",
"flux_tally_zernike = openmc.Tally()\n",
"flux_tally_zernike.scores = ['flux']\n",
"zernike_filter = openmc.ZernikeFilter(order=order, x=0.0, y=0.0, r=radius)\n",
"flux_tally_zernike.filters = [cell_filter, zernike_filter]\n",
"zernike_filter = openmc.ZernikeFilter(order=order, x=0.0, y=0.0, r=radius)\n",
"flux_tally_zernike.filters = [cell_filter, zernike_filter]\n",
"\n",
"# Create a Zernike radial polynomial expansion filter and add to tally \n",
"flux_tally_zernike1d = openmc.Tally()\n",
"flux_tally_zernike1d.scores = ['flux']\n",
"zernike1d_filter = openmc.ZernikeRadialFilter(order=order, x=0.0, y=0.0, r=radius)\n",
"flux_tally_zernike1d.filters = [cell_filter, zernike1d_filter]\n"
"zernike1d_filter = openmc.ZernikeRadialFilter(order=order, x=0.0, y=0.0, r=radius)\n",
"flux_tally_zernike1d.filters = [cell_filter, zernike1d_filter]\n"
]
},
{
@ -1086,7 +1086,7 @@
}
],
"source": [
"z_n = np.array(df2['mean']) \n",
"z_n = df2['mean'] \n",
"zz = openmc.Zernike(z_n, radius)\n",
"rr = np.linspace(0, radius, 100)\n",
"plt.plot(rr, zz(rr, 0.0)) \n",
@ -1120,7 +1120,7 @@
}
],
"source": [
"z_n = np.array(df2['mean'])\n",
"z_n = df2['mean']\n",
"zz = openmc.Zernike(z_n, radius=radius) \n",
"#\n",
"# Using linspace so that the endpoint of 360 is included...\n",
@ -1299,7 +1299,7 @@
}
],
"source": [
"z_n = np.array(df3['mean']) \n",
"z_n = df3['mean'] \n",
"zz = openmc.ZernikeRadial(z_n, radius=radius)\n",
"rr = np.linspace(0, radius, 50)\n",
"plt.plot(rr, zz(rr)) \n",
@ -1333,7 +1333,7 @@
}
],
"source": [
"z_n = np.array(df3['mean']) \n",
"z_n = df3['mean'] \n",
"zz = openmc.ZernikeRadial(z_n, radius=radius)\n",
"azimuths = np.radians(np.linspace(0, 360, 50))\n",
"zeniths = np.linspace(0, radius, 100)\n",
@ -1348,7 +1348,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Based on Legendre polynomial coefficients and the azimuthal or radial-only Zernike coefficient, one can easily re-construct the flux both on radial and axial directions. "
"Based on Legendre polynomial coefficients and the azimuthal or radial-only Zernike coefficient, it's possible to reconstruct the flux both on radial and axial directions. "
]
},
{
@ -1359,7 +1359,7 @@
{
"data": {
"text/plain": [
"<matplotlib.colorbar.Colorbar at 0x7fed339ccfd0>"
"<matplotlib.colorbar.Colorbar at 0x7ffe048a2f90>"
]
},
"execution_count": 34,
@ -1380,16 +1380,18 @@
}
],
"source": [
"# reconstruct 3-D flux based on radial only Zernike and Legendre polynomials\n",
"z_n = np.array(df3['mean']) \n",
"# Reconstruct 3-D flux based on radial only Zernike and Legendre polynomials\n",
"z_n = df3['mean'] \n",
"zz = openmc.ZernikeRadial(z_n, radius=radius)\n",
"azimuths = np.radians(np.linspace(0, 360, 100)) # azimuthal mesh \n",
"zeniths = np.linspace(0, radius, 100) # radial mesh \n",
"zmin, zmax = -1.0, 1.0 \n",
"z = np.linspace(zmin, zmax, 100) # axial mesh \n",
"#\n",
"flux = np.matmul(np.matrix(phi(z)).transpose(), np.matrix(zz(zeniths))) \n",
"flux = np.array(flux) # change np.matrix to np.array\n",
"# \n",
"# flux = np.matmul(np.matrix(phi(z)).transpose(), np.matrix(zz(zeniths))) \n",
"# flux = np.array(flux) # change np.matrix to np.array\n",
"# np.matrix is not recommended for use anymore\n",
"flux = np.array([phi(z)]).T @ np.array([zz(zeniths)])\n",
"#\n",
"plt.figure(figsize=(5,10))\n",
"plt.title('Flux distribution')\n",
@ -1403,7 +1405,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"One can also easily re-construct the 3-D flux distribution based on Legendre and Zernike polynomial tallied coefficients. "
"One can also reconstruct the 3D flux distribution based on Legendre and Zernike polynomial tallied coefficients."
]
},
{
@ -1419,7 +1421,7 @@
" return(rho, phi)\n",
"\n",
"# Reconstruct 3-D flux based on azimuthal Zernike and Legendre polynomials\n",
"z_n = np.array(df2['mean'])\n",
"z_n = df2['mean']\n",
"zz = openmc.Zernike(z_n, radius=radius) \n",
"#\n",
"xstep = 2.0*radius/20\n",
@ -1451,20 +1453,9 @@
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'/mnt/d/MIT_CRPG/openmc_develop/openmc/examples/jupyter/rectilinear.vtr'"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# One should install pyevtk as the pre-condition\n",
"# You'll need to install pyevtk as a prerequisite\n",
"from pyevtk.hl import gridToVTK\n",
"import numpy as np\n",
"#\n",
@ -1481,7 +1472,7 @@
"y = np.arange(0, ly + 0.1*dy, dy, dtype='float64')\n",
"z = np.arange(0, lz + 0.1*dz, dz, dtype='float64')\n",
"# Print out \n",
"gridToVTK(\"./rectilinear\", x, y, z, cellData = {\"flux3d\" : flux3d})"
"path = gridToVTK(\"./rectilinear\", x, y, z, cellData = {\"flux3d\" : flux3d})"
]
},
{
@ -1499,7 +1490,7 @@
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x7fed34097450>"
"<matplotlib.image.AxesImage at 0x7ffe050592d0>"
]
},
"execution_count": 37,