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

adding new mphys wrapper and removing the old openmdao wrappers #196

Merged
merged 9 commits into from
Apr 3, 2022

Conversation

anilyil
Copy link
Contributor

@anilyil anilyil commented Mar 11, 2022

Purpose

This PR removes the old om_adflow wrapper and moves the new MPhys ADflow wrapper from the MPhys repo to the ADflow repo. Importing ADflow on its own should not trigger an import of the MPhys wrapper, so we also do not need the OpenMDAO warning. To import the new mphys wrapper:

from adflow.mphys import ADflowBuilder

which is the only class needed from ADflow for MPhys.

Expected time until merged

Type of change

  • 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
  • Maintenance update
  • Other (please describe)

Testing

We can discuss how we want to add tests now that MPhys is open-source and the solver repos have their own builders.

@anilyil anilyil requested a review from a team as a code owner March 11, 2022 22:50
@anilyil anilyil requested review from joanibal and sseraj March 11, 2022 22:50
@anilyil
Copy link
Contributor Author

anilyil commented Mar 11, 2022

What do you recommend for testing @joanibal? Do we want to just move what we had in MPhys or do we want to add new tests on top?

@codecov
Copy link

codecov bot commented Mar 11, 2022

Codecov Report

Merging #196 (affcf42) into main (25b5dfa) will decrease coverage by 2.70%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #196      +/-   ##
==========================================
- Coverage   43.32%   40.62%   -2.71%     
==========================================
  Files          15       13       -2     
  Lines        3550     3769     +219     
==========================================
- Hits         1538     1531       -7     
- Misses       2012     2238     +226     
Impacted Files Coverage Δ
adflow/__init__.py 100.00% <ø> (+7.14%) ⬆️
adflow/mphys/__init__.py 0.00% <0.00%> (ø)
adflow/mphys/mphys_adflow.py 0.00% <0.00%> (ø)
adflow/mphys/om_utils.py 0.00% <0.00%> (ø)

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@joanibal
Copy link
Collaborator

I'd like to add some tests here too. With all the changes we make to ADflow, It's worth checking that they didn't break the MPhys wrapper.

@joanibal
Copy link
Collaborator

Should we copy the tests? or maybe we can run the ADflow tests in the mphys repo when changes are made to ADflow.

@anilyil
Copy link
Contributor Author

anilyil commented Mar 21, 2022

I would like to have a few adflow only mphys tests here. not sure how we can only run adflow tests on mphys side when adflow changes

Copy link
Collaborator

@sseraj sseraj left a comment

Choose a reason for hiding this comment

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

Please also fix the style checks

Copy link
Collaborator

@joanibal joanibal left a comment

Choose a reason for hiding this comment

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

Unfortunately, I could not get the mphys wrapper to import properly when not using pip install -e ..
I tried pip install ., but it didn't work for me.

@anilyil
Copy link
Contributor Author

anilyil commented Mar 21, 2022

Right. Is there a better approach for the import here? I can check if openmdao is available and then import but that results in weird side-effects

@ewu63
Copy link
Collaborator

ewu63 commented Mar 21, 2022

I think the way to do this is to update setup.py, either by hardcoding adflow.mphys as a package, or using setuptool's find_packages function (which I think we use in pygeo).

@joanibal
Copy link
Collaborator

It appears to still be broken

mdolabuser@josh-mdolab:~/repos/mphys/tests/regression_tests$ python test_aerostruct.py 

pyOCSM version 1.19 has been loaded

Traceback (most recent call last):
  File "test_aerostruct.py", line 31, in <module>
    from adflow.mphys import ADflowBuilder
ModuleNotFoundError: No module named 'adflow.mphys'

@ewu63
Copy link
Collaborator

ewu63 commented Mar 21, 2022

Did you try either of the approaches I mentioned? I don't think Anil pushed anything related to setup.py.

@ewu63
Copy link
Collaborator

ewu63 commented Mar 21, 2022

@joanibal I pushed up the changes and they work locally for me.

@anilyil
Copy link
Contributor Author

anilyil commented Mar 22, 2022

I tested @nwu63's changes and they worked great for me. I dont think it imports the mphys builder by default, it can import it regardless of an in place install or a site packages install, and it complains that I dont have openmdao if I try to import it w/o having openmdao installed, but I can still import the ADFLOW class.

On top of this, I added the requirements list for the mphys wrapper because it uses openmdao, mphys, and also idwarp.

@joanibal can you check the imports again with the current state of the PR?

@joanibal
Copy link
Collaborator

joanibal commented Apr 2, 2022

It works for me after the changes

@joanibal joanibal self-requested a review April 2, 2022 16:37
@sseraj sseraj merged commit bee3f4b into mdolab:main Apr 3, 2022
@anilyil anilyil deleted the add_mphys branch April 4, 2022 07: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.

4 participants