Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CMFD to work with scipy 1.13 #2936

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

paulromano
Copy link
Contributor

Description

Recent PRs are failing on CMFD tests due to the release of scipy 1.13. This PR adds a few fixes to get those tests working again:

  • The indptr attribute of sparse data structures in scipy 1.13 is now an array with int64, instead of int32. OpenMC C API functions accept int32s, so the indptr arrays need to be cast first.
  • Constructing a CSR matrix before would always result in underlying arrays that were sorted by index within a given row, but with scipy 1.13 that doesn't seem to be the case. There is evidently an implicit assumption in OpenMC that CSR data coming in is sorted, so I had to add explicit calls to sort_indices() to get it working (otherwise it fails on the Gauss-Seidel iteration).

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)

@paulromano paulromano requested a review from eepeterson April 3, 2024 15:44
@paulromano paulromano requested a review from shikhar413 as a code owner April 3, 2024 15:44
Copy link
Contributor

@eepeterson eepeterson 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 quick fix @paulromano

@eepeterson eepeterson merged commit 1a34ddf into openmc-dev:develop Apr 4, 2024
18 checks passed
@paulromano paulromano deleted the scipy-1.13-fix branch April 4, 2024 06:59
church89 pushed a commit to openmsr/openmc that referenced this pull request Jul 18, 2024
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.

2 participants