mdolab / adflow

ADflow is a finite volume RANS solver tailored for gradient-based aerodynamic design optimization.
Other
229 stars 100 forks source link

Adding volume dependency for actuator regions #318

Closed lamkina closed 1 year ago

lamkina commented 1 year ago

Purpose

This PR adds a volume dependency to actuator regions. Previously, the actuator region volume was computed once during initialization and the source terms were computed using the baseline actuator region volume and baseline cell volumes. In subsequent optimization iterations with shape change, the baseline volumes were still used, resulting in an incorrect distribution of source terms in the actuator region.

With this PR, we re-compute the actuator region total volume in the metric subroutine after we update the geometry. Additionally, the sourceTerms_block subroutine in residuals.f90 was updated to depend on the current cell volumes and current actuator region total volume. I used AD to get the derivative of the actuator region total volume calculation and added the necessary mpi calls to master, master_d, and master_b to accumulate the volume seeds.

Finally, I added a new test that uses an FFD around the actuator zone pipe mesh to test the derivatives with the actuator zone volume changing. The FFD file is added to AFS and I retrained the actuator zone tests to account for the changes.

Expected time until merged

A few weeks, but hopefully sooner since this is incorrectly computing the actuator zone during optimization.

Type of change

Testing

I added a test to the actuator region regression tests that runs the dot product test with shape variables using a simple FFD.

Checklist

codecov[bot] commented 1 year ago

Codecov Report

Merging #318 (b84ab84) into main (409b986) will increase coverage by 0.07%. The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #318      +/-   ##
==========================================
+ Coverage   41.87%   41.94%   +0.07%     
==========================================
  Files          13       13              
  Lines        4017     4017              
==========================================
+ Hits         1682     1685       +3     
+ Misses       2335     2332       -3     

see 1 file with indirect coverage changes

:mega: Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

lamkina commented 1 year ago

bump @anilyil @sseraj