-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #815 from ukaea/adding_dagmc_logo_example
Adding dagmc logo example
- Loading branch information
Showing
8 changed files
with
760 additions
and
82 deletions.
There are no files selected for viewing
104 changes: 104 additions & 0 deletions
104
examples/example_neutronics_simulations/ball_reactor.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"\"\"\"This example makes a reactor geometry and a neutronics model. A homogenised\n", | ||
"material made of enriched lithium lead and eurofer is being used as the blanket\n", | ||
"material for this simulation in order to demonstrate the use of more complex\n", | ||
"materials.\"\"\"\n", | ||
"\n", | ||
"import neutronics_material_maker as nmm\n", | ||
"import openmc\n", | ||
"import paramak\n", | ||
"\n", | ||
"\n", | ||
"\"\"\"Makes a neutronics Reactor model and simulates the TBR\"\"\"\n", | ||
"\n", | ||
"# makes the 3d geometry\n", | ||
"my_reactor = paramak.BallReactor(\n", | ||
" inner_bore_radial_thickness=1,\n", | ||
" inboard_tf_leg_radial_thickness=30,\n", | ||
" center_column_shield_radial_thickness=60,\n", | ||
" divertor_radial_thickness=50,\n", | ||
" inner_plasma_gap_radial_thickness=30,\n", | ||
" plasma_radial_thickness=300,\n", | ||
" outer_plasma_gap_radial_thickness=30,\n", | ||
" firstwall_radial_thickness=3,\n", | ||
" blanket_radial_thickness=100,\n", | ||
" blanket_rear_wall_radial_thickness=3,\n", | ||
" elongation=2.75,\n", | ||
" triangularity=0.5,\n", | ||
" number_of_tf_coils=16,\n", | ||
" rotation_angle=360,\n", | ||
")\n", | ||
"\n", | ||
"# makes a homogenised material for the blanket from lithium lead and\n", | ||
"# eurofer\n", | ||
"blanket_material = nmm.Material.from_mixture(\n", | ||
" fracs=[0.8, 0.2],\n", | ||
" materials=[\n", | ||
" nmm.Material.from_library(\n", | ||
" name='Pb842Li158',\n", | ||
" enrichment=90,\n", | ||
" temperature=500),\n", | ||
" nmm.Material.from_library(name='eurofer')\n", | ||
" ])\n", | ||
"\n", | ||
"source = openmc.Source()\n", | ||
"# sets the location of the source to x=0 y=0 z=0\n", | ||
"source.space = openmc.stats.Point((my_reactor.major_radius, 0, 0))\n", | ||
"# sets the direction to isotropic\n", | ||
"source.angle = openmc.stats.Isotropic()\n", | ||
"# sets the energy distribution to 100% 14MeV neutrons\n", | ||
"source.energy = openmc.stats.Discrete([14e6], [1])\n", | ||
"\n", | ||
"# makes the neutronics material\n", | ||
"neutronics_model = paramak.NeutronicsModel(\n", | ||
" geometry=my_reactor,\n", | ||
" source=source,\n", | ||
" materials={\n", | ||
" 'inboard_tf_coils_mat': 'copper',\n", | ||
" 'center_column_shield_mat': 'WC',\n", | ||
" 'divertor_mat': 'eurofer',\n", | ||
" 'firstwall_mat': 'eurofer',\n", | ||
" 'blanket_mat': blanket_material, # use of homogenised material\n", | ||
" 'blanket_rear_wall_mat': 'eurofer'},\n", | ||
" cell_tallies=['TBR'],\n", | ||
" simulation_batches=5,\n", | ||
" simulation_particles_per_batch=1e4,\n", | ||
")\n", | ||
"\n", | ||
"# starts the neutronics simulation\n", | ||
"neutronics_model.simulate()\n", | ||
"\n", | ||
"# prints the results to screen\n", | ||
"print('TBR', neutronics_model.results['TBR'])" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
163 changes: 163 additions & 0 deletions
163
examples/example_neutronics_simulations/ball_reactor_source_plot.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"This example makes a reactor geometry and a neutronics model. A homogenised\n", | ||
"material made of enriched lithium lead and eurofer is being used as the blanket\n", | ||
"material for this simulation in order to demonstrate the use of more complex\n", | ||
"materials." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"application/vnd.jupyter.widget-view+json": { | ||
"model_id": "d60463a4756748d8bed08ef7d5f1d524", | ||
"version_major": 2, | ||
"version_minor": 0 | ||
}, | ||
"text/plain": [ | ||
"HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"import neutronics_material_maker as nmm\n", | ||
"import openmc\n", | ||
"import paramak\n", | ||
"from parametric_plasma_source import SOURCE_SAMPLING_PATH, PlasmaSource\n", | ||
"\n", | ||
"\n", | ||
"# makes the 3d geometry\n", | ||
"my_reactor = paramak.BallReactor(\n", | ||
" inner_bore_radial_thickness=10,\n", | ||
" inboard_tf_leg_radial_thickness=30,\n", | ||
" center_column_shield_radial_thickness=60,\n", | ||
" divertor_radial_thickness=150,\n", | ||
" inner_plasma_gap_radial_thickness=30,\n", | ||
" plasma_radial_thickness=300,\n", | ||
" outer_plasma_gap_radial_thickness=30,\n", | ||
" firstwall_radial_thickness=30,\n", | ||
" blanket_radial_thickness=50,\n", | ||
" blanket_rear_wall_radial_thickness=30,\n", | ||
" elongation=2,\n", | ||
" triangularity=0.55,\n", | ||
" number_of_tf_coils=16,\n", | ||
" pf_coil_radial_thicknesses=[50, 50, 50, 50],\n", | ||
" pf_coil_vertical_thicknesses=[50, 50, 50, 50],\n", | ||
" pf_coil_to_rear_blanket_radial_gap=50,\n", | ||
" pf_coil_to_tf_coil_radial_gap=50,\n", | ||
" outboard_tf_coil_radial_thickness=100,\n", | ||
" outboard_tf_coil_poloidal_thickness=50,\n", | ||
" rotation_angle=180,\n", | ||
")\n", | ||
"\n", | ||
"my_reactor.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# creates a parametric plasma source, more details\n", | ||
"# https://github.com/open-radiation-sources/parametric-plasma-source\n", | ||
"my_plasma = PlasmaSource(\n", | ||
" ion_density_origin=1.09e20,\n", | ||
" ion_density_peaking_factor=1,\n", | ||
" ion_density_pedestal=1.09e20,\n", | ||
" ion_density_separatrix=3e19,\n", | ||
" ion_temperature_origin=45.9,\n", | ||
" ion_temperature_peaking_factor=8.06,\n", | ||
" ion_temperature_pedestal=6.09,\n", | ||
" ion_temperature_separatrix=0.1,\n", | ||
" elongation=2,\n", | ||
" triangularity=0.55,\n", | ||
" major_radius=2.5, # note the source takes m arguments\n", | ||
" minor_radius=1., # note the source takes m arguments\n", | ||
" pedestal_radius=0.8 * 100, # note the source takes m arguments\n", | ||
" plasma_id=1,\n", | ||
" shafranov_shift=0.44789,\n", | ||
" ion_temperature_beta=6\n", | ||
")\n", | ||
"\n", | ||
"# assigns parametric plasma source as source\n", | ||
"source = openmc.Source()\n", | ||
"source.library = SOURCE_SAMPLING_PATH\n", | ||
"source.parameters = str(my_plasma)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# makes the neutronics material\n", | ||
"neutronics_model = paramak.NeutronicsModel(\n", | ||
" geometry=my_reactor,\n", | ||
" source=source,\n", | ||
" materials={\n", | ||
" 'inboard_tf_coils_mat': 'copper',\n", | ||
" 'center_column_shield_mat': 'WC',\n", | ||
" 'divertor_mat': 'eurofer',\n", | ||
" 'firstwall_mat': 'eurofer',\n", | ||
" 'blanket_mat': 'eurofer',\n", | ||
" 'blanket_rear_wall_mat': 'eurofer'},\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# exports the geometry and source in 2d (RZ) viewplane where R stands for\n", | ||
"# radius\n", | ||
"neutronics_model.export_html(\n", | ||
" filename='2d_source.html',\n", | ||
" view_plane='RZ'\n", | ||
")\n", | ||
"\n", | ||
"# exports the geometry and source in 3d (XYZ) viewplane\n", | ||
"neutronics_model.export_html(\n", | ||
" filename='3d_source.html',\n", | ||
" view_plane='XYZ',\n", | ||
" number_of_source_particles=1000\n", | ||
")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
Oops, something went wrong.