Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
9a3edc6
Can use F,f,T,t for logical init value in registry
deslaughter Jul 21, 2023
f2595bb
Auto gen Registry_NWTC_Library.txt from base/mesh
deslaughter Jul 21, 2023
f6da687
Add ModVar for module variables to NWTC Library
deslaughter Jul 21, 2023
49de27a
Modify ElastoDyn for tight coupling
deslaughter Jul 21, 2023
f22c46b
Add TIGHT_COUPLING CMake config option
deslaughter Jul 21, 2023
8a07610
Add tight coupling modules in OF-library
deslaughter Jul 21, 2023
b1ba73e
Default to TIGHT_COUPLING=OFF
deslaughter Jul 21, 2023
6f99479
NWTC Library updates for tight coupling
deslaughter Aug 16, 2023
bde06b8
Updated ElastoDyn for more TC changes
deslaughter Aug 16, 2023
d5f229d
Integrate BeamDyn for tight coupling
deslaughter Aug 16, 2023
f475b54
Expand tight coupling to include BeamDyn
deslaughter Aug 16, 2023
f70158e
Tight Coupling working with BeamDyn!
deslaughter Aug 17, 2023
152f4ad
Resolve BeamDyn initial strain for rotated blade
deslaughter Jun 29, 2023
1388756
Can take large time steps, fails before full rot
deslaughter Aug 23, 2023
623ebe2
Attempting to reset BeamDyn states
deslaughter Aug 25, 2023
381aac1
Maybe working?
deslaughter Aug 25, 2023
74e7162
Pretty sure it works
deslaughter Aug 25, 2023
4bb864e
Began adding other modules to FAST_Eval
deslaughter Aug 28, 2023
487d72a
Fix BD state displacement calc
deslaughter Aug 28, 2023
8c96eaa
Partially working
deslaughter Aug 29, 2023
709cdff
BD: change reference frame to rootmotion mesh
andrew-platt Aug 28, 2023
e6841d7
BD Refchange: store gravity vector in inertial frame
andrew-platt Aug 28, 2023
54ceceb
BD RefChange: fix some translation displacement issues
andrew-platt Aug 28, 2023
128ea2b
BeamDyn works in Tight Coupling!
deslaughter Aug 30, 2023
b5195fb
Nearly there. Initialization needs work.
deslaughter Aug 31, 2023
5e26dd2
Commit everything
deslaughter Sep 6, 2023
d30ae7c
fix bug in cross product in ModVar
deslaughter Sep 6, 2023
9ed05f6
More changes
deslaughter Sep 6, 2023
e928c25
BD RefChange: minor corrections to reference frame.
andrew-platt Aug 31, 2023
0ecd3c3
BD RefChange: fix root node in mesh
andrew-platt Aug 31, 2023
d89a8ef
BD RefChange: code cleanup. Add flag to get old behaviour
andrew-platt Aug 31, 2023
a78fed3
Updating the BD global reference is working!
deslaughter Sep 2, 2023
b9f9b2e
Tight coupling with BeamDyn works!
deslaughter Sep 7, 2023
7fbf6fc
Add ModVars to InflowWind
deslaughter Sep 7, 2023
0c630d2
Remove check for Module ID in FAST_ResetRemapFlags
deslaughter Sep 7, 2023
f2a32fc
Add missing public funcs in BD
deslaughter Sep 7, 2023
6fa22bb
Add consts, remove unused array in FAST_Registry
deslaughter Sep 7, 2023
17b3054
Solver cleanup, add modules to index arrays
deslaughter Sep 7, 2023
fecfcbd
Add code to add modules in FAST_Subs
deslaughter Sep 7, 2023
61eb515
Fix poorly formatted line in ElastoDyn Registry
deslaughter Sep 7, 2023
e39fcd2
Add ModVars to AeroDyn and ServoDyn registries
deslaughter Sep 7, 2023
18c2f79
Mapping init in FAST_Eval, simplify InputSolve
deslaughter Sep 8, 2023
fb6cc1f
Fix wrong variable bug in ModVar
deslaughter Sep 8, 2023
ed00cb5
Add MV_InitVarsVals to AeroDyn
deslaughter Sep 8, 2023
5a8d906
Integrated AeroDyn with ED, BD, and IfW
deslaughter Sep 9, 2023
3aae012
Add SrvD to TC, cleanup TC, extend mappings
deslaughter Sep 14, 2023
0a4495d
Fix error handling in FAST_Subs
deslaughter Sep 14, 2023
c6a0906
Add ModVars to SubDyn Registry, clean BD Registry
deslaughter Sep 14, 2023
cc5b1c7
Add ModVars placeholder in SubDyn
deslaughter Sep 14, 2023
2796ae3
Move BD update ref into FAST_UpdateStates, cleanup
deslaughter Sep 14, 2023
2197264
Cleanup and automatic Jacobian recalc
deslaughter Sep 14, 2023
5fff699
Add ConvIter, ConvErr, and NumUJac to output file
deslaughter Sep 15, 2023
1d94347
TC: mesh transfer order: motion comes before loads
deslaughter Sep 22, 2023
5270bf8
BD_JacobianPInput: skip rotate states if IsSolve=T
deslaughter Sep 27, 2023
e126ce8
Remove check in FAST_LinearizeMappings, add TODO
deslaughter Sep 27, 2023
e4b7dc0
Solver.f90: fix warning, Jacobian negative sign
deslaughter Sep 27, 2023
98d0224
Revised mesh mapping spec, added SubDyn
deslaughter Oct 3, 2023
9faec51
Remove smart Jac update from Solver.f90
deslaughter Oct 5, 2023
ecd4274
Don't use fancy DDT init, ifort doesn't support
deslaughter Oct 5, 2023
c5b7960
Enable smart Jacobian update logic
deslaughter Dec 1, 2023
239c437
Make MaxOutPts public from InflowWind_Subs
deslaughter Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ option(VARIABLE_TRACKING "Enables variable tracking for better runtime debugging
option(GENERATE_TYPES "Use the openfast-regsitry to autogenerate types modules" off)
option(BUILD_SHARED_LIBS "Enable building shared libraries" off)
option(DOUBLE_PRECISION "Treat REAL as double precision" on)
option(TIGHT_COUPLING "Enable tight couping solver" off)
option(USE_DLL_INTERFACE "Enable runtime loading of dynamic libraries" on)
option(FPE_TRAP_ENABLED "Enable FPE trap in compiler options" off)
option(ORCA_DLL_LOAD "Enable OrcaFlex Library Load" on)
Expand Down
204 changes: 203 additions & 1 deletion modules/aerodyn/src/AeroDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,13 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut
if (Failed()) return;
enddo
end if


!............................................................................................
! Initialize Module Variables:
!............................................................................................

call Init_ModuleVars(InitInp, u, p, y, m, InitOut, errStat2, errMsg2); if (Failed()) return

!............................................................................................
! Print the summary file if requested:
!............................................................................................
Expand Down Expand Up @@ -602,6 +608,202 @@ subroutine AD_ReInit(p, x, xd, z, OtherState, m, Interval, ErrStat, ErrMsg )

end subroutine AD_ReInit
!----------------------------------------------------------------------------------------------------------------------------------
!> This routine initializes module variables for use by the solver and linearization.
subroutine Init_ModuleVars(InitInp, u, p, y, m, InitOut, ErrStat, ErrMsg)
TYPE(AD_InitInputType), INTENT(IN ) :: InitInp !< Input data for initialization routine
TYPE(AD_InputType), INTENT(INOUT) :: u !< An initial guess for the input; input mesh must be defined
TYPE(AD_ParameterType), INTENT(INOUT) :: p !< Parameters
TYPE(AD_OutputType), INTENT(INOUT) :: y !< Initial system outputs (outputs are not calculated;
TYPE(AD_MiscVarType), INTENT(INOUT) :: m !< Misc variables for optimization (not copied in glue code)
TYPE(AD_InitOutputType), INTENT(INOUT) :: InitOut !< Output for initialization routine
INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation
CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None

character(*), parameter :: RoutineName = 'Init_ModuleVars'
integer(IntKi) :: ErrStat2 ! Temporary Error status
character(ErrMsgLen) :: ErrMsg2 ! Temporary Error message
integer(IntKi) :: i, j, k
character(4) :: RotorStr

! Allocate space for variables (deallocate if already allocated)
if (associated(p%Vars)) deallocate(p%Vars)
allocate(p%Vars, stat=ErrStat2)
if (ErrStat2 /= 0) then
call SetErrStat(ErrID_Fatal, "Error allocating p%Vars", ErrStat, ErrMsg, RoutineName)
return
end if

! Add pointers to vars to inititialization output
InitOut%Vars => p%Vars

! Loop through rotors
do i = 1, size(InitInp%rotors)

RotorStr = 'R'//trim(Num2LStr(i))

associate(rp => p%rotors(i), &
ru => u%rotors(i), &
ry => y%rotors(i), &
rInitOut => InitOut%rotors(i))

!----------------------------------------------------------------------
! Continuous State Variables
!----------------------------------------------------------------------


!----------------------------------------------------------------------
! Input variables
!----------------------------------------------------------------------

! Add tower motion
call MV_AddMeshVar(p%Vars%u, trim(RotorStr)//"TowerMotion", &
Mesh=ru%TowerMotion, &
Fields=[VF_TransDisp, VF_Orientation, VF_TransVel])

! Add nacelle motion
call MV_AddMeshVar(p%Vars%u, trim(RotorStr)//"NacelleMotion", &
Mesh=ru%NacelleMotion, &
Fields=[VF_TransDisp, VF_Orientation, VF_TransVel])

! Add hub motion
call MV_AddMeshVar(p%Vars%u, trim(RotorStr)//"HubMotion", &
Mesh=ru%HubMotion, &
Fields=[VF_TransDisp, VF_Orientation, VF_AngularVel])

! Add blade root motion
do j = 1, rp%NumBlades
call MV_AddMeshVar(p%Vars%u, trim(RotorStr)//"BladeRootMotion"//IdxStr(j), &
Mesh=ru%BladeRootMotion(j), &
Fields=[VF_Orientation])
end do

! Add blade motion
do j = 1, rp%NumBlades
call MV_AddMeshVar(p%Vars%u, trim(RotorStr)//"BladeMotion"//IdxStr(j), &
Mesh=ru%BladeMotion(j), &
Fields=[VF_TransDisp, VF_Orientation, VF_TransVel, VF_AngularVel, VF_TransAcc])
end do

! Add user props
do j = 1, size(ru%UserProp,2)
do k = 1, size(ru%UserProp,1)
call MV_AddVar(p%Vars%u, trim(RotorStr)//"UserProp"//IdxStr(j, k), VF_Scalar, iUsr=j, jUsr=k)
end do
end do

!----------------------------------------------------------------------
! Output variables
!----------------------------------------------------------------------

! Add tower load
call MV_AddMeshVar(p%Vars%y, trim(RotorStr)//"TowerLoad", LoadFields, Mesh=ry%TowerLoad)

! Add nacelle load
call MV_AddMeshVar(p%Vars%y, trim(RotorStr)//"HubLoad", LoadFields, Mesh=ry%HubLoad)

! Add nacelle load
call MV_AddMeshVar(p%Vars%y, trim(RotorStr)//"NacelleLoad", LoadFields, Mesh=ry%NacelleLoad)

! Loop through blades, add blade loads
do j = 1, rp%NumBlades
call MV_AddMeshVar(p%Vars%y, trim(RotorStr)//"BladeLoad"//IdxStr(j), LoadFields, Mesh=ry%BladeLoad(j))
end do

! Rotor outputs
do j = 1, rp%NumOuts
call MV_AddVar(p%Vars%y, rInitOut%WriteOutputHdr(j), VF_Scalar, &
Flags=OutParamFlags(rp%OutParam(j)%Indx), &
iUsr=j, &
LinNames=[trim(rInitOut%WriteOutputHdr(j))//', '//trim(rInitOut%WriteOutputUnt(j))])
end do

! Blade node outputs
do j = rp%NumOuts + 1, rp%NumOuts + rp%BldNd_TotNumOuts
call MV_AddVar(p%Vars%y, rInitOut%WriteOutputHdr(j), VF_Scalar, &
Flags=VF_RotFrame, &
iUsr=k, &
LinNames=[trim(rInitOut%WriteOutputHdr(j))//', '//trim(rInitOut%WriteOutputUnt(j))])
end do

end associate
end do

!----------------------------------------------------------------------------
! Initialize Variables and Values
!----------------------------------------------------------------------------

CALL MV_InitVarsVals(p%Vars, m%Vals, InitInp%Linearize, ErrStat2, ErrMsg2); if (Failed()) return

!----------------------------------------------------------------------------
! Linearization
!----------------------------------------------------------------------------

! If linearization is not requested, return
! if (.not. InitInp%Linearize) return
! TODO: Use modvars for linearization
return

! Loop through rotors
do i = 1, size(InitInp%rotors)

! State Variables
call AllocAry(InitOut%rotors(i)%LinNames_x, p%Vars%Nx, 'LinNames_x', ErrStat2, ErrMsg2); if (Failed()) return
call AllocAry(InitOut%rotors(i)%RotFrame_x, p%Vars%Nx, 'RotFrame_x', ErrStat2, ErrMsg2); if (Failed()) return
call AllocAry(InitOut%rotors(i)%DerivOrder_x, p%Vars%Nx, 'DerivOrder_x', ErrStat2, ErrMsg2); if (Failed()) return
InitOut%rotors(i)%DerivOrder_x = 2
do j = 1, size(p%Vars%x)
do k = 1, p%Vars%x(j)%Num
InitOut%rotors(i)%LinNames_x(p%Vars%x(j)%iLoc) = p%Vars%x(j)%LinNames
InitOut%rotors(i)%RotFrame_x(p%Vars%x(j)%iLoc) = iand(p%Vars%x(j)%Flags, VF_RotFrame) > 0
end do
end do

! Input Variables
call AllocAry(InitOut%rotors(i)%LinNames_u, p%Vars%Nu, 'LinNames_u', ErrStat2, ErrMsg2); if (Failed()) return
call AllocAry(InitOut%rotors(i)%RotFrame_u, p%Vars%Nu, 'RotFrame_u', ErrStat2, ErrMsg2); if (Failed()) return
call AllocAry(InitOut%rotors(i)%IsLoad_u, p%Vars%Nu, 'IsLoad_u', ErrStat2, ErrMsg2); if (Failed()) return
do j = 1, size(p%Vars%u)
do k = 1, p%Vars%u(j)%Num
InitOut%rotors(i)%LinNames_u(p%Vars%u(j)%iLoc) = p%Vars%u(j)%LinNames
InitOut%rotors(i)%RotFrame_u(p%Vars%u(j)%iLoc) = iand(p%Vars%u(j)%Flags, VF_RotFrame) > 0
InitOut%rotors(i)%IsLoad_u(p%Vars%u(j)%iLoc) = iand(p%Vars%u(j)%Field, VF_Force+VF_Moment) > 0
end do
end do

! Output variables
call AllocAry(InitOut%rotors(i)%LinNames_y, p%Vars%Ny, 'LinNames_y', ErrStat2, ErrMsg2); if (Failed()) return
call AllocAry(InitOut%rotors(i)%RotFrame_y, p%Vars%Ny, 'RotFrame_y', ErrStat2, ErrMsg2); if (Failed()) return
do j = 1, size(p%Vars%y)
do k = 1, p%Vars%y(j)%Num
InitOut%rotors(i)%LinNames_y(p%Vars%y(j)%iLoc) = p%Vars%y(j)%LinNames
InitOut%rotors(i)%RotFrame_y(p%Vars%y(j)%iLoc) = iand(p%Vars%y(j)%Flags, VF_RotFrame) > 0
end do
end do
end do

contains

pure integer(IntKi) function OutParamFlags(idx)
integer(IntKi), intent(in) :: idx
integer(IntKi), parameter :: RotFrameInds(*) = [&
BAzimuth, BPitch, &
BNVUndx, BNVUndy, BNVUndz, BNVDisx, BNVDisy, BNVDisz, BNSTVx, BNSTVy, &
BNSTVz, BNVRel, BNDynP, BNRe, BNM, BNVIndx, BNVIndy, BNAxInd, BNTnInd, &
BNAlpha, BNTheta, BNPhi, BNCurve, BNCl, BNCd, BNCm, BNCx, BNCy, BNCn, &
BNCt, BNFl, BNFd, BNMm, BNFx, BNFy, BNFn, BNFt, BNClrnc]
if (any(RotFrameInds == idx)) then
OutParamFlags = VF_RotFrame
else
OutParamFlags = VF_None
end if
end function

logical function Failed()
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
Failed = ErrStat >= AbortErrLev
end function Failed
end subroutine
!----------------------------------------------------------------------------------------------------------------------------------
!> This routine initializes (allocates) the misc variables for use during the simulation.
subroutine Init_MiscVars(m, p, u, y, errStat, errMsg)
type(RotMiscVarType), intent(inout) :: m !< misc/optimization data (not defined in submodules)
Expand Down
3 changes: 3 additions & 0 deletions modules/aerodyn/src/AeroDyn_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ typedef ^ RotInitOutputType ReKi TwrDiam {:} - - "Diameter of tower at node" m

typedef ^ InitOutputType RotInitOutputType rotors {:} - - "Rotor init output type" -
typedef ^ InitOutputType ProgDesc Ver - - - "This module's name, version, and date" -
typedef ^ InitOutputType ModVarsType *Vars - - - "Module Variables" -
# ..... Input file data ...........................................................................................................

# ..... Primary Input file data ...................................................................................................
Expand Down Expand Up @@ -324,6 +325,7 @@ 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" -
typedef ^ MiscVarType ModValsType Vals - - - "Module Values" -

# ..... Parameters ................................................................................................................
# Define parameters here:
Expand Down Expand Up @@ -410,6 +412,7 @@ 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" -
typedef ^ ParameterType ModVarsType &Vars - - - "Module Variables" -


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