Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
202 commits
Select commit Hold shift + click to select a range
6b1b645
First commit - made a mockup of NeutronFluxProfile calculator.
OceanNuclear May 2, 2025
1e7b5fc
Added the effect of neutron multiplication, which is done by increasi…
OceanNuclear May 3, 2025
dd095b9
relocated some functions
OceanNuclear May 3, 2025
9b8b480
Ruff improvements.
OceanNuclear May 3, 2025
06db567
Decided to implement a switch case for sinh(x/sqrt(-...))=-sin(x/sqrt…
OceanNuclear May 3, 2025
0b77458
Some further progress on docstrings and equations.
OceanNuclear May 9, 2025
52033d2
WIP - pushing to save progress.
OceanNuclear Jun 4, 2025
899498b
Transcribed the one-group constant (manually solved and verified by D…
OceanNuclear Jul 13, 2025
548d6b4
Modified expression into sum-of-exponentials form, rather than sum-of…
OceanNuclear Jul 13, 2025
d202979
Added reaction rates calculations and neutron passage/escape flux.
OceanNuclear Jul 14, 2025
a5c3306
Added a unit test.
OceanNuclear Jul 14, 2025
d760149
Re-distributed where functions and classes live. Materials data relat…
OceanNuclear Oct 29, 2025
e47caa4
Added publically available data (same source as openmc), so we don't …
OceanNuclear Oct 29, 2025
c79b48b
Made the decorator in neutronics.py follow the open-closed principle …
OceanNuclear Oct 30, 2025
7b9c0a1
made the four attributes: integration_constants, l_fw_2, l_bz_2, exte…
OceanNuclear Oct 30, 2025
a0b3b57
Some quality-of-life things - _attempting_to_access attribute is made…
OceanNuclear Oct 30, 2025
5c12521
Keeping test updated.
OceanNuclear Oct 30, 2025
d26e718
Corrected the ordering of the group structure to ensure that the firs…
OceanNuclear Oct 30, 2025
b0720b6
to cm fix.
OceanNuclear Oct 30, 2025
1d927e9
ruff fix
OceanNuclear Oct 30, 2025
517872d
Quality of life things: (clarify non-scattering into 'exclude elastic…
OceanNuclear Oct 30, 2025
deb0395
Allowed source macroscopic cross-section matrix to be larger than the…
OceanNuclear Oct 31, 2025
80b47f3
Added a property 'downscatter_only' which helps quickly determine if …
OceanNuclear Oct 31, 2025
12eef5c
Clean up to make four separate dictionaries: micro_total_xs, micro_sc…
OceanNuclear Oct 31, 2025
6a50ddd
Ruff fixes.
OceanNuclear Oct 31, 2025
a11cd30
Created the scattering matrix, and tested it. Next on the to-do list:…
OceanNuclear Nov 5, 2025
7cabd78
Added the n2n_matrix the feature, and added tests.
OceanNuclear Nov 6, 2025
f72f134
Cleaned a bit up where the hypothetical 'integrate' function is used,…
OceanNuclear Nov 6, 2025
3080e66
Used numpy testing in appropriate places
OceanNuclear Nov 6, 2025
87c70d0
Ruff fix: numpy.random
OceanNuclear Nov 6, 2025
33b605b
Docstring improvements
OceanNuclear Nov 6, 2025
c3c3ec1
Added plotting function.
OceanNuclear Nov 6, 2025
02c3fd1
further improved the plotting.
OceanNuclear Nov 6, 2025
5cfcf1b
Formatting fix
OceanNuclear Nov 6, 2025
2653712
extended_boundary renamed to extended_boundary_cm
OceanNuclear Nov 6, 2025
5635a5a
Added regression test, and fixed all the little details to make the r…
OceanNuclear Nov 7, 2025
939044b
regression test fix.
OceanNuclear Nov 7, 2025
6a9388f
Regression test added - conservation in total number of neutrons (the…
OceanNuclear Nov 7, 2025
f5d814f
Added an IntegrationConstants class, which contains a validation meth…
OceanNuclear Nov 9, 2025
a843960
Made return None more explicit in some places.
OceanNuclear Nov 9, 2025
8a2b87b
self.integration_constants conversion step 1 of 3: groupwise_neutron_…
OceanNuclear Nov 9, 2025
1eb4dc7
Added d_fw and d_bz diffusion constants as attributes of NeutronFluxP…
OceanNuclear Nov 9, 2025
dfbd211
Fixed the ordering of the two arguments outputted by get_diffusion_co…
OceanNuclear Nov 9, 2025
340e54c
self.integration_constants conversion step 2 of 3: solve_group_n conv…
OceanNuclear Nov 9, 2025
ee26bb2
self.integration_constants conversion step 3 of 3: neutron current an…
OceanNuclear Nov 9, 2025
50f5de3
Fixed regression test
OceanNuclear Nov 9, 2025
7a29955
Wrote up the solver for higher order groups, not tested yet.
OceanNuclear Nov 9, 2025
e9fda82
Handled events of same-characteristic-lengths more gracefully.
OceanNuclear Nov 11, 2025
b3abf72
Added validation to warn when there's elastic upscatter, or error whe…
OceanNuclear Nov 11, 2025
2a8e250
ruff fixes.
OceanNuclear Nov 11, 2025
037e9af
Separated the in_source matrix from the scattering matrix in Material…
OceanNuclear Nov 11, 2025
2e6730e
Turned the base functions from exp(x),exp(-x) to cosh(x),sinh(x); suc…
OceanNuclear Nov 12, 2025
cb29551
Conversion from exponential basis to ((cosh/sinh)/(cos/sin)) bases co…
OceanNuclear Nov 12, 2025
beb191d
Fixed where the abs() are placed for taking the absolute value of x
OceanNuclear Nov 12, 2025
37cb8a5
renamed the integration constants' working names to something a littl…
OceanNuclear Nov 12, 2025
2fa1be5
One more regression test for now.
OceanNuclear Nov 12, 2025
ad3dd8a
Beginning removal of the _groupwise functions (because they don't nee…
OceanNuclear Nov 12, 2025
ebe6f5a
Minor change to the solve_n_group method to prep it for future (itera…
OceanNuclear Nov 12, 2025
480b29f
Completed removal of the _groupwise functions.
OceanNuclear Nov 12, 2025
f98b633
Completed one-group fission regression test.
OceanNuclear Nov 20, 2025
c941605
Updated the docs for MaterialMacroInfo parameters.
OceanNuclear Nov 20, 2025
3cfac8c
Converted from cgs to metric
OceanNuclear Nov 20, 2025
b04da55
Updated regression test to use cgs.
OceanNuclear Nov 20, 2025
673456a
Updated unit-test for checking the number of methods present.
OceanNuclear Nov 20, 2025
0fbf14d
Pre-commit ruff fix
OceanNuclear Nov 20, 2025
ad727f5
Renamed the integration_constants to coefficients (because they're no…
OceanNuclear Nov 21, 2025
ed8dca1
Removed unused constant
OceanNuclear Nov 21, 2025
8e0078e
Majority of the conversion from 2-layer model to the infinite-layer m…
OceanNuclear Nov 21, 2025
f71b7b4
Neutron flux and current are defined such that they're assumed to be …
OceanNuclear Nov 21, 2025
adb9f96
Updated docstring on Coefficients (now gives the correct use case) an…
OceanNuclear Nov 21, 2025
f3a576a
Fixed the various off-by-one errors deliberately introduced a couple …
OceanNuclear Nov 21, 2025
f5875af
Completed conversion from 2-layer model to infinite-layer model. Clea…
OceanNuclear Nov 21, 2025
d5ccff7
Added new class LayerSpecificGroupwiseConstants to encapsulate the be…
OceanNuclear Nov 22, 2025
b2ee531
Starting to fix plotting. Still need to verify that the layers' bound…
OceanNuclear Nov 22, 2025
7c26b7d
Slight name change
OceanNuclear Nov 22, 2025
fea5e0d
Finished updating the plotting function, so at the moment it works fo…
OceanNuclear Nov 22, 2025
8740a3c
Simplified the sign extraction function
OceanNuclear Nov 23, 2025
635f76a
Implemented an attribute to record the neutron energy; and changed un…
OceanNuclear Nov 23, 2025
3f285f5
Updated documentation and test
OceanNuclear Nov 23, 2025
009f2df
Slight fixes to docstring, and fix to regression test dummy energies …
OceanNuclear Nov 23, 2025
849db6a
Docstring update for heating methods
OceanNuclear Nov 23, 2025
1cf19cb
Added test to ensure integration of the heating term is done correctly.
OceanNuclear Nov 23, 2025
a7b19d7
tested units output as well.
OceanNuclear Nov 23, 2025
9341a15
Fixed the plot such that all discontinuity are minimized, and those d…
OceanNuclear Nov 23, 2025
47b7619
Does not allow higher energy bins than the incident neutron energy to…
OceanNuclear Nov 24, 2025
3cb9de6
Further modification to include a new attribute incident_neutron_grou…
OceanNuclear Nov 24, 2025
a18aeea
Removed conservation of neutrons condition entirely.
OceanNuclear Nov 24, 2025
57591be
Fix the list of conditions so it's no longer singular
OceanNuclear Nov 24, 2025
e2cbb42
Bug fixes prompted by ruff
OceanNuclear Nov 24, 2025
a5cbc54
Ruff fixes for tests too
OceanNuclear Nov 24, 2025
8785d6e
Fixed plotting zorder
OceanNuclear Nov 25, 2025
a6dfc71
Prepared for the case that allows for contains_upscatter=True, where …
OceanNuclear Nov 25, 2025
161dc53
Slightly tidied up the code that calculates the non-central cosh/sinh…
OceanNuclear Nov 25, 2025
10bc80e
Added placeholder list for summing up all of the skipped coefficients.
OceanNuclear Nov 25, 2025
3b76e36
slightly modified validate_length to allow for second+ passes to have…
OceanNuclear Dec 16, 2025
6dd5f3e
Put the cosh-sinh/cos-sin switching logic into dedicated methods, so …
OceanNuclear Dec 16, 2025
93c19b1
Added feature to count the number of coefficient pairs.
OceanNuclear Dec 17, 2025
2824492
THe problem of deducing the next layer's coefficient given the previo…
OceanNuclear Dec 17, 2025
47493c9
Handling duplicate diffusion lengths is simpler than expected!
OceanNuclear Feb 1, 2026
dc60fcf
Changed self.flux to self.fluxes, such that the incident neutron flux…
OceanNuclear Feb 11, 2026
641cd17
Changed the bounds of summation almost everywhere, and applied a shor…
OceanNuclear Feb 11, 2026
ccc4e81
Style cleanup and docstring update.
OceanNuclear Feb 12, 2026
da7c9ed
unit tests passed, still need to fix regression tests
OceanNuclear Mar 6, 2026
02ba086
Fixed the regression test too.
OceanNuclear Mar 7, 2026
e96db7c
Removed the print statements
OceanNuclear Mar 7, 2026
6645cc0
Added the 'solve()' method.
OceanNuclear Mar 8, 2026
a9dc900
Most tests have passed, but can't get conservation of flux to pass on…
OceanNuclear Mar 9, 2026
9bb976c
Made the unit tests more comprehensive & passed on the Conservation o…
OceanNuclear Mar 10, 2026
190e58b
Fixed the conservation of neutrons as well for regression test of neu…
OceanNuclear Mar 10, 2026
4aef46c
Ignored 'layer too narrow' warnings.
OceanNuclear Mar 13, 2026
9688d15
Slightly improved the index-translation-table and cleaned up the erro…
OceanNuclear Mar 13, 2026
34c9a74
Prepping neutronics_data.py for loading actual nuclear data.
OceanNuclear Mar 16, 2026
8bb701f
Modified the neutornics_data.py so that the MaterialsMacroInfo can be…
OceanNuclear Mar 16, 2026
9d98497
Some ruff cleanups
OceanNuclear Mar 16, 2026
4019a99
undid the try:import and sorted the remainder of the required_isotope…
OceanNuclear Mar 17, 2026
6c8db14
Some ruff fixes
OceanNuclear Mar 17, 2026
baaaf12
Reordered methods to prepare for the addition of tritium breeding dia…
OceanNuclear Mar 17, 2026
dbc0602
Added tritium production rate getting methods, and added tests for th…
OceanNuclear Mar 17, 2026
cd88f46
Moved the l2 and diffusion_coefficients into attributes of the neutro…
OceanNuclear Mar 27, 2026
214c6d3
Fixes for regression tests to reduce the number of warnings, and ruff…
OceanNuclear Mar 27, 2026
70b6347
More ruff fixes
OceanNuclear Mar 27, 2026
03dfc74
Rebase
OceanNuclear Mar 27, 2026
9467faf
No longer needs the .txt file
OceanNuclear Mar 27, 2026
d265669
Updated ruff fixes
OceanNuclear Mar 27, 2026
1ed76b3
Ruff fix of json
OceanNuclear Mar 27, 2026
91f2ad5
Fixed bug introduced because of ruff fixes.
OceanNuclear Mar 31, 2026
0bd7662
ruff formatting
OceanNuclear Mar 31, 2026
f7b710c
Improved scattering matrix calculation to account for the non-conserv…
OceanNuclear May 21, 2026
b817083
Implemented the rest of the fixes accounting for the non-conservation…
OceanNuclear May 21, 2026
5a84a3b
Confirming that the flux is represented correctly (by noting in the d…
OceanNuclear May 21, 2026
5522427
Fixed the loading of the data into ExtractedNuclearData to include th…
OceanNuclear May 27, 2026
98b3f3d
Fixed the missing density factor
OceanNuclear Jun 4, 2026
fa16e47
Converted everything from np.sum to fsum where fitting.
OceanNuclear Jun 18, 2026
8ea84dd
Added test case for potential negative flux.
OceanNuclear Aug 24, 2026
b2ea32e
Fixed the units in the docstrings.
OceanNuclear Aug 25, 2026
9b7f92a
Fixed the test for units.
OceanNuclear Aug 25, 2026
9ad866b
Begun change into exponential base for non-imaginary diffusion distance.
OceanNuclear Aug 25, 2026
52582b3
Fixed typo: if condition was flipped (should've been x2 when L2>0, ra…
OceanNuclear Aug 26, 2026
70dfe99
Removed debug print line. Next thing left to do is optimization: i.e.…
OceanNuclear Aug 26, 2026
7dbcb56
Ruff changes.
OceanNuclear Aug 27, 2026
07a41bc
changed the location of some tests. More complex, integrative tests a…
OceanNuclear Sep 8, 2026
e47e058
Added a method that lists all terms of the diffusion equation, and wr…
OceanNuclear Sep 10, 2026
0bc0e24
Not the most tidy list of tests, but it should catch all error cases …
OceanNuclear Sep 10, 2026
e781a7c
Added test to ensure that there's no current at x=0 for non-incident …
OceanNuclear Sep 10, 2026
69cd9ea
Factorized _groupwise_cs_definite_integral_in_layer to use expm1 so i…
OceanNuclear Sep 15, 2026
3979158
Added print statements to see the failure of np.linalg.solve (near si…
OceanNuclear Sep 16, 2026
7f369b5
Typing and typo fix
OceanNuclear Sep 16, 2026
f536623
Removed debug print lines. Re-added method to home in on the solution…
OceanNuclear Sep 16, 2026
7e45c85
_groupwise_neutron_current/flux_derivative_in_layer is now working.
OceanNuclear Sep 16, 2026
adf0eca
Realized that the first derivatives created in the previous commit ar…
OceanNuclear Sep 16, 2026
f49c1b9
Moved the 'evaluate_fit' function into a '_groupwise_fitness' method.
OceanNuclear Sep 21, 2026
9c0ddc0
Added method to tabulate the coefficients.
OceanNuclear Sep 21, 2026
1402acf
Gave 'g' and 'i' more comprehensible names in solve_group_n, so it's …
OceanNuclear Sep 21, 2026
cebbe1b
Comments update in line with the previous commit.
OceanNuclear Sep 21, 2026
aa8457e
Finished renaming the rest of the 'g' variables to the more descripti…
OceanNuclear Sep 21, 2026
3373ed9
Slight naming change.
OceanNuclear Sep 22, 2026
62a5672
Between the data.py and base.py, we only need one check/warning about…
OceanNuclear Sep 22, 2026
bb991b2
Added a variable called 'sigma_source'.
OceanNuclear Sep 22, 2026
6e57267
Fixed the test - should throw NotImplementedError instead of Warning …
OceanNuclear Sep 22, 2026
921c059
variable name 'constifficient' typo fix.
OceanNuclear Sep 22, 2026
ae27baf
'scale_factor' has been moved from being a temporary variable within …
OceanNuclear Sep 22, 2026
8a2eb6c
The MaterialMacroInfo.conversion_factor attribute is directly populat…
OceanNuclear Sep 22, 2026
ef0de7c
Slight rearrangement of the optimisation logic, and some print-statem…
OceanNuclear Sep 23, 2026
efcdd62
Changed self.coefficients to be a static object, thus eliminating a l…
OceanNuclear Sep 24, 2026
79d2f78
Fixed the TODO associated with tabulating, it's now tabulated differe…
OceanNuclear Sep 24, 2026
1dbd1e2
No longer strip the leading + sign from tabulate, further reducing th…
OceanNuclear Sep 24, 2026
3a169ff
TODO removed: the current way is already the best way to account for …
OceanNuclear Sep 24, 2026
3f0aa5c
A lot of quality-of-life improvements were made by making the limits …
OceanNuclear Sep 24, 2026
2cb842f
Getting one step closer to simplifying the summation limits by puttin…
OceanNuclear Sep 25, 2026
8f0ce02
separated _update_off_diag_coefs_of_column_n into its own method.
OceanNuclear Sep 25, 2026
795158f
Summation limits simplification success!
OceanNuclear Sep 25, 2026
7448c1e
massively simplified the summation _update_off_diag_coefs_of_column_n…
OceanNuclear Sep 25, 2026
c0ca69a
Made all of the necessary changes! And now it no longer has any more …
OceanNuclear Sep 25, 2026
6fb909d
Added more comprehensive error checks before the solve_group_n exits.
OceanNuclear Sep 28, 2026
6e09304
Better warning messages for any deviation. I'm considering using thre…
OceanNuclear Sep 28, 2026
9dda50d
Changed the threshold for raising non-convergence warnings.
OceanNuclear Sep 29, 2026
75aef57
Minor change to NotImplementedError error message.
OceanNuclear Sep 30, 2026
f171027
Used a better class to record the optimization process.
OceanNuclear Oct 5, 2026
8809d86
Fixed the legend when animating
OceanNuclear Oct 5, 2026
8502e7f
Improved plot_groupwise_profile_evolution method for both animate=Tru…
OceanNuclear Oct 7, 2026
a4f2d83
Minor typing clean up.
OceanNuclear Oct 8, 2026
7f7216e
added one validation test for instantiation of NeutronFluxProfile obj…
OceanNuclear Oct 28, 2026
44eab64
Corrected the name of one test.
OceanNuclear Oct 9, 2026
db71d12
Renamed NONCONVERGENCE_WARNING_ATOL to CONVERGENCE_ATOL
OceanNuclear Oct 23, 2026
b5f9ecb
Fixed plotting method.
OceanNuclear Oct 23, 2026
616507b
Ruff fixes of base.py.
OceanNuclear Oct 28, 2026
95a80a2
Automated ruff fixes for data.py
OceanNuclear Oct 28, 2026
64a2980
automatic ruff formatting of base.py
OceanNuclear Oct 28, 2026
44b4444
LinAlgError documentation.
OceanNuclear Oct 29, 2026
65795c3
final ruff formatting fixes of data.py
OceanNuclear Oct 29, 2026
8098896
More minor ruff fixes.
OceanNuclear Oct 29, 2026
4f2ddd9
regression/test_neutronics.py ruff formatting.
OceanNuclear Oct 29, 2026
17c10f8
Ruff formatting fixes of unit/tests_neutronics* (excluding pytest.rai…
OceanNuclear Oct 29, 2026
064174e
Missed cleanups to the tests.
OceanNuclear Oct 29, 2026
5fcc604
multiply_2_2_matrices previously generated the wrong dtype of matrix.…
OceanNuclear Oct 29, 2026
d5b9980
Fixed the 'Data has no positive values, and therefore cannot be log-s…
OceanNuclear Oct 29, 2026
5086966
unit/test_neutronics ruff fixes.
OceanNuclear Oct 29, 2026
0570e7f
Neutronics __init__.py ruff formatting.
OceanNuclear Oct 29, 2026
3f2bd26
Moved the initial steps of Gaussian elimination to solve the set of l…
OceanNuclear Oct 29, 2026
08c108c
Added __future__.annotations in preparation of the next commit.
OceanNuclear Oct 29, 2026
1014a75
Further reduced the complexity of solve_group_n by outsourcing the it…
OceanNuclear Oct 29, 2026
7dfd8c0
moved the location of some comments.
OceanNuclear Oct 30, 2026
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
6 changes: 6 additions & 0 deletions process/models/neutronics/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Module containing diffusion-based neutronics model."""

from process.models.neutronics.base import NeutronFluxProfile as NeutronFluxProfile
from process.models.neutronics.data import DT_NEUTRON_E as DT_NEUTRON_E
from process.models.neutronics.data import EV_TO_J as EV_TO_J
from process.models.neutronics.data import MaterialMacroInfo as MaterialMacroInfo
Loading
Loading