-
Notifications
You must be signed in to change notification settings - Fork 106
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
fixing petsc output vector error in the MPhys wrapper #300
Conversation
@lamkina can you test this with your code as well? |
Codecov Report
@@ Coverage Diff @@
## main #300 +/- ##
==========================================
- Coverage 42.01% 41.98% -0.03%
==========================================
Files 13 13
Lines 3999 4001 +2
==========================================
Hits 1680 1680
- Misses 2319 2321 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Do you really need both of the copies? I would imagine the openmdao vector is already doing one copy when setting the values? Did you test that the second copy is strictly necessary? Also, any idea why just passing the pointer did not work? Maybe we can get rid of all of the copies? |
Actually, the second copy is not necessary. I just did a copy for consistency. The first one is necessary though. Just setting the pointer didn't work. I am okay with removing it too |
Remove the second copy if its not strictly necessary. Try to understand why the first copy is needed. We may be able to get away with not copying it. Might need to slightly modify the f2py wrapper or add a new wrapper function that takes in the openmdao vector. |
To avoid further delaying this fix, I say this: test it again with the current state. Make sure all relevant cases work. Then, we can merge this PR and create an issue to investigate the removal of the first copy later. |
I fixed it. I think this is the only place we are using |
It tested and works fine with the aeroprop cases! |
Purpose
In rev, when the adjoint function is called, there is some issue with f2py handling some outputs in the function:. For example,
d_residuals["adflow_states"]
is not passing the correct output from the Fortran layer to Python in this call:solver.adflow.adjointapi.solveadjoint(d_outputs["adflow_states"], d_residuals["adflow_states"], True)
. Thus, Some derivatives become wrong:This PR address this issue with a minor fix. It fixes the derivative issues.
Expected time until merged
Type of change
Testing
Checklist
flake8
andblack
to make sure the Python code adheres to PEP-8 and is consistently formattedfprettify
or C/C++ code withclang-format
as applicable