ants-sn 0.3.1__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.
Files changed (116) hide show
  1. ants_sn-0.3.1/CHANGELOG.md +97 -0
  2. ants_sn-0.3.1/LICENSE +7 -0
  3. ants_sn-0.3.1/MANIFEST.in +4 -0
  4. ants_sn-0.3.1/PKG-INFO +202 -0
  5. ants_sn-0.3.1/README.md +152 -0
  6. ants_sn-0.3.1/ants/__init__.py +143 -0
  7. ants_sn-0.3.1/ants/benchmarks/__init__.py +10 -0
  8. ants_sn-0.3.1/ants/benchmarks/icsbep.py +259 -0
  9. ants_sn-0.3.1/ants/benchmarks/icsbep_data/__init__.py +31 -0
  10. ants_sn-0.3.1/ants/benchmarks/icsbep_data/heu_met_fast.py +92 -0
  11. ants_sn-0.3.1/ants/benchmarks/icsbep_data/pu_met_fast.py +138 -0
  12. ants_sn-0.3.1/ants/benchmarks/icsbep_data/u233_met_fast.py +63 -0
  13. ants_sn-0.3.1/ants/benchmarks/kobayashi.py +306 -0
  14. ants_sn-0.3.1/ants/boundary1d.pyx +122 -0
  15. ants_sn-0.3.1/ants/boundary2d.pyx +206 -0
  16. ants_sn-0.3.1/ants/constants.py +61 -0
  17. ants_sn-0.3.1/ants/critical1d.pyx +489 -0
  18. ants_sn-0.3.1/ants/critical2d.pyx +537 -0
  19. ants_sn-0.3.1/ants/cytools_1d.pxd +265 -0
  20. ants_sn-0.3.1/ants/cytools_1d.pyx +1050 -0
  21. ants_sn-0.3.1/ants/cytools_2d.pxd +332 -0
  22. ants_sn-0.3.1/ants/cytools_2d.pyx +1561 -0
  23. ants_sn-0.3.1/ants/cytools_3d.pxd +112 -0
  24. ants_sn-0.3.1/ants/cytools_3d.pyx +367 -0
  25. ants_sn-0.3.1/ants/cytools_shared.pxd +98 -0
  26. ants_sn-0.3.1/ants/cytools_shared.pyx +280 -0
  27. ants_sn-0.3.1/ants/data/__init__.py +10 -0
  28. ants_sn-0.3.1/ants/data/energy/__init__.py +685 -0
  29. ants_sn-0.3.1/ants/data/energy/_njoy.py +10247 -0
  30. ants_sn-0.3.1/ants/data/energy/_serpent.py +5257 -0
  31. ants_sn-0.3.1/ants/data/external.py +130 -0
  32. ants_sn-0.3.1/ants/datatypes.py +741 -0
  33. ants_sn-0.3.1/ants/external1d.pyx +159 -0
  34. ants_sn-0.3.1/ants/external2d.pyx +106 -0
  35. ants_sn-0.3.1/ants/fixed1d.pyx +214 -0
  36. ants_sn-0.3.1/ants/fixed2d.pyx +475 -0
  37. ants_sn-0.3.1/ants/fixed3d.pyx +481 -0
  38. ants_sn-0.3.1/ants/hybrid1d.pyx +534 -0
  39. ants_sn-0.3.1/ants/hybrid2d.pyx +852 -0
  40. ants_sn-0.3.1/ants/library.py +299 -0
  41. ants_sn-0.3.1/ants/main.py +597 -0
  42. ants_sn-0.3.1/ants/materials.py +666 -0
  43. ants_sn-0.3.1/ants/multi_group_1d.pxd +86 -0
  44. ants_sn-0.3.1/ants/multi_group_1d.pyx +796 -0
  45. ants_sn-0.3.1/ants/multi_group_2d.pxd +120 -0
  46. ants_sn-0.3.1/ants/multi_group_2d.pyx +926 -0
  47. ants_sn-0.3.1/ants/multi_group_3d.pxd +71 -0
  48. ants_sn-0.3.1/ants/multi_group_3d.pyx +693 -0
  49. ants_sn-0.3.1/ants/nearby1d.pyx +613 -0
  50. ants_sn-0.3.1/ants/nearby2d.pyx +828 -0
  51. ants_sn-0.3.1/ants/openmp_status.pyx +28 -0
  52. ants_sn-0.3.1/ants/parameters.pxd +173 -0
  53. ants_sn-0.3.1/ants/parameters.pyx +291 -0
  54. ants_sn-0.3.1/ants/quadrature.py +727 -0
  55. ants_sn-0.3.1/ants/spatial_sweep_1d.pxd +64 -0
  56. ants_sn-0.3.1/ants/spatial_sweep_1d.pyx +813 -0
  57. ants_sn-0.3.1/ants/spatial_sweep_2d.pxd +80 -0
  58. ants_sn-0.3.1/ants/spatial_sweep_2d.pyx +840 -0
  59. ants_sn-0.3.1/ants/spatial_sweep_3d.pxd +90 -0
  60. ants_sn-0.3.1/ants/spatial_sweep_3d.pyx +634 -0
  61. ants_sn-0.3.1/ants/timed1d.pyx +478 -0
  62. ants_sn-0.3.1/ants/timed2d.pyx +810 -0
  63. ants_sn-0.3.1/ants/utils/__init__.py +0 -0
  64. ants_sn-0.3.1/ants/utils/hybrid.py +286 -0
  65. ants_sn-0.3.1/ants/utils/interp1d.pyx +612 -0
  66. ants_sn-0.3.1/ants/utils/interp2d.pyx +916 -0
  67. ants_sn-0.3.1/ants/utils/interp3d.pyx +1115 -0
  68. ants_sn-0.3.1/ants/utils/manufactured_1d.py +80 -0
  69. ants_sn-0.3.1/ants/utils/manufactured_2d.py +93 -0
  70. ants_sn-0.3.1/ants/utils/mesh2d.py +512 -0
  71. ants_sn-0.3.1/ants/utils/pytools.py +668 -0
  72. ants_sn-0.3.1/ants/utils/sources.py +216 -0
  73. ants_sn-0.3.1/ants/vhybrid1d.pyx +585 -0
  74. ants_sn-0.3.1/ants/vhybrid2d.pyx +655 -0
  75. ants_sn-0.3.1/ants_sn.egg-info/PKG-INFO +202 -0
  76. ants_sn-0.3.1/ants_sn.egg-info/SOURCES.txt +114 -0
  77. ants_sn-0.3.1/ants_sn.egg-info/dependency_links.txt +1 -0
  78. ants_sn-0.3.1/ants_sn.egg-info/requires.txt +27 -0
  79. ants_sn-0.3.1/ants_sn.egg-info/top_level.txt +1 -0
  80. ants_sn-0.3.1/pyproject.toml +131 -0
  81. ants_sn-0.3.1/setup.cfg +4 -0
  82. ants_sn-0.3.1/setup.py +84 -0
  83. ants_sn-0.3.1/tests/test_angular_ordering.py +267 -0
  84. ants_sn-0.3.1/tests/test_anisotropic_1d.py +592 -0
  85. ants_sn-0.3.1/tests/test_anisotropic_2d.py +492 -0
  86. ants_sn-0.3.1/tests/test_anisotropic_3d.py +187 -0
  87. ants_sn-0.3.1/tests/test_artificial_scattering.py +398 -0
  88. ants_sn-0.3.1/tests/test_compact_sources.py +297 -0
  89. ants_sn-0.3.1/tests/test_criticality_1d.py +294 -0
  90. ants_sn-0.3.1/tests/test_criticality_2d.py +450 -0
  91. ants_sn-0.3.1/tests/test_dimensions_2d.py +182 -0
  92. ants_sn-0.3.1/tests/test_energy_structures.py +174 -0
  93. ants_sn-0.3.1/tests/test_fixed_source_1d.py +197 -0
  94. ants_sn-0.3.1/tests/test_fixed_source_2d.py +227 -0
  95. ants_sn-0.3.1/tests/test_fixed_source_3d.py +534 -0
  96. ants_sn-0.3.1/tests/test_hybrid_1d.py +486 -0
  97. ants_sn-0.3.1/tests/test_hybrid_2d.py +408 -0
  98. ants_sn-0.3.1/tests/test_icsbep.py +106 -0
  99. ants_sn-0.3.1/tests/test_interp1d.py +253 -0
  100. ants_sn-0.3.1/tests/test_interp2d.py +322 -0
  101. ants_sn-0.3.1/tests/test_interp3d.py +309 -0
  102. ants_sn-0.3.1/tests/test_kobayashi.py +101 -0
  103. ants_sn-0.3.1/tests/test_materials.py +275 -0
  104. ants_sn-0.3.1/tests/test_medium_map.py +212 -0
  105. ants_sn-0.3.1/tests/test_nearby_1d.py +259 -0
  106. ants_sn-0.3.1/tests/test_nearby_2d.py +247 -0
  107. ants_sn-0.3.1/tests/test_notebooks.py +53 -0
  108. ants_sn-0.3.1/tests/test_parallel_sweep.py +563 -0
  109. ants_sn-0.3.1/tests/test_spatial_accuracy_1d.py +169 -0
  110. ants_sn-0.3.1/tests/test_spatial_accuracy_2d.py +257 -0
  111. ants_sn-0.3.1/tests/test_spatial_accuracy_3d.py +138 -0
  112. ants_sn-0.3.1/tests/test_time_accuracy_1d.py +330 -0
  113. ants_sn-0.3.1/tests/test_time_accuracy_2d.py +391 -0
  114. ants_sn-0.3.1/tests/test_time_dependent_1d.py +89 -0
  115. ants_sn-0.3.1/tests/test_vhybrid_1d.py +666 -0
  116. ants_sn-0.3.1/tests/test_vhybrid_2d.py +740 -0
@@ -0,0 +1,97 @@
1
+ # Changelog
2
+
3
+ ## 0.3.1 (2026-11-08)
4
+
5
+ ### Added
6
+ - ANTS is on PyPI as `ants-sn` (`pip install ants-sn`). Wheels are built for
7
+ CPython 3.11-3.14 on Linux (x86_64 and aarch64), macOS 15 or newer (arm64
8
+ and x86_64), and Windows (x86_64), so no compiler is needed. The package is
9
+ still imported as `ants`.
10
+
11
+ ### Changed
12
+ - The distribution is named `ants-sn` (was `ants`). Run `pip uninstall ants`
13
+ before installing `ants-sn` over an earlier source install.
14
+ - The wheels are built without `-march=native` so they run on any CPU. Source
15
+ builds still use it and can be a little faster.
16
+
17
+ ## 0.3.0 (2026-11-08)
18
+
19
+ ### Added
20
+ - Three-dimensional fixed source problems with `ants.fixed3d.fixed_source`
21
+ and `Geometry.SLAB3D`. Supports step, diamond difference, and step
22
+ characteristic differencing, source iteration and DMD, anisotropic
23
+ scattering, artificial scattering, the angular flux and cell edge fluxes,
24
+ and angle and group parallelism. New inputs are `GeometryData.delta_z`,
25
+ `GeometryData.bc_z`, and `SourceData.boundary_z`, with `angular_xyz` for
26
+ the quadrature.
27
+ - `ants.spatial3d`, `ants.extrude3d`, and `ants.weight_spatial3d` for 3D
28
+ medium maps. `weight_spatial2d` takes `chi` and `decimals`.
29
+ - Kobayashi 3D benchmarks (problems 1-3 with reference fluxes) in
30
+ `ants.benchmarks.kobayashi`, and the dog leg example
31
+ `examples/fixed_source_3d_kobayashi.py`.
32
+ - Artificial scattering (as-SN) for 2D fixed source, time-dependent, and
33
+ hybrid problems, set with `SolverData.sigma_as` and `beta_as`. The kernel
34
+ follows Frank et al. (2020) and uses the ordinates of the full sphere, so a
35
+ 2D problem has the same artificial scattering as a 3D problem that does
36
+ not change in z. The outer iterations stop when the scalar flux changes by
37
+ less than `tol_energy` and warn when they reach `max_iter_angular`.
38
+ - Anisotropic scattering in 1D and 2D for the fixed source, criticality,
39
+ time-dependent, and nearby problems. The Legendre moments go on a last
40
+ axis of `MaterialData.scatter`. `legendre_polynomials`,
41
+ `spherical_harmonics`, and the related helpers are in `ants.quadrature`.
42
+ - Fission spectra with `MaterialData.chi` in all solvers.
43
+ - Step characteristic differencing in 2D.
44
+ - `CompactSource` for external and boundary sources that only take a few
45
+ distinct values, in the 1D and 2D solvers.
46
+ - `TimeDependentData.save_to_file` writes the scalar flux of each time step
47
+ to a memory-mapped `.npy` file instead of keeping it in memory.
48
+ - Group parallel sweeps with `SolverData.parallel` (`ParallelType.ANGLE`,
49
+ `GROUP`, or `BOTH`). The group sweeps run without the GIL.
50
+ - Cross sections from HDF5 multigroup libraries with `ants.Library` and the
51
+ `library` argument of `ants.materials`, with `parse_composition`,
52
+ `create_material`, `combine_materials`, and `named_material`. Needs the
53
+ `library` extra.
54
+ - NJOY and Serpent energy group structures (`ants.list_structures`,
55
+ `ants.get_structure`) and the AmBe source spectrum.
56
+ - ICSBEP fast metal benchmarks (`ants.list_benchmarks`,
57
+ `ants.get_benchmark`, `ants.run_suite`) and `examples/icsbep_suite.py`.
58
+ - `ants.utils.interp3d`. `interp1d` and `interp2d` are now written in
59
+ Cython.
60
+ - `python -m ants.utils.mesh2d` to generate or resize 2D weight matrices.
61
+ - Warnings when an iteration reaches its maximum without converging, and an
62
+ error for an invalid k-effective.
63
+ - Example notebooks and hosted documentation at
64
+ https://bwhewe-13.github.io/ants/.
65
+
66
+ ### Changed
67
+ - Python 3.11 or newer is required (was 3.9). Python 3.13 and 3.14 are
68
+ supported.
69
+ - `energy_grid` returns edges in eV and in descending order for every grid
70
+ (the 618 group grid was in MeV) and also takes structure names. The
71
+ integer grids 361 and 618 are the SHEM-361 and LANL-618 structures, and
72
+ 87 needs the local `ants/sources/` data.
73
+ - `nearby1d` and `nearby2d` take the same dataclass inputs as the other
74
+ solvers.
75
+ - `artificial_scatter_matrix` uses the number of ordinates on the full
76
+ sphere (`2 N**2` for `angular_xy(N)`), which narrows the kernel for the
77
+ same `beta_as`. `beta_as=9` gives about the old amount of smoothing. Pass
78
+ `angle_z` for 3D sets.
79
+ - The criticality solvers start from a seeded initial flux, so runs are
80
+ reproducible.
81
+ - The quadrature helpers moved to `ants.quadrature`. They can still be
82
+ imported from `ants`.
83
+ - The regions in `spatial1d` can have negative coordinates.
84
+ - Time-dependent boundary sources only hold the incoming angles, so the
85
+ angle dimension is `angles // 2` instead of `angles`.
86
+
87
+ ### Fixed
88
+ - The 2D solvers gave a wrong angular flux, cell edge flux, or
89
+ time-dependent flux when the quadrature was not ordered for the
90
+ reflecting boundaries, for example `angular_xy(N)` without `bc_x` and
91
+ `bc_y`. They now raise an error. The scalar flux of a fixed source or
92
+ criticality problem does not depend on the order.
93
+ - The sign of tau in the 1D step characteristic sweep, and the radii of
94
+ non-uniform sphere meshes.
95
+ - Step characteristic gave NaN in void cells.
96
+ - The 1D and 2D sweeps used single precision for some coefficients.
97
+ - A bug in the 1D DMD solver and a bug in `interp2d`.
ants_sn-0.3.1/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2026 Ben Whewell
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include CHANGELOG.md
2
+ recursive-include ants *.pyx *.pxd
3
+ prune ants/sources
4
+ global-exclude *.c *.cpp *.so *.pyd *.dylib *.py[cod] __pycache__
ants_sn-0.3.1/PKG-INFO ADDED
@@ -0,0 +1,202 @@
1
+ Metadata-Version: 2.4
2
+ Name: ants-sn
3
+ Version: 0.3.1
4
+ Summary: Discrete ordinates (S_N) neutron transport in Cython
5
+ Author-email: Ben Whewell <ben.whewell@pm.me>
6
+ License-Expression: MIT
7
+ Project-URL: Documentation, https://bwhewe-13.github.io/ants/
8
+ Project-URL: Source, https://github.com/bwhewe-13/ants
9
+ Project-URL: Changelog, https://github.com/bwhewe-13/ants/blob/main/CHANGELOG.md
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Operating System :: MacOS
13
+ Classifier: Operating System :: Microsoft :: Windows
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Cython
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Scientific/Engineering :: Physics
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: cython
26
+ Requires-Dist: numpy
27
+ Requires-Dist: scipy
28
+ Requires-Dist: tqdm
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest; extra == "dev"
31
+ Requires-Dist: pytest-xdist; extra == "dev"
32
+ Requires-Dist: pytest-cov; extra == "dev"
33
+ Requires-Dist: black; extra == "dev"
34
+ Requires-Dist: isort; extra == "dev"
35
+ Requires-Dist: flake8; extra == "dev"
36
+ Requires-Dist: pre-commit; extra == "dev"
37
+ Requires-Dist: nbclient; extra == "dev"
38
+ Requires-Dist: ipykernel; extra == "dev"
39
+ Requires-Dist: matplotlib; extra == "dev"
40
+ Provides-Extra: library
41
+ Requires-Dist: h5py; extra == "library"
42
+ Provides-Extra: docs
43
+ Requires-Dist: sphinx; extra == "docs"
44
+ Requires-Dist: sphinxcontrib-bibtex; extra == "docs"
45
+ Requires-Dist: sphinxcontrib-tikz; extra == "docs"
46
+ Requires-Dist: pydata-sphinx-theme; extra == "docs"
47
+ Requires-Dist: nbsphinx; extra == "docs"
48
+ Requires-Dist: ipython; extra == "docs"
49
+ Dynamic: license-file
50
+
51
+ <picture>
52
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/bwhewe-13/ants/main/docs/_static/logo-dark.svg">
53
+ <img alt="ants" src="https://raw.githubusercontent.com/bwhewe-13/ants/main/docs/_static/logo.svg" width="202">
54
+ </picture>
55
+
56
+ [![Python Versions](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue)](https://pypi.org/project/ants-sn/)
57
+ [![Style](https://img.shields.io/github/actions/workflow/status/bwhewe-13/ants/ci.yml?label=Style)](https://github.com/bwhewe-13/ants/actions/workflows/ci.yml)
58
+ [![Tests](https://img.shields.io/github/actions/workflow/status/bwhewe-13/ants/tests.yml?label=Tests)](https://github.com/bwhewe-13/ants/actions/workflows/tests.yml)
59
+ [![Coverage](https://codecov.io/gh/bwhewe-13/ants/graph/badge.svg)](https://codecov.io/gh/bwhewe-13/ants)
60
+ [![Docs](https://img.shields.io/github/actions/workflow/status/bwhewe-13/ants/docs.yml?label=Docs)](https://bwhewe-13.github.io/ants/)
61
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
62
+
63
+ A Neutron Transport Solution (ANTS) calculates the neutron flux for both criticality and fixed source problems of one dimensional slabs and spheres and two dimensional slabs, and fixed source problems of three dimensional slabs, using the discrete ordinates method and written in Cython.
64
+
65
+ There are a number of different acceleration methods used including a collision-based hybrid method, machine learning models to predict matrix-vector multiplication, dynamic mode decomposition, and synthetic diffusion acceleration (DSA).
66
+
67
+ There are also verification procedures to ensure both the code and solutions are correct. For code verification, manufactured solutions are used for one-, two-, and three-dimensional slab problems to ensure proper discretization. Solution verification uses the method of nearby problems, which uses one spatial grid.
68
+
69
+ 📖 **Documentation:** The full ANTS documentation is hosted online at [bwhewe-13.github.io/ants](https://bwhewe-13.github.io/ants/).
70
+
71
+ &nbsp;
72
+
73
+ ## Installation
74
+
75
+ ### Requirements
76
+ - Python 3.11+
77
+ - For source builds, a C/C++ compiler and OpenMP (included on Linux, `brew install libomp`
78
+ on macOS)
79
+
80
+ ### Install from PyPI
81
+ ```bash
82
+ python -m pip install ants-sn
83
+ ```
84
+ The package is imported as `ants`. Wheels are built for Linux, macOS, and Windows, so
85
+ no compiler is needed.
86
+
87
+ ### Install from source
88
+ ```bash
89
+ python -m pip install --upgrade pip
90
+ python -m pip install .
91
+ ```
92
+
93
+ ### Install for development (tests + style)
94
+ ```bash
95
+ python -m pip install --upgrade pip
96
+ python -m pip install -e ".[dev]"
97
+ ```
98
+
99
+ ### Cross section libraries
100
+ Cross sections are built from HDF5 multigroup libraries of microscopic cross sections
101
+ (layout in `ants/library.py`), which requires the `library` extra:
102
+ ```bash
103
+ python -m pip install "ants-sn[library]"
104
+ ```
105
+ The standard NJOY and Serpent energy group structures (`ants.list_structures()`) and
106
+ ICSBEP benchmark specifications (`ants.list_benchmarks()`) are included with ANTS.
107
+
108
+ ### Enable pre-commit hooks
109
+ ```bash
110
+ pre-commit install
111
+ ```
112
+
113
+ ## Running ANTS
114
+
115
+ Run one of the provided examples from the repository root:
116
+
117
+ ```bash
118
+ python examples/fixed_source_1d_reeds.py
119
+ python examples/critical_1d_uranium_slab.py
120
+ python examples/icsbep_suite.py path/to/library.h5
121
+ ```
122
+
123
+ ## Testing, Coverage, and Docs
124
+
125
+ ### Run tests
126
+ ```bash
127
+ pytest tests
128
+ ```
129
+
130
+ ### Run smoke tests (quick check)
131
+ ```bash
132
+ pytest tests -m smoke
133
+ ```
134
+
135
+ ### Generate coverage locally
136
+ ```bash
137
+ pytest tests --cov=ants --cov-report=term --cov-report=xml
138
+ ```
139
+
140
+ ### Run formatting and lint checks locally
141
+ ```bash
142
+ pre-commit run --all-files
143
+ ```
144
+
145
+ ### Documentation
146
+ The full documentation is hosted online at [bwhewe-13.github.io/ants](https://bwhewe-13.github.io/ants/). To build it locally:
147
+ ```bash
148
+ python -m pip install sphinx sphinxcontrib-bibtex sphinxcontrib-tikz
149
+ make -C docs html
150
+ ```
151
+
152
+ &nbsp;
153
+
154
+ ## One Dimensional Features
155
+ | Spatial Discretization | Temporal Discretization | Multigroup Solve | K-Eigenvalue Solve |
156
+ |---------------------------|----------------------------|---------------------------|-------------------------|
157
+ | &#9745; Step Method | &#9745; Backward Euler | &#9745; Source Iteration | &#9745; Power Iteration |
158
+ | &#9745; Diamond Difference | &#9745; BDF2 | &#9744; DSA | &#9744; DJINN |
159
+ | &#9745; Step Characteristic | &#9745; Crank-Nicolson | &#9745; DMD | &#9745; DMD |
160
+ | &#9744; Discontinuous Galerkin| &#9745; TR - BDF2 | &#9744; GMRES | &#9744; Davidson Method |
161
+
162
+ &nbsp;
163
+
164
+ ## Two Dimensional Features
165
+ | Spatial Discretization | Temporal Discretization | Multigroup Solve | K-Eigenvalue Solve |
166
+ |---------------------------|----------------------------|---------------------------|-------------------------|
167
+ | &#9745; Step Method | &#9745; Backward Euler | &#9745; Source Iteration | &#9745; Power Iteration |
168
+ | &#9745; Diamond Difference | &#9745; BDF2 | &#9744; DSA | &#9745; DMD |
169
+ | &#9745; Step Characteristic | &#9745; Crank-Nicolson | &#9745; DMD | &#9744; Davidson Method |
170
+ | &#9744; Discontinuous Galerkin| &#9745; TR - BDF2 | &#9744; GMRES | |
171
+
172
+ &nbsp;
173
+
174
+ ## Three Dimensional Features
175
+ | Spatial Discretization | Temporal Discretization | Multigroup Solve | K-Eigenvalue Solve |
176
+ |---------------------------|----------------------------|---------------------------|-------------------------|
177
+ | &#9745; Step Method | &#9744; Backward Euler | &#9745; Source Iteration | &#9744; Power Iteration |
178
+ | &#9745; Diamond Difference | &#9744; BDF2 | &#9744; DSA | &#9744; DMD |
179
+ | &#9745; Step Characteristic | &#9744; Crank-Nicolson | &#9745; DMD | &#9744; Davidson Method |
180
+ | &#9744; Discontinuous Galerkin| &#9744; TR - BDF2 | &#9744; GMRES | |
181
+
182
+ &nbsp;
183
+
184
+ ## Code and Solution Verification
185
+ - &#9744; Spatial Method of Manufactured Solutions (1D/2D/3D)
186
+ - &#9745; &#9745; &#9745; Step Method
187
+ - &#9745; &#9745; &#9745; Diamond Difference
188
+ - &#9745; &#9745; &#9745; Step Characteristics
189
+ - &#9744; &#9744; &#9744; Discontinuous Galerkin
190
+ - &#9745; Temporal Method of Manufactured Solutions
191
+ - &#9745; &#9745; Backward Euler
192
+ - &#9745; &#9745; BDF2
193
+ - &#9745; &#9745; Crank-Nicolson
194
+ - &#9745; &#9745; TR - BDF2
195
+ - &#9745; &#9745; Criticality Benchmarks \
196
+ (Analytical Benchmark Test Set for Criticality Code Verification, Sood et al)
197
+ - &#9745; ICSBEP Fast Metal Benchmarks (1D)
198
+ - &#9745; Kobayashi Benchmarks (3D) \
199
+ (3-D Radiation Transport Benchmark Problems and Results for Simple Geometries with Void Regions, Kobayashi et al)
200
+ - &#9745; &#9745; Method of Nearby Problems (MNP)
201
+
202
+ &nbsp;
@@ -0,0 +1,152 @@
1
+ <picture>
2
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/bwhewe-13/ants/main/docs/_static/logo-dark.svg">
3
+ <img alt="ants" src="https://raw.githubusercontent.com/bwhewe-13/ants/main/docs/_static/logo.svg" width="202">
4
+ </picture>
5
+
6
+ [![Python Versions](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue)](https://pypi.org/project/ants-sn/)
7
+ [![Style](https://img.shields.io/github/actions/workflow/status/bwhewe-13/ants/ci.yml?label=Style)](https://github.com/bwhewe-13/ants/actions/workflows/ci.yml)
8
+ [![Tests](https://img.shields.io/github/actions/workflow/status/bwhewe-13/ants/tests.yml?label=Tests)](https://github.com/bwhewe-13/ants/actions/workflows/tests.yml)
9
+ [![Coverage](https://codecov.io/gh/bwhewe-13/ants/graph/badge.svg)](https://codecov.io/gh/bwhewe-13/ants)
10
+ [![Docs](https://img.shields.io/github/actions/workflow/status/bwhewe-13/ants/docs.yml?label=Docs)](https://bwhewe-13.github.io/ants/)
11
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
12
+
13
+ A Neutron Transport Solution (ANTS) calculates the neutron flux for both criticality and fixed source problems of one dimensional slabs and spheres and two dimensional slabs, and fixed source problems of three dimensional slabs, using the discrete ordinates method and written in Cython.
14
+
15
+ There are a number of different acceleration methods used including a collision-based hybrid method, machine learning models to predict matrix-vector multiplication, dynamic mode decomposition, and synthetic diffusion acceleration (DSA).
16
+
17
+ There are also verification procedures to ensure both the code and solutions are correct. For code verification, manufactured solutions are used for one-, two-, and three-dimensional slab problems to ensure proper discretization. Solution verification uses the method of nearby problems, which uses one spatial grid.
18
+
19
+ 📖 **Documentation:** The full ANTS documentation is hosted online at [bwhewe-13.github.io/ants](https://bwhewe-13.github.io/ants/).
20
+
21
+ &nbsp;
22
+
23
+ ## Installation
24
+
25
+ ### Requirements
26
+ - Python 3.11+
27
+ - For source builds, a C/C++ compiler and OpenMP (included on Linux, `brew install libomp`
28
+ on macOS)
29
+
30
+ ### Install from PyPI
31
+ ```bash
32
+ python -m pip install ants-sn
33
+ ```
34
+ The package is imported as `ants`. Wheels are built for Linux, macOS, and Windows, so
35
+ no compiler is needed.
36
+
37
+ ### Install from source
38
+ ```bash
39
+ python -m pip install --upgrade pip
40
+ python -m pip install .
41
+ ```
42
+
43
+ ### Install for development (tests + style)
44
+ ```bash
45
+ python -m pip install --upgrade pip
46
+ python -m pip install -e ".[dev]"
47
+ ```
48
+
49
+ ### Cross section libraries
50
+ Cross sections are built from HDF5 multigroup libraries of microscopic cross sections
51
+ (layout in `ants/library.py`), which requires the `library` extra:
52
+ ```bash
53
+ python -m pip install "ants-sn[library]"
54
+ ```
55
+ The standard NJOY and Serpent energy group structures (`ants.list_structures()`) and
56
+ ICSBEP benchmark specifications (`ants.list_benchmarks()`) are included with ANTS.
57
+
58
+ ### Enable pre-commit hooks
59
+ ```bash
60
+ pre-commit install
61
+ ```
62
+
63
+ ## Running ANTS
64
+
65
+ Run one of the provided examples from the repository root:
66
+
67
+ ```bash
68
+ python examples/fixed_source_1d_reeds.py
69
+ python examples/critical_1d_uranium_slab.py
70
+ python examples/icsbep_suite.py path/to/library.h5
71
+ ```
72
+
73
+ ## Testing, Coverage, and Docs
74
+
75
+ ### Run tests
76
+ ```bash
77
+ pytest tests
78
+ ```
79
+
80
+ ### Run smoke tests (quick check)
81
+ ```bash
82
+ pytest tests -m smoke
83
+ ```
84
+
85
+ ### Generate coverage locally
86
+ ```bash
87
+ pytest tests --cov=ants --cov-report=term --cov-report=xml
88
+ ```
89
+
90
+ ### Run formatting and lint checks locally
91
+ ```bash
92
+ pre-commit run --all-files
93
+ ```
94
+
95
+ ### Documentation
96
+ The full documentation is hosted online at [bwhewe-13.github.io/ants](https://bwhewe-13.github.io/ants/). To build it locally:
97
+ ```bash
98
+ python -m pip install sphinx sphinxcontrib-bibtex sphinxcontrib-tikz
99
+ make -C docs html
100
+ ```
101
+
102
+ &nbsp;
103
+
104
+ ## One Dimensional Features
105
+ | Spatial Discretization | Temporal Discretization | Multigroup Solve | K-Eigenvalue Solve |
106
+ |---------------------------|----------------------------|---------------------------|-------------------------|
107
+ | &#9745; Step Method | &#9745; Backward Euler | &#9745; Source Iteration | &#9745; Power Iteration |
108
+ | &#9745; Diamond Difference | &#9745; BDF2 | &#9744; DSA | &#9744; DJINN |
109
+ | &#9745; Step Characteristic | &#9745; Crank-Nicolson | &#9745; DMD | &#9745; DMD |
110
+ | &#9744; Discontinuous Galerkin| &#9745; TR - BDF2 | &#9744; GMRES | &#9744; Davidson Method |
111
+
112
+ &nbsp;
113
+
114
+ ## Two Dimensional Features
115
+ | Spatial Discretization | Temporal Discretization | Multigroup Solve | K-Eigenvalue Solve |
116
+ |---------------------------|----------------------------|---------------------------|-------------------------|
117
+ | &#9745; Step Method | &#9745; Backward Euler | &#9745; Source Iteration | &#9745; Power Iteration |
118
+ | &#9745; Diamond Difference | &#9745; BDF2 | &#9744; DSA | &#9745; DMD |
119
+ | &#9745; Step Characteristic | &#9745; Crank-Nicolson | &#9745; DMD | &#9744; Davidson Method |
120
+ | &#9744; Discontinuous Galerkin| &#9745; TR - BDF2 | &#9744; GMRES | |
121
+
122
+ &nbsp;
123
+
124
+ ## Three Dimensional Features
125
+ | Spatial Discretization | Temporal Discretization | Multigroup Solve | K-Eigenvalue Solve |
126
+ |---------------------------|----------------------------|---------------------------|-------------------------|
127
+ | &#9745; Step Method | &#9744; Backward Euler | &#9745; Source Iteration | &#9744; Power Iteration |
128
+ | &#9745; Diamond Difference | &#9744; BDF2 | &#9744; DSA | &#9744; DMD |
129
+ | &#9745; Step Characteristic | &#9744; Crank-Nicolson | &#9745; DMD | &#9744; Davidson Method |
130
+ | &#9744; Discontinuous Galerkin| &#9744; TR - BDF2 | &#9744; GMRES | |
131
+
132
+ &nbsp;
133
+
134
+ ## Code and Solution Verification
135
+ - &#9744; Spatial Method of Manufactured Solutions (1D/2D/3D)
136
+ - &#9745; &#9745; &#9745; Step Method
137
+ - &#9745; &#9745; &#9745; Diamond Difference
138
+ - &#9745; &#9745; &#9745; Step Characteristics
139
+ - &#9744; &#9744; &#9744; Discontinuous Galerkin
140
+ - &#9745; Temporal Method of Manufactured Solutions
141
+ - &#9745; &#9745; Backward Euler
142
+ - &#9745; &#9745; BDF2
143
+ - &#9745; &#9745; Crank-Nicolson
144
+ - &#9745; &#9745; TR - BDF2
145
+ - &#9745; &#9745; Criticality Benchmarks \
146
+ (Analytical Benchmark Test Set for Criticality Code Verification, Sood et al)
147
+ - &#9745; ICSBEP Fast Metal Benchmarks (1D)
148
+ - &#9745; Kobayashi Benchmarks (3D) \
149
+ (3-D Radiation Transport Benchmark Problems and Results for Simple Geometries with Void Regions, Kobayashi et al)
150
+ - &#9745; &#9745; Method of Nearby Problems (MNP)
151
+
152
+ &nbsp;
@@ -0,0 +1,143 @@
1
+ ########################################################################
2
+ # ___ _ _____________
3
+ # / | / | / /_ __/ ___/
4
+ # / /| | / |/ / / / \__ \
5
+ # / ___ |/ /| / / / ___/ /
6
+ # /_/ |_/_/ |_/ /_/ /____/
7
+ #
8
+ ########################################################################
9
+
10
+ """Public package interface for ANTS.
11
+
12
+ This module exposes the most commonly used datatypes and helper functions at
13
+ the package level while loading submodules lazily to reduce import overhead and
14
+ avoid unnecessary import-time coupling.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ from importlib import import_module
20
+ from importlib.metadata import PackageNotFoundError, version
21
+
22
+ _MODULE_EXPORTS = (
23
+ "boundary1d",
24
+ "boundary2d",
25
+ "external1d",
26
+ "external2d",
27
+ )
28
+
29
+ _DATATYPE_EXPORTS = (
30
+ "GeometryData",
31
+ "HybridData",
32
+ "MaterialData",
33
+ "QuadratureData",
34
+ "SolverData",
35
+ "TimeDependentData",
36
+ )
37
+
38
+ _QUADRATURE_EXPORTS = (
39
+ "_angular_x",
40
+ "_angular_xy",
41
+ "_angular_xyz",
42
+ "angular_x",
43
+ "angular_xy",
44
+ "angular_xyz",
45
+ "artificial_scatter_matrix",
46
+ "harmonic_data",
47
+ "harmonic_degrees",
48
+ "legendre_data",
49
+ "legendre_polynomials",
50
+ "spherical_harmonics",
51
+ )
52
+
53
+ _ENERGY_EXPORTS = (
54
+ "get_structure",
55
+ "list_structures",
56
+ )
57
+
58
+ _LIBRARY_EXPORTS = ("Library",)
59
+
60
+ _BENCHMARK_EXPORTS = (
61
+ "build_problem",
62
+ "get_benchmark",
63
+ "list_benchmarks",
64
+ "run_suite",
65
+ )
66
+
67
+ _MAIN_EXPORTS = (
68
+ "_energy_grid",
69
+ "energy_grid",
70
+ "energy_velocity",
71
+ "extrude3d",
72
+ "gamma_time_steps",
73
+ "spatial1d",
74
+ "spatial2d",
75
+ "spatial3d",
76
+ "weight_matrix2d",
77
+ "weight_spatial2d",
78
+ "weight_spatial3d",
79
+ )
80
+
81
+ _MATERIAL_EXPORTS = (
82
+ "combine_materials",
83
+ "create_material",
84
+ "materials",
85
+ "named_material",
86
+ "normalize_nuclide",
87
+ "parse_composition",
88
+ )
89
+
90
+ __all__ = [
91
+ "__version__",
92
+ *_MODULE_EXPORTS,
93
+ *_DATATYPE_EXPORTS,
94
+ *_QUADRATURE_EXPORTS,
95
+ *_ENERGY_EXPORTS,
96
+ *_LIBRARY_EXPORTS,
97
+ *_BENCHMARK_EXPORTS,
98
+ *_MAIN_EXPORTS,
99
+ *_MATERIAL_EXPORTS,
100
+ ]
101
+
102
+
103
+ # The materials() function shares its name with the ants.materials module,
104
+ # so bind it now; otherwise importing the module would shadow the function.
105
+ from ants.materials import materials # noqa: E402, F401
106
+
107
+
108
+ def __getattr__(name):
109
+ """Lazily resolve package-level exports from their source modules."""
110
+
111
+ if name in _MODULE_EXPORTS:
112
+ value = import_module(f".{name}", __name__)
113
+ elif name in _DATATYPE_EXPORTS:
114
+ value = getattr(import_module(".datatypes", __name__), name)
115
+ elif name in _QUADRATURE_EXPORTS:
116
+ value = getattr(import_module(".quadrature", __name__), name)
117
+ elif name in _ENERGY_EXPORTS:
118
+ value = getattr(import_module(".data.energy", __name__), name)
119
+ elif name in _LIBRARY_EXPORTS:
120
+ value = getattr(import_module(".library", __name__), name)
121
+ elif name in _BENCHMARK_EXPORTS:
122
+ value = getattr(import_module(".benchmarks.icsbep", __name__), name)
123
+ elif name in _MAIN_EXPORTS:
124
+ value = getattr(import_module(".main", __name__), name)
125
+ elif name in _MATERIAL_EXPORTS:
126
+ value = getattr(import_module(".materials", __name__), name)
127
+ else:
128
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
129
+
130
+ globals()[name] = value
131
+ return value
132
+
133
+
134
+ def __dir__():
135
+ """Return dynamic module attributes for auto-completion/introspection."""
136
+
137
+ return sorted(set(globals()) | set(__all__))
138
+
139
+
140
+ try:
141
+ __version__ = version("ants-sn")
142
+ except PackageNotFoundError:
143
+ __version__ = "0.3.1"
@@ -0,0 +1,10 @@
1
+ ########################################################################
2
+ # ___ _ _____________
3
+ # / | / | / /_ __/ ___/
4
+ # / /| | / |/ / / / \__ \
5
+ # / ___ |/ /| / / / ___/ /
6
+ # /_/ |_/_/ |_/ /_/ /____/
7
+ #
8
+ # Benchmark problem specifications
9
+ #
10
+ ########################################################################