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

Added option for 2D airfoil interpolation #213

Merged
merged 27 commits into from
Dec 3, 2019

Conversation

bjonkman
Copy link
Contributor

@bjonkman bjonkman commented Dec 6, 2018

Summary

This pull request adds 2D interpolation capability to AeroDyn airfoils, based on code @ghaymanNREL sent me earlier this year.

Previous versions interpolated airfoils within a table based on angle of attack. This version also interpolates between airfoil tables based on Reynolds number or a user-control parameter.

The AeroDyn input file has changed. New input files for the regression test cases can be found here: https://github.com/bjonkman/r-test/tree/pullrequest/bjonkman-airfoil. None of the regression tests currently use 2D airfoil interpolation, but the SWRT airfoil files do contain data for multiple Reynolds numbers, so they could be modified to use the additional tables.

Regression tests pass if built with -DSPLINE_INTERP, which overrides the default airfoil interpolation method, which has changed.

Details

AeroDyn changes:

  • There is a new line for the AFTabMod input parameter in the AeroDyn input file.
  • AeroDyn has a new input for a User Control property, which is passed to AirfoilInfo so it can be used for 2D interpolation. The input is currently set to 0, and would need to be set in source code for a specific project.
  • Types in the AirfoilInfo (AFI) module were changed, requiring changes to many other parts of AeroDyn, its driver, and the UA driver.
  • The default interpolation on angle-of-attack in the airfoil tables has changed from cubic to linear.
    This will change regression-test results if the interpolation order is not specified in the airfoil files. (This includes all of the regression tests that use AeroDyn.)
  • The single type defined in fmin_fcn.f90 was moved to mod_root1dim.f90
  • Routine UncoupledErrFn() was replaced with BEMTU_InductionWithResidual(), which already existed and performed the same basic tasks.
  • Routines GetSteadyOutputs() in UA and ComputeSteadyAirfoilCoefs() in BEMT were removed and replaced with AFI_ComputeAirfoilCoefs().
  • AFI_GetAirfoilParams() was replaced with AFI_ComputeUACoefs().
  • The UA computation for C_nalpha_circ was removed from AFI_ComputeUACoefs() and placed in UA's ComputeKelvinChain() instead.
  • The UA module now validates the UA parameters from AFI and checks if UA should be shut off based on the AFI parameters (instead of having AeroDyn do this)
  • The AFI module validates its own data (with the exception of parameters in UA tables)

OpenFAST Registry changes:

  • Fixed an issue so that ExtrapInterp routines aren't generated for types that don't exist (-noextrap flag isn't strictly necessary anymore,
    but using it will result in smaller files if types exist but ExtrapInterp isn't necessary for the module)
  • added ExtrapInterp for two specific types in airfoilinfo (this module name and its types are hardcoded)

Visual Studio build changes:

  • added checks for unused variables in non-*_Types.f90 files in debug mode.

General changes:

  • removed some unused variables
  • updated error handling
  • fixed spelling errors

The following documentation has been updated:

  • text for the new AeroDyn input and interpolation capability
  • example AeroDyn input files
  • [bug fix] example BeamDyn input files that were not consistent with previous changes to BeamDyn

The following source file are not used but are still in the repo, in case they are useful elsewhere:

  • NetLib/Dierckx_FitPack/dierckx_fitpack.f
  • NetLib/Dierckx_FitPack/NWTC_FitPack.f90

The following source file are unnecessary and were deleted from the repo:

  • modules-local/aerodyn/src/fmin_fcn.f90
  • modules-local/aerodyn/src/ToDoList.txt

One more thing...

The BEMT solution computes the Reynolds number using axial and tangential induction factors set to 0. Then, it gets cl and cd from the airfoil tables (potentially based on Reynolds number), which allow it to compute the axial and tangential induction factors. The BEMT solve would have to be modified to solve these items simultaneously. Apparently there was discussion at NREL that using induction factors or zero was an okay approximation for Reynolds number (for now).

This code came from GHayman in Feb 2018; I fixed some merge conflicts and some minor details. It compiles (with the exception of UA driver) and gives same results as before.

I did not add the AFI driver or move the AFI code into a separate source-code directory,
Any airfoils that use "default" interpolation will see different results.
BEMTU_Wind was calculating Re based on dynamic viscosity instead of kinematic viscosity as reported here: OpenFAST#71

Fixed the calculation and cleaned up calling routines that don't need the airDens variable anymore.
- These shouldn't cause errors if there are no input or output types in a module any more (-noextrap command isn't as critical now)
- AirfoilInfo module will have extrap-interp routines generated for Output Type and UA_BL_Type data structures.
- added `UserProp` input to AeroDyn for 2D airfoil interpolation (currently not implemented in OpenFAST driver)
- changed Registry so that it generates extrap-interp routines for AFI output type and UA_BL (parameter) types
- removed fitpack from build (was used only in previous code for 2D cubic splines, which are not used now)\
- fixed a bug that could cause a seg fault if the first airfoil contained coordinates, but other airfoil files did not contain the same number of coordinates.
- moved the small amount of code in `fmin_fcn.f90` to `mod_root1dim.f90` and deleted it.
- removed some unused variables
- moved checks on AirfoilInfo init input data from AeroDyn to AirfoilInfo (so other drivers can perform the same checks)
- moved checks on AirfoilInfo Unsteady Aero data to the UnsteadyAero module (so other drivers can perform the same checks)
- moved checks on UnsteadyAero input data to the UnsteadyAero module (so other drivers can perform the same checks)
- added `AFTabMod` to the AeroDyn input files
- fixed spelling of "Gonzalez" in a few places
- replaced `GetSteadyOutputs` with `AFI_ComputeAirfoilCoefs`, which basically does the same thing.
- replaced `ComputeSteadyAirfoilCoefs` with `AFI_ComputeAirfoilCoefs`, which basically does the same thing.
- modified arguments to `BEMTU_Wind`, and moved call to it inside `BEMTU_InductionWithResidual` (This routine computes `Re` with inductions set to zero.
  this assumption is now contained in one place, so we may be able to include that in the solve with Re-interpolated airfoil tables)
- Made inductions an optional output of the `BEMTU_InductionWithResidual` routine, then 
  replaced calls to `UncoupledErrFn` with it.
- replaced `AFI_GetAirfoilParams` with `AFI_ComputeAirfoilCoefs`
- removed condition that all airfoil tables must have the same number of alphas
- airfoilInfo interpolates on log of Reynolds number if 2D Reynolds number interpolation is requested
- changed some of the interpolation in AirfoilInfo, including required subroutine arguements. AFI takes care of calling appropriate subroutine for 
  desired interpolation method.
- removed compiler warnings of unused variables in auto-generated types files using vs-build debug mode
- removed unused variables
default interpolation order is now 1
@andrew-platt
Copy link
Collaborator

@rafmudaf: I think there is a build issue here similar to the PR I submitted yesterday. CMAKE_Fortran_COMPILER not set

@abhineet-gupta
Copy link
Contributor

Are there any plans to add simulink build capability to this version?

@bjonkman
Copy link
Contributor Author

bjonkman commented Sep 9, 2019

Hopefully both #204 and #213 will be merged into the OpenFAST dev branch in the near future, which will give you both 2D airfoil interpolation and Simulink build capability. You could alternatively merge the branch from #204 into your own copy of this one to have both capabilities while waiting for the NREL merge.

- intent on extrap/interp routines is IN instead of INOUT where there are no meshes in the data type (from Registry change)
- changes to aerodyn data structures
@andrew-platt
Copy link
Collaborator

I made a minor update in the comment for InterpOrd in the airfoil tables on r-test. Do we need to point to the new git hash for that?

@rafmudaf
Copy link
Collaborator

Yep, you'll need to commit the change to the r-test commit within OpenFAST.

From openfast/ and with the r-test submodule on the correct commit, do this:

git add reg_test/r-test
git commit -m "Your message"

@andrew-platt
Copy link
Collaborator

I checked the results using the SPLINE_INTERP compiler flag (this currently sets the default interpolation to cubic for testing -- this was the previous default). This gives a very close match to the baseline results (3 offshore tests fail due to a very small timeshift).

I also checked the results with the new default interpolation. The results mostly show a timeshift relative to the baseline for most cases with very minor changes in loads. I would expect this to happen.

So, I propose we rebaseline the results, and remove the SPLINE_INTERP preprocessor directive and merge this PR.

@ebranlard
Copy link
Contributor

that sounds good to me

@andrew-platt
Copy link
Collaborator

Some polars will be more sensitive to changing from cubic to linear interpolation than others. For the AWT27_35 polar, this will result in slightly different values for Cl, particularly around the sharp transitions. Cubic interpolation has a tendency to produce overshoot.

AirFoil_Polar_Cl_AWT27_35
Figure: Absolute value of lift curve from AWT27_35 polar. Blue indicates positive lift, red indicates negative lift. Linear interpolation near 0 degrees angle of attack will yield different Cl values than cubic interpolation.

andrew-platt and others added 5 commits November 20, 2019 15:19
Also removed precompilier directive for SPLINE_INTERP now that we are satisfied with r-test baseline results using linear interp of airfoils in AD15
Airfoil-interp PR: Update r-test for new baseline
@rafmudaf rafmudaf self-assigned this Dec 3, 2019
@rafmudaf rafmudaf merged commit 2c6b78d into OpenFAST:dev Dec 3, 2019
@bjonkman bjonkman deleted the f/Airfoil-interp branch December 4, 2019 16:35
@rafmudaf rafmudaf mentioned this pull request Apr 2, 2020
rafmudaf pushed a commit to rafmudaf/openfast that referenced this pull request Jul 8, 2020
Accepted all of OpenFAST#213 for the non cmake-related code.
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.

5 participants