Some updates to the example file.

This commit is contained in:
Patrick Shriwise 2020-03-18 22:30:01 -05:00
parent 29bfb27d2b
commit 3a7b22cc52

View file

@ -162,7 +162,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Next we'll create a point source at the entrance the single pipe on the low side of the model."
"Next we'll create a 5 MeV isotropic neutron point source at the entrance the single pipe on the low side of the model."
]
},
{
@ -172,7 +172,7 @@
"outputs": [],
"source": [
"src_pnt = openmc.stats.Point(xyz=(0.0, 0.0, 0.0))\n",
"src_energy = openmc.stats.Discrete(x=[10.0], p=[1.0])\n",
"src_energy = openmc.stats.Discrete(x=[5.e+06], p=[1.0])\n",
"\n",
"source = openmc.Source(space=src_pnt, energy=src_energy)\n",
"\n",
@ -247,7 +247,7 @@
" License | http://openmc.readthedocs.io/en/latest/license.html\n",
" Version | 0.12.0-dev\n",
" Git SHA1 | e5e67eb4d2780d739f290b995e5acd676b70be41\n",
" Date/Time | 2020-03-18 15:11:49\n",
" Date/Time | 2020-03-18 21:52:40\n",
" OpenMP Threads | 8\n",
"\n",
" Reading settings XML file...\n",
@ -312,21 +312,21 @@
" Simulating batch 9\n",
" Simulating batch 10\n",
" Creating state point statepoint.10.h5...\n",
" WARNING: Skipping unstructured mesh writing for tally 1. More than one filter\n",
" WARNING: Skipping unstructured mesh writing for tally 2. More than one filter\n",
" is present on the tally.\n",
"\n",
" =======================> TIMING STATISTICS <=======================\n",
"\n",
" Total time for initialization = 4.4827e+01 seconds\n",
" Reading cross sections = 4.3268e+00 seconds\n",
" Total time in simulation = 1.5399e+01 seconds\n",
" Time in transport only = 1.1936e+01 seconds\n",
" Time in active batches = 1.5399e+01 seconds\n",
" Time sampling source = 3.3231e+00 seconds\n",
" Time accumulating tallies = 2.4006e-02 seconds\n",
" Total time for finalization = 9.0122e-01 seconds\n",
" Total time elapsed = 6.1396e+01 seconds\n",
" Calculation Rate (active) = 3247.02 particles/second\n",
" Total time for initialization = 4.3207e+01 seconds\n",
" Reading cross sections = 4.8009e+00 seconds\n",
" Total time in simulation = 8.7535e+00 seconds\n",
" Time in transport only = 5.2673e+00 seconds\n",
" Time in active batches = 8.7535e+00 seconds\n",
" Time sampling source = 3.3281e+00 seconds\n",
" Time accumulating tallies = 2.3008e-02 seconds\n",
" Total time for finalization = 1.0243e+00 seconds\n",
" Total time elapsed = 5.3271e+01 seconds\n",
" Calculation Rate (active) = 5711.99 particles/second\n",
"\n",
" ============================> RESULTS <============================\n",
"\n",
@ -419,7 +419,7 @@
"libgcov profiling error:/home/shriwise/opt/openmc/bld/CMakeFiles/libopenmc.dir/src/dagmc.cpp.gcda:overwriting an existing profile data with a different timestamp\n",
"libgcov profiling error:/home/shriwise/opt/openmc/bld/CMakeFiles/libopenmc.dir/src/bremsstrahlung.cpp.gcda:overwriting an existing profile data with a different timestamp\n",
"libgcov profiling error:/home/shriwise/opt/openmc/bld/CMakeFiles/libopenmc.dir/src/bank.cpp.gcda:overwriting an existing profile data with a different timestamp\n",
" Leakage Fraction = 0.78918 +/- 0.00118\n",
" Leakage Fraction = 0.97422 +/- 0.00091\n",
"\n"
]
}
@ -503,7 +503,7 @@
" License | http://openmc.readthedocs.io/en/latest/license.html\n",
" Version | 0.12.0-dev\n",
" Git SHA1 | e5e67eb4d2780d739f290b995e5acd676b70be41\n",
" Date/Time | 2020-03-18 15:12:52\n",
" Date/Time | 2020-03-18 21:53:34\n",
" OpenMP Threads | 8\n",
"\n",
" Reading settings XML file...\n",
@ -768,20 +768,20 @@
"\n",
" =======================> TIMING STATISTICS <=======================\n",
"\n",
" Total time for initialization = 4.8649e+01 seconds\n",
" Reading cross sections = 4.6421e+00 seconds\n",
" Total time in simulation = 3.4910e+02 seconds\n",
" Time in transport only = 2.7176e+02 seconds\n",
" Time in active batches = 3.4910e+02 seconds\n",
" Time sampling source = 7.6141e+01 seconds\n",
" Time accumulating tallies = 2.5132e-01 seconds\n",
" Total time for finalization = 3.8468e-01 seconds\n",
" Total time elapsed = 3.9841e+02 seconds\n",
" Calculation Rate (active) = 2864.54 particles/second\n",
" Total time for initialization = 4.4251e+01 seconds\n",
" Reading cross sections = 4.4934e+00 seconds\n",
" Total time in simulation = 1.9648e+02 seconds\n",
" Time in transport only = 1.2118e+02 seconds\n",
" Time in active batches = 1.9648e+02 seconds\n",
" Time sampling source = 7.4103e+01 seconds\n",
" Time accumulating tallies = 2.4364e-01 seconds\n",
" Total time for finalization = 3.6704e-01 seconds\n",
" Total time elapsed = 2.4138e+02 seconds\n",
" Calculation Rate (active) = 5089.68 particles/second\n",
"\n",
" ============================> RESULTS <============================\n",
"\n",
" Leakage Fraction = 0.78744 +/- 0.00041\n",
" Leakage Fraction = 0.97394 +/- 0.00017\n",
"\n"
]
}
@ -806,7 +806,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"tally_1.200.vtk\r\n"
"manifold_flux.vtk tally_1.200.vtk\r\n"
]
}
],
@ -855,16 +855,21 @@
"\tNuclides =\t\n",
"\tScores =\t['flux']\n",
"\tEstimator =\ttracklength\n",
"\n",
"EnergyFilter\n",
"\tValues =\t[0.e+00 1.e+00 1.e+07]\n",
"\tID =\t2\n",
"\n"
]
}
],
"source": [
"# energy filter with bins from 0 to 1 eV and 1 eV to 10 MeV\n",
"energy_filter = openmc.EnergyFilter((0.0, 1.E6, 1.E7))\n",
"energy_filter = openmc.EnergyFilter((0.0, 1.0, 1.e+07))\n",
"\n",
"tally.filters = [mesh_filter, energy_filter]\n",
"print(tally)\n",
"print(energy_filter)\n",
"tallies.export_to_xml()"
]
},
@ -877,15 +882,28 @@
"name": "stdout",
"output_type": "stream",
"text": [
"EnergyFilter\n",
"\tValues =\t[ 0. 1000000. 10000000.]\n",
"\tID =\t2\n",
"\n"
"<?xml version='1.0' encoding='utf-8'?>\r\n",
"<tallies>\r\n",
" <mesh id=\"1\" type=\"unstructured\">\r\n",
" <mesh_file>manifold.h5m</mesh_file>\r\n",
" </mesh>\r\n",
" <filter id=\"1\" type=\"mesh\">\r\n",
" <bins>1</bins>\r\n",
" </filter>\r\n",
" <filter id=\"2\" type=\"energy\">\r\n",
" <bins>0.0 1.0 10000000.0</bins>\r\n",
" </filter>\r\n",
" <tally id=\"1\">\r\n",
" <filters>1 2</filters>\r\n",
" <scores>flux</scores>\r\n",
" <estimator>tracklength</estimator>\r\n",
" </tally>\r\n",
"</tallies>\r\n"
]
}
],
"source": [
"print(energy_filter)"
"!cat tallies.xml"
]
},
{
@ -926,7 +944,7 @@
" License | http://openmc.readthedocs.io/en/latest/license.html\n",
" Version | 0.12.0-dev\n",
" Git SHA1 | e5e67eb4d2780d739f290b995e5acd676b70be41\n",
" Date/Time | 2020-03-18 15:19:31\n",
" Date/Time | 2020-03-18 21:57:37\n",
" OpenMP Threads | 8\n",
"\n",
" Reading settings XML file...\n",
@ -1192,20 +1210,20 @@
"\n",
" =======================> TIMING STATISTICS <=======================\n",
"\n",
" Total time for initialization = 4.8227e+01 seconds\n",
" Reading cross sections = 4.4680e+00 seconds\n",
" Total time in simulation = 3.4969e+02 seconds\n",
" Time in transport only = 2.7219e+02 seconds\n",
" Time in active batches = 3.4969e+02 seconds\n",
" Time sampling source = 7.6881e+01 seconds\n",
" Time accumulating tallies = 4.9819e-01 seconds\n",
" Total time for finalization = 1.0085e+00 seconds\n",
" Total time elapsed = 3.9922e+02 seconds\n",
" Calculation Rate (active) = 2859.65 particles/second\n",
" Total time for initialization = 4.4772e+01 seconds\n",
" Reading cross sections = 4.3243e+00 seconds\n",
" Total time in simulation = 1.9726e+02 seconds\n",
" Time in transport only = 1.2160e+02 seconds\n",
" Time in active batches = 1.9726e+02 seconds\n",
" Time sampling source = 7.5024e+01 seconds\n",
" Time accumulating tallies = 4.9306e-01 seconds\n",
" Total time for finalization = 1.0223e+00 seconds\n",
" Total time elapsed = 2.4336e+02 seconds\n",
" Calculation Rate (active) = 5069.40 particles/second\n",
"\n",
" ============================> RESULTS <============================\n",
"\n",
" Leakage Fraction = 0.78744 +/- 0.00041\n",
" Leakage Fraction = 0.97394 +/- 0.00017\n",
"\n"
]
}
@ -1218,7 +1236,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's open up this statepoint file and get the information we need to create the point cloud data.\n",
"Noice the warning at the end of the output above indicating that the .vtk file we used before isn't written in this case.\n",
"\n",
"Let's open up this statepoint file and get the information we need to create the point cloud data instead.\n",
"\n",
"_**NOTE: You will need the Python vtk module installed to run this part of the notebook.**_"
]
@ -1238,10 +1258,10 @@
" \n",
" thermal_flux = tally.get_values(scores=['flux'], \n",
" filters=[openmc.EnergyFilter],\n",
" filter_bins=[((0.0, 1.E6),)]) \n",
" filter_bins=[((0.0, 1.0),)]) \n",
" fast_flux = tally.get_values(scores=['flux'],\n",
" filters=[openmc.EnergyFilter],\n",
" filter_bins=[((1.E6, 1E7),)])"
" filter_bins=[((1.0, 1.e+07),)])"
]
},
{
@ -1309,15 +1329,22 @@
" fast_flux.size,\n",
" True)\n",
"\n",
"total_flux = thermal_flux + fast_flux\n",
"total_results = vtk.vtkDoubleArray()\n",
"total_results.SetName(\"Total Flux\")\n",
"total_results.SetNumberOfComponents(1)\n",
"total_results.SetArray(npsup.numpy_to_vtk(total_flux),\n",
" total_flux.size,\n",
" True)\n",
"\n",
"polyData.GetPointData().AddArray(thermal_results)\n",
"polyData.GetPointData().AddArray(fast_results)\n",
"polyData.GetPointData().AddArray(total_results)\n",
"\n",
"writer = vtk.vtkGenericDataObjectWriter()\n",
"writer.SetFileName(\"manifold_flux.vtk\")\n",
"writer.SetInputData(polyData)\n",
"writer.Write()\n",
"\n",
"\n"
"writer.Write()"
]
},
{