Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion modules/awae/src/vtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ extern "C"

// Read remaining values
const auto n_values{n_points * 3};
for (auto i = 1U; i < n_values; ++i)
for (auto i = 1; i < n_values; ++i)
{
answer = fast_float::from_chars(answer.ptr, input.data() + input.size(), values[i],
fast_float::chars_format::skip_white_space);
Expand Down
4 changes: 2 additions & 2 deletions modules/openfast-library/src/FAST_Funcs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,7 @@ subroutine FAST_JacobianPInput(ModData, ThisTime, iInput, iState, T, ErrStat, Er
dYdu=dYdu, dXdu=dXdu)

case (Module_SrvD)
call SrvD_JacobianPInput(ThisTime, T%SrvD%Input(iInput, ModData%Ins), T%SrvD%p(ModData%Ins), &
call SrvD_JacobianPInput(ModData%Vars, ThisTime, T%SrvD%Input(iInput, ModData%Ins), T%SrvD%p(ModData%Ins), &
T%SrvD%x(ModData%Ins, iState), T%SrvD%xd(ModData%Ins, iState), &
T%SrvD%z(ModData%Ins, iState), T%SrvD%OtherSt(ModData%Ins, iState), &
T%SrvD%y(ModData%Ins), T%SrvD%m(ModData%Ins), &
Expand Down Expand Up @@ -1563,7 +1563,7 @@ subroutine FAST_JacobianPContState(ModData, ThisTime, iInput, iState, T, ErrStat
dYdx=dYdx, dXdx=dXdx)

case (Module_SrvD)
call SrvD_JacobianPContState(ThisTime, T%SrvD%Input(iInput, ModData%Ins), T%SrvD%p(ModData%Ins), &
call SrvD_JacobianPContState(ModData%Vars, ThisTime, T%SrvD%Input(iInput, ModData%Ins), T%SrvD%p(ModData%Ins), &
T%SrvD%x(ModData%Ins, iState), T%SrvD%xd(ModData%Ins, iState), &
T%SrvD%z(ModData%Ins, iState), T%SrvD%OtherSt(ModData%Ins, iState), &
T%SrvD%y(ModData%Ins), T%SrvD%m(ModData%Ins), ErrStat2, ErrMsg2, &
Expand Down
74 changes: 62 additions & 12 deletions modules/openfast-library/src/FAST_Solver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ subroutine FAST_SolverInit(p_FAST, p, m, GlueModData, GlueModMaps, Turbine, ErrS
character(ErrMsgLen) :: ErrMsg2
integer(IntKi) :: i, j, k
integer(IntKi), allocatable :: modIDs(:), modInds(:), iMod(:)
logical :: SrvDOpt1

!----------------------------------------------------------------------------
! Initialize data in TC structure
Expand Down Expand Up @@ -91,6 +92,17 @@ subroutine FAST_SolverInit(p_FAST, p, m, GlueModData, GlueModMaps, Turbine, ErrS
p%BetaPrime = p%h*p%h*p%Beta*(1.0_R8Ki - p%AlphaF)/(1.0_R8Ki - p%AlphaM)
p%GammaPrime = p%h*p%Gamma*(1.0_R8Ki - p%AlphaF)/(1.0_R8Ki - p%AlphaM)

! ServoDyn is an Option 1 module if it has structural controllers
SrvDOpt1 = .false.
do i = 1, size(Turbine%SrvD%p)
SrvDOpt1 = SrvDOpt1 .or. &
(Turbine%SrvD%p(i)%NumBStC > 0) .or. &
(Turbine%SrvD%p(i)%NumTStC > 0) .or. &
(Turbine%SrvD%p(i)%NumSStC > 0) .or. &
(Turbine%SrvD%p(i)%NumNStC > 0)
end do


!----------------------------------------------------------------------------
! Module ordering for solve
!----------------------------------------------------------------------------
Expand All @@ -115,7 +127,8 @@ subroutine FAST_SolverInit(p_FAST, p, m, GlueModData, GlueModMaps, Turbine, ErrS
pack(modInds, ModIDs == Module_SD .and. p%ModCoupling /= LooseCoupling)]

! Indices of Option 1 modules
p%iModOpt1 = [pack(modInds, ModIDs == Module_ED .and. p%ModCoupling == LooseCoupling), &
p%iModOpt1 = [pack(modInds, ModIDs == Module_SrvD .and. SrvDOpt1), &
pack(modInds, ModIDs == Module_ED .and. p%ModCoupling == LooseCoupling), &
pack(modInds, ModIDs == Module_BD .and. p%ModCoupling == LooseCoupling), &
pack(modInds, ModIDs == Module_SD .and. p%ModCoupling == LooseCoupling), &
pack(modInds, ModIDs == Module_SED), &
Expand Down Expand Up @@ -450,9 +463,30 @@ subroutine SetVarSolveFlags()
end associate
end do
end if

end if

case (Map_Variable)

! This includes all variable-to-variable mappings for modules
! that are in tight coupling and/or Option 1. May need to limit
! this in the future to just loads and accelerations.

! Add flag to source variable
do i = 1, size(SrcMod%Vars%y)
associate (Var => SrcMod%Vars%y(i))
if (.not. MV_EqualDL(Mapping%SrcDL, Var%DL)) cycle
call MV_SetFlags(Var, VF_Solve)
end associate
end do

! Add flag to destination variable
do i = 1, size(DstMod%Vars%u)
associate (Var => DstMod%Vars%u(i))
if (.not. MV_EqualDL(Mapping%DstDL, Var%DL)) cycle
call MV_SetFlags(Var, VF_Solve)
end associate
end do

end select

end associate
Expand Down Expand Up @@ -953,6 +987,14 @@ subroutine FAST_SolverStep0(p, m, GlueModData, GlueModMaps, Turbine, ErrStat, Er
! Set algorithmic acceleration from actual acceleration
m%StatePred%a = m%StatePred%vd

! Initialize the algorithmic acceleration to actual acceleration in BeamDyn
do i = 1, size(GlueModData)
if (GlueModData(i)%ID == Module_BD) then
Turbine%BD%OtherSt(GlueModData(i)%Ins, STATE_CURR)%xcc = &
Turbine%BD%OtherSt(GlueModData(i)%Ins, STATE_CURR)%acc
end if
end do

!----------------------------------------------------------------------------
! Set Outputs
!----------------------------------------------------------------------------
Expand Down Expand Up @@ -1272,9 +1314,11 @@ subroutine FAST_SolverStep(n_t_global, t_initial, p, m, GlueModData, GlueModMaps
call FAST_InputSolve(p%iModOpt2(i), GlueModData, GlueModMaps, INPUT_CURR, Turbine, ErrStat2, ErrMsg2)
if (Failed()) return

! Update states
call FAST_UpdateStates(ModData, t_initial, n_t_global, Turbine, ErrStat2, ErrMsg2)
if (Failed()) return
! Update states of modules not in the tight coupling category
if (iand(ModData%Category, MC_Tight) == 0) then
call FAST_UpdateStates(ModData, t_initial, n_t_global, Turbine, ErrStat2, ErrMsg2)
if (Failed()) return
end if

! Calculate outputs
call FAST_CalcOutput(ModData, GlueModMaps, t_global_next, INPUT_CURR, STATE_PRED, Turbine, ErrStat2, ErrMsg2)
Expand All @@ -1287,12 +1331,18 @@ subroutine FAST_SolverStep(n_t_global, t_initial, p, m, GlueModData, GlueModMaps
!-------------------------------------------------------------------------

do i = 1, size(p%iModOpt1)
associate (ModData => GlueModData(p%iModOpt1(i)))

call FAST_InputSolve(p%iModOpt1(i), GlueModData, GlueModMaps, INPUT_CURR, Turbine, ErrStat2, ErrMsg2)
if (Failed()) return
! Solve for inputs to module
call FAST_InputSolve(p%iModOpt1(i), GlueModData, GlueModMaps, INPUT_CURR, Turbine, ErrStat2, ErrMsg2)
if (Failed()) return

call FAST_UpdateStates(GlueModData(p%iModOpt1(i)), t_initial, n_t_global, Turbine, ErrStat2, ErrMsg2)
if (Failed()) return
! Update states for modules not updated in Option 2
if (iand(ModData%Category, MC_Option2) == 0) then
call FAST_UpdateStates(GlueModData(p%iModOpt1(i)), t_initial, n_t_global, Turbine, ErrStat2, ErrMsg2)
if (Failed()) return
end if
end associate
end do

!-------------------------------------------------------------------------
Expand Down Expand Up @@ -1505,9 +1555,9 @@ subroutine FAST_SolverStep(n_t_global, t_initial, p, m, GlueModData, GlueModMaps
if (Failed()) return

! Transfer accelerations to BeamDyn
if (ModData%ID == Module_BD) then
call SetBDAccel(ModData, m%StatePred, Turbine%BD%OtherSt(ModData%Ins, STATE_PRED))
end if
! if (ModData%ID == Module_BD) then
! call SetBDAccel(ModData, m%StatePred, Turbine%BD%OtherSt(ModData%Ins, STATE_PRED))
! end if

end associate
end do
Expand Down
Loading
Loading