Skip to content
Open
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
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ RUN apt-get --yes install libeigen3-dev \


# installing cadquery and jupyter
RUN conda install jupyter -y && \
conda install -c conda-forge -c python python=3.7.8 && \
conda install -c conda-forge -c cadquery cadquery=2
# cadquery master dose not appear to show the .solid in the notebook
RUN conda install -c conda-forge -c python python=3.8 && \
conda install -c conda-forge -c cadquery cadquery=2.1 && \
pip install jupyter-cadquery==2.0.0-rc1


# Python libraries used in the workshop
Expand Down Expand Up @@ -250,8 +249,9 @@ COPY tasks tasks/

WORKDIR /tasks

#this sets the port, gcr looks for this varible
#this sets the port, gcr looks for this ENV varible
ENV PORT 8888
EXPOSE 8888

# could switch to --ip='*'
CMD ["jupyter", "notebook", "--notebook-dir=/tasks", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root"]
CMD ["jupyter", "lab", "--notebook-dir=/tasks", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root"]
4 changes: 2 additions & 2 deletions tasks/task_01_cross_sections/1_isotope_xs_plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 1,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -216,5 +216,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
58 changes: 48 additions & 10 deletions tasks/task_08_CSG_mesh_tally/2_example_3d_mesh_tallies.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,39 @@
"sett.batches = batches\n",
"sett.inactive = 0\n",
"sett.particles = 5000\n",
"sett.run_mode = 'fixed source'\n",
"sett.run_mode = 'fixed source'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from parametric_plasma_source import PlasmaSource, SOURCE_SAMPLING_PATH\n",
"\n",
"# Create a DT point source\n",
"source = openmc.Source()\n",
"source.angle = openmc.stats.Isotropic()\n",
"source.energy = openmc.stats.Discrete([14e6], [1])\n",
"source.space = openmc.stats.Point((150, 150, 0))\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=4.5, # note the source takes m arguments\n",
" minor_radius=1.,\n",
" pedestal_radius=0.8 * 100,\n",
" plasma_id=1,\n",
" shafranov_shift=0.44789,\n",
" ion_temperature_beta=6\n",
")\n",
"\n",
"sett.source = source"
"source = openmc.Source()\n",
"source.library = SOURCE_SAMPLING_PATH\n",
"source.parameters = str(my_plasma)"
]
},
{
Expand Down Expand Up @@ -138,16 +162,22 @@
"# Create mesh filter for tally\n",
"mesh_filter = openmc.MeshFilter(mesh)\n",
"\n",
"# Create flux mesh tally to score flux\n",
"# Create tritium production mesh tally to score flux\n",
"mesh_tally = openmc.Tally(tally_id=1, name='tbr_on_mesh') # note the tally_id is specified\n",
"mesh_tally.filters = [mesh_filter]\n",
"mesh_tally.scores = ['(n,Xt)']\n",
"tallies.append(mesh_tally)\n",
"\n",
"# Create flux mesh tally to score flux\n",
"# Create heat mesh tally to score flux\n",
"mesh_tally = openmc.Tally(tally_id=2, name='heating_on_mesh') # note the tally_id is specified\n",
"mesh_tally.filters = [mesh_filter]\n",
"mesh_tally.scores = ['heating']\n",
"tallies.append(mesh_tally)\n",
"\n",
"# Create flux mesh tally to score flux\n",
"mesh_tally = openmc.Tally(tally_id=3,name='flux_on_mesh') # note the tally_id is specified\n",
"mesh_tally.filters = [mesh_filter]\n",
"mesh_tally.scores = ['flux']\n",
"tallies.append(mesh_tally)"
]
},
Expand Down Expand Up @@ -185,7 +215,7 @@
"metadata": {},
"outputs": [],
"source": [
"from statepoint_to_vtk import initiate_mesh\n",
"from statepoint_to_vtk import *\n",
"\n",
"initiate_mesh(\n",
" statepoint_filename=sp_filename,\n",
Expand All @@ -201,6 +231,14 @@
" output_filename='heating_tally_on_mesh.vtk',\n",
" mesh_id=1, # note the mesh_id from earlier is used\n",
" tally_id=2 # note the tally_id from earlier is used\n",
")\n",
"\n",
"initiate_mesh(\n",
" statepoint_filename=sp_filename,\n",
" tally_name='flux_on_mesh',\n",
" output_filename='flux_tally_on_mesh.vtk',\n",
" mesh_id=1, # note the mesh_id from earlier is used\n",
" tally_id=3 # note the tally_id from earlier is used\n",
")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/Bn_TcJSOvaA\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"from IPython.display import HTML\n",
"HTML('<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/Bn_TcJSOvaA\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>')"
Expand All @@ -63,6 +49,8 @@
"outputs": [],
"source": [
"import paramak\n",
"from jupyter_cadquery.cadquery import show\n",
"\n",
"my_shape = paramak.RotateStraightShape(\n",
" points=[\n",
" (50,50),\n",
Expand All @@ -73,7 +61,7 @@
" rotation_angle=180\n",
")\n",
"\n",
"my_shape.solid"
"show(my_shape.solid)"
]
},
{
Expand All @@ -99,7 +87,7 @@
" rotation_angle=180\n",
")\n",
"\n",
"my_shape.solid"
"show(my_shape.solid)"
]
},
{
Expand All @@ -125,7 +113,7 @@
" distance=20\n",
")\n",
"\n",
"my_shape.solid"
"show(my_shape.solid)"
]
},
{
Expand All @@ -151,7 +139,7 @@
" distance=20\n",
")\n",
"\n",
"my_shape.solid"
"show(my_shape.solid)"
]
},
{
Expand Down Expand Up @@ -190,7 +178,7 @@
" cut=small_Shape\n",
")\n",
"\n",
"my_shape.solid"
"show(my_shape.solid)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"outputs": [],
"source": [
"import paramak\n",
"from jupyter_cadquery.cadquery import show\n",
"\n",
"pf_1 = paramak.PoloidalFieldCoil(\n",
" height=50,\n",
Expand All @@ -55,7 +56,7 @@
" rotation_angle=180\n",
")\n",
"\n",
"pf_1.solid"
"show(pf_1.solid)"
]
},
{
Expand Down Expand Up @@ -93,7 +94,7 @@
" rotation_angle=180\n",
")\n",
"\n",
"tf.solid"
"show(tf.solid)"
]
},
{
Expand Down Expand Up @@ -130,7 +131,7 @@
" rotation_angle=180\n",
")\n",
"\n",
"plasma.solid"
"show(plasma.solid)"
]
},
{
Expand Down Expand Up @@ -168,7 +169,7 @@
" rotation_angle=180\n",
")\n",
"\n",
"blanket.solid"
"show(blanket.solid)"
]
},
{
Expand All @@ -191,7 +192,7 @@
"my_reactor.export_stp()\n",
"my_reactor.export_stl()\n",
"\n",
"my_reactor.solid"
"show(my_reactor.solid)"
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion tasks/task_10_making_CAD_geometry/3_make_CAD_reactors.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"outputs": [],
"source": [
"import paramak\n",
"from jupyter_cadquery.cadquery import show\n",
"\n",
"my_reactor = paramak.BallReactor(\n",
" inner_bore_radial_thickness=10,\n",
Expand All @@ -70,7 +71,7 @@
" outboard_tf_coil_poloidal_thickness=50\n",
")\n",
"\n",
"my_reactor.solid"
"show(my_reactor.solid)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"outputs": [],
"source": [
"import paramak\n",
"from jupyter_cadquery.cadquery import show\n",
"\n",
"pf_1 = paramak.PoloidalFieldCoil(\n",
" height=50,\n",
Expand All @@ -44,7 +45,6 @@
" with_inner_leg=True\n",
")\n",
"\n",
"\n",
"plasma = paramak.Plasma(\n",
" minor_radius=150.,\n",
" major_radius=450.,\n",
Expand All @@ -69,7 +69,7 @@
"# 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.solid"
"show(my_reactor.solid)"
]
},
{
Expand Down Expand Up @@ -185,7 +185,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.3"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"outputs": [],
"source": [
"import paramak\n",
"from jupyter_cadquery.cadquery import show\n",
"\n",
"pf_coil = paramak.RotateStraightShape(\n",
" points=[\n",
Expand All @@ -39,7 +40,7 @@
" material_tag = 'pf_coil_material'\n",
")\n",
"\n",
"pf_coil.solid"
"show(pf_coil.solid)"
]
},
{
Expand Down Expand Up @@ -67,7 +68,7 @@
" material_tag = 'center_column_material'\n",
")\n",
"\n",
"center_column.solid"
"show(center_column.solid)"
]
},
{
Expand Down Expand Up @@ -100,7 +101,7 @@
" material_tag = 'blanket_material'\n",
")\n",
"\n",
"blanket.solid"
"show(blanket.solid)"
]
},
{
Expand Down
Loading