mdolab / pygeo

pyGeo provides geometric design variables and constraints suitable for gradient-based optimization.
https://mdolab-pygeo.readthedocs-hosted.com/en/latest/?badge=latest
Apache License 2.0
131 stars 55 forks source link

Fixing Constraints for new OM Parallelism Convention #191

Closed bernardopacini closed 1 year ago

bernardopacini commented 1 year ago

Purpose

The new OpenMDAO serial derivative parallelism convention (v3.25.0) made how we handled constraints invalid as we had different derivative values on different procs for serial inputs. The solution for this is to make constraints serial and consistent on each proc. I changed all the constraints in the MPhys wrapper as well as the compute() and compute_jacvec_product() functions to reflect these changes.

Expected time until merged

1 week.

Type of change

Testing

I tested this using the DAFoam MPhys aero-only and aerostructural tests. The derivatives are correct (even for TACS structural functionals) and OpenMDAO does not complain about derivative inconsistencies.

Checklist

codecov[bot] commented 1 year ago

Codecov Report

Merging #191 (e7a3452) into main (5b7066e) will increase coverage by 0.13%. The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #191      +/-   ##
==========================================
+ Coverage   64.75%   64.88%   +0.13%     
==========================================
  Files          47       47              
  Lines       11964    11939      -25     
==========================================
  Hits         7747     7747              
+ Misses       4217     4192      -25     
Impacted Files Coverage Δ
pygeo/mphys/mphys_dvgeo.py 0.00% <0.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

bernardopacini commented 1 year ago

@ArshSaja @hajdik Could you both please try running check_totals() on your MPhys cases with this branch and make sure you get correct derivatives and no warnings about mismatches on processors? You may need the latest OpenMDAO commit for this, not just the latest version.

joanibal commented 1 year ago

Sorry for not checking that the change worked. I appreciate you all fixing this. It's probably best not to wait on me for anything going forward.