Skip to content

Add improved actuator zone model #375

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

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft

Conversation

anilyil
Copy link
Contributor

@anilyil anilyil commented Jan 17, 2025

Purpose

This adds the improved actuator zone model that includes more parameters to control the distribution of the actuator zone terms, as well as adding a swirl term. I believe some of the changes originated from the work of @shamsheersc19.

It is WIP right now but opening the PR to start the discussions on this.

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

Checklist

  • I have run flake8 and black to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

Copy link

codecov bot commented Mar 4, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 41.20%. Comparing base (8f5e065) to head (4745f0c).

Files with missing lines Patch % Lines
adflow/pyADflow.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #375   +/-   ##
=======================================
  Coverage   41.19%   41.20%           
=======================================
  Files          13       13           
  Lines        4127     4131    +4     
=======================================
+ Hits         1700     1702    +2     
- Misses       2427     2429    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Fix dot product in `simpleProp` actuator region setup
@eytanadler
Copy link
Collaborator

Currently, the actuator zone's thrust cannot be set through the AeroProblem as expected if the actuator zone uses the simpleProp type. The simpleProp uses the thrust attribute from actuatorRegionData rather than the force one in the residual routine. However, only the force attribute is set in the update BC call. To fix this, the thrust attribute must also be updated with something like actuatorRegions(iRegion)%thrust = bcDataIn(iVar). This could be done in an if/else based on the actuator region type. I'd make this change, but I don't have Tapenade set up to differentiate it. @eirikurj do you have an environment set up where you could easily make this change?

@eirikurj
Copy link
Contributor

eirikurj commented Mar 5, 2025

@eytanadler I have everything setup and can add this, but I dont have any case available to test this. Do you have anything that can be considered as a unit/regression test?

@eytanadler
Copy link
Collaborator

I don't have anything unit testable but the basic behavior necessary is that this wasn't working before:

solver = ADFLOW(options=options)
solver.addActuatorRegion(
    "az_surf.x",
    actType="simpleProp",
    axis1=np.array([0.0, 0.0, 0.0]),
    axis2=np.array([1.0, 0.0, 0.0]),
   familyName="az",
    thrust=0.0,
    propRadius=1.0,
    spinnerRadius=0.1,
)

# Doing this should make thrust settable through the AeroProblem
ap.setBCVar("Thrust", 0.0, "az")
ap.addDV("Thrust", family="az", name="az_thrust")
ap.setDesignVars({"az_thrust": 1e4})

solver(ap)

Specifically, adding the design variable to the AeroProblem and setting it should change the thrust (observable via flowpower cost function), but it doesn't without the changes I mentioned. I think something like this would make a fine unit test, right?

@shamsheersc19
Copy link
Contributor

shamsheersc19 commented Mar 9, 2025 via email

@shamsheersc19
Copy link
Contributor

I had a look at the dot product error fixed in commit 0d21897. I got lucky there because in the cases I ran for the papers, v1(1) = 0 (or approximately 0) so it being multiplied by the incorrect number fortunately didn't affect my cases. Nice catch!

@eytanadler
Copy link
Collaborator

@shamsheersc19 I deleted it because I realized I overlooked the force per length to force per volume conversion and it made sense after. Thanks for the clarification!

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