Skip to content

Numpy 2 comatibility#87

Open
A-CGray wants to merge 7 commits intomainfrom
feature-numpy2-compat
Open

Numpy 2 comatibility#87
A-CGray wants to merge 7 commits intomainfrom
feature-numpy2-compat

Conversation

@A-CGray
Copy link
Copy Markdown
Member

@A-CGray A-CGray commented Mar 21, 2026

Purpose

Explain the goal of this PR, if it addresses an existing issue be sure to link to it. Describe the big picture of your changes here, perhaps using a bullet list if multiple changes are done to accomplish a single goal. If it accomplishes multiple goals, it would be best to create separate PR's for each.
Makes openconcept compatible with numpy 2.4+

Type of change

What types of change is it?
Select the appropriate type(s) that describe this PR

  • - Bugfix (non-breaking change which fixes an issue)
  • - New feature (non-breaking change which adds functionality)
  • - Breaking change (non-backwards-compatible fix or feature)
  • - Code style update (formatting, renaming)
  • - Refactoring (no functional changes, no API changes)
  • - Documentation update
  • - Other (please describe)

Testing

Explain the steps needed to test the new code to verify that it does indeed address the issue and produce the expected behavior.

Checklist

Put an x in the boxes that apply.

  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

A-CGray and others added 7 commits March 20, 2026 23:57
np.complex_ was removed in NumPy 2.0. np.complex128 is semantically
identical and available in all supported NumPy versions.

Also fixes a pre-existing bug in combine_split_comp.py where dtype=np.dtype
(the class itself) was passed instead of the local variable dtype.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
NumPy 2.0 removed automatic coercion of 1-element arrays to Python
scalars, so math.cos/sin/sqrt no longer accept numpy array inputs.
Replace with np.cos/sin/sqrt which handle arrays natively.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…enMDAO 3.43

Small numerical differences (~3e-6 relative) in surge_margin (N3) and
battery SOC_final (HybridTwin) arise from library version changes and
are not correctness regressions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
During Newton solver warmup iterations, fltcond|Utrue can temporarily
go negative, making Re negative and causing log(negative) = NaN which
propagates through the Jacobian.

Fix: compute Re = U*L/visc_kin and apply abs(Re) for real-valued
arrays only, so complex-step derivative checking still propagates the
imaginary part correctly (for complex arrays, negate Re where real(Re)<0).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@A-CGray A-CGray requested a review from a team as a code owner March 21, 2026 04:02
@A-CGray A-CGray requested a review from sabakhshi March 21, 2026 04:02
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.

1 participant