Skip to content

More accurately simulate the neutron flux profile - #3653

Open
OceanNuclear wants to merge 187 commits into
mainfrom
neutronics
Open

OceanNuclear wants to merge 187 commits into
mainfrom
neutronics

Conversation

@OceanNuclear

@OceanNuclear OceanNuclear commented May 2, 2025 •

Copy link
Copy Markdown
Contributor

Description

Calculates the neutron flux profile in the first wall and blanket, using an extremely simplified diffusion-based model of an infinite slab sandwich.

Reason for choosing this model

It's better than not having a neutronics model.
It's also very simplified, so it can be calculated on the fly, without installing any deterministic neutron transport codes as dependency.

Checklist

I confirm that I have completed the following checks:

  • My changes follow the PROCESS style guide
  • I have justified any large differences in the regression tests caused by this pull request in the comments.
  • I have added new tests where appropriate for the changes I have made.
  • If I have had to change any existing unit or integration tests, I have justified this change in the pull request comments.
  • If I have made documentation changes, I have checked they render correctly.
  • I have added documentation for my change, if appropriate.

@codecov-commenter

codecov-commenter commented May 2, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.84222% with 415 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.39%. Comparing base (0b69cfc) to head (8502e7f).

Files with missing lines Patch % Lines
process/models/neutronics/base.py 47.40% 284 Missing ⚠️
process/models/neutronics/data.py 65.06% 131 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3653      +/-   ##
==========================================
+ Coverage   50.26%   50.39%   +0.13%     
==========================================
  Files         181      184       +3     
  Lines       30629    31548     +919     
==========================================
+ Hits        15395    15899     +504     
- Misses      15234    15649     +415     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@OceanNuclear
OceanNuclear requested a review from chris-ashe May 2, 2025 21:04
@chris-ashe chris-ashe added Physics Relating to the physics models Neutronics Power Cycle and removed Physics Relating to the physics models labels May 6, 2025
@OceanNuclear
OceanNuclear force-pushed the neutronics branch 2 times, most recently from a7c3d81 to 56884d7 Compare June 4, 2025 15:47
@OceanNuclear OceanNuclear changed the title First commit - made a mockup of NeutronFluxProfile calculator. More accurately simulate the neutron flux profile, to get a more accurate estimate of the neutronics quantities. Jun 4, 2025
@OceanNuclear OceanNuclear changed the title More accurately simulate the neutron flux profile, to get a more accurate estimate of the neutronics quantities. More accurately simulate the neutron flux profile Jun 4, 2025
@OceanNuclear
OceanNuclear force-pushed the neutronics branch 3 times, most recently from 5ada3ea to 3336c23 Compare October 30, 2025 15:13
@OceanNuclear

OceanNuclear commented Nov 24, 2025 •

Copy link
Copy Markdown
Contributor Author

The current state of this branch is:

  • 1-group 2-layer model is written
  • 1-group 2-layer model is fully tested (regression & unit tests)
  • Multi-group model & >2-layer model is written
  • Multi-group model & >2-layer model is tested
  • incorporated real data
  • Wrote function that accepts collapsed cross-section data (The downloading and collapsing of nuclear data has to be done by the user using a class that inherits from ENDFRecord.)
  • Plotting is already available, example 1-group 2-layer model:
current flux heating
  • Plotting is tested

@je-cook
je-cook self-requested a review March 23, 2026 09:58
@OceanNuclear
OceanNuclear marked this pull request as ready for review March 27, 2026 13:41
@OceanNuclear
OceanNuclear requested a review from a team as a code owner March 27, 2026 13:41
@OceanNuclear

Copy link
Copy Markdown
Contributor Author

@chris-ashe In the new folder structure, would you prefer the neutronics.py and neutronics_data.py to live in model/ or core/?

@je-cook je-cook self-assigned this Apr 1, 2026

@je-cook je-cook left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not sure descriptors is the right way to go. Most descriptor stuff I've written I have eventually rewritten without descriptors because I found a better way.

On the atomic data is there any reason we cant use something like periodictable which we use in elsewhere.

@OceanNuclear

Copy link
Copy Markdown
Contributor Author

Happy to hear out examples of where descriptors were removed and see if I can implement anything similar. So far I'm unaware of any other ways of writing the code that wouldn't make it even more spaghetti: the @summarize_values decorator is doing a lot of heavy lifting and cutting the amount of code that I have to write down by half.

@je-cook

je-cook commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

Great, need to have a think but will let you know

@OceanNuclear

Copy link
Copy Markdown
Contributor Author

periodictable sounds good, thanks for the suggestion, I'll likely replace the atomic_data.json with it, and possibly cutting down the size of the PR as a result.

I haven't figured out yet the right way of getting the abundance values in periodictable (in the same format as written at the top of the atomic_data.json), but I'm sure I'll find it eventually.

…the scope of 'NeutronProfile.solve_group_n' to a persistent attribute inside MaterialInfo, and renamed 'conversion_factor'. Also created NeutronProfile.extended_boundary statically as an array, rather than using AutoPopulatingDict.
…ed as a static value, rather than a property. The warning for any collision in characteristic lengths between groups is ported to inside the data.py file as well. Used sigma_source in base.py.
…ot of the complexity associated with the AutoPopulatingDict/LayerSpecificGroupwiseConstants classes. Amended tests as well.
…e code complexity, and increasing backwards compatibility as preserve_whitespace was not an argument before tabulate version 0.10.0.
…arbitrary dimensions of c_va/s_val, c_int/s_int, c_diff/s_diff.
…of the summations handled with less redundancy & more automatically.
… by turning fsum back to np.sum (which is also useful in preparation for the next commit).
…sholds scaled by the total neutron flux/local neutron flux and currents for flagging nonconvergence at the end of solve_group_n, since the current scheme causes a lot of unnecessary warnings being raised when the flux is large.
…e and animate=False. Removed redundant _set_coefficient.
@OceanNuclear
OceanNuclear removed this pull request from stack #4707 October 23, 2026 14:15
…, and mp.sin when the argument is scalar. This speeds up the calculation of long flux values. Also, we revert to using np.sqrt instead of mp.sqrt to obtain l from self.materials[...].l2, which somehow makes the calculation more accurate as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants