Skip to content

Commit

Permalink
Merge pull request #1596 from deslaughter/f/ifwptr
Browse files Browse the repository at this point in the history
Use pointers to couple InflowWind and AeroDyn
  • Loading branch information
deslaughter authored Jun 8, 2023
2 parents 22e8320 + 59e82d7 commit 7b77296
Show file tree
Hide file tree
Showing 29 changed files with 663 additions and 383 deletions.
2 changes: 1 addition & 1 deletion modules/aerodyn/src/AeroAcoustics_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ typedef ^ InitOutputType ReKi AirDens
#

# ..... Primary Input file data ...................................................................................................
typedef ^ AA_InputFile DbKi DT_AA - - - "Time interval for aerodynamic calculations {or "default"}" s
typedef ^ AA_InputFile DbKi DT_AA - - - "Time interval for aerodynamic calculations {or \"default\"}" s
typedef ^ AA_InputFile IntKi IBLUNT - - - "FLAG TO COMPUTE BLUNTNESS NOISE" -
typedef ^ AA_InputFile IntKi ILAM - - - "FLAG TO COMPUTE LBL NOISE {1=steady model, 2=Beddoes-Leishman unsteady model}" -
typedef ^ AA_InputFile IntKi ITIP - - - "FLAG TO COMPUTE TIP NOISE {0=none, 1=baseline potential flow, 2=potential flow with Bak correction}" -
Expand Down
2 changes: 1 addition & 1 deletion modules/aerodyn/src/AeroAcoustics_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ MODULE AeroAcoustics_Types
! =======================
! ========= AA_InputFile =======
TYPE, PUBLIC :: AA_InputFile
REAL(DbKi) :: DT_AA !< Time interval for aerodynamic calculations {or [default"}"]
REAL(DbKi) :: DT_AA !< Time interval for aerodynamic calculations {or "default"} [s]
INTEGER(IntKi) :: IBLUNT !< FLAG TO COMPUTE BLUNTNESS NOISE [-]
INTEGER(IntKi) :: ILAM !< FLAG TO COMPUTE LBL NOISE {1=steady model, 2=Beddoes-Leishman unsteady model} [-]
INTEGER(IntKi) :: ITIP !< FLAG TO COMPUTE TIP NOISE {0=none, 1=baseline potential flow, 2=potential flow with Bak correction} [-]
Expand Down
191 changes: 140 additions & 51 deletions modules/aerodyn/src/AeroDyn.f90

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions modules/aerodyn/src/AeroDyn_Driver_Subs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ module AeroDyn_Driver_Subs
use AeroDyn_Inflow_Types
use AeroDyn_Inflow, only: ADI_Init, ADI_ReInit, ADI_End, ADI_CalcOutput, ADI_UpdateStates
use AeroDyn_Inflow, only: concatOutputHeaders
use AeroDyn_Inflow, only: ADI_ADIW_Solve ! TODO remove me
use AeroDyn_Inflow, only: Init_MeshMap_For_ADI, Set_Inputs_For_ADI
use AeroDyn_IO, only: AD_WrVTK_Surfaces, AD_WrVTK_LinesPoints

Expand Down Expand Up @@ -238,7 +237,6 @@ subroutine Dvr_InitCase(iCase, dvr, ADI, FED, errStat, errMsg )
DO j = 1-numInp, 0
call Shift_ADI_Inputs(j,dvr, ADI, errStat2, errMsg2); if(Failed()) return
call Set_Inputs_For_ADI(ADI%u(1), FED, errStat2, errMsg2); if(Failed()) return
call ADI_ADIW_Solve(ADI%inputTimes(1), ADI%p, ADI%u(1)%AD, ADI%OtherState(1)%AD, ADI%m%IW%u, ADI%m%IW, .true., errStat2, errMsg2); if(Failed()) return ! TODO TODO TODO remove me
END DO
! --- AeroDyn + Inflow at T=0
call ADI_CalcOutput(ADI%inputTimes(1), ADI%u(1), ADI%p, ADI%x(1), ADI%xd(1), ADI%z(1), ADI%OtherState(1), ADI%y, ADI%m, errStat2, errMsg2); if(Failed()) return
Expand Down Expand Up @@ -291,8 +289,7 @@ subroutine Dvr_TimeStep(nt, dvr, ADI, FED, errStat, errMsg)
! u(1) is at nt, u(2) is at nt-1. Set inputs for nt timestep
call Shift_ADI_Inputs(nt,dvr, ADI, errStat2, errMsg2); if(Failed()) return
call Set_Inputs_For_ADI(ADI%u(1), FED, errStat2, errMsg2); if(Failed()) return
call ADI_ADIW_Solve(ADI%inputTimes(1), ADI%p, ADI%u(1)%AD, ADI%OtherState(1)%AD, ADI%m%IW%u, ADI%m%IW, .true., errStat, errMsg)


time = ADI%inputTimes(2)

! Calculate outputs at nt - 1 (current time)
Expand Down Expand Up @@ -702,9 +699,12 @@ subroutine Set_Mesh_Motion(nt, dvr, ADI, FED, errStat, errMsg)
! Getting current time values by interpolation
! timestate = HWindSpeed, PLExp, RotSpeed, Pitch, yaw
call interpTimeValue(dvr%timeSeries, time, dvr%iTimeSeries, timeState)
! Set wind at this time
! Set wind at this time
ADI%m%IW%HWindSpeed = timeState(1)
ADI%m%IW%PLexp = timeState(2)
! Set values in flow field (not recommended)
ADI%m%IW%p%FlowField%Uniform%VelH = timeState(1)
ADI%m%IW%p%FlowField%Uniform%ShrV = timeState(2)
!! Set motion at this time
dvr%WT(1)%hub%rotSpeed = timeState(3) ! rad/s
do j=1,size(dvr%WT(1)%bld)
Expand Down
236 changes: 83 additions & 153 deletions modules/aerodyn/src/AeroDyn_Inflow.f90

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions modules/aerodyn/src/AeroDyn_Inflow_C_Binding.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1052,10 +1052,6 @@ SUBROUTINE AeroDyn_Inflow_C_CalcOutput(Time_C, &
ErrStat2, ErrMsg2 ) ! transfer input motion mesh to u(1) meshes
if (Failed()) return

! call IfW and set inputs for AD
call ADI_ADIW_Solve(Time, ADI%p, ADI%u(1)%AD, ADI%OtherState(STATE_CURR)%AD, ADI%m%IW%u, ADI%m%IW, .false., ErrStat2, ErrMsg2)
if (Failed()) return

! Call the main subroutine ADI_CalcOutput to get the resulting forces and moments at time T
CALL ADI_CalcOutput( Time, ADI%u(1), ADI%p, ADI%x(STATE_CURR), ADI%xd(STATE_CURR), ADI%z(STATE_CURR), ADI%OtherState(STATE_CURR), ADI%y, ADI%m, ErrStat2, ErrMsg2 )
if (Failed()) return
Expand Down
1 change: 0 additions & 1 deletion modules/aerodyn/src/AeroDyn_Inflow_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
MODULE AeroDyn_Inflow_Types
!---------------------------------------------------------------------------------------------------------------------------------
USE AeroDyn_Types
USE InflowWind_Types
USE NWTC_Library
IMPLICIT NONE
INTEGER(IntKi), PUBLIC, PARAMETER :: ADI_Version = 1 ! [-]
Expand Down
11 changes: 8 additions & 3 deletions modules/aerodyn/src/AeroDyn_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ usefrom BEMT_Registry.txt
usefrom FVW_Registry.txt
usefrom UnsteadyAero_Registry.txt
usefrom AeroAcoustics_Registry.txt
usefrom InflowWind.txt

param AeroDyn/AD - IntKi ModelUnknown - -1 - "" -
param ^ - IntKi WakeMod_none - 0 - "Wake model - none" -
Expand Down Expand Up @@ -160,7 +161,7 @@ typedef ^ RotInputFile CHARACTER(1024) TFinFile - - - "Input file
typedef ^ RotInputFile TFinInputFileType TFin - - - "Input file data for tail fin" -

typedef ^ AD_InputFile Logical Echo - - - "Echo input file to echo file" -
typedef ^ AD_InputFile DbKi DTAero - - - "Time interval for aerodynamic calculations {or "default"}" s
typedef ^ AD_InputFile DbKi DTAero - - - "Time interval for aerodynamic calculations {or \"default\"}" s
typedef ^ AD_InputFile IntKi WakeMod - - - "Type of wake/induction model {0=none, 1=BEMT, 2=DBEMT, 3=FVW}" -
typedef ^ AD_InputFile IntKi AFAeroMod - - - "Type of blade airfoil aerodynamics model {1=steady model, 2=Beddoes-Leishman unsteady model}" -
typedef ^ AD_InputFile IntKi TwrPotent - - - "Type of tower influence on wind based on potential flow around the tower {0=none, 1=baseline potential flow, 2=potential flow with Bak correction}" -
Expand Down Expand Up @@ -199,7 +200,7 @@ typedef ^ AD_InputFile CHARACTER(1024) FVWFileName - - - "FVW input filename" "q
typedef ^ AD_InputFile CHARACTER(1024) AFNames {:} - - "Airfoil file names (NumAF lines)" "quoted strings"
typedef ^ AD_InputFile LOGICAL UseBlCm - - - "Include aerodynamic pitching moment in calculations?" flag
#typedef ^ AD_InputFile IntKi NumBlNds - - - "Number of blade nodes used in the analysis" -
typedef ^ AD_InputFile LOGICAL SumPrint - - - "Generate a summary file listing input options and interpolated properties to "<rootname>.AD.sum"?" flag
typedef ^ AD_InputFile LOGICAL SumPrint - - - "Generate a summary file listing input options and interpolated properties to \"<rootname>.AD.sum\"?" flag
typedef ^ AD_InputFile IntKi NBlOuts - - - "Number of blade node outputs [0 - 9]" -
typedef ^ AD_InputFile IntKi BlOutNd {9} - - "Blade nodes whose values will be output" -
typedef ^ AD_InputFile IntKi NTwOuts - - - "Number of tower node outputs [0 - 9]" -
Expand Down Expand Up @@ -316,10 +317,13 @@ typedef ^ RotMiscVarType ReKi TFinSTV_i 3 - - "Structural velocity at the refer
typedef ^ RotMiscVarType ReKi TFinF_i 3 - - "Forces at the reference point of the fin in the inertial system"
typedef ^ RotMiscVarType ReKi TFinM_i 3 - - "Moments at the reference point of the fin in the inertial system"

typedef ^ MiscVarType RotMiscVarType rotors {:} - - - "MiscVars for each rotor" -
typedef ^ MiscVarType RotMiscVarType rotors {:} - - "MiscVars for each rotor" -
typedef ^ MiscVarType FVW_InputType FVW_u : - - "Inputs to the FVW module" -
typedef ^ MiscVarType FVW_OutputType FVW_y - - - "Outputs from the FVW module" -
typedef ^ MiscVarType FVW_MiscVarType FVW - - - "MiscVars from the FVW module" -
typedef ^ MiscVarType ReKi WindPos {:}{:} - - "XYZ coordinates to query for wind velocity/acceleration" -
typedef ^ MiscVarType ReKi WindVel {:}{:} - - "XYZ components of wind velocity" -
typedef ^ MiscVarType ReKi WindAcc {:}{:} - - "XYZ components of wind acceleration" -

# ..... Parameters ................................................................................................................
# Define parameters here:
Expand Down Expand Up @@ -405,6 +409,7 @@ typedef ^ ParameterType IntKi WakeMod - - - "Type of wake/induction model {0=non
typedef ^ ParameterType FVW_ParameterType FVW - - - "Parameters for FVW module"
typedef ^ ParameterType LOGICAL CompAeroMaps - .FALSE. - "flag to determine if AeroDyn is computing aero maps (true) or running a normal simulation (false)" -
typedef ^ ParameterType LOGICAL UA_Flag - - - "logical flag indicating whether to use UnsteadyAero" -
typedef ^ ParameterType FlowFieldType *FlowField - - - "Pointer of InflowWinds flow field data type" -


# ..... Inputs ....................................................................................................................
Expand Down
Loading

0 comments on commit 7b77296

Please sign in to comment.