Repository navigation
Numpy 2 compatibility - #87
Conversation
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>
|
Hi, thanks for working on this. We ran into the Tested at 10f644b on Python 3.12.13, with numpy 2.5.1, OpenMDAO 3.45.0 and AeroSandbox 4.2.10. Full suite from source, same result on three runs: 461 passed, 2 failed, 2 skipped, 48 errors. The 48 errors are all The 2 failures are That one might be worth your attention. The branch already carries "Loosen test tolerances for minor numerical shifts with NumPy 2.x / OpenMDAO 3.43", and that commit puts the drift at about 3e-6. What we see is an order of magnitude larger. Our guess is that numpy moved again after you calibrated it. The main thing we wanted to ask about is the history. These changes went into main on 2026-03-21 and were reverted the same day, by 9187a53 and 14b7176. Neither commit message says why, and there are no comments here. Did you hit something concrete, or was it backed out so it could land through this PR instead? We'd rather not pin an unmerged branch if you already know something is wrong with it. If it's the latter, happy to help. We can post the full test log, run other configurations, or send a PR for the tolerance calibration. |
np.trapz and np.ComplexWarning were removed in NumPy 2, and NumPy 2.5 no longer allows assigning size-1 arrays to scalar array elements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Exclude mdot_coolant from the propulsion input promotion with glob character classes and connect it explicitly, instead of listing every ac|propulsion input by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use U * sign(U.real), which is |U| for real inputs and remains complex-step safe, rather than branching on the input dtype. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SOC_final reference values were under-converged results whose last digits depend on the Newton iteration path, which changed in OpenMDAO 3.43. Use the tightly converged values with an absolute tolerance consistent with the solver tolerance, and revert the earlier tolerance loosening (the N3 discrepancy came from stale local engine deck caches, not NumPy). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OpenAeroStruct 2.7.1 does not support NumPy 2. OAS 2.10 does, but it evaluates B-splines of panel quantities (t/c, skin and spar thickness) at panel centres, which changes the aerostructural results; with uniform distributions the results are unchanged. Update the reference values, make run_OAS set the panel t/c directly, and bump the oldest tested versions to OpenMDAO 3.35 (required by OAS 2.10), NumPy 1.25 and SciPy 1.11. Install pyCycle from GitHub in the latest build because its NumPy 2 fixes are unreleased. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #87 +/- ##
=======================================
Coverage 82.05% 82.06%
=======================================
Files 103 103
Lines 10730 10733 +3
=======================================
+ Hits 8805 8808 +3
Misses 1925 1925 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
With Python 3.11, installing pyCycle pulled in the latest OpenMDAO, which requires NumPy 2 and silently replaced the oldest NumPy and SciPy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The glob character classes also excluded any other input starting with "t" or "m". Promote everything with "ac|propulsion|*" and rename just mdot_coolant with an explicit tuple, which takes precedence over the wildcard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Promote each ac|propulsion input by its full name, leaving out only the per-node mdot_coolant, rather than renaming it out of the ac| namespace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since OpenMDAO 3.35 every problem creates a <name>_out directory in the working directory, so running the tests left hundreds of them in the repo root. Point OPENMDAO_WORKDIR at a temporary directory for the pytest session unless the user has already set it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OpenMDAO is now pinned when pyCycle is installed, so the later step that reinstalled the oldest OpenMDAO had nothing left to do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Use a single Python setup step that picks the oldest or latest version - Let pyCycle and the testing and docs extras install in one pip call, rather than installing pyCycle, NumPy, SciPy and OpenMDAO separately - Drop the conda always_yes config, which the latest build never needed, and pass -y to the one conda install instead Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Give each dep-versions value its own versions through matrix include, so the job names list the OS and the Python, NumPy, SciPy and OpenMDAO versions instead of every version setting for both builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Writing outputs to a temporary directory broke the Windows build: the temporary directory and the checkout are on different drives, and OpenMDAO's inputs report calls os.path.relpath on its output file. The reports are what create the <name>_out directories, so turn them off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@sabakhshi can you post the details of the environment you're having test failures with? |
|
|
@sabakhshi which python version? |
3.12.3 |
|
I cannot recreate the failure you're seeing. Here's the full list of commands I ran (in the root dir of openconcept): |
Purpose
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
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
xin the boxes that apply.