ndiffusion 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ndiffusion-1.0.0/.github/workflows/ci.yml +96 -0
- ndiffusion-1.0.0/.github/workflows/docs.yml +65 -0
- ndiffusion-1.0.0/.github/workflows/wheels.yml +79 -0
- ndiffusion-1.0.0/.gitignore +45 -0
- ndiffusion-1.0.0/.zenodo.json +28 -0
- ndiffusion-1.0.0/CHANGELOG.md +120 -0
- ndiffusion-1.0.0/CITATION.cff +28 -0
- ndiffusion-1.0.0/CMakeLists.txt +59 -0
- ndiffusion-1.0.0/CONTRIBUTING.md +27 -0
- ndiffusion-1.0.0/Doxyfile +28 -0
- ndiffusion-1.0.0/LICENSE +21 -0
- ndiffusion-1.0.0/PKG-INFO +175 -0
- ndiffusion-1.0.0/README.md +123 -0
- ndiffusion-1.0.0/TODO.md +55 -0
- ndiffusion-1.0.0/cpp/CMakeLists.txt +49 -0
- ndiffusion-1.0.0/cpp/include/ndiffusion/solver_1d.hpp +470 -0
- ndiffusion-1.0.0/cpp/include/ndiffusion/solver_2d.hpp +846 -0
- ndiffusion-1.0.0/cpp/include/ndiffusion/solver_3d.hpp +13 -0
- ndiffusion-1.0.0/cpp/include/ndiffusion/solver_detail.hpp +1086 -0
- ndiffusion-1.0.0/cpp/include/ndiffusion/types.hpp +411 -0
- ndiffusion-1.0.0/cpp/python/bindings.cpp +842 -0
- ndiffusion-1.0.0/cpp/src/main.cpp +360 -0
- ndiffusion-1.0.0/cpp/src/solver_1d.cpp +732 -0
- ndiffusion-1.0.0/cpp/src/solver_2d_structured.cpp +1067 -0
- ndiffusion-1.0.0/cpp/src/solver_2d_unstructured.cpp +1576 -0
- ndiffusion-1.0.0/data/problem_setup.json +37 -0
- ndiffusion-1.0.0/docs/_static/favicon.png +0 -0
- ndiffusion-1.0.0/docs/_static/gallery/c5g7_flux.png +0 -0
- ndiffusion-1.0.0/docs/_static/icon.svg +42 -0
- ndiffusion-1.0.0/docs/_static/logo-dark.svg +43 -0
- ndiffusion-1.0.0/docs/_static/logo.svg +43 -0
- ndiffusion-1.0.0/docs/_static/quickstart_2d.png +0 -0
- ndiffusion-1.0.0/docs/_static/readme_sphere.png +0 -0
- ndiffusion-1.0.0/docs/_static/social-preview.png +0 -0
- ndiffusion-1.0.0/docs/api/cpp.md +22 -0
- ndiffusion-1.0.0/docs/api/python.md +122 -0
- ndiffusion-1.0.0/docs/archive/DiffusionCode.pdf +0 -0
- ndiffusion-1.0.0/docs/archive/SettingUpUraniumSphere.pdf +0 -0
- ndiffusion-1.0.0/docs/benchmarks.md +42 -0
- ndiffusion-1.0.0/docs/changelog.md +2 -0
- ndiffusion-1.0.0/docs/citing.md +18 -0
- ndiffusion-1.0.0/docs/conf.py +89 -0
- ndiffusion-1.0.0/docs/contributing.md +72 -0
- ndiffusion-1.0.0/docs/index.md +93 -0
- ndiffusion-1.0.0/docs/installation.md +70 -0
- ndiffusion-1.0.0/docs/quickstart.md +124 -0
- ndiffusion-1.0.0/docs/roadmap.md +8 -0
- ndiffusion-1.0.0/docs/scripts/benchmark_table.py +34 -0
- ndiffusion-1.0.0/docs/scripts/make_branding.py +313 -0
- ndiffusion-1.0.0/docs/scripts/make_readme_figures.py +83 -0
- ndiffusion-1.0.0/docs/theory/diffusion.md +85 -0
- ndiffusion-1.0.0/docs/theory/discretization_1d.md +60 -0
- ndiffusion-1.0.0/docs/theory/discretization_2d.md +41 -0
- ndiffusion-1.0.0/docs/theory/finite_volume.md +86 -0
- ndiffusion-1.0.0/docs/theory/iteration.md +80 -0
- ndiffusion-1.0.0/docs/theory/kinetics.md +109 -0
- ndiffusion-1.0.0/docs/theory/nearby_problems.md +66 -0
- ndiffusion-1.0.0/docs/theory/references.bib +60 -0
- ndiffusion-1.0.0/docs/theory/references.md +4 -0
- ndiffusion-1.0.0/docs/user_guide/boundary_conditions.md +84 -0
- ndiffusion-1.0.0/docs/user_guide/cpp.md +76 -0
- ndiffusion-1.0.0/docs/user_guide/geometry.md +214 -0
- ndiffusion-1.0.0/docs/user_guide/kinetics.md +166 -0
- ndiffusion-1.0.0/docs/user_guide/materials.md +154 -0
- ndiffusion-1.0.0/docs/user_guide/postprocessing.md +63 -0
- ndiffusion-1.0.0/docs/user_guide/solvers.md +113 -0
- ndiffusion-1.0.0/docs/user_guide/verification.md +82 -0
- ndiffusion-1.0.0/examples/GALLERY_HEADER.rst +6 -0
- ndiffusion-1.0.0/examples/_benchmarks.py +147 -0
- ndiffusion-1.0.0/examples/_plotting.py +70 -0
- ndiffusion-1.0.0/examples/c5g7_quarter_core.py +256 -0
- ndiffusion-1.0.0/examples/critical_2d_C5G7_xs.h5 +0 -0
- ndiffusion-1.0.0/examples/k_eigenvalue.py +110 -0
- ndiffusion-1.0.0/examples/kinetics.py +191 -0
- ndiffusion-1.0.0/examples/plot_benchmarks.py +75 -0
- ndiffusion-1.0.0/examples/plot_unstructured_mesh.py +113 -0
- ndiffusion-1.0.0/examples/time_dependent.py +93 -0
- ndiffusion-1.0.0/examples/transport_cross_sections.py +97 -0
- ndiffusion-1.0.0/pyproject.toml +107 -0
- ndiffusion-1.0.0/src/ndiffusion/__init__.py +125 -0
- ndiffusion-1.0.0/src/ndiffusion/adjoint.py +101 -0
- ndiffusion-1.0.0/src/ndiffusion/create.py +290 -0
- ndiffusion-1.0.0/src/ndiffusion/kinetics.py +277 -0
- ndiffusion-1.0.0/src/ndiffusion/layouts.py +644 -0
- ndiffusion-1.0.0/src/ndiffusion/materials.py +268 -0
- ndiffusion-1.0.0/src/ndiffusion/mesh.py +392 -0
- ndiffusion-1.0.0/src/ndiffusion/nearby.py +634 -0
- ndiffusion-1.0.0/src/ndiffusion/postprocess.py +290 -0
- ndiffusion-1.0.0/src/ndiffusion/transport.py +258 -0
- ndiffusion-1.0.0/tests/__init__.py +0 -0
- ndiffusion-1.0.0/tests/conftest.py +6 -0
- ndiffusion-1.0.0/tests/test_1d_fixed_source.py +317 -0
- ndiffusion-1.0.0/tests/test_1d_k_eigenvalue.py +426 -0
- ndiffusion-1.0.0/tests/test_1d_time_dependent.py +404 -0
- ndiffusion-1.0.0/tests/test_2d_fixed_source.py +642 -0
- ndiffusion-1.0.0/tests/test_2d_k_eigenvalue.py +542 -0
- ndiffusion-1.0.0/tests/test_2d_time_dependent.py +268 -0
- ndiffusion-1.0.0/tests/test_adjoint.py +154 -0
- ndiffusion-1.0.0/tests/test_benchmarks.py +525 -0
- ndiffusion-1.0.0/tests/test_boundaries.py +234 -0
- ndiffusion-1.0.0/tests/test_cg_ab.py +179 -0
- ndiffusion-1.0.0/tests/test_kinetics.py +1321 -0
- ndiffusion-1.0.0/tests/test_layouts.py +431 -0
- ndiffusion-1.0.0/tests/test_materials_sets.py +126 -0
- ndiffusion-1.0.0/tests/test_materials_validation.py +337 -0
- ndiffusion-1.0.0/tests/test_mesh_gmsh.py +90 -0
- ndiffusion-1.0.0/tests/test_mesh_materials.py +522 -0
- ndiffusion-1.0.0/tests/test_nearby_1d.py +153 -0
- ndiffusion-1.0.0/tests/test_nearby_2d.py +81 -0
- ndiffusion-1.0.0/tests/test_nearby_unstructured.py +200 -0
- ndiffusion-1.0.0/tests/test_numpy_api.py +177 -0
- ndiffusion-1.0.0/tests/test_postprocess.py +334 -0
- ndiffusion-1.0.0/tests/test_transport.py +300 -0
- ndiffusion-1.0.0/tests/test_version.py +24 -0
- ndiffusion-1.0.0/tests/test_warnings.py +187 -0
- ndiffusion-1.0.0/tools/c5g7_fuel_mesh.py +494 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
name: pytest (${{ matrix.os }}, py${{ matrix.python-version }})
|
|
11
|
+
runs-on: ${{ matrix.os }}
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
16
|
+
python-version: ["3.9", "3.12", "3.13"]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install package with test dependencies
|
|
25
|
+
run: pip install .[test]
|
|
26
|
+
|
|
27
|
+
- name: Run test suite
|
|
28
|
+
run: pytest
|
|
29
|
+
|
|
30
|
+
examples:
|
|
31
|
+
name: examples
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
- uses: actions/setup-python@v5
|
|
36
|
+
with:
|
|
37
|
+
python-version: "3.12"
|
|
38
|
+
- run: pip install .[dev]
|
|
39
|
+
# The C5G7 quarter core takes minutes and needs gmsh and h5py.
|
|
40
|
+
- name: Run every example except C5G7
|
|
41
|
+
env:
|
|
42
|
+
MPLBACKEND: Agg
|
|
43
|
+
run: |
|
|
44
|
+
for f in examples/*.py; do
|
|
45
|
+
case "$(basename "$f")" in _*|c5g7_*) continue ;; esac
|
|
46
|
+
echo "::group::$f"
|
|
47
|
+
python "$f"
|
|
48
|
+
echo "::endgroup::"
|
|
49
|
+
done
|
|
50
|
+
|
|
51
|
+
coverage:
|
|
52
|
+
name: coverage
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
# Reporting only: a Codecov outage or a missing token must not fail CI.
|
|
55
|
+
continue-on-error: true
|
|
56
|
+
steps:
|
|
57
|
+
- uses: actions/checkout@v4
|
|
58
|
+
- uses: actions/setup-python@v5
|
|
59
|
+
with:
|
|
60
|
+
python-version: "3.12"
|
|
61
|
+
- run: pip install -e .[test] pytest-cov
|
|
62
|
+
- run: pytest --cov=ndiffusion --cov-report=xml
|
|
63
|
+
- uses: codecov/codecov-action@v5
|
|
64
|
+
with:
|
|
65
|
+
files: coverage.xml
|
|
66
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
67
|
+
fail_ci_if_error: false
|
|
68
|
+
|
|
69
|
+
lint:
|
|
70
|
+
name: ruff
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
steps:
|
|
73
|
+
- uses: actions/checkout@v4
|
|
74
|
+
- uses: actions/setup-python@v5
|
|
75
|
+
with:
|
|
76
|
+
python-version: "3.12"
|
|
77
|
+
- run: pip install ruff
|
|
78
|
+
- run: ruff check src tests examples tools docs
|
|
79
|
+
|
|
80
|
+
cpp-sanitize:
|
|
81
|
+
name: C++ driver (ASan/UBSan)
|
|
82
|
+
runs-on: ubuntu-latest
|
|
83
|
+
steps:
|
|
84
|
+
- uses: actions/checkout@v4
|
|
85
|
+
|
|
86
|
+
- name: Configure (Debug + sanitizers)
|
|
87
|
+
run: >
|
|
88
|
+
cmake -B build -DCMAKE_BUILD_TYPE=Debug
|
|
89
|
+
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer"
|
|
90
|
+
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined"
|
|
91
|
+
|
|
92
|
+
- name: Build
|
|
93
|
+
run: cmake --build build -j
|
|
94
|
+
|
|
95
|
+
- name: Run 1-D reference problems under sanitizers
|
|
96
|
+
run: ./build/cpp/ndiffusion_driver
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
name: Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: docs-${{ github.ref }}
|
|
14
|
+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build:
|
|
18
|
+
name: sphinx
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: "3.12"
|
|
26
|
+
|
|
27
|
+
- name: Install package with docs dependencies
|
|
28
|
+
run: pip install .[docs]
|
|
29
|
+
|
|
30
|
+
- name: Build HTML
|
|
31
|
+
run: sphinx-build -W --keep-going docs docs/_build/html
|
|
32
|
+
|
|
33
|
+
# External sites come and go, so a dead link should hold up a PR, not a
|
|
34
|
+
# deploy of master.
|
|
35
|
+
- name: Check links
|
|
36
|
+
if: github.event_name == 'pull_request'
|
|
37
|
+
run: sphinx-build -b linkcheck -W --keep-going docs docs/_build/linkcheck
|
|
38
|
+
|
|
39
|
+
- name: Build C++ reference
|
|
40
|
+
if: github.event_name != 'pull_request'
|
|
41
|
+
run: |
|
|
42
|
+
sudo apt-get update
|
|
43
|
+
sudo apt-get install -y doxygen
|
|
44
|
+
doxygen Doxyfile
|
|
45
|
+
cp -r docs/doxygen/html docs/_build/html/cpp
|
|
46
|
+
|
|
47
|
+
- uses: actions/upload-pages-artifact@v3
|
|
48
|
+
if: github.event_name != 'pull_request'
|
|
49
|
+
with:
|
|
50
|
+
path: docs/_build/html
|
|
51
|
+
|
|
52
|
+
deploy:
|
|
53
|
+
name: deploy
|
|
54
|
+
if: github.event_name != 'pull_request'
|
|
55
|
+
needs: build
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
permissions:
|
|
58
|
+
pages: write
|
|
59
|
+
id-token: write
|
|
60
|
+
environment:
|
|
61
|
+
name: github-pages
|
|
62
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
63
|
+
steps:
|
|
64
|
+
- id: deployment
|
|
65
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: Wheels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
release:
|
|
7
|
+
types: [published]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
wheels:
|
|
15
|
+
name: wheels (${{ matrix.os }})
|
|
16
|
+
runs-on: ${{ matrix.os }}
|
|
17
|
+
strategy:
|
|
18
|
+
fail-fast: false
|
|
19
|
+
matrix:
|
|
20
|
+
include:
|
|
21
|
+
- os: ubuntu-latest # manylinux x86_64
|
|
22
|
+
- os: ubuntu-24.04-arm # manylinux aarch64, native rather than emulated
|
|
23
|
+
- os: macos-14 # arm64, and x86_64 tested under Rosetta
|
|
24
|
+
archs: x86_64 arm64
|
|
25
|
+
- os: windows-latest # AMD64
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
|
+
|
|
29
|
+
- uses: pypa/cibuildwheel@v4.3.0
|
|
30
|
+
env:
|
|
31
|
+
CIBW_ARCHS_MACOS: ${{ matrix.archs || 'auto' }}
|
|
32
|
+
|
|
33
|
+
- uses: actions/upload-artifact@v4
|
|
34
|
+
with:
|
|
35
|
+
name: wheels-${{ matrix.os }}
|
|
36
|
+
path: wheelhouse/*.whl
|
|
37
|
+
|
|
38
|
+
sdist:
|
|
39
|
+
name: sdist
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v4
|
|
43
|
+
- run: pipx run build --sdist
|
|
44
|
+
- uses: actions/upload-artifact@v4
|
|
45
|
+
with:
|
|
46
|
+
name: sdist
|
|
47
|
+
path: dist/*.tar.gz
|
|
48
|
+
|
|
49
|
+
testpypi:
|
|
50
|
+
name: publish to TestPyPI
|
|
51
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'rc')
|
|
52
|
+
needs: [wheels, sdist]
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
environment: testpypi
|
|
55
|
+
permissions:
|
|
56
|
+
id-token: write
|
|
57
|
+
steps:
|
|
58
|
+
- uses: actions/download-artifact@v4
|
|
59
|
+
with:
|
|
60
|
+
path: dist
|
|
61
|
+
merge-multiple: true
|
|
62
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
63
|
+
with:
|
|
64
|
+
repository-url: https://test.pypi.org/legacy/
|
|
65
|
+
|
|
66
|
+
pypi:
|
|
67
|
+
name: publish to PyPI
|
|
68
|
+
if: github.event_name == 'release' && github.event.action == 'published'
|
|
69
|
+
needs: [wheels, sdist]
|
|
70
|
+
runs-on: ubuntu-latest
|
|
71
|
+
environment: pypi
|
|
72
|
+
permissions:
|
|
73
|
+
id-token: write
|
|
74
|
+
steps:
|
|
75
|
+
- uses: actions/download-artifact@v4
|
|
76
|
+
with:
|
|
77
|
+
path: dist
|
|
78
|
+
merge-multiple: true
|
|
79
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# IDE and tool configuration
|
|
2
|
+
.vscode/
|
|
3
|
+
.claude/
|
|
4
|
+
|
|
5
|
+
# CMake build trees
|
|
6
|
+
build/
|
|
7
|
+
_skbuild/
|
|
8
|
+
Testing/
|
|
9
|
+
docs/doxygen/
|
|
10
|
+
CMakeCache.txt
|
|
11
|
+
CMakeFiles/
|
|
12
|
+
cmake_install.cmake
|
|
13
|
+
*.cmake
|
|
14
|
+
!CMakeLists.txt
|
|
15
|
+
|
|
16
|
+
# Compiled extensions
|
|
17
|
+
*.so
|
|
18
|
+
*.pyd
|
|
19
|
+
src/ndiffusion/_core*.so
|
|
20
|
+
|
|
21
|
+
# Python
|
|
22
|
+
__pycache__/
|
|
23
|
+
*.py[cod]
|
|
24
|
+
*.dll
|
|
25
|
+
*.Rhistory
|
|
26
|
+
*.ipynb
|
|
27
|
+
*.npy
|
|
28
|
+
|
|
29
|
+
# Cross-section data (large binary files, not tracked in git)
|
|
30
|
+
data/*
|
|
31
|
+
!data/problem_setup.json
|
|
32
|
+
|
|
33
|
+
# Generated gmsh meshes (regenerate via tools/c5g7_fuel_mesh.py)
|
|
34
|
+
*.msh
|
|
35
|
+
|
|
36
|
+
# Packaging
|
|
37
|
+
*.egg-info/
|
|
38
|
+
*.egg
|
|
39
|
+
dist/
|
|
40
|
+
|
|
41
|
+
# Sphinx build output and autosummary stubs
|
|
42
|
+
docs/_build/
|
|
43
|
+
docs/api/generated/
|
|
44
|
+
docs/auto_examples/
|
|
45
|
+
docs/sg_execution_times.rst
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "ndiffusion: multigroup neutron diffusion in C++ and Python",
|
|
3
|
+
"description": "Multigroup neutron diffusion solvers for 1-D slab, cylinder and sphere geometries, 2-D structured XY and RZ meshes, and 2-D unstructured polygonal meshes: k-eigenvalue, fixed-source and time-dependent problems, with delayed neutrons. The solvers are written in C++17 and exposed to Python through pybind11; the Python package adds cross-section builders, mesh and core layout tools, post-processing, and a discretization-error estimator based on the method of nearby problems.",
|
|
4
|
+
"upload_type": "software",
|
|
5
|
+
"creators": [
|
|
6
|
+
{
|
|
7
|
+
"name": "Whewell, Ben",
|
|
8
|
+
"orcid": "0000-0001-7826-5525"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"neutron diffusion",
|
|
14
|
+
"reactor physics",
|
|
15
|
+
"k-eigenvalue",
|
|
16
|
+
"reactor kinetics",
|
|
17
|
+
"finite volume",
|
|
18
|
+
"unstructured mesh"
|
|
19
|
+
],
|
|
20
|
+
"related_identifiers": [
|
|
21
|
+
{
|
|
22
|
+
"identifier": "https://bwhewe-13.github.io/NeutronDiffusion/",
|
|
23
|
+
"relation": "isDocumentedBy",
|
|
24
|
+
"resource_type": "publication-softwaredocumentation",
|
|
25
|
+
"scheme": "url"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to ndiffusion are recorded here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
|
|
5
|
+
[semantic versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [1.0.0] - 2026-10-07
|
|
10
|
+
|
|
11
|
+
The first stable release. The public API is fixed from here on: changes are
|
|
12
|
+
additive until a 2.0.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- Delayed neutron precursors in all three time-dependent solvers, with an
|
|
16
|
+
implicit fission source and `update_materials` for mid-transient
|
|
17
|
+
perturbations; `make_delayed_data`, `scale_to_critical` and the Keepin
|
|
18
|
+
6-group set `DELAYED_U235_6GROUP`
|
|
19
|
+
- Theta-weighted time differencing (`theta = 0.5` is Crank-Nicolson,
|
|
20
|
+
`theta = 1` the default backward Euler)
|
|
21
|
+
- Deferred non-orthogonal correction with least-squares gradients, so the
|
|
22
|
+
unstructured solvers stay second order on triangles and skewed cells
|
|
23
|
+
- Polygonal unstructured cells (hexagons and the clipped cells of a symmetry
|
|
24
|
+
sector), plus `validate_mesh`, `cell_centroids` and `cell_areas`
|
|
25
|
+
- `assign_materials` and `copy_mesh`, so one mesh can carry several material
|
|
26
|
+
layouts; Gmsh physical-group names are kept on the mesh as `region_names`
|
|
27
|
+
and `bc_names`
|
|
28
|
+
- Periodic boundary pairs, translational or rotational
|
|
29
|
+
- `ndiffusion.layouts`: Cartesian and hex core meshes, symmetry orientations
|
|
30
|
+
and material painters
|
|
31
|
+
- `ndiffusion.materials`: one- and two-group builders and the published
|
|
32
|
+
Ringhals, TWIGL, IAEA and BIBLIS benchmark tables
|
|
33
|
+
- Transport-to-diffusion cross-section conversion
|
|
34
|
+
(`make_materials_from_transport`, `transport_to_diffusion`)
|
|
35
|
+
- `make_adjoint_materials` for the adjoint (importance) problem
|
|
36
|
+
- Method of nearby problems discretization-error estimator (`nearby_*`)
|
|
37
|
+
- Within-group CG inner solver for the 2-D k-eigenvalue solvers (`use_cg`)
|
|
38
|
+
- Published benchmark regression tests and a C5G7 quarter-core example
|
|
39
|
+
- Ctrl-C interrupts a running solve instead of waiting for it to finish
|
|
40
|
+
- `ndiffusion.__version__`
|
|
41
|
+
- `n_cells` and `n_groups` on every solver, and `n_groups` (plus `n_precursor`
|
|
42
|
+
for transients) on the result objects
|
|
43
|
+
- GitHub Actions CI on Linux, macOS and Windows, ruff linting and a
|
|
44
|
+
sanitizer build of the C++ driver
|
|
45
|
+
- Robin boundary conditions on the 1-D left edge (`bc_left`) and the 2-D
|
|
46
|
+
structured left and bottom edges (`bc_x_left`, `bc_y_bottom`). They default
|
|
47
|
+
to reflective, the old fixed behavior, so a full core no longer has to be cut
|
|
48
|
+
to a quarter, and a 1-D cylinder or sphere can have an inner surface. A
|
|
49
|
+
non-reflective condition on an r = 0 axis raises.
|
|
50
|
+
- `ndiffusion.ConvergenceWarning`, and a `converged` flag on
|
|
51
|
+
`TimeDependentResult` (false once any step has hit `max_inner`)
|
|
52
|
+
- Post-processing helpers: `cell_volumes`, `reaction_rate`, `power_density`,
|
|
53
|
+
`normalize_to_power`, `region_powers`, `peaking_factors`, and
|
|
54
|
+
`save_result` / `load_result` for `.npz` files
|
|
55
|
+
- A documentation site built with Sphinx - installation, quickstart, user
|
|
56
|
+
guide and API reference - deployed to GitHub Pages along with the Doxygen
|
|
57
|
+
C++ reference
|
|
58
|
+
- A logo, favicon and social preview image
|
|
59
|
+
- Theory pages (the diffusion equation, the 1-D, structured and unstructured
|
|
60
|
+
discretizations, the iterative methods, kinetics and the method of nearby
|
|
61
|
+
problems), an examples gallery with plots, a benchmarks page with
|
|
62
|
+
published-versus-computed eigenvalues, and figures for the README and
|
|
63
|
+
quickstart
|
|
64
|
+
- Two new examples: unstructured meshes and symmetry sectors, and benchmark
|
|
65
|
+
convergence for TWIGL and IAEA
|
|
66
|
+
- Prebuilt wheels for Linux (x86_64, aarch64), macOS (Intel, Apple silicon) and
|
|
67
|
+
Windows, Python 3.9 to 3.14, published to PyPI from tagged releases
|
|
68
|
+
- `CITATION.cff`, `.zenodo.json` and `CONTRIBUTING.md`
|
|
69
|
+
|
|
70
|
+
### Changed
|
|
71
|
+
- The README is shortened to an overview; the detailed usage moved to the
|
|
72
|
+
documentation, and the 2021 notes in `docs/` to `docs/archive/`
|
|
73
|
+
- The examples are sphinx-gallery scripts with plots; `examples/kinetics.py`
|
|
74
|
+
plots the power history and the time-differencing convergence
|
|
75
|
+
- CI tests Python 3.13 too, runs the examples, and reports coverage
|
|
76
|
+
- Arrays cross into and out of Python as numpy arrays instead of lists.
|
|
77
|
+
`flux` is shaped `(n_cells, n_groups)` and `precursors`
|
|
78
|
+
`(n_cells, n_precursor)`; the `Materials`, `DelayedNeutronData` and
|
|
79
|
+
`UnstructuredMesh2D` fields read back as 1-D arrays. Inputs accept any
|
|
80
|
+
array-like, and a fixed source, initial flux or initial precursors can be
|
|
81
|
+
given in the same 2-D shape - a transposed array is rejected rather than
|
|
82
|
+
read in the wrong order. The `nearby_*` results and `fission_source` use the
|
|
83
|
+
same shape.
|
|
84
|
+
- `make_materials` takes `scatter_orientation`; `descending_energy=True` is
|
|
85
|
+
deprecated and `descending_energy=False` raises
|
|
86
|
+
- The 1-D k-eigenvalue `max_inner` default is 1000, and the C++ solvers are
|
|
87
|
+
quiet by default like the Python bindings
|
|
88
|
+
- A bare CMake configure builds Release, and warning flags apply to every
|
|
89
|
+
target
|
|
90
|
+
- Convergence warnings go through Python's `warnings` module as
|
|
91
|
+
`ConvergenceWarning` instead of to stderr, so they can be filtered, recorded
|
|
92
|
+
or raised. The k-eigenvalue solvers now also warn when power iteration stops
|
|
93
|
+
at `max_outer`, and the fixed-source solvers when they stop at `max_inner`.
|
|
94
|
+
The transient warning is issued after the step completes, so turning it into
|
|
95
|
+
an exception leaves the solver at a consistent state. The C++ driver still
|
|
96
|
+
prints to stderr.
|
|
97
|
+
|
|
98
|
+
### Fixed
|
|
99
|
+
- 1-D interface coupling now divides by the center-to-center distance, so
|
|
100
|
+
non-uniform meshes converge at second order
|
|
101
|
+
- Fixed-source iteration counts no longer overcount by one at the cap
|
|
102
|
+
- `make_materials` derives removal from the solver-ordered scatter matrix
|
|
103
|
+
- `make_delayed_data` rejects `ChiPrompt` given for only some materials
|
|
104
|
+
- Higher-order Gmsh elements are imported by their corner nodes rather than
|
|
105
|
+
silently dropped
|
|
106
|
+
- Unstructured meshes are validated: the `bc` array must cover every boundary
|
|
107
|
+
tag, and non-manifold edges, hanging nodes, coincident vertices and zero-area
|
|
108
|
+
cells are rejected
|
|
109
|
+
- Boundary faces are emitted in sorted order, so results no longer depend on
|
|
110
|
+
the standard library's hash ordering
|
|
111
|
+
- Time steps must be positive and finite
|
|
112
|
+
- `copy_mesh` keeps periodic boundary pairs
|
|
113
|
+
- The `DelayedNeutronData` docstring no longer says fission-matrix mode is
|
|
114
|
+
rejected, or that an empty `chi_prompt` falls back to `Materials.chi`
|
|
115
|
+
- `examples/k_eigenvalue.py` printed the 20-cell slab reference for its sphere;
|
|
116
|
+
the sphere is at its critical radius, so the exact eigenvalue is 1
|
|
117
|
+
|
|
118
|
+
## [0.3.0] - 2026-06-22
|
|
119
|
+
|
|
120
|
+
Gmsh import for unstructured meshes. Earlier history is in the git log.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If ndiffusion contributes to published work, please cite it as below."
|
|
3
|
+
type: software
|
|
4
|
+
title: "ndiffusion: multigroup neutron diffusion in C++ and Python"
|
|
5
|
+
authors:
|
|
6
|
+
- family-names: Whewell
|
|
7
|
+
given-names: Ben
|
|
8
|
+
orcid: "https://orcid.org/0000-0001-7826-5525"
|
|
9
|
+
repository-code: "https://github.com/bwhewe-13/NeutronDiffusion"
|
|
10
|
+
url: "https://bwhewe-13.github.io/NeutronDiffusion/"
|
|
11
|
+
license: MIT
|
|
12
|
+
version: 1.0.0
|
|
13
|
+
date-released: 2026-10-07
|
|
14
|
+
abstract: >-
|
|
15
|
+
Multigroup neutron diffusion solvers for 1-D slab, cylinder and sphere
|
|
16
|
+
geometries, 2-D structured XY and RZ meshes, and 2-D unstructured polygonal
|
|
17
|
+
meshes: k-eigenvalue, fixed-source and time-dependent problems, with delayed
|
|
18
|
+
neutrons. The solvers are written in C++17 and exposed to Python through
|
|
19
|
+
pybind11; the Python package adds cross-section builders, mesh and core
|
|
20
|
+
layout tools, post-processing, and a discretization-error estimator based on
|
|
21
|
+
the method of nearby problems.
|
|
22
|
+
keywords:
|
|
23
|
+
- neutron diffusion
|
|
24
|
+
- reactor physics
|
|
25
|
+
- k-eigenvalue
|
|
26
|
+
- reactor kinetics
|
|
27
|
+
- finite volume
|
|
28
|
+
- unstructured mesh
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.21)
|
|
2
|
+
project(NeutronDiffusion VERSION 1.0.0 LANGUAGES CXX)
|
|
3
|
+
|
|
4
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
5
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
6
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
7
|
+
|
|
8
|
+
# The solvers are hot loops, so default to an optimized build rather than let a
|
|
9
|
+
# bare `cmake -B build` produce an unoptimized one. An explicit
|
|
10
|
+
# -DCMAKE_BUILD_TYPE still wins.
|
|
11
|
+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
12
|
+
set(CMAKE_BUILD_TYPE Release CACHE STRING
|
|
13
|
+
"Build type (Debug, Release, RelWithDebInfo, MinSizeRel)" FORCE)
|
|
14
|
+
endif()
|
|
15
|
+
|
|
16
|
+
if(SKBUILD)
|
|
17
|
+
set(_ndiffusion_build_python_default ON)
|
|
18
|
+
else()
|
|
19
|
+
set(_ndiffusion_build_python_default OFF)
|
|
20
|
+
endif()
|
|
21
|
+
|
|
22
|
+
option(NDIFFUSION_BUILD_PYTHON "Build the Python extension module" ${_ndiffusion_build_python_default})
|
|
23
|
+
|
|
24
|
+
find_package(Doxygen QUIET)
|
|
25
|
+
if(DOXYGEN_FOUND)
|
|
26
|
+
add_custom_target(docs
|
|
27
|
+
COMMAND "${DOXYGEN_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/Doxyfile"
|
|
28
|
+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
29
|
+
COMMENT "Generating API documentation with Doxygen"
|
|
30
|
+
VERBATIM
|
|
31
|
+
)
|
|
32
|
+
else()
|
|
33
|
+
message(STATUS "Doxygen not found; 'docs' target is unavailable")
|
|
34
|
+
endif()
|
|
35
|
+
|
|
36
|
+
if(NDIFFUSION_BUILD_PYTHON)
|
|
37
|
+
find_package(Python3 COMPONENTS Interpreter Development.Module REQUIRED)
|
|
38
|
+
|
|
39
|
+
# pybind11 is injected via CMAKE_PREFIX_PATH by scikit-build-core at install
|
|
40
|
+
# time, and can also be found from a manual install for standalone builds.
|
|
41
|
+
# Fall back to querying the active Python interpreter if pybind11_DIR is unset.
|
|
42
|
+
if(NOT DEFINED pybind11_DIR)
|
|
43
|
+
execute_process(
|
|
44
|
+
COMMAND "${Python3_EXECUTABLE}" -c
|
|
45
|
+
"import pybind11; print(pybind11.get_cmake_dir())"
|
|
46
|
+
RESULT_VARIABLE _pybind11_status
|
|
47
|
+
OUTPUT_VARIABLE _pybind11_cmake_dir
|
|
48
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
49
|
+
ERROR_QUIET
|
|
50
|
+
)
|
|
51
|
+
if(_pybind11_status EQUAL 0 AND _pybind11_cmake_dir)
|
|
52
|
+
set(pybind11_DIR "${_pybind11_cmake_dir}")
|
|
53
|
+
endif()
|
|
54
|
+
endif()
|
|
55
|
+
|
|
56
|
+
find_package(pybind11 REQUIRED)
|
|
57
|
+
endif()
|
|
58
|
+
|
|
59
|
+
add_subdirectory(cpp)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Bug reports and pull requests are welcome.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
git clone https://github.com/bwhewe-13/NeutronDiffusion.git
|
|
7
|
+
cd NeutronDiffusion
|
|
8
|
+
pip install -e ".[dev]"
|
|
9
|
+
pytest
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Python changes under `src/ndiffusion/` are picked up immediately; after a C++
|
|
13
|
+
change, run `pip install -e ".[dev]"` again to rebuild the extension.
|
|
14
|
+
|
|
15
|
+
Before opening a pull request:
|
|
16
|
+
|
|
17
|
+
- `pytest` passes. Convergence warnings are errors in the suite, so a test that
|
|
18
|
+
stops at an iteration cap on purpose says so with
|
|
19
|
+
`pytest.warns(nd.ConvergenceWarning)`.
|
|
20
|
+
- `ruff check src tests examples tools docs` is clean.
|
|
21
|
+
- New C++ classes and methods have a binding, with a docstring, in
|
|
22
|
+
`cpp/python/bindings.cpp`.
|
|
23
|
+
- New behavior has a test and a line in the `Unreleased` section of
|
|
24
|
+
`CHANGELOG.md`.
|
|
25
|
+
|
|
26
|
+
The [contributing page](https://bwhewe-13.github.io/NeutronDiffusion/contributing.html)
|
|
27
|
+
of the documentation describes the repository layout and what CI checks.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
PROJECT_NAME = "NeutronDiffusion"
|
|
2
|
+
PROJECT_BRIEF = "Multigroup neutron diffusion solver for 1-D and 2-D geometries"
|
|
3
|
+
PROJECT_NUMBER = 1.0.0
|
|
4
|
+
|
|
5
|
+
OUTPUT_DIRECTORY = docs/doxygen
|
|
6
|
+
|
|
7
|
+
INPUT = cpp/include/ndiffusion cpp/src cpp/python
|
|
8
|
+
RECURSIVE = YES
|
|
9
|
+
FILE_PATTERNS = *.hpp *.cpp
|
|
10
|
+
EXCLUDE = build _skbuild
|
|
11
|
+
|
|
12
|
+
GENERATE_HTML = YES
|
|
13
|
+
HTML_OUTPUT = html
|
|
14
|
+
GENERATE_LATEX = NO
|
|
15
|
+
|
|
16
|
+
EXTRACT_ALL = NO
|
|
17
|
+
EXTRACT_PRIVATE = NO
|
|
18
|
+
EXTRACT_STATIC = YES
|
|
19
|
+
|
|
20
|
+
JAVADOC_AUTOBRIEF = YES
|
|
21
|
+
QT_AUTOBRIEF = NO
|
|
22
|
+
MULTILINE_CPP_IS_BRIEF = NO
|
|
23
|
+
|
|
24
|
+
WARN_IF_UNDOCUMENTED = YES
|
|
25
|
+
WARN_NO_PARAMDOC = YES
|
|
26
|
+
|
|
27
|
+
QUIET = YES
|
|
28
|
+
WARNINGS = YES
|
ndiffusion-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ben Whewell
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|