Skip to content
Closed
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
8 changes: 5 additions & 3 deletions glue-codes/python/pyOpenFAST/hydrodyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ def _initialize_routines(self):
POINTER(c_float), # nodeAdm -- node added mass matrix in flat array of 6*numNodePts*6*numNodePts
POINTER(c_float), # Output Channel Values
POINTER(c_int), # ErrStat_C
POINTER(c_char) # ErrMsg_C
POINTER(c_char), # ErrMsg_C
POINTER(c_int) # DynamicOnly_C -- optional (NULL = full added mass; nonzero = strip-theory part only)
]
self.HydroDyn_C_CalcOutput_and_AddedMass.restype = c_int

Expand Down Expand Up @@ -359,7 +360,7 @@ def hydrodyn_calcOutput(self, time, nodePos, nodeVel, nodeAcc, nodeFrcMom, outpu
outputChannelValues[k] = float(outputChannelValues_c[k])

# hydrodyn_calcOutput_and_addedMass ------------------------------------------------------------------------------------------------------
def hydrodyn_calcOutput_and_addedMass(self, time, nodePos, nodeVel, nodeFrcMom, nodeAdm, outputChannelValues):
def hydrodyn_calcOutput_and_addedMass(self, time, nodePos, nodeVel, nodeFrcMom, nodeAdm, outputChannelValues, dynamicOnly=None):

# Check input motion info
self.check_input_motions_noAcc(time,nodePos,nodeVel)
Expand Down Expand Up @@ -396,7 +397,8 @@ def hydrodyn_calcOutput_and_addedMass(self, time, nodePos, nodeVel, nodeFrcMom,
nodeAdm_flat_c, # OUT: resulting forces/moments array
outputChannelValues_c, # OUT: output channel values as described in input file
byref(self.error_status_c), # OUT: ErrStat_C
self.error_message_c # OUT: ErrMsg_C
self.error_message_c, # OUT: ErrMsg_C
None if dynamicOnly is None else byref(c_int(int(bool(dynamicOnly)))) # IN (optional): nonzero returns only the strip-theory added mass
)

self.check_error()
Expand Down
12 changes: 10 additions & 2 deletions modules/hydrodyn/src/HydroDyn_C_Binding.f90
Original file line number Diff line number Diff line change
Expand Up @@ -859,10 +859,12 @@ END SUBROUTINE HydroDyn_C_CalcOutput
!-------------------------------------- HydroDyn CalcOutput_and_AddedMass --------------------------------------
!> This routine is similar to the HydroDyn_C_CalcOutput, but splits the forces returned from HydroDyn_CalcOutput
!! into the hydrodynamic forces without added mass, and a separate added mass matrix.
!! If the optional DynamicOnly_C is passed and nonzero, the matrix holds only the strip-theory (Morison)
!! contribution; the potential-flow (WAMIT) contribution is omitted. Otherwise the full matrix is returned.
!===============================================================================================================

SUBROUTINE HydroDyn_C_CalcOutput_and_AddedMass(Time_C, NumNodePts_C, NodePos_C, NodeVel_C, &
NodeFrc_C, NodeAdm_C, OutputChannelValues_C, ErrStat_C, ErrMsg_C) BIND (C, NAME='HydroDyn_C_CalcOutput_and_AddedMass')
NodeFrc_C, NodeAdm_C, OutputChannelValues_C, ErrStat_C, ErrMsg_C, DynamicOnly_C) BIND (C, NAME='HydroDyn_C_CalcOutput_and_AddedMass')
implicit none
#ifndef IMPLICIT_DLLEXPORT
!DEC$ ATTRIBUTES DLLEXPORT :: HydroDyn_C_CalcOutput_and_AddedMass
Expand All @@ -877,8 +879,10 @@ SUBROUTINE HydroDyn_C_CalcOutput_and_AddedMass(Time_C, NumNodePts_C, NodePos_C,
real(c_float), intent( out) :: OutputChannelValues_C(SeaSt%p%NumOuts+HD%p%NumOuts)
integer(c_int), intent( out) :: ErrStat_C
character(kind=c_char), intent( out) :: ErrMsg_C(ErrMsgLen_C)
integer(c_int), intent(in ), optional :: DynamicOnly_C !< if present and nonzero, NodeAdm_C excludes the potential-flow (WAMIT) contribution

! Local variables
logical :: DynamicOnly
real(DbKi) :: Time
integer(IntKi) :: iNode,i,j,k,m
integer(IntKi) :: ErrStat !< aggregated error status
Expand All @@ -891,6 +895,9 @@ SUBROUTINE HydroDyn_C_CalcOutput_and_AddedMass(Time_C, NumNodePts_C, NodePos_C,
ErrStat = ErrID_None
ErrMsg = ""

DynamicOnly = .false.
if (present(DynamicOnly_C)) DynamicOnly = DynamicOnly_C /= 0_c_int

! Sanity check -- number of node points cannot change
if ( NumNodePts /= int(NumNodePts_C, IntKi) ) then
ErrStat2 = ErrID_Fatal
Expand Down Expand Up @@ -933,7 +940,8 @@ SUBROUTINE HydroDyn_C_CalcOutput_and_AddedMass(Time_C, NumNodePts_C, NodePos_C,
Perturbed = .false.

! Contributions from potential-flow bodies - need to perturb the acceleration of one node at a time, but only need to consider nodes with motion mapping to WAMIT mesh
if ( HD%u(1)%WAMITMesh%Committed ) then
! (skipped when only the dynamic, strip-theory part is requested)
if ( HD%u(1)%WAMITMesh%Committed .and. .not. DynamicOnly ) then

! Map the potential-flow loads without added-mass contributions and strip-theory contributions to HD_LoadMesh as a baseline
call Transfer_Point_to_Point( HD%y%WAMITMesh, HD_LoadMesh, Map_HD_WB_P_2_Load, ErrStat2, ErrMsg2, HD%u(1)%WAMITMesh, HD_MotionMesh )
Expand Down
2 changes: 1 addition & 1 deletion reg_tests/r-test
Submodule r-test updated 183 files