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

Use pointers to couple InflowWind and AeroDyn #1596

Merged
merged 13 commits into from
Jun 8, 2023

Conversation

deslaughter
Copy link
Collaborator

This is a draft pull request for review of the implementation.

Feature or improvement description

The goal of this PR is to allow AeroDyn to call InflowWind directly via a pointer to FlowFieldType derived data type and the IfW_FlowField_GetVelAcc function. This code adds logic to copy the FlowField pointer from the InflowWind Parameters derived type into the AeroDyn Parameters derived type during initialization. From there AD_CalcOutputs and AD_UpdateStates can call IfW_FlowField_GetVelAcc to get and update the wind velocities and acceleration.

Impacted areas of the software

  • AeroDyn
  • AeroDyn Inflow
  • OpenFAST Library (glue code)

Additional supporting information

The calls to get the wind velocity from InflowWind and transfer them to AeroDyn within FAST_Solver have been removed as they are no longer needed. To avoid disrupting Linearization, the wind velocity variables have been left as inputs in AeroDyn but will be moved to MiscVars as part of Linearization work in a future PR.

Test results, if applicable

Test results are unchanged as expected.

This commit contains a complete port of the openfast-registry to C++.
The new registry doesn't support the dimspecs used in AD14 so
they were replaced in the input file. This module will be removed soon
and this feature is not used by other modules so it didn't seem
necessary to keep this feature.

AeroDyn_Registry.txt had a malformed line which was acceptable to the
previous parser, but didn't work for the new one so the input file was
updated.

The registry implements specifying a target and a regular pointer
pointer on the field name using & and * respectively. The registry
treats TARGETs (&) the same as allocatable fields wrt pack/unpack/copy.
Essentially, target's own their memory. POINTERS (*) do not own their
memory and are not packed/unpacked. The pointer association is
maintained by the copy function.
While this may duplicate the wind calculation, it avoids having code
outside the module dealing with the wind calc.
Copy link
Contributor

@ebranlard ebranlard left a comment

Choose a reason for hiding this comment

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

This looks great. I didn't review the changes to the registry.

I didn't find the GetVelAcc function but I guess it was part of a previous pull request. I wanted to check that this function has some speedup if a simple flow field is used (shear), but I think you indeed took care of it. I also wanted to see if we could easily add a flag to request OpenMP parallelization on the fly (likely harder). For even more speedup in OLAF we would need to pass the flowfield to FVW. That can be done at another stage.

I have my nerdy preference of having the "if failed" at the end of the line so that similar lines can easily be read on top of each other and I'm not sure I'm set on cutting lines with & (when they are medium size). Don't change that for me of course.

modules/aerodyn/src/AeroDyn_Inflow.f90 Outdated Show resolved Hide resolved
modules/aerodyn/src/AeroDyn_Inflow.f90 Show resolved Hide resolved
modules/aerodyn/src/AeroDyn.f90 Outdated Show resolved Hide resolved
modules/aerodyn/src/AeroDyn_Driver_Subs.f90 Show resolved Hide resolved
modules/inflowwind/src/InflowWind_Subs.f90 Outdated Show resolved Hide resolved
modules/inflowwind/src/InflowWind_Subs.f90 Outdated Show resolved Hide resolved
modules/inflowwind/src/InflowWind_Subs.f90 Show resolved Hide resolved
Tried to clean it up a little with an associate block
The functions called by AD_CalcWind had inconsistent starting node
numbering. The functions were fixe so the starting node has the same
meaning. The functions were also renamed
Renamed this function to the more descriptive
InflowWind_GetRotorSpatialAverage.
Also fixed routine name in InflowWind_GetHubValues
AD_SetExternalWindPositions was previously called here, but
had been commented out.
Ideally this will allow for parallel evaluation of the wind
velocity/acceleration
@andrew-platt andrew-platt changed the base branch from dev to dev-unstable-pointers June 5, 2023 21:25
The new registry parses files and keeps quoted strings intact.
There were a couple of instances where "default" appeared inside
a quoted string which was then interpreted as separate fields.
This can be avoided by escaping the double quote as \" so the
parser won't end the string.

There was also an extra dash on line 320 in AeroDyn_Registry.txt
which caused the description to be printed as a unit.
@deslaughter
Copy link
Collaborator Author

@bjonkman , I've updated the registry input files to escape the double quotes and remove the extra dash. The double quote can be escaped by writing \" inside the string.

@bjonkman
Copy link
Contributor

bjonkman commented Jun 6, 2023

Thanks, @deslaughter! I'm actually surprised the old registry parsed that without the escape character. There are probably other registry input files that have the same issue, but I just happened to see the AA and AD ones.

…ifwptr

Regenerated all Types files using registry.
@deslaughter deslaughter marked this pull request as ready for review June 8, 2023 22:35
@deslaughter deslaughter merged commit 7b77296 into OpenFAST:dev-unstable-pointers Jun 8, 2023
@deslaughter deslaughter deleted the f/ifwptr branch June 8, 2023 22:37
@andrew-platt andrew-platt mentioned this pull request Dec 24, 2024
38 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants