Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for 2024 york workshop #264

Merged
merged 5 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,31 @@ FROM ghcr.io/fusion-energy/neutronics-workshop:base as base
# local image
# FROM neutronics-workshop:base as base

RUN pip install openmc_source_plotter==0.6.6

# Copy over the local repository files
COPY tasks tasks/
COPY tests tests/


RUN mkdir tasks/half-day-workshop
RUN cp tasks/task_01_cross_sections/1_isotope_xs_plot.ipynb tasks/half-day-workshop/task_01_isotope_xs_plot.ipynb
RUN cp tasks/task_01_cross_sections/2_element_xs_plot.ipynb tasks/half-day-workshop/task_02_element_xs_plot.ipynb
RUN cp tasks/task_01_cross_sections/3_material_xs_plot.ipynb tasks/half-day-workshop/task_03_material_xs_plot.ipynb
RUN cp tasks/task_02_making_materials/1_example_materials_from_isotopes.ipynb tasks/half-day-workshop/task_04_example_materials_from_isotopes.ipynb
RUN cp tasks/task_02_making_materials/2_example_materials_from_elements.ipynb tasks/half-day-workshop/task_05_example_materials_from_elements.ipynb
RUN cp tasks/task_03_making_CSG_geometry/1_simple_csg_geometry.ipynb tasks/half-day-workshop/task_06_simple_csg_geometry.ipynb
RUN cp tasks/task_04_make_sources/1_point_source_plots.ipynb tasks/half-day-workshop/task_07_point_source_plots.ipynb
RUN cp tasks/task_04_make_sources/2_ring_source.ipynb tasks/half-day-workshop/task_08_ring_source.ipynb
RUN cp tasks/task_04_make_sources/3_plasma_source_plots.ipynb tasks/half-day-workshop/task_09_plasma_source_plots.ipynb
RUN cp tasks/task_05_CSG_cell_tally_TBR/1_example_tritium_production.ipynb tasks/half-day-workshop/task_10_example_tritium_production.ipynb
RUN cp tasks/task_06_CSG_cell_tally_DPA/1_find_dpa.ipynb tasks/half-day-workshop/task_11_find_dpa.ipynb
RUN cp tasks/task_07_CSG_cell_tally_spectra/2_example_neutron_spectra_on_cell.ipynb tasks/half-day-workshop/task_12_example_neutron_spectra_on_cell.ipynb
RUN cp tasks/task_07_CSG_cell_tally_spectra/4_example_photon_spectra.ipynb tasks/half-day-workshop/task_13_example_photon_spectra.ipynb
RUN cp tasks/task_08_CSG_mesh_tally/1_example_2d_regular_mesh_tallies.ipynb tasks/half-day-workshop/task_14_example_2d_regular_mesh_tallies.ipynb
RUN cp tasks/task_10_activation_transmutation_depletion/3_full_pulse_schedule.ipynb tasks/half-day-workshop/task_15_full_pulse_schedule.ipynb
RUN cp tasks/optimal_design.ipynb tasks/half-day-workshop/optimal_design.ipynb

WORKDIR /tasks

# this sets the port, gcr looks for this varible
Expand Down
115 changes: 115 additions & 0 deletions tasks/optimal_design.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "72324188-e724-46bf-9a3c-f7f6501ccc73",
"metadata": {},
"source": [
"This activity allows you to put lots of simulation skills to the test.\n",
"\n",
"We are going to simulate a tokamak where you get to decide the materials.\n",
"\n",
"The goal is to:\n",
"\n",
"maximize the Tritium Breeding Ratio\n",
"minimize the heating on the center colum\n",
"maximize the heat in the blanket"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7114fda7-b184-46d4-bbce-0d88206c573e",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "ef814191-35a3-44a9-b088-f27c1bb53457",
"metadata": {},
"outputs": [],
"source": [
"import openmc\n",
"\n",
"# surfaces\n",
"central_column_surface_outer = openmc.ZCylinder(r=100)\n",
"central_column_surface_mid = openmc.ZCylinder(r=90)\n",
"central_column_surface_inner = openmc.ZCylinder(r=80)\n",
"\n",
"inner_sphere_surface = openmc.Sphere(r=480)\n",
"middle_sphere_surface = openmc.Sphere(r=500) \n",
"outer_sphere_surface = openmc.Sphere(r=600)\n",
"outer_outer_sphere_surface = openmc.Sphere(r=650)\n",
"edge_of_simulation_surface = openmc.Sphere(r=650, boundary_type='vacuum')\n",
"\n",
"# regions\n",
"central_column_region = -central_column_surface_inner & -edge_of_simulation_surface\n",
"central_column_coolant_region = +central_column_surface_inner & -central_column_surface_mid & -edge_of_simulation_surface\n",
"central_column_fw_region = +central_column_surface_mid & -central_column_surface_outer & -edge_of_simulation_surface\n",
"\n",
"inner_vessel_region = +central_column_surface_outer & -inner_sphere_surface\n",
"\n",
"blanket_fw_region = -middle_sphere_surface & +inner_sphere_surface & +central_column_surface_outer\n",
"blanket_coolant_region = +middle_sphere_surface & -outer_sphere_surface & +central_column_surface_outer\n",
"blanket_breeder_region = +outer_sphere_surface & -outer_outer_sphere_surface & +central_column_surface_outer\n",
"blanket_reflector_region = +outer_outer_sphere_surface & -edge_of_simulation_surface & +central_column_surface_outer\n",
"\n",
"# cells\n",
"central_column_cell = openmc.Cell(region=central_column_region)\n",
"central_column_coolant_cell = openmc.Cell(region=central_column_coolant_region)\n",
"central_column_fw_cell = openmc.Cell(region=central_column_fw_region)\n",
"\n",
"inner_vessel_cell = openmc.Cell(region=inner_vessel_region)\n",
"\n",
"blanket_fw_cell = openmc.Cell(region=blanket_fw_region)\n",
"blanket_coolant_cell = openmc.Cell(region=blanket_coolant_region)\n",
"blanket_breeder_cell = openmc.Cell(region=blanket_breeder_region)\n",
"blanket_reflector_cell = openmc.Cell(region=blanket_reflector_region)\n",
"\n",
"geometry = openmc.Geometry([\n",
" central_column_cell,\n",
" central_column_coolant_cell,\n",
" central_column_fw_cell,\n",
" inner_vessel_cell,\n",
" blanket_fw_cell,\n",
" blanket_coolant_cell,\n",
" blanket_breeder_cell,\n",
" blanket_reflector_cell,\n",
"])\n",
"\n",
"# visualization\n",
"plot = geometry.plot(basis='xz')\n",
"plot.figure.savefig('xz-cell.png')\n",
"\n",
"plot = geometry.plot(basis='xy')\n",
"plot.figure.savefig('xy-cell.png')\n",
"\n",
"plot = geometry.plot(basis='yz')\n",
"plot.figure.savefig('yz-cell.png')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.16"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
27 changes: 12 additions & 15 deletions tasks/task_04_make_sources/3_plasma_source_plots.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"To plot the parametric plasma source we store the x y z birth locations, energies and directions of neutrons in the source in separate lists."
"Makes a simple model for the sources."
]
},
{
Expand All @@ -73,12 +73,15 @@
"metadata": {},
"outputs": [],
"source": [
"# plots multiple sources on one plot by iterating through\n",
"# the list of sources and building up the plot\n",
"plot = None\n",
"for source in my_sources:\n",
" plot = source.plot_source_energy(figure=plot)\n",
"plot.show()"
"settings = openmc.Settings()\n",
"settings.particles = 1\n",
"settings.batches = 1\n",
"settings.source = my_sources\n",
"materials = openmc.Materials()\n",
"sph = openmc.Sphere(r=1000000, boundary_type=\"vacuum\")\n",
"cell = openmc.Cell(region=-sph)\n",
"geometry = openmc.Geometry([cell])\n",
"model = openmc.Model(geometry, materials, settings)"
]
},
{
Expand All @@ -94,11 +97,7 @@
"metadata": {},
"outputs": [],
"source": [
"# plots multiple sources on one plot by iterating through\n",
"# the list of sources and building up the plot\n",
"plot = None\n",
"for source in my_sources:\n",
" plot = source.plot_source_position(figure=plot)\n",
"plot = model.plot_source_position(n_samples=2000)\n",
"plot.show()"
]
},
Expand All @@ -115,9 +114,7 @@
"metadata": {},
"outputs": [],
"source": [
"plot = None\n",
"for source in my_sources:\n",
" plot = source.plot_source_direction(figure=plot)\n",
"plot = model.plot_source_direction(n_samples=500)\n",
"plot.show()"
]
},
Expand Down
Loading
Loading