Skip to content

thermo_add.py crashes with NumPy 2.x and OpenMDAO 3.42+ #116

Closed

Description

@Jhawk414

ThermoAdd.compute() raises a TypeError at line 121 due to two breaking changes:

  • OpenMDAO 3.42.0 stores scalar inputs as (1,) arrays instead of scalars

  • NumPy 2.0 removed implicit float() conversion on 1-element arrays

The crash: W_other_out[self.idx_compo] += W_other_mix on line 121 causes the following TypeErrors:

TypeError: 'DESIGN.burner.mix_fuel.thermo_add' <class ThermoAdd>: Error calling compute(), only 0-dimensional arrays can be converted to Python scalars

  File "C:\Users\REDACTED_FILEPATH\pycycle\thermo\tabular\thermo_add.py", line 121, in compute
    W_other_out[self.idx_compo] += float(W_other_mix)
                                   ^^^^^^^^^^^^^^^^^^
TypeError: only 0-dimensional arrays can be converted to Python scalars

Fix: change line 121 in thermo_add.py to W_other_out[self.idx_compo] += W_other_mix.item()

Versions: om-pycycle 4.4.0, openmdao 3.42.0, numpy 2.4.2

Activity

  1. stefano2734 commented on Mar 11, 2026

    @stefano2734

    New releases Numpy 2.4.3 and openMDao 2.4.3
    Should be Equal or perhaps more to do here?

  2. Jhawk414 commented on Mar 12, 2026

    @Jhawk414
    ContributorAuthor

    I'm not sure I understand your question.

    However, OpenMDAO release 3.43.0 was released today (11 March 2026) and I haven't had a chance to see if this issue is affected.

  3. stefano2734 commented on Apr 30, 2026

    @stefano2734

    I'm not sure I understand your question.

    However, OpenMDAO release 3.43.0 was released today (11 March 2026) and I haven't had a chance to see if this issue is affected.

    Sometimes new version errors are solved in next version. NumPy 2.44 is also now available.
    And sometimes a permanent change is the source of failure.

  4. flight-test-engineering commented on May 7, 2026

    @flight-test-engineering
    Contributor

    @Jhawk414 , are you going to open a PR with your fix?

  5. Jhawk414 commented on May 13, 2026

    @Jhawk414
    ContributorAuthor

    Yep. As shown I've created PR #117 to address this. One line fix

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions