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 material compositions #14

Merged
merged 91 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
877ad5a
remove pytest install calls
abachma2 Feb 21, 2023
879d4a1
add pytest and nose install
abachma2 Feb 21, 2023
2327646
add step to list conde env
abachma2 Feb 21, 2023
ab743eb
install python 3.11
abachma2 Feb 21, 2023
7f7500e
build openmc from source
abachma2 Feb 21, 2023
0be970f
change build file path
abachma2 Feb 21, 2023
2c5ccd8
add install dependencies steps
abachma2 Feb 21, 2023
cbc481f
change model path to relative path
abachma2 May 31, 2023
5a4bd72
add notes about file and recipe names
abachma2 Jun 1, 2023
754a6d6
adjust print statements, add call to Depletion.update_materials
abachma2 Jun 1, 2023
6a61c9d
add function to update material definitions in OpenMC model
abachma2 Jun 1, 2023
cc8bf8d
move spent fuel recipes to separate file
abachma2 Jun 1, 2023
0def789
update OpenMC model to have more materials present and correct naming
abachma2 Jun 1, 2023
710752b
change from atom fraction to weight fraction
abachma2 Jun 2, 2023
df594c9
remove some prints and comments with transmute
abachma2 Jun 2, 2023
0dfc6a6
use openmc function to convert zaid
abachma2 Jun 2, 2023
a3ab1bc
call transmute method, print transmuted comp
abachma2 Jun 2, 2023
6127f6e
hard code spent fuel file name
abachma2 Jun 2, 2023
dbf7f6a
update cyclus repo branch to install from
abachma2 Jun 2, 2023
4c4897f
move openmc files to examples directory, reflect in inputs
abachma2 Jun 5, 2023
90029c9
change create_recipe to use ET, correct output file name
abachma2 Jun 5, 2023
3727f5e
move to examples/ with other openmc files
abachma2 Jun 5, 2023
b7b637d
change to examples dir for model path
abachma2 Jun 5, 2023
c7481d4
move to examples/ with other openmc files
abachma2 Jun 5, 2023
8ac6829
change where prototype name is passed
abachma2 Jun 5, 2023
bf91703
remove from tests dir, previously moved to examples dir
abachma2 Jun 5, 2023
b471a38
remove file, not needed
abachma2 Jun 6, 2023
1903577
change reacte_recipe to not use export_to_materials
abachma2 Jun 6, 2023
e32903f
pass recipe names from prototype to Depletion.create_recipe
abachma2 Jun 6, 2023
c8786ae
use out recipe names in create_recipe, add tolerance for including nu…
abachma2 Jun 6, 2023
dab00c3
pass the openmc material ids to create_recipe
abachma2 Jun 6, 2023
5841c57
pep8 fixes
abachma2 Jun 6, 2023
b40bd16
add conditional so that only 1 composition for each recipe gets written
abachma2 Jun 6, 2023
bf58053
move removal of duplicate recipe names to Depletion class
abachma2 Jun 6, 2023
2466c5c
Merge branch 'main' into circle-ci
abachma2 Jun 6, 2023
ab55448
add dependencies from README
abachma2 Jun 6, 2023
d2d7a1a
change env update to conda
abachma2 Jun 6, 2023
865fbaa
reduce dependencies to install for now
abachma2 Jun 6, 2023
f6df8f0
switch to mamba and mamba install of openmc
abachma2 Jun 6, 2023
4b903e1
remove call to sudo
abachma2 Jun 6, 2023
7962004
remove line to install pytest
abachma2 Jun 6, 2023
55ba731
add dependencies back in
abachma2 Jun 6, 2023
547dcea
add steps to build cyclus from abachma2/cyclus python-api branch
abachma2 Jun 6, 2023
55a231a
fix spelling error in command
abachma2 Jun 6, 2023
da23fad
adjust build-cyclus file to get permission
abachma2 Jun 6, 2023
1ae2875
change file permissions
abachma2 Jun 6, 2023
6df9c71
move conda dependencies to main file
abachma2 Jun 6, 2023
02fcbe3
reduce dependencies, install h5py
abachma2 Jun 6, 2023
0c29596
remove h5py install
abachma2 Jun 6, 2023
c03839a
remove mamba update env
abachma2 Jun 7, 2023
ac4089d
explicit call to activate env
abachma2 Jun 7, 2023
24d8bf8
Merge branch 'main' into depletion
abachma2 Jun 19, 2023
259304b
change writing of spent comps, calls to OpenMC
abachma2 Jun 19, 2023
a758406
update README
abachma2 Jun 19, 2023
c028326
change model path to relative
abachma2 Jun 20, 2023
bec805c
change model path handleing
abachma2 Jun 20, 2023
2c15672
add path as input variable for each function
abachma2 Jun 20, 2023
6e5ae1b
update doc strings
abachma2 Jun 20, 2023
8ca8020
change large numbers to scietific notation
abachma2 Jun 21, 2023
8803602
change depletion timesteps to 30 days
abachma2 Jun 21, 2023
64cb2f6
Merge branch 'circle-ci' into depletion
abachma2 Jun 21, 2023
86c9a94
move install for cyclus to main file
abachma2 Jun 21, 2023
e92199e
auto activate base false
abachma2 Jun 21, 2023
f69a311
correct MW to W conversion factor
abachma2 Jun 21, 2023
cfeb1d6
ignore cyclus install, run unit tests
abachma2 Jun 21, 2023
394fc0c
adjust workflow to match a previously passing setup
abachma2 Jun 21, 2023
ea0ab48
add extra step to install pytest
abachma2 Jun 21, 2023
b863eff
set auto activate base to false
abachma2 Jun 21, 2023
c834203
change conda install to pip rquriements.txt
abachma2 Jun 21, 2023
3571e81
change openmc to source install
abachma2 Jun 21, 2023
3013783
correct syntax for version specs
abachma2 Jun 21, 2023
190fd2e
remove call to requirements.txt
abachma2 Jun 21, 2023
1bd84cc
adjust call to run build-openmc.sh
abachma2 Jun 21, 2023
9b2a241
correct dir for build-openmc.sh
abachma2 Jun 21, 2023
b0019f2
add install of openmc dependencies
abachma2 Jun 21, 2023
e17e4ad
add openmc library install, mirror saltproc more
abachma2 Jun 21, 2023
3773947
remove install openmc deps
abachma2 Jun 21, 2023
ccb4ebb
add step to install sudo
abachma2 Jun 23, 2023
a44eaf8
remove docker image, install openmc from mamba
abachma2 Jun 26, 2023
49778ab
remove pip install, no openssh found via pip
abachma2 Jun 26, 2023
8ac4c79
remove commented out parts, install cycamore and cyclus
abachma2 Jun 26, 2023
3d8a146
install python3.10
abachma2 Jun 26, 2023
93da2e3
remove default in top section
abachma2 Jun 26, 2023
b19fef3
change dep syntax
abachma2 Jun 26, 2023
461cdeb
go back to docker image
abachma2 Jun 26, 2023
a0cc1ba
comment out check_cmd for running cyclus
abachma2 Jun 26, 2023
494e6ef
match environment.yml and requirement.txt
abachma2 Jun 26, 2023
dd875af
Merge branch 'main' into depletion
abachma2 Jun 27, 2023
357286c
update gnd_name method to gnds_name
abachma2 Jun 27, 2023
bcca908
change transmute back to transmuting all assemblies
abachma2 Jun 27, 2023
8560bd9
remove print statements
abachma2 Jun 27, 2023
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
47 changes: 20 additions & 27 deletions .github/workflows/test-openmcyclus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,47 @@ jobs:
runs-on: ubuntu-latest
container:
image: cyclus/cycamore
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v3
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: openmcyclus-env
environment-file: environment.yml
use-mamba: true

- name: Conda config
run: |
conda config --env --set pip_interop_enabled True

- name: Install pytest
run: conda install -y pytest

- name: Build OpenMC
run: |
conda install -y python=3.7 cyclus cycamore
HDF5_DIR=$CONDA_PREFIX && pip install h5py

- name: OpenMC dependencies

- name: Update Environment
run: |
sudo apt -y update
sudo apt install -y libhdf5-dev

- name: Download OpenMC
uses: actions/checkout@v3
with:
repository: openmc-dev/openmc
path: openmc
submodules: recursive
pip install pytest
mamba env update -n openmcyclus-env -f environment.yml

- name: Build OpenMC from source
run: |
run: build-openmc.sh
- name: Install OpenMC cross section library
run: $GITHUB_WORKSPACE/openmc-xs.bash

- name: Install OpenMC from Mamba
run: mamba install openmc

- name: Install OpenMC cross section library
run: echo "OPENMC_CROSS_SECTIONS=cross_sections.xml" >> $GITHUB_ENV

- name: Install OpenMCyclus
run: |
pip install .
- name: Check environment
run: |
pip install pytest

# - name: Check environment
# run: |
# pip install pytest

- name: Run Tests
run: |
pytest
pytest tests/integration_tests/test_depletereactor.py
33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ git clone https://github.com/abachma2/cyclus.git

cd cyclus

git checkout 2022-05-maintenance
git checkout python-api

python install.py

Expand Down Expand Up @@ -53,12 +53,10 @@ directory. To run tests: ``pytest`` from the main directory.

## Running
This archetype assumes that you have a defined reactor model in OpenMC (``.xml``)
files and the
required microscopic cross sections (``.csv`` file) for the model. The
cross
section data must be saved as a ``.csv`` file. These files must
all be in the same location. Information about
these can be found on the [OpenMC docpages](https://docs.openmc.org).
files and the required microscopic cross sections (``.csv`` file) for the model.
The cross section data must be saved as a ``.csv`` file. These files must
all be in the same location. Information about these can be found on the
[OpenMC docpages](https://docs.openmc.org).

This archetype is then called during a Cyclus simulation by calling
the ``DepleteReactor`` archetype from the ``openmcyclus.DepleteReactor``
Expand Down Expand Up @@ -96,15 +94,26 @@ library. The input structure is:
<n_assem_core>int</n_assem_core>
<n_assem_batch>int</n_assem_batch>
<power_cap>double</power_cap>
<model_path>string</model_path>
<chain_file>string</chain_file>
</DepleteReactor>

The `fuel_prefs`, `fuel_inrecipes`, and `fuel_outrecipes` state variables are optional.
But if included, `fuel_prefs` and `fuel_inrecipes` must be equal in length to
`fuel_prefs` and `fuel_inrecipes` must be equal in length to
`fuel_incommods` and `fuel_outrecipes` must be equal in length to `fuel_outcommods`.

The fresh fuel recipes (`fuel_increipes`) are to be defined in the main input file but
the spent fuel recipes (`fuel_outrecipes`) are to be defined in a separate xml file
name `prototype_fuel.xml`, in which `prototype` is the name given to the prototype
in the main input file. The spent fuel recipes should be named the same as the
fresh fuel recipes, with `spent_` prepended (e.g. `spent_uox` if the inrecipe is
named `uox`).

The `model_path` variable must be an absolute path. The archetype assumes that
the OpenMC materials are in the file called `materials.xml`, located in the `model_path`
directory, and that the cross section data is in a file called `micro_xs.csv`,
also located in the `model_path` directory.


### Outputs
The compositions for the spent fuel are saved to an ``.xml`` file named
``prototype_fuel.xml`` in which ``prototype`` is the prototype name in
the Cyclus simulation. The results of the simulation wil be written to `cyclus.sqlite`
The results of the simulation wil be written to `cyclus.sqlite`
or the file name provided when Cyclus was called.
7 changes: 7 additions & 0 deletions build-cyclus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Build cyclus
cd cyclus
conda activate openmcyclus-env
python install.py
cd ../
46 changes: 44 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,48 @@ channels:
- conda-forge
- defaults
dependencies:
- numpy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is numpy really not used in this package?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not. I just always add numpy as a force of habit.

- openssh
- pytest
- pip
- gxx_linux-64==12.2
- gcc_linux-64==12.2
- cmake
- make
- docker-pycreds
- git
- xo
- python-json-logger
- glib
- libxml2
- libxmlpp
- libblas
- libcblas
- liblapack
- pkg-config
- coincbc
- boost-cpp
- sqlite
- pcre
- gettext
- bzip2
- xz
- setuptools
- pytables
- pandas
- jinja2
- cython
- websockets
- pprintpp
- hdf5==1.12.2
- notebook
- nb_conda_kernels
- requests
- entrypoints
- pyyaml
- vtk
- coverage
- pytest-cov
- colorama
- libpng
- uncertainties
- lxml
- scipy
27 changes: 27 additions & 0 deletions examples/OneReactor_fuel.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<recipes>
<recipe>
<name>spent_uox</name>
<basis>mass</basis>
<nuclide>
<id>92235</id>
<comp>0.05</comp>
</nuclide>
<nuclide>
<id>92238</id>
<comp>0.95</comp>
</nuclide>
</recipe>

<recipe>
<name>spent_mox</name>
<basis>mass</basis>
<nuclide>
<id>94239</id>
<comp>0.05</comp>
</nuclide>
<nuclide>
<id>94241</id>
<comp>0.95</comp>
</nuclide>
</recipe>
</recipes>
File renamed without changes.
31 changes: 3 additions & 28 deletions examples/complex.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<simulation>
<simulation xmlns:xi="http://www.w3.org/2001/XInclude">

<control>
<duration>20</duration>
Expand Down Expand Up @@ -105,7 +105,7 @@
<n_assem_core>3</n_assem_core>
<n_assem_batch>1</n_assem_batch>
<power_cap>100</power_cap>
<model_path>/home/abachmann/openmcyclus/tests/</model_path>
<model_path>./examples/</model_path>
<chain_file>chain_endfb71_pwr.xml</chain_file>
</DepleteReactor>
</config>
Expand Down Expand Up @@ -163,20 +163,6 @@
</nuclide>
</recipe>

<recipe>
<name>spent_uox</name>
<basis>mass</basis>
<nuclide>
<id>92235</id>
<comp>0.05</comp>
</nuclide>
<nuclide>
<id>92238</id>
<comp>0.95</comp>
</nuclide>
</recipe>


<recipe>
<name>mox</name>
<basis>mass</basis>
Expand All @@ -190,17 +176,6 @@
</nuclide>
</recipe>

<recipe>
<name>spent_mox</name>
<basis>mass</basis>
<nuclide>
<id>94239</id>
<comp>0.05</comp>
</nuclide>
<nuclide>
<id>94241</id>
<comp>0.95</comp>
</nuclide>
</recipe>
<xi:include href="examples/OneReactor_fuel.xml#xpointer(/recipes/child::*)"/>

</simulation>
12 changes: 12 additions & 0 deletions examples/geometry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version='1.0' encoding='utf-8'?>
<geometry>
<cell id="6" material="5" region="-9" universe="2" />
<cell id="7" material="6" region="-10" universe="2" />
<cell id="8" material="7" region="-11" universe="2" />
<cell id="9" material="8" region="9 10 11 -12" universe="2" />
<cell id="10" material="void" region="12" universe="2" />
<surface boundary="vacuum" coeffs="-15 0.0 0.0 5" id="9" type="sphere" />
<surface boundary="vacuum" coeffs="0.0 0.0 0.0 5" id="10" type="sphere" />
<surface boundary="vacuum" coeffs="15 0.0 0.0 5" id="11" type="sphere" />
<surface boundary="vacuum" coeffs="0.0 0.0 0.0 50" id="12" type="sphere" />
</geometry>
16 changes: 16 additions & 0 deletions examples/materials.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<materials>
<material depletable="true" id="5" name="assembly_1" temperature="900" volume="78.53981633974483">
<density units="g/cm3" value="19.1" />
<nuclide wo="0.99289" name="U238" /><nuclide wo="0.00711" name="U235" /></material>
<material depletable="true" id="6" name="assembly_2" temperature="900" volume="78.53981633974483">
<density units="g/cm3" value="19.1" />
<nuclide wo="0.99289" name="U238" /><nuclide wo="0.00711" name="U235" /></material>
<material depletable="true" id="7" name="assembly_3" temperature="900" volume="78.53981633974483">
<density units="g/cm3" value="19.1" />
<nuclide wo="0.99289" name="U238" /><nuclide wo="0.00711" name="U235" /></material>
<material id="8" name="water" temperature="900" volume="7853.981633974483">
<density units="g/cm3" value="1" />
<nuclide ao="0.6667" name="H1" />
<nuclide ao="0.3333" name="O16" />
</material>
</materials>
File renamed without changes.
File renamed without changes.
18 changes: 3 additions & 15 deletions examples/simple.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<simulation>
<simulation xmlns:xi="http://www.w3.org/2001/XInclude">

<control>
<duration>10</duration>
Expand Down Expand Up @@ -65,7 +65,7 @@
<n_assem_core>3</n_assem_core>
<n_assem_batch>1</n_assem_batch>
<power_cap>100</power_cap>
<model_path>/home/abachmann/openmcyclus/tests/</model_path>
<model_path>./examples/</model_path>
<chain_file>chain_endfb71_pwr.xml</chain_file>
</DepleteReactor>
</config>
Expand Down Expand Up @@ -112,18 +112,6 @@
</nuclide>
</recipe>

<recipe>
<name>spent_uox</name>
<basis>mass</basis>
<nuclide>
<id>92235</id>
<comp>0.05</comp>
</nuclide>
<nuclide>
<id>92238</id>
<comp>0.95</comp>
</nuclide>
</recipe>

<xi:include href="examples/OneReactor_fuel.xml#xpointer(/recipes/child::*)"/>

</simulation>
7 changes: 0 additions & 7 deletions materials.xml

This file was deleted.

Loading