Skip to content

Commit

Permalink
Merge branch 'main' into jaggedArrays
Browse files Browse the repository at this point in the history
  • Loading branch information
mgjarrett committed Jun 5, 2024
2 parents b95ec48 + f06e2bf commit b697a6e
Show file tree
Hide file tree
Showing 93 changed files with 1,988 additions and 1,818 deletions.
35 changes: 0 additions & 35 deletions .coveragerc

This file was deleted.

18 changes: 10 additions & 8 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ jobs:
python-version: '3.11'
- name: Update package index
run: sudo apt-get update
- name: Install mpi libs
run: sudo apt-get -y install libopenmpi-dev
- name: Install Tox and any other packages
run: pip install tox
- name: Run Coverage Part 1
run: tox -e cov1
- name: Run Coverage Part 2
run: tox -e cov2 || true
- name: Install ARMI and MPI
run: |
sudo apt-get -y install libopenmpi-dev
pip install -e .[memprof,mpi,test]
- name: Run Coverage
run: |
coverage run --rcfile=pyproject.toml -m pytest -n 4 --cov=armi --cov-config=pyproject.toml --cov-report=lcov --ignore=venv armi
mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiFeatures.py || true
mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiParameters.py || true
coverage combine --rcfile=pyproject.toml --keep -a
- name: Publish to coveralls.io
uses: coverallsapp/[email protected]
with:
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ jobs:
run: sudo apt-get -y install libopenmpi-dev
- name: Install Pandoc
run: sudo apt-get -y install pandoc
- name: Install Tox and any other packages
run: pip install tox
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
uses: ts-graphviz/setup-graphviz@v2.0.2
- name: Make HTML Docs
run: tox -e doc
run: |
pip install -e .[memprof,mpi,test,docs]
cd doc
git submodule init
git submodule update
make html
- name: deploy
uses: JamesIves/github-pages-deploy-action@4.1.5
uses: JamesIves/github-pages-deploy-action@v4.6.1
with:
token: ${{ secrets.ACCESS_TOKEN }}
repository-name: ${{ github.repository_owner }}/terrapower.github.io
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/find_test_crumbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"armi/logs/armiRun.mpi.log",
"armi/tests/tutorials/case-suite/",
"armi/tests/tutorials/logs/",
"armiRun.h5",
"logs/",
]


Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/licensechecker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Check License Lines
on: [push, pull_request]
jobs:
check-license-lines:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@master
- name: Check License Lines
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request]
jobs:
build:

runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2
Expand All @@ -15,7 +15,7 @@ jobs:
python-version: '3.9'
- name: Update package index
run: sudo apt-get update
- name: Install Tox and any other packages
run: pip install tox
- name: Run Linter
run: tox -e lint
run: |
pip install -e .[test]
ruff .
28 changes: 28 additions & 0 deletions .github/workflows/mac_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: ARMI MacOS Tests

on:
push:
paths-ignore:
- 'doc/**'
pull_request:
paths-ignore:
- 'doc/**'

jobs:
build:

runs-on: macos-14

steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Upgrade PIP
run: python -m pip install --upgrade pip
- name: Run Unit Tests on MacOS
run: |
brew install openmpi
pip install -e .[memprof,mpi,test]
pytest armi
11 changes: 7 additions & 4 deletions .github/workflows/unittests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ jobs:
run: sudo apt-get update
- name: Install mpi libs
run: sudo apt-get -y install libopenmpi-dev
- name: Install Tox and any other packages
run: pip install tox
- name: Run Tox
run: tox -e test,mpitest
- name: Run Tests and Coverage
run: |
pip install -e .[memprof,mpi,test]
pytest -n 4 armi
mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiFeatures.py || true
mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiParameters.py || true
coverage combine --rcfile=pyproject.toml --keep -a
10 changes: 5 additions & 5 deletions .github/workflows/validatemanifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ on: [push, pull_request]
jobs:
build:

runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Install Tox and any other packages
run: pip install tox
- name: Run Tox
run: tox -e manifest
- name: Validate Manifest
run: |
pip install toml
python .github/workflows/validatemanifest.py
8 changes: 4 additions & 4 deletions .github/workflows/wintests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
python-version: '3.11'
- name: Upgrade PIP
run: python -m pip install --upgrade pip
- name: Install deps
run: python -m pip install tox tox-gh-actions
- name: Run Tox
run: tox -e test
- name: Run Unit Tests on Windows
run: |
pip install -e .[memprof,mpi,test]
pytest -n 4 armi
- name: Find Test Crumbs
run: python .github/workflows/find_test_crumbs.py
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ venv*/
*.h5
*.txt

# metadata file specific to MacOS
.DS_Store

# vis files
*.vtu
*.vtd
Expand Down
47 changes: 19 additions & 28 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ peak structural temperature in a design-basis transient.

.. note:: ARMI does not come with a full selection of physics kernels. They will need to
be acquired or developed for your specific project in order to make full use of this
tool. Many of the example use-cases discussed in this manual require functionality
tool. Many of the example use-cases discussed in this manual require functionality
that is not included in the open-source ARMI Framework.

In general, ARMI aims to enhance the quality, ease, and rigor of computational nuclear
Expand Down Expand Up @@ -79,16 +79,8 @@ Now clone and install ARMI::
$ pip install -e .
$ armi --help

The easiest way to run the tests is to install `tox <https://tox.readthedocs.io/en/latest/>`_
and then run::

$ pip install -e ".[test]"
$ tox -- -n 6

This runs the unit tests in parallel on 6 processes. Omit the ``-n 6`` argument
to run on a single process.

The tests can also be run directly, using ``pytest``::
The ARMI tests are meant to be run using `pytest <https://docs.pytest.org/en/8.0.x/>`_
locally ::

$ pip install -e ".[test]"
$ pytest -n 4 armi
Expand Down Expand Up @@ -132,7 +124,7 @@ Nuclear reactor design requires, among other things, answers to the following qu
* How does the building handle earthquakes?

Digital computers have assisted in nuclear technology development since the days of the
ENIAC in the 1940s. We now understand reactor physics well enough to build detailed
ENIAC in the 1940s. We now understand reactor physics well enough to build detailed
simulations, which can answer many of these design questions in a cost-effective, and
flexible manner. This allows us to simulate all kinds of different reactors with
different fuels, coolants, moderators, power levels, safety systems, and power cycles.
Expand All @@ -144,7 +136,7 @@ economics, and safety.

Perhaps surprisingly, some nuclear software written in the 1960s is still in use today
(mostly ported to Fortran 90 by now). These codes are validated against physical
experiments that no longer exist. Meanwhile, new cutting-edge nuclear software is being
experiments that no longer exist. Meanwhile, new cutting-edge nuclear software is being
developed today for powerful computers. Both old and new, these tools are often
challenging to operate and to use in concert with other sub-specialty codes that are
necessary to reach a full system analysis.
Expand All @@ -153,7 +145,7 @@ The ARMI approach was born out of this situation: how can we best leverage an ec
mix of legacy and modern tools with a small team to do full-scope analysis? We built an
environment that lets us automate the tedious, uncoupled, and error-prone parts of
reactor engineering/analysis work. We can turn around a very meaningful and detailed
core analysis given a major change (e.g. change power by 50%) in just a few weeks. We
core analysis given a major change (e.g. change power by 50%) in just a few weeks. We
can dispatch hundreds of parameter sweeps to multiple machines and then perform
multiobjective optimization on the resulting design space.

Expand Down Expand Up @@ -190,7 +182,7 @@ Automation
----------

ARMI can quickly and easily produce complex input files with high levels of detail in
various approximations. This enables users to perform rapid high-fidelity analyses to
various approximations. This enables users to perform rapid high-fidelity analyses to
make sure all important physics are captured. It also enables sensitivity studies of
different modeling approximations (e.g. symmetries, transport vs. diffusion vs. Monte
Carlo, subchannel vs. CFD, etc.).
Expand Down Expand Up @@ -223,7 +215,7 @@ and finding the peak power density is easy::

Any ARMI state can be written out to whichever format the user desires, meaning that
nominally identical cases can be produced for multiple similar codes in sensitivity
studies. To read power densities, simply read them off the assembly objects. Instead of
studies. To read power densities, simply read them off the assembly objects. Instead of
producing spreadsheets and making plots manually, analysts may write scripts to generate
output reports that run automatically.

Expand All @@ -242,7 +234,7 @@ Use cases
Given input describing a reactor, a typical ARMI run loops over a set of plugins in a
certain sequence. Some plugins trigger third-party simulation codes, producing input
files for them, executing them, and translating the output back onto the reactor model
as state information. Other plugins perform physics simulations directly. A variety of
as state information. Other plugins perform physics simulations directly. A variety of
plugins are available from TerraPower LLC with certain licensing terms, and it is our
hope that a rich ecosystem of useful plugins will be developed and curated by the
community (university research teams, national labs, other companies, etc.).
Expand All @@ -266,7 +258,7 @@ For example, one ARMI sequence may involve the calculation of:
transients.

Another sequence may simply compute the cost of feed uranium and enrichment in an
initial core and quit. The possibilities are limited only by our creativity.
initial core and quit. The possibilities are limited only by our creativity.

These large runs may also be run through the multiobjective design optimization system,
which runs many cases with input perturbations to help find the best overall system,
Expand Down Expand Up @@ -322,7 +314,7 @@ ARMI was originally created by TerraPower, LLC near Seattle WA starting in 2009.
founding mission was to determine the optimal fuel management operations required to
transition a fresh Traveling Wave Reactor core from startup into an equilibrium state.
It started out automating the Argonne National Lab (ANL) fast reactor neutronics codes,
MC2 and REBUS. The reactor model design was made with the intention of adding other
MC2 and REBUS. The reactor model design was made with the intention of adding other
physics capabilities later. Soon, simple thermal hydraulics were added and it's grown
ever since. It has continuously evolved towards a general reactor analysis framework.

Expand All @@ -331,16 +323,16 @@ architecture for ARMI, allowing some of the intertwined physics capabilities to
separated out as plugins from the standalone framework.

The nuclear industry is small, and it faces many challenges. It also has a tradition of
secrecy. As a result, there is risk of overlapping work being done by other entities.
secrecy. As a result, there is risk of overlapping work being done by other entities.

We hypothesize that collaborating on software systems can help align some efforts
worldwide, increasing quality and efficiency. In reactor development, the idea is
generally cheap. It's the shakedown, technology and supply chain development,
generally cheap. It's the shakedown, technology and supply chain development,
engineering demo, and commercial demo that are the hard parts.

Thus, ARMI was released under an open-source license in 2019 to facilitate mutually
beneficial collaboration across the nuclear industry, where many teams are independently
developing similar reactor analysis/automation frameworks. TerraPower will make its
developing similar reactor analysis/automation frameworks. TerraPower will make its
proprietary analysis routines, physics kernels, and material properties available under
commercial licenses.

Expand Down Expand Up @@ -381,16 +373,15 @@ needs of thermal reactors (like a good spatial description of pin maps) exists b
has not been subject to as much use.

ARMI was developed within a rapidly changing R&D environment. It evolved accordingly,
and naturally carries some legacy. We continuously attempt to identify and update
problematic parts of the code. Users should understand that ARMI is not a polished
consumer software product, but rather a powerful and flexible engineering tool. It has
and naturally carries some legacy. We continuously attempt to identify and update
problematic parts of the code. Users should understand that ARMI is not a polished
consumer software product, but rather a powerful and flexible engineering tool. It has
the potential to accelerate work on many kinds of reactors. But in many cases, it will
require serious and targeted investment.

ARMI was largely written by nuclear and mechanical engineers. We (as a whole) only
really, truly, recognized the value of things like static typing in a complex system
like ARMI somewhat recently. Contributions from software engineers are *more than*
welcome!
like ARMI somewhat recently.

ARMI has been written to support specific engineering/design tasks. As such, polish in
the GUIs and output is somewhat lacking.
Expand Down Expand Up @@ -427,7 +418,7 @@ Be careful when including any dependency in ARMI (say in the ``pyproject.toml``
to include anything with a license that superceeds our Apache license. For instance,
any third-party Python library included in ARMI with a GPL license will make the whole
project fall under the GPL license. But a lot of potential users of ARMI will want to
keep some of their work private, so we can't allow any GPL tools.
keep some of their work private, so we can't allow any GPL dependencies.

For that reason, it is generally considered best-practice in the ARMI ecosystem to
only use third-party Python libraries that have MIT or BSD licenses.
Expand Down
10 changes: 6 additions & 4 deletions armi/bookkeeping/report/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,14 @@ def encode64(file_path):
from armi import runLog

runLog.warning(
"'.pdf' images cannot be embedded into this HTML report. {} will not be inserted.".format(
file_path
(
f"'.pdf' images cannot be embedded into this HTML report. {file_path} will not be"
" inserted."
)
)
return "Faulty PDF image inclusion: {} attempted to be inserted but no support is currently offered for such.".format(
file_path
return (
f"Faulty PDF image inclusion: {file_path} attempted to be inserted but no support is "
"currently offered for such."
)
with open(file_path, "rb") as img_src:
return r"data:image/{};base64,{}".format(
Expand Down
3 changes: 1 addition & 2 deletions armi/bookkeeping/report/newReportUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ def createDimensionReport(comp):
def insertCoreAndAssemblyMaps(
r, cs, report, blueprint, generateFullCoreMap=False, showBlockAxMesh=True
):
r"""Create core and assembly design plots.
"""Create core and assembly design plots.
Parameters
----------
Expand Down Expand Up @@ -700,7 +700,6 @@ def insertCoreAndAssemblyMaps(
fontSize=8,
)

plotting.close()
report[DESIGN][CORE_MAP] = newReports.Image(
"Map of the Core at BOL", os.path.abspath(fName)
)
Expand Down
Loading

0 comments on commit b697a6e

Please sign in to comment.