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

update to nmm, ring source and pip install packages #258

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
39 changes: 5 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ RUN pip install cmake\
# cython is needed for moab
cython \
paramak \
openmc_data_downloader
openmc_data_downloader \
itkwidgets \
nest_asyncio \
ipywidgets

# svalinn-tools should be added but it is not working with python 3 at the moment

Expand Down Expand Up @@ -189,46 +192,14 @@ RUN cd /opt && \
cd /opt/openmc/ && \
pip install .

# NJOY2016 install from source
# RUN mkdir njoy && \
# cd njoy && \
# git clone --single-branch --branch 2016.61 --depth 1 https://github.com/njoy/NJOY2016.git && \
# mkdir build && \
# cd build && \
# cmake -Dstatic=on ../NJOY2016 && \
# make 2>/dev/null && \
# rm -rf /njoy/NJOY2016

# ENV PATH=$PATH:/njoy/build


# install nuclear data
RUN wget https://github.com/mit-crpg/WMP_Library/releases/download/v1.1/WMP_Library_v1.1.tar.gz && \
tar -xf WMP_Library_v1.1.tar.gz -C / && \
rm WMP_Library_v1.1.tar.gz

# ENV OPENMC_CROSS_SECTIONS=/cross_sections.xml


# COPY scripts/delete_nuclear_data_not_used_in_cross_section_xml.py .


# RUN wget -O nndc-b7.1.tar.xz https://anl.box.com/shared/static/9igk353zpy8fn9ttvtrqgzvw1vtejoz6.xz && \
# mkdir nndc-b7.1-hdf5 && \
# tar -xf nndc-b7.1.tar.xz -C nndc-b7.1-hdf5 && \
# rm nndc-b7.1.tar.xz

RUN git clone --single-branch --branch master --depth 1 https://github.com/openmc-dev/data.git && \
openmc_data_downloader -l ENDFB-7.1-NNDC TENDL-2019 -d cross_section_data -p neutron photon -e H He Li Be B C N O F Ne Na Mg Al Si P S Cl Ar K Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr Rb Sr Y Zr Nb Mo Ru Rh Pd Ag Cd In Sn Sb Te I Xe Cs Ba La Ce Pr Nd Sm Eu Gd Tb Dy Ho Er Tm Yb Lu Hf Ta W Re Os Ir Pt Au Hg Tl Pb Bi Th Pa U
# python data/convert_nndc71.py --cleanup && \
# rm -rf nndc-b7.1-endf && \
# rm -rf nndc-b7.1-ace/ && \
# rm -rf nndc-b7.1-download && \
# python data/convert_tendl.py --cleanup && \
# rm -rf tendl-2019-ace/ && \
# rm -rf tendl-2019-download && \
# python data/combine_libraries.py -l nndc-b7.1-hdf5/cross_sections.xml tendl-2019-hdf5/cross_sections.xml -o cross_sections.xml && \
# python delete_nuclear_data_not_used_in_cross_section_xml.py
openmc_data_downloader -l ENDFB-7.1-NNDC TENDL-2019 -d cross_section_data -p neutron photon -e all

ENV OPENMC_CROSS_SECTIONS=/cross_section_data/cross_sections.xml

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"\n",
"import neutronics_material_maker as nmm\n",
"\n",
"eurofer_mat = nmm.Material('eurofer')\n",
"eurofer_mat = nmm.Material.from_library('eurofer')\n",
"\n",
"eurofer_mat.openmc_material"
]
Expand All @@ -62,7 +62,7 @@
"outputs": [],
"source": [
"# Water requires temperature and pressure arguments to be passed\n",
"water = nmm.Material('H2O', temperature_in_C=25, pressure_in_Pa=100000)\n",
"water = nmm.Material.from_library('H2O', temperature=300, pressure=100000)\n",
"\n",
"water.openmc_material"
]
Expand All @@ -85,7 +85,7 @@
"# Lithium Orthosilicate (Li4SiO4) can take arguments of 'enrichment', 'enrichment_target', 'enrichment_type' and 'packing_fraction'\n",
"# Note: for some lithium crystals, 'enrichment_target' and 'enrichment_type' are defined by default, but can be changed\n",
"\n",
"default_Li4SiO4 = nmm.Material('Li4SiO4')\n",
"default_Li4SiO4 = nmm.Material.from_library('Li4SiO4')\n",
"default_Li4SiO4.openmc_material"
]
},
Expand All @@ -98,7 +98,7 @@
"# the following command creates Li4SiO4 with respect to given arguments but uses the default values for enrichment_target and enrichment_type\n",
"# enrichment_target='Li6', enrichment_type='ao' defined by default\n",
"\n",
"enriched_and_packed_Li4SiO4 = nmm.Material(\n",
"enriched_and_packed_Li4SiO4 = nmm.Material.from_library(\n",
" 'Li4SiO4',\n",
" enrichment=60,\n",
" packing_fraction=0.64\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
"metadata": {},
"outputs": [],
"source": [
"temperatures = np.linspace(0.1, 600., 200)\n",
"temperatures = np.linspace(400, 800., 100)\n",
"\n",
"water_densities = [nmm.Material('H2O', temperature_in_C=temperature, pressure_in_Pa=15500000).openmc_material.density for temperature in temperatures]\n",
"water_densities = [nmm.Material.from_library('H2O', temperature=temperature, pressure=15500000).openmc_material.density for temperature in temperatures]\n",
"\n",
"fig = go.Figure()\n",
"\n",
Expand Down Expand Up @@ -84,7 +84,7 @@
"source": [
"pressures = np.linspace(1000000., 10000000., 100)\n",
"\n",
"helium_densities = [nmm.Material('He', temperature_in_C=400, pressure_in_Pa=pressure).openmc_material.density for pressure in pressures]\n",
"helium_densities = [nmm.Material.from_library('He', temperature=700, pressure=pressure).openmc_material.density for pressure in pressures]\n",
"\n",
"fig = go.Figure()\n",
"\n",
Expand Down Expand Up @@ -119,7 +119,7 @@
"source": [
"enrichments = np.linspace(0., 100., 50)\n",
"\n",
"li4sio4_densities = [nmm.Material('Li4SiO4', enrichment=enrichment).openmc_material.density for enrichment in enrichments]\n",
"li4sio4_densities = [nmm.Material.from_library('Li4SiO4', enrichment=enrichment).openmc_material.density for enrichment in enrichments]\n",
"\n",
"fig =go.Figure()\n",
"\n",
Expand Down
42 changes: 21 additions & 21 deletions tasks/task_02_making_materials/5_example_materials_mixed.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@
"steel_mat.add_element('C', 0.025)\n",
"steel_mat.set_density('g/cm3', 7.7)\n",
"\n",
"h20_material = nmm.Material(\n",
"h20_material = nmm.Material.from_library(\n",
" 'H2O',\n",
" temperature_in_C=500,\n",
" pressure_in_Pa=80000\n",
" temperature=500,\n",
" pressure=80000\n",
").openmc_material\n",
"\n",
"mixed_mat = openmc.Material.mix_materials(\n",
Expand Down Expand Up @@ -135,12 +135,12 @@
"metadata": {},
"outputs": [],
"source": [
"steel_mat = nmm.Material('a36_steel').openmc_material\n",
"steel_mat = nmm.Material.from_library('a36_steel').openmc_material\n",
"\n",
"h20_material = nmm.Material(\n",
"h20_material = nmm.Material.from_library(\n",
" 'H2O',\n",
" temperature_in_C=500,\n",
" pressure_in_Pa=80000\n",
" temperature=500,\n",
" pressure=80000\n",
").openmc_material\n",
"\n",
"mixed_mat = openmc.Material.mix_materials(\n",
Expand Down Expand Up @@ -182,8 +182,8 @@
"h20_mat.add_elements_from_formula('H2O')\n",
"h20_mat.set_density('g/cm3', 1.)\n",
"\n",
"mixed_mat = nmm.MultiMaterial(\n",
" material_tag='mixed_material', # name of homogeneous material\n",
"mixed_mat = nmm.Material.from_mixture(\n",
" name='mixed_material', # name of homogeneous material\n",
" materials=[\n",
" steel_mat,\n",
" h20_material\n",
Expand Down Expand Up @@ -218,14 +218,14 @@
"steel_mat.add_element('C', 0.025)\n",
"steel_mat.set_density('g/cm3', 7.7)\n",
"\n",
"h20_material = nmm.Material(\n",
"h20_material = nmm.Material.from_library(\n",
" 'H2O',\n",
" temperature_in_C=500,\n",
" pressure_in_Pa=80000\n",
" temperature=700,\n",
" pressure=80000\n",
").openmc_material\n",
"\n",
"mixed_mat = nmm.MultiMaterial(\n",
" material_tag='mixed_material', # name of homogeneous material\n",
"mixed_mat = nmm.Material.from_mixture(\n",
" name='mixed_material', # name of homogeneous material\n",
" materials=[\n",
" steel_mat,\n",
" h20_material\n",
Expand Down Expand Up @@ -255,16 +255,16 @@
"metadata": {},
"outputs": [],
"source": [
"steel_mat = nmm.Material('a36_steel').openmc_material\n",
"steel_mat = nmm.Material.from_library('a36_steel').openmc_material\n",
"\n",
"h20_material = nmm.Material(\n",
" 'H2O',\n",
" temperature_in_C=500,\n",
" pressure_in_Pa=80000\n",
"h20_material = nmm.Material.from_library(\n",
" name='H2O',\n",
" temperature=500,\n",
" pressure=80000\n",
").openmc_material\n",
"\n",
"mixed_mat = nmm.MultiMaterial(\n",
" material_tag='mixed_material', # name of homogeneous material\n",
"mixed_mat = nmm.Material.from_mixture(\n",
" name='mixed_material', # name of homogeneous material\n",
" materials=[\n",
" steel_mat,\n",
" h20_material\n",
Expand Down
2 changes: 1 addition & 1 deletion tasks/task_04_make_sources/2_ring_source.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"source.angle = openmc.stats.Isotropic()\n",
"\n",
"# sets the energy distribution to a Muir distribution neutrons\n",
"source.energy = openmc.stats.Watt(a=988000.0, b=2.249e-06)\n",
"source.energy = openmc.stats.Muir(e0=14080000.0, m_rat=5.0, kt=20000.0)\n",
"\n",
"create_inital_particles(source)\n",
"plot_postion_from_initial_source()"
Expand Down