Skip to content

Conversation

@aprilnovak
Copy link
Collaborator

@aprilnovak aprilnovak commented Aug 1, 2025

This PR adds an example of performing a criticality search using Cardinal, starting by the easiest form of criticality maneuvers:

  • changing a material density
  • changing the boron weight ppm in water.

Additional criticality search changes can be added as daughter classes of CriticalitySearchBase.

@aprilnovak aprilnovak requested a review from nuclearkevin August 1, 2025 23:11
Copy link
Contributor

@nuclearkevin nuclearkevin left a comment

Choose a reason for hiding this comment

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

Looks good, my requested changes mostly involve implementation details. The design looks easy to extend to other search quantities (boron concentration, rod height, drum rotation, etc.)!

@aprilnovak aprilnovak changed the title WIP: Criticality search Criticality search Aug 2, 2025
@moosebuild
Copy link
Collaborator

moosebuild commented Aug 2, 2025

Job Documentation, step Sync to remote on ea3c7c9 wanted to post the following:

View the site here

This comment will be updated on new commits.

@aprilnovak
Copy link
Collaborator Author

This is ready for review - I added the borated water control as a second example.

Copy link
Contributor

@nuclearkevin nuclearkevin left a comment

Choose a reason for hiding this comment

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

Just a few minor comments / changes. The only major change I'd recommend would be to swap over to using https://github.com/OTU-Centre-for-SMRs/nuclear_data as a submodule instead of copy-pasting functions in (to avoid adding 3,000 lines of lookup tables). Otherwise, looks good to me!

Copy link
Contributor

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

Thanks for the effort on this @aprilnovak - I definitely would not have produced a design quite this sophisticated.

I've taken a Quick Look at the code (i.e. not yet the docs or tests) and it all looks good to me.

I did find two small changes related to Nek that seemed out of place and I wanted to flag to see that it's what you intended.

@gonuke
Copy link
Contributor

gonuke commented Aug 5, 2025

Just a few minor comments / changes. The only major change I'd recommend would be to swap over to using https://github.com/OTU-Centre-for-SMRs/nuclear_data as a submodule instead of copy-pasting functions in (to avoid adding 3,000 lines of lookup tables). Otherwise, looks good to me!

Yeah - I was definitely surprised to see that this didn't exist in MOOSE somewhere already.

@aprilnovak
Copy link
Collaborator Author

The only major change I'd recommend would be to swap over to using https://github.com/OTU-Centre-for-SMRs/nuclear_data as a submodule instead of copy-pasting functions in (to avoid adding 3,000 lines of lookup tables).

Yes, agreed! Thanks for moving that shared code into a submodule @nuclearkevin. I've updated this PR to add the new submodule.

@moosebuild
Copy link
Collaborator

Job Precheck, step Clang format on 2f85537 wanted to post the following:

Your code requires style changes.

A patch was auto generated and copied here
You can directly apply the patch by running, in the top level of your repository:

curl -s https://mooseframework.inl.gov/cardinal/docs/PRs/1184/clang_format/style.patch | git apply -v

Alternatively, with your repository up to date and in the top level of your repository:

git clang-format 4f4414a6dfb6d20fcf6bea4b70d951008384d1a5

Copy link
Contributor

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

Thanks for clarifying the Nek changes. I've added a few comments final comments.

Copy link
Contributor

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

An alternative to implementing other absent nuclides (Since they are extremely unlikely) is to tweak the documentation, as suggested in this comment

Copy link
Contributor

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

This all looks great to me - thanks @aprilnovak - I'll get to work on implementing the control element transformation versions.

Copy link
Contributor

@nuclearkevin nuclearkevin left a comment

Choose a reason for hiding this comment

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

LGTM! Should be good to go once the CIVET recipe is updated to take into account the new submodule addition and the tests start running + passing.

@aprilnovak
Copy link
Collaborator Author

yep, waiting for the PR in civet_recipes to be merged.

Copy link
Contributor

@lewisgross1296 lewisgross1296 left a comment

Choose a reason for hiding this comment

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

Nothing major, just somethings I didn't fully understand and was hoping for clarification / addition of comments to the code.

Thanks for putting this together so rapidly @aprilnovak!

@pshriwise
Copy link
Collaborator

pshriwise commented Aug 6, 2025

Passing thought: might be nice to allow a target k-eff to be specified (with a default of 1.0).

@gonuke
Copy link
Contributor

gonuke commented Aug 11, 2025

Passing thought: might be nice to allow a target k-eff to be specified (with a default of 1.0).

This might be a straightforward addition to include here, esp if it's optional with a default value of 1.0.

@aprilnovak
Copy link
Collaborator Author

I'm going to leave adding the S(a,b) tables to a future PR since there's not a nice API to do it on the OpenMC side. Updated the docs to reflect this.

@moosebuild
Copy link
Collaborator

Job Test OpenMC on 01a3e0f : invalidated by @aprilnovak

@moosebuild
Copy link
Collaborator

Job Test OpenMC on 2a2f832 : invalidated by @aprilnovak

@moosebuild
Copy link
Collaborator

Job Test OpenMC on 3dac017 : invalidated by @aprilnovak

@@ -0,0 +1,3 @@
time,critical_value,k
0,0,0
1,522.19791328636,1.0002525559801
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe something changed in how the critical boron search is performed between when you generated the gold file for the test and now (which is why the test is failing). It might need a regold.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's passing fine on my local machine - I think it's some indeterminisim as the number of batches increases (locally, I'm seeing the same values for k print out up until a point, so I tried decreasing the number of batches in my latest push). Will keep trying!

@gonuke
Copy link
Contributor

gonuke commented Sep 16, 2025

Passing thought: might be nice to allow a target k-eff to be specified (with a default of 1.0).

We'd be happy to PR this little tweak to your branch.

We're getting close to having the rotational search ready. Should we PR that to this branch? or wait for this to be merged first?

@aprilnovak
Copy link
Collaborator Author

That would be great if you wanted to add, thank you! Sorry this has slipped a bit on my to-do list (still need to figure out why the test is passing for me locally but not on CIVET). Please feel free to go ahead and add a commit with the k \ne 1 option!

I'd suggest we merge this one first and then a follow-on one with the cell modification options.

@gonuke
Copy link
Contributor

gonuke commented Sep 18, 2025

That would be great if you wanted to add, thank you! Sorry this has slipped a bit on my to-do list (still need to figure out why the test is passing for me locally but not on CIVET). Please feel free to go ahead and add a commit with the k \ne 1 option!

I'd suggest we merge this one first and then a follow-on one with the cell modification options.

I PR'd this into your branch for you to review and merge there.

@gonuke
Copy link
Contributor

gonuke commented Sep 30, 2025

Note: OpenMC's tolerance for keff search is a relative tolerance. As far as we can tell, the MOOSE implementation of Brents Method interprets the tolerance as an absolute tolerance on the independent variable. When comparing "gold" solutions between Cardinal and OpenMC, this may matter, but may be moot when only relying on one or the other for solutions, as long as the user knows which.

@lewisgross1296
Copy link
Contributor

Once OpenMC finishes up its search refactor (PR), we should be able to specify either relative or absolute tolerance in the scipy run args, which will making testing/golding against MOOSE easier.

@aprilnovak
Copy link
Collaborator Author

I have no idea what github is showing me, I'm not sure if it's a glitch or something went really wrong... anyways, I've re-opened the same branch over here: #1233

@moosebuild
Copy link
Collaborator

Job Test on 19afc12 : invalidated by @aprilnovak

@aprilnovak
Copy link
Collaborator Author

Once OpenMC finishes up its search refactor (openmc-dev/openmc#3569), we should be able to specify either relative or absolute tolerance in the scipy run args, which will making testing/golding against MOOSE easier.

The test failures here aren't anything to do with a relative error/tolerance -- the issue is that when I run OpenMC on my machine where I created the test gold file, the random number stream/etc. is different than when the test runs on Civet.

@lewisgross1296
Copy link
Contributor

lewisgross1296 commented Oct 29, 2025

Is it possible to use openmc.Settings.seed in the test? Also are any of the tests using OpenMP parallelism? In my experience to get identical searches, you need to use only MPI parallelism

@aprilnovak
Copy link
Collaborator Author

I don't think the seed is relevant (the tests are using the same exact seed). Also, I believe OpenMC should be reproducible even if using OpenMP (but FWIW, the tests on CIVET use MPI only I believe, unless otherwise instructed, which we are not in these new tests being added).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants