Skip to content

Commit

Permalink
Merge pull request #41 from fusion-energy/develop
Browse files Browse the repository at this point in the history
updates to work with latest openmc compile
  • Loading branch information
shimwell authored May 31, 2022
2 parents 13b9d0c + 4f96c54 commit ffd4ab4
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 60 deletions.
26 changes: 9 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# docker build -t fusion-neutronics-workflow:embree --build-arg compile_cores=7 --build-arg build_double_down=ON --build-arg include_avx=true .

# base image contains nuclear data
FROM ghcr.io/openmc-data-storage/miniconda3_4.9.2_endfb-7.1_nndc_tendl_2019:latest
FROM continuumio/miniconda3:4.10.3

ARG compile_cores=1
ARG include_avx=true
Expand Down Expand Up @@ -163,7 +163,7 @@ RUN if [ "$build_double_down" = "ON" ] ; \
# Clone and install DAGMC
RUN mkdir DAGMC && \
cd DAGMC && \
git clone --single-branch --branch v3.2.1 --depth 1 https://github.com/svalinn/DAGMC.git && \
git clone --single-branch --branch v3.2.2 --depth 1 https://github.com/svalinn/DAGMC.git && \
mkdir build && \
cd build && \
cmake ../DAGMC -DBUILD_TALLY=ON \
Expand Down Expand Up @@ -192,26 +192,18 @@ RUN cd /opt && \
cd .. && \
pip install -e .[test]

COPY environment.yml .
RUN conda env update -f environment.yml

RUN conda install -c fusion-energy -c cadquery -c conda-forge paramak_develop
# downloads nuclear data from zip file an uncompress
# RUN download_nndc

# pip installs latest versions of analysis packages
RUN pip install openmc-dagmc-wrapper
RUN pip install openmc-plasma-source
RUN pip install openmc_tally_unit_converter
RUN pip install spectrum_plotter
RUN pip install regular_mesh_plotter
RUN pip install openmc_data_downloader

# solves binary incompatabilitiy error
RUN pip install numpy --upgrade


# # installs python packages and nuclear data (quick as it does not overwrite existing h5 files)
# RUN openmc_data_downloader -d nuclear_data -e all -i H3 -l ENDFB-7.1-NNDC TENDL-2019 -p neutron photon --no-overwrite
# this is an optional way to install python packages and nuclear data (quick as it does not overwrite existing h5 files)
RUN openmc_data_downloader -d nuclear_data -e all -i H3 -l ENDFB-7.1-NNDC TENDL-2019 -p neutron photon --no-overwrite

# setting enviromental varibles
ENV OPENMC_CROSS_SECTIONS=/nuclear_data/cross_sections.xml
# ENV OPENMC_CROSS_SECTIONS=/nndc-b7.1-hdf5/endfb71_hdf5/cross_sections.xml
ENV PATH="/MOAB/build/bin:${PATH}"
ENV PATH="/DAGMC/bin:${PATH}"

Expand Down
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,10 @@ Links to the packages that are utilized by the fusion-neutronics-workflow

* Open source projects created and maintained

* [Paramak](https://github.com/fusion-energy/openmc_data_downloader) -
* [Paramak](https://github.com/fusion-energy/paramak) -
automated production of fusion reactor CAD models (stp and stl files) from
parameters.

* [cad_to_h5m](https://github.com/fusion-energy/cad_to_h5m) automated
conversion of STP or SAT CAD files to h5m files compatible with DAGMC
enabled particle transport codes.

* [stl_to_h5m](https://github.com/fusion-energy/stl_to_h5m) automated
conversion of STL files to h5m files compatible with DAGMC enabled
particle transport codes.
Expand All @@ -112,8 +108,9 @@ Links to the packages that are utilized by the fusion-neutronics-workflow
* [openmc_tally_unit_converter](https://github.com/openmc-data-storage/openmc_tally_unit_converter) converts the units of common tally such as
heating, DPA, effective dose into user specified units.

* [openmc_data_downloader](https://github.com/openmc-data-storage/openmc_data_downloader) performs on the fly downloading of nuclear data
needed for OpenMC neutronics simulations.
* [openmc_data_downloader](https://github.com/openmc-data-storage/openmc_data_downloader) performs on the fly downloading of nuclear data needed for OpenMC neutronics simulations.

* [openmc_data](https://github.com/openmc-data-storage/openmc_data) downloading and processing of nuclear data needed for OpenMC neutronics simulations.

* [openmc-plasma-source](https://github.com/fusion-energy/openmc-plasma-source/)
Creates a plasma source as an openmc.source object from input parameters that describe the plasma
Expand Down
16 changes: 16 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: base
channels:
- fusion-energy
- cadquery
- conda-forge
dependencies:
- paramak>=0.8.1
- pip
- pip:
- openmc-dagmc-wrapper
- openmc-plasma-source
- openmc_tally_unit_converter
- spectrum_plotter
- regular_mesh_plotter
- openmc_data_downloader
- openmc_data
33 changes: 12 additions & 21 deletions example_01_single_volume_cell_tally/2_run_neutronics_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,26 @@


# defines a simple DT neutron point source
my_source = ops.FusionPointSource(
coordinate = (0,0,0),
temperature = 20000.,
fuel='DT'
)
my_source = ops.FusionPointSource(coordinate=(0, 0, 0), temperature=20000.0, fuel="DT")

# set the geometry file to use
geometry = odw.Geometry(
h5m_filename='dagmc.h5m',
h5m_filename="dagmc.h5m",
)

# sets the material to use
materials = odw.Materials(
h5m_filename='dagmc.h5m',
correspondence_dict={"mat_my_material": "eurofer"}
h5m_filename="dagmc.h5m", correspondence_dict={"my_material": "eurofer"}
)

# creates a cell tally for neutron flux
tally1 = odw.CellTally(
tally_type="neutron_flux",
target="mat_my_material",
materials=materials
tally_type="neutron_flux", target="my_material", materials=materials
)

# creates a cell tally for neutron spectra
tally2 = odw.CellTally(
tally_type="neutron_spectra",
target="mat_my_material",
materials=materials
tally_type="neutron_spectra", target="my_material", materials=materials
)

tallies = openmc.Tallies([tally1, tally2])
Expand All @@ -63,7 +54,7 @@
statepoint = openmc.StatePoint(filepath=statepoint_file)

# gets the first tally using its name
my_tally_1 = statepoint.get_tally(name="mat_my_material_neutron_flux")
my_tally_1 = statepoint.get_tally(name="my_material_neutron_flux")

# gets number of neutron for a 1.3 mega joule shot
source_strength = otuc.find_source_strength(fusion_energy_per_second_or_per_pulse=1.3e6)
Expand All @@ -78,25 +69,25 @@
print(f"flux per second = {result}", end="\n\n")

# gets the second tally using its name
my_tally_2 = statepoint.get_tally(name="mat_my_material_neutron_spectra")
my_tally_2 = statepoint.get_tally(name="my_material_neutron_spectra")

# returns the tally converted to MeV, scaled and normalisation for source strength
result = otuc.process_spectra_tally(
tally=my_tally_2,
required_units="centimeter / second",
required_energy_units='MeV',
source_strength=source_strength
required_energy_units="MeV",
source_strength=source_strength,
)

# creates a matplotlib figure of the tally
spectrum_plot = plot_spectrum_from_tally(
spectrum={'neutron spectra tally': my_tally_2},
spectrum={"neutron spectra tally": my_tally_2},
x_label="Energy [MeV]",
y_label="Flux [n/cm^2s]",
x_scale="log",
y_scale="log",
title="neutron spectra tally",
filename='my_spectrum_plot.png'
filename="my_spectrum_plot.png",
)

print('image saved as my_spectrum_plot.png')
print("image saved as my_spectrum_plot.png")
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
materials = odw.Materials(
h5m_filename=geometry.h5m_filename,
correspondence_dict={
"mat_plasma": "DT_plasma",
"mat_inboard_tf_coils": "copper",
"mat_center_column_shield": "tungsten",
"mat_firstwall": "tungsten",
"mat_blanket": "Li4SiO4",
"mat_blanket_rear_wall": "eurofer",
"mat_divertor_upper": "tungsten",
"mat_divertor_lower": "tungsten",
"plasma": "DT_plasma",
"inboard_tf_coils": "copper",
"center_column_shield": "tungsten",
"firstwall": "tungsten",
"blanket": "Li4SiO4",
"blanket_rear_wall": "eurofer",
"divertor_upper": "tungsten",
"divertor_lower": "tungsten",
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
# these materials are input as strings so they will be looked up in the
# neutronics material maker package
material_tag_to_material_dict = {
"mat_inboard_tf_coils": "copper",
"mat_center_column_shield": "tungsten",
"mat_firstwall": "tungsten",
"mat_blanket": "Li4SiO4",
"mat_blanket_rear_wall": "eurofer",
"mat_divertor_upper": "tungsten",
"mat_divertor_lower": "tungsten",
"inboard_tf_coils": "copper",
"center_column_shield": "tungsten",
"firstwall": "tungsten",
"blanket": "Li4SiO4",
"blanket_rear_wall": "eurofer",
"divertor_upper": "tungsten",
"divertor_lower": "tungsten",
}

materials = odw.Materials(
Expand Down

0 comments on commit ffd4ab4

Please sign in to comment.