Skip to content

Commit

Permalink
updated to use show() instead of .soild
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Jul 31, 2021
1 parent bb24ae5 commit a08171f
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 164 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Heating Mesh Tally on CAD geometry made from Shapes\n",
"\n",
Expand All @@ -11,20 +10,19 @@
"The Shapes made include a breeder blanket, PF coil and a central column shield.\n",
"\n",
"2D and 3D Meshes tally are then simulated to show nuclear heating, flux and tritium_production across the model."
]
],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This makes a 3D geometry and material for PF coil"
]
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import paramak\n",
"\n",
Expand All @@ -39,21 +37,21 @@
" material_tag = 'pf_coil_material'\n",
")\n",
"\n",
"pf_coil.solid"
]
"pf_coil.show()"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This makes a 3D geometry and material for the centre column"
]
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"center_column = paramak.RotateMixedShape(\n",
" points=[\n",
Expand All @@ -67,21 +65,21 @@
" material_tag = 'center_column_material'\n",
")\n",
"\n",
"center_column.solid"
]
"center_column.show()"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This makes a 3D geometry and material for breeder blanket. The azimuth_placement_angle argument is used to repeat the geometry around the Z axis at specified angles."
]
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"blanket = paramak.RotateSplineShape(\n",
" points=[\n",
Expand All @@ -100,39 +98,39 @@
" material_tag = 'blanket_material'\n",
")\n",
"\n",
"blanket.solid"
]
"blanket.show()"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This makes a reactor object from the three components"
]
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"my_reactor = paramak.Reactor([blanket, pf_coil,center_column])\n",
"\n",
"my_reactor.solid"
]
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"At this stage we can export the reactor geometry as stp files and make them avaialbe from download and viewing in FreeCAD."
]
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"my_reactor.export_stp()\n",
"\n",
Expand All @@ -141,45 +139,42 @@
"display(FileLink('pf_coil.stp'))\n",
"display(FileLink('center_column.stp'))\n",
"display(FileLink('Graveyard.stp'))"
]
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The next section defines the materials. This can be done using openmc.Materials or in this case strings that look up materials from the neutronics material maker."
]
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from neutronics_material_maker import Material\n",
"\n",
"mat1 = Material(material_name='Li4SiO4',\n",
" material_tag='blanket_material')\n",
"mat1 = Material.from_library(name='Li4SiO4')\n",
"\n",
"mat2 = Material(material_name='copper',\n",
" material_tag='pf_coil_material')\n",
"mat2 = Material.from_library(name='copper')\n",
"\n",
"mat3 = Material(material_name='WC',\n",
" material_tag='center_column_material')"
]
"mat3 = Material.from_library(name='WC')"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This next step makes a simple point source"
]
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import openmc\n",
"\n",
Expand All @@ -194,22 +189,24 @@
"\n",
"# sets the energy distribution to 100% 14MeV neutrons\n",
"source.energy = openmc.stats.Discrete([14e6], [1])"
]
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This next section combines the geometry with the materials and specifies a few mesh tallies"
]
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"neutronics_model = paramak.NeutronicsModel(\n",
"import paramak_neutronics\n",
"\n",
"neutronics_model = paramak_neutronics.NeutronicsModel(\n",
" geometry=my_reactor,\n",
" mesh_tally_2d=['heating', 'flux', '(n,Xt)'],\n",
" mesh_tally_3d=['heating', 'flux', '(n,Xt)'],\n",
Expand All @@ -224,23 +221,23 @@
")\n",
"\n",
"neutronics_model.simulate()"
]
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The next section produces download links for:\n",
"\n",
"- vtk files that contain the 3D mesh results (open with Paraview)\n",
"- png images that show the resuls of the 2D mesh tally"
]
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import FileLink\n",
"display(FileLink('heating_on_3D_mesh.vtk'))\n",
Expand All @@ -255,7 +252,9 @@
"display(FileLink('tritium_production_on_2D_mesh_yz.png'))\n",
"display(FileLink('tritium_production_on_2D_mesh_xz.png'))\n",
"display(FileLink('tritium_production_on_2D_mesh_yz.png'))"
]
],
"outputs": [],
"metadata": {}
}
],
"metadata": {
Expand All @@ -279,4 +278,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
Loading

0 comments on commit a08171f

Please sign in to comment.