Skip to content

Commit

Permalink
Merge pull request #10 from fusion-energy/develop
Browse files Browse the repository at this point in the history
updating task 11 and 12
  • Loading branch information
shimwell authored Jul 31, 2021
2 parents 7e40b5d + a08171f commit d8a8b1f
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
"# but the curved shape does slow down the simulation due to the large number of facets need\n",
"# so it has been removed to speed up the example\n",
"\n",
"my_reactor.rotation_angle=360 # this is a small \"feature\" which we will fix soon\n",
"my_reactor.show()"
]
},
Expand All @@ -91,7 +90,7 @@
"# initialises a new source object\n",
"source = openmc.Source()\n",
"# the distribution of radius is just a single value\n",
"radius = openmc.stats.Discrete([300], [1])\n",
"radius = openmc.stats.Discrete([400], [1])\n",
"# the distribution of source z values is just a single value\n",
"z_values = openmc.stats.Discrete([0], [1])\n",
"# the distribution of source azimuthal angles values is a uniform distribution between 0 and 2 Pi\n",
Expand All @@ -108,7 +107,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"This section forms the neutronics model by combining the 3D model, the plasma source and some assigned materials. Additionally, the tallies to record the heating are specified. There are a few different methods of converting a CAD model into a neutronics model. The 'pymoab' method is the only open-source automated method that can also convert splines."
"This section forms the neutronics model by combining the 3D model, the plasma source and some assigned materials. Additionally, the tallies to record the heating are specified. There are a few different methods of converting a CAD model into a neutronics model."
]
},
{
Expand All @@ -130,8 +129,38 @@
" 'tf_coil_mat': 'copper',\n",
" 'blanket_mat': 'Li4SiO4',\n",
" }\n",
")\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This next step might take a while to create so consider this an optional step.\n",
"\n",
"The NeutronicsModel.export_html() method creates a 3D diagram of the mode and includes sample points for the source."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"neutronics_model.export_html()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The model can now be simulated in OpenMC"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"neutronics_model.simulate()"
]
},
Expand Down Expand Up @@ -177,7 +206,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.9.5"
}
},
"nbformat": 4,
Expand Down
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 d8a8b1f

Please sign in to comment.