Skip to content

Comments

avoid need to set particles and batches for dagmc models when calling convert_to_multigroup#3801

Merged
pshriwise merged 10 commits intoopenmc-dev:developfrom
shimwell:shimwell-patch-3
Feb 18, 2026
Merged

avoid need to set particles and batches for dagmc models when calling convert_to_multigroup#3801
pshriwise merged 10 commits intoopenmc-dev:developfrom
shimwell:shimwell-patch-3

Conversation

@shimwell
Copy link
Member

@shimwell shimwell commented Feb 12, 2026

Description

If we call convert_to_multigroup with a dagmc model currently and the settings have no particles or batches then it fails validation.

IMO we shouldn't need to set particles or batches before calling convert_to_multigroup as convert_to_multigroup has an argument for nparticles and decides internally the batches particles split.

This PR just sets the batches and particles to a valid, this will help it pass validation but it does not actually get used in simulation

If we ask user to set particles and batches on the model.settings then this could be a bit confusing as they are not used by convert_to_multigroup

What do people think is this an acceptable hack?

Fixes # (issue)

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 15) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@pshriwise
Copy link
Contributor

One alternative might be to initialize OpenMC in a non-transport mode when synchronizing DAGMC universes

@shimwell shimwell changed the title setting particles and batches for dagmc models calling convert_to_multigroup avoid need to set particles and batches for dagmc models when calling convert_to_multigroup Feb 13, 2026
@shimwell
Copy link
Member Author

Thanks for the suggestion @pshriwise I've had a go at implementing the transport free option and also added a test.

Copy link
Contributor

@pshriwise pshriwise left a comment

Choose a reason for hiding this comment

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

Tiny suggestion here but otherwise looks good @shimwell!

Co-authored-by: Patrick Shriwise <pshriwise@gmail.com>
@jon-proximafusion
Copy link
Contributor

note to self CI is failing with

E                   TypeError: Model.init_lib() got an unexpected keyword argument 'args'

@pshriwise
Copy link
Contributor

note to self CI is failing with

E                   TypeError: Model.init_lib() got an unexpected keyword argument 'args'

Hrmmm yeah it seems we allow only a subset of command line arguments to go through to the openmc.lib.init call. Would probably be better if we simply accepted an cl_rags keyword dictionary for flexibility in hindsight.

shimwell and others added 2 commits February 15, 2026 22:59
Co-authored-by: GuySten <62616591+GuySten@users.noreply.github.com>
Reset auto IDs before creating material in the test.
@shimwell shimwell requested a review from pshriwise February 16, 2026 08:36
@shimwell
Copy link
Member Author

Thanks for fixing this @GuySten and in particular getting the CI passing
Are you able to take another peak at this @pshriwise

Copy link
Contributor

@pshriwise pshriwise 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 @shimwell! Thanks!

@pshriwise pshriwise merged commit 6d6b051 into openmc-dev:develop Feb 18, 2026
16 checks passed
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.

4 participants