Make Materials, Plots, and Tallies list-like

This commit is contained in:
Paul Romano 2016-04-29 16:14:02 -05:00
parent ae083cf5d4
commit d9b097dbaf
31 changed files with 373 additions and 297 deletions

View file

@ -104,11 +104,8 @@
},
"outputs": [],
"source": [
"# Instantiate a Materials object, add Materials\n",
"materials_file = openmc.Materials()\n",
"materials_file.add_material(fuel)\n",
"materials_file.add_material(water)\n",
"materials_file.add_material(zircaloy)\n",
"# Instantiate a Materials collection\n",
"materials_file = openmc.Materials((fuel, water, zircaloy))\n",
"materials_file.default_xs = '71c'\n",
"\n",
"# Export to \"materials.xml\"\n",
@ -298,9 +295,8 @@
"plot.pixels = [250, 250]\n",
"plot.color = 'mat'\n",
"\n",
"# Instantiate a Plots object, add Plot, and export to \"plots.xml\"\n",
"plot_file = openmc.Plots()\n",
"plot_file.add_plot(plot)\n",
"# Instantiate a Plots collection and export to \"plots.xml\"\n",
"plot_file = openmc.Plots([plot])\n",
"plot_file.export_to_xml()"
]
},
@ -393,17 +389,16 @@
"mesh.dimension = [100, 100]\n",
"mesh.lower_left = [-0.63, -0.63]\n",
"mesh.upper_right = [0.63, 0.63]\n",
"tallies_file.add_mesh(mesh)\n",
"\n",
"# Create mesh filter for tally\n",
"mesh_filter = openmc.Filter(type='mesh', bins=[1])\n",
"mesh_filter = openmc.Filter(type='mesh')\n",
"mesh_filter.mesh = mesh\n",
"\n",
"# Create mesh tally to score flux and fission rate\n",
"tally = openmc.Tally(name='flux')\n",
"tally.filters = [mesh_filter]\n",
"tally.scores = ['flux', 'fission']\n",
"tallies_file.add_tally(tally)"
"tallies_file.append(tally)"
]
},
{