Skip to content

Commit

Permalink
Unsteady Aero changes (#226)
Browse files Browse the repository at this point in the history
* Update of Unsteady Aero model UAMod=2, corrections and added parameters

* UA bug fix: xd%tau_V was updated too early

- tau_V was reset at n+1 before setting other states that required values at n.
- also removed some comments

* UA: updated comments

this commit should affect spacing and comments only

* UA: fix condition around vortex shedding - incomplete?

   factor = (alpha_filt_cur - alpha0) * Kalpha_f     
   if (xd%tau_V(i,j) > T_VL .AND. (factor > 0)) then  
         ! The assertion is the T_V will always equal T_V0/2 when this condition is satisfied 
 
      becomes [note sign change and comment regarding value of sigma3, BUT: Code still needs a fix which is incomplete regarding the 2nd comment.  If you fall into that if block, then  we must continue to eliminate the vortex feed until we begin tracking another vortex, i.e., tau_V is reset to 0.0, this may mean the addition of a new flag.]
 
   if (xd%tau_V(i,j) > T_VL .AND. (Kalpha_f*dalpha0 < 0)) then ! .AND. (.not. LESF) 
         ! We no longer require that T_V will always equal T_V0/2 when this condition is satisfied as was the case in AD v13 GJH 7/20/2017 
         ! If we fall into this condition, we need to require we stay here until the current vortex is shed (i.e., tauV is reset to zero) 
      Cn_v = xd%Cn_v_minus1(i,j)*exp(-ds/T_V)   ! Eqn 1.52     
   else       
      Cn_v = Get_ExpEqn( ds, T_V, xd%Cn_v_minus1(i,j), C_V, xd%C_V_minus1(i,j) )   ! Eqn 1.47

* UA: Changed definition of VRTX

Email dated July 28, 2017: From Greg Hayman/Rick Damiani to Envision Energy:

We changed the definition of VRTX:
 
was:  
    VRTX = (xd%tau_V(i,j) <= 2.0_ReKi*T_VL) .and. (xd%tau_V(i,j) > 0.0_ReKi) 
 now:
      ! Is the vortex over the chord?   
   VRTX = (xd%tau_V(i,j) > 0.0_ReKi) .and. (xd%tau_V(i,j) <= T_VL) 
 
Because of this change in the definition of VRTX all if tests related to VRTX have been changed:
    if ( VRTX .and. (xd%tau_V(i,j) <= T_VL) ) then  ! Still shedding a vortex? 
 becomes
    if ( VRTX ) then  ! Still shedding a vortex, i.e., the current vortex is still over the chord?
 and
    if ( VRTX .and. (xd%tau_V(i,j) <= T_VL) ) then
 becomes  [ NOTE This is part of a logic change in the sigma3 section, see below]
    else if ( VRTX ) then

* UA bug fixes from merge of Alvaro's code

1. fprimeprime_m wasn't initialized in UAMod 2, but was still used to compue cm_FS. I initialized to 0 until Alvaro can comment as to what it should be.
2. Df_c was changed to use T_fc instead of T_f, but T_fc was static when UAMod/=2 (it is based on a new state variable for UAMod==2). I modified the OtherState%sigma1c variable to be equal to the old %sigma1 to get the same results here.

* UA: cleaned up some logic and removed non-standard tab formatting

* UA: Removed comment that doesn't seem to apply

* UA: removed unused variables

* UA: reverted some code I had changed from Alvaro

His fix changes the calculation of DF_c.

* UA: Fixed definition of fprimeprime_m from bad merge

* Some proposed corrections to merge the UA model Gonzalez with the Envision changes

* AD: updated AFI module with 2D interp code

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,

* AFI: change default interpolation to linear

Any airfoils that use "default" interpolation will see different results.

* AD big fix: calculation of Re

BEMTU_Wind was calculating Re based on dynamic viscosity instead of kinematic viscosity as reported here: #71

Fixed the calculation and cleaned up calling routines that don't need the airDens variable anymore.

* Registry: modified auto-generated ExtrapInterp routines for AFI

- 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.

* AeroDyn updates for 2D airfoil interpolation

- 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

* Updated example input files in documentation

* updated documentation for AD/Airfoils

* fix typos; replace 1.44 with already-defined parameter

* updated comment in example airfoil file

default interpolation order is now 1

* UA: updated calculation of Cn_FS for UAmod = 3

also updated some numerics to account for periodicity in differences of angles

* fixed format in SysGnuWin.f90

* rename files that git thinks were deleted (not renamed) on nrel/dev

* Update auto-generated types files

- 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

* updated types files

* UA: add (unnecessary) initialization to avoid compiler warning

* Update baselines

Co-authored-by: alvarogonzalezsalcedo <35765400+alvarogonzalezsalcedo@users.noreply.github.com>
Co-authored-by: Rafael M Mudafort <rafmudaf@gmail.com>
  • Loading branch information
3 people committed Dec 29, 2019
1 parent 5a8dfc0 commit b6bc63c
Show file tree
Hide file tree
Showing 7 changed files with 733 additions and 176 deletions.
2 changes: 2 additions & 0 deletions modules/aerodyn/src/AirfoilInfo.f90
Original file line number Diff line number Diff line change
Expand Up @@ -963,8 +963,10 @@ subroutine AFI_ComputeAirfoilCoefs1D( AOA, p, AFI_interp, errStat, errMsg, Table
! needed if using UnsteadyAero:
if (p%Table(iTab)%InclUAdata) then
AFI_interp%Cd0 = p%Table(iTab)%UA_BL%Cd0
AFI_interp%Cm0 = p%Table(iTab)%UA_BL%Cm0
else
AFI_interp%Cd0 = 0.0_ReKi
AFI_interp%Cm0 = 0.0_ReKi
end if

end subroutine AFI_ComputeAirfoilCoefs1D
Expand Down
1 change: 1 addition & 0 deletions modules/aerodyn/src/AirfoilInfo_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,6 @@ typedef ^ ^ ReKi Cd
typedef ^ ^ ReKi Cm - 0. - "Dimensionless coefficient of pitching moment" -
typedef ^ ^ ReKi Cpmin - 0. - "Dimensionless coefficient of minimum pressure" -
typedef ^ ^ ReKi Cd0 - 0. - "Minimum Cd value (used for Beddoes-Leishman unsteady aero)" -
typedef ^ ^ ReKi Cm0 - 0. - "2D pitching moment coefficient at zero lift, positive if nose is up" -


12 changes: 12 additions & 0 deletions modules/aerodyn/src/AirfoilInfo_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ MODULE AirfoilInfo_Types
REAL(ReKi) :: Cm = 0. !< Dimensionless coefficient of pitching moment [-]
REAL(ReKi) :: Cpmin = 0. !< Dimensionless coefficient of minimum pressure [-]
REAL(ReKi) :: Cd0 = 0. !< Minimum Cd value (used for Beddoes-Leishman unsteady aero) [-]
REAL(ReKi) :: Cm0 = 0. !< 2D pitching moment coefficient at zero lift, positive if nose is up [-]
END TYPE AFI_OutputType
! =======================
CONTAINS
Expand Down Expand Up @@ -1941,6 +1942,7 @@ SUBROUTINE AFI_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, ErrM
DstOutputData%Cm = SrcOutputData%Cm
DstOutputData%Cpmin = SrcOutputData%Cpmin
DstOutputData%Cd0 = SrcOutputData%Cd0
DstOutputData%Cm0 = SrcOutputData%Cm0
END SUBROUTINE AFI_CopyOutput

SUBROUTINE AFI_DestroyOutput( OutputData, ErrStat, ErrMsg )
Expand Down Expand Up @@ -1994,6 +1996,7 @@ SUBROUTINE AFI_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg,
Re_BufSz = Re_BufSz + 1 ! Cm
Re_BufSz = Re_BufSz + 1 ! Cpmin
Re_BufSz = Re_BufSz + 1 ! Cd0
Re_BufSz = Re_BufSz + 1 ! Cm0
IF ( Re_BufSz .GT. 0 ) THEN
ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 )
IF (ErrStat2 /= 0) THEN
Expand Down Expand Up @@ -2031,6 +2034,8 @@ SUBROUTINE AFI_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg,
Re_Xferred = Re_Xferred + 1
ReKiBuf ( Re_Xferred:Re_Xferred+(1)-1 ) = InData%Cd0
Re_Xferred = Re_Xferred + 1
ReKiBuf ( Re_Xferred:Re_Xferred+(1)-1 ) = InData%Cm0
Re_Xferred = Re_Xferred + 1
END SUBROUTINE AFI_PackOutput

SUBROUTINE AFI_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg )
Expand Down Expand Up @@ -2075,6 +2080,8 @@ SUBROUTINE AFI_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs
Re_Xferred = Re_Xferred + 1
OutData%Cd0 = ReKiBuf( Re_Xferred )
Re_Xferred = Re_Xferred + 1
OutData%Cm0 = ReKiBuf( Re_Xferred )
Re_Xferred = Re_Xferred + 1
END SUBROUTINE AFI_UnPackOutput


Expand Down Expand Up @@ -2178,6 +2185,8 @@ SUBROUTINE AFI_Output_ExtrapInterp1(y1, y2, tin, y_out, tin_out, ErrStat, ErrMsg
y_out%Cpmin = y1%Cpmin + b0 * t_out
b0 = -(y1%Cd0 - y2%Cd0)/t(2)
y_out%Cd0 = y1%Cd0 + b0 * t_out
b0 = -(y1%Cm0 - y2%Cm0)/t(2)
y_out%Cm0 = y1%Cm0 + b0 * t_out
END SUBROUTINE AFI_Output_ExtrapInterp1


Expand Down Expand Up @@ -2245,6 +2254,9 @@ SUBROUTINE AFI_Output_ExtrapInterp2(y1, y2, y3, tin, y_out, tin_out, ErrStat, Er
b0 = (t(3)**2*(y1%Cd0 - y2%Cd0) + t(2)**2*(-y1%Cd0 + y3%Cd0))/(t(2)*t(3)*(t(2) - t(3)))
c0 = ( (t(2)-t(3))*y1%Cd0 + t(3)*y2%Cd0 - t(2)*y3%Cd0 ) / (t(2)*t(3)*(t(2) - t(3)))
y_out%Cd0 = y1%Cd0 + b0 * t_out + c0 * t_out**2
b0 = (t(3)**2*(y1%Cm0 - y2%Cm0) + t(2)**2*(-y1%Cm0 + y3%Cm0))/(t(2)*t(3)*(t(2) - t(3)))
c0 = ( (t(2)-t(3))*y1%Cm0 + t(3)*y2%Cm0 - t(2)*y3%Cm0 ) / (t(2)*t(3)*(t(2) - t(3)))
y_out%Cm0 = y1%Cm0 + b0 * t_out + c0 * t_out**2
END SUBROUTINE AFI_Output_ExtrapInterp2


Expand Down
Loading

0 comments on commit b6bc63c

Please sign in to comment.