From 87eb1eb0840d51c72e81b62c800a5c4b37135668 Mon Sep 17 00:00:00 2001 From: Emmanuel Branlard Date: Thu, 7 Mar 2019 15:14:53 -0700 Subject: [PATCH] Allowing number of Morison number to be 0 (see #79) --- modules-local/hydrodyn/src/HydroDyn.f90 | 8 ++- .../openfast-library/src/FAST_Solver.f90 | 54 ++++++++++++------- 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/modules-local/hydrodyn/src/HydroDyn.f90 b/modules-local/hydrodyn/src/HydroDyn.f90 index 1aa6afdee0..8bcf719c8e 100644 --- a/modules-local/hydrodyn/src/HydroDyn.f90 +++ b/modules-local/hydrodyn/src/HydroDyn.f90 @@ -1437,8 +1437,12 @@ SUBROUTINE HydroDyn_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, I m%y_mapped%RemapFlag = .TRUE. CALL MeshMapCreate( y%Mesh, m%y_mapped, m%HD_MeshMap%HD_P_2_WRP_P, ErrStat2, ErrMsg2 );CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - CALL MeshMapCreate( y%Morison%LumpedMesh, m%y_mapped, m%HD_MeshMap%M_P_2_WRP_P, ErrStat2, ErrMsg2 );CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - CALL MeshMapCreate( y%Morison%DistribMesh, m%y_mapped, m%HD_MeshMap%M_L_2_WRP_P, ErrStat2, ErrMsg2 );CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + IF ( y%Morison%LumpedMesh%Committed ) THEN + CALL MeshMapCreate( y%Morison%LumpedMesh, m%y_mapped, m%HD_MeshMap%M_P_2_WRP_P, ErrStat2, ErrMsg2 );CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ENDIF + IF ( y%Morison%DistribMesh%Committed ) THEN + CALL MeshMapCreate( y%Morison%DistribMesh, m%y_mapped, m%HD_MeshMap%M_L_2_WRP_P, ErrStat2, ErrMsg2 );CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ENDIF IF ( ErrStat >= AbortErrLev ) THEN CALL CleanUp() diff --git a/modules-local/openfast-library/src/FAST_Solver.f90 b/modules-local/openfast-library/src/FAST_Solver.f90 index 782c9eb335..adfbecf129 100644 --- a/modules-local/openfast-library/src/FAST_Solver.f90 +++ b/modules-local/openfast-library/src/FAST_Solver.f90 @@ -2443,13 +2443,19 @@ SUBROUTINE FullOpt1_InputOutputSolve( this_time, p_FAST, calcJacobian & ! HD motion inputs: (from SD and ED) IF (p_FAST%CompHydro == Module_HD ) THEN - ! Make copies of the accelerations we just solved for (so we don't overwrite them) - MeshMapData%u_HD_M_LumpedMesh%RotationAcc = u_HD%Morison%LumpedMesh%RotationAcc - MeshMapData%u_HD_M_LumpedMesh%TranslationAcc = u_HD%Morison%LumpedMesh%TranslationAcc - MeshMapData%u_HD_M_DistribMesh%RotationAcc = u_HD%Morison%DistribMesh%RotationAcc - MeshMapData%u_HD_M_DistribMesh%TranslationAcc = u_HD%Morison%DistribMesh%TranslationAcc - MeshMapData%u_HD_Mesh%RotationAcc = u_HD%Mesh%RotationAcc - MeshMapData%u_HD_Mesh%TranslationAcc = u_HD%Mesh%TranslationAcc + ! Make copies of the accelerations we just solved for (so we don't overwrite them) + IF (MeshMapData%u_HD_M_LumpedMesh%Committed) THEN + MeshMapData%u_HD_M_LumpedMesh%RotationAcc = u_HD%Morison%LumpedMesh%RotationAcc + MeshMapData%u_HD_M_LumpedMesh%TranslationAcc = u_HD%Morison%LumpedMesh%TranslationAcc + ENDIF + IF (MeshMapData%u_HD_M_DistribMesh%Committed) THEN + MeshMapData%u_HD_M_DistribMesh%RotationAcc = u_HD%Morison%DistribMesh%RotationAcc + MeshMapData%u_HD_M_DistribMesh%TranslationAcc = u_HD%Morison%DistribMesh%TranslationAcc + ENDIF + IF (MeshMapData%u_HD_Mesh%Committed) THEN + MeshMapData%u_HD_Mesh%RotationAcc = u_HD%Mesh%RotationAcc + MeshMapData%u_HD_Mesh%TranslationAcc = u_HD%Mesh%TranslationAcc + ENDIF ! transfer the output data to inputs @@ -2472,13 +2478,19 @@ SUBROUTINE FullOpt1_InputOutputSolve( this_time, p_FAST, calcJacobian & END IF - ! put the acceleration data (calucluted in this routine) back - u_HD%Morison%LumpedMesh%RotationAcc = MeshMapData%u_HD_M_LumpedMesh%RotationAcc - u_HD%Morison%LumpedMesh%TranslationAcc = MeshMapData%u_HD_M_LumpedMesh%TranslationAcc - u_HD%Morison%DistribMesh%RotationAcc = MeshMapData%u_HD_M_DistribMesh%RotationAcc - u_HD%Morison%DistribMesh%TranslationAcc = MeshMapData%u_HD_M_DistribMesh%TranslationAcc - u_HD%Mesh%RotationAcc = MeshMapData%u_HD_Mesh%RotationAcc - u_HD%Mesh%TranslationAcc = MeshMapData%u_HD_Mesh%TranslationAcc + ! put the acceleration data (calucluted in this routine) back + IF (MeshMapData%u_HD_M_LumpedMesh%Committed) THEN + u_HD%Morison%LumpedMesh%RotationAcc = MeshMapData%u_HD_M_LumpedMesh%RotationAcc + u_HD%Morison%LumpedMesh%TranslationAcc = MeshMapData%u_HD_M_LumpedMesh%TranslationAcc + ENDIF + IF (MeshMapData%u_HD_M_DistribMesh%Committed) THEN + u_HD%Morison%DistribMesh%RotationAcc = MeshMapData%u_HD_M_DistribMesh%RotationAcc + u_HD%Morison%DistribMesh%TranslationAcc = MeshMapData%u_HD_M_DistribMesh%TranslationAcc + ENDIF + IF (MeshMapData%u_HD_Mesh%Committed) THEN + u_HD%Mesh%RotationAcc = MeshMapData%u_HD_Mesh%RotationAcc + u_HD%Mesh%TranslationAcc = MeshMapData%u_HD_Mesh%TranslationAcc + ENDIF !...... @@ -2771,12 +2783,16 @@ SUBROUTINE U_FullOpt1_Residual( y_ED2, y_SD2, y_HD2, y_BD2, y_Orca2, y_ExtPtfm2, CALL SetErrStat(ErrStat2,ErrMsg2, ErrStat, ErrMsg, RoutineName) ! These are the motions for the lumped point loads associated viscous drag on the WAMIT body and/or filled/flooded lumped forces of the WAMIT body - CALL Transfer_Point_to_Point( y_ED2%PlatformPtMesh, MeshMapData%u_HD_M_LumpedMesh, MeshMapData%ED_P_2_HD_M_P, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2,ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (MeshMapData%u_HD_M_LumpedMesh%Committed) then + CALL Transfer_Point_to_Point( y_ED2%PlatformPtMesh, MeshMapData%u_HD_M_LumpedMesh, MeshMapData%ED_P_2_HD_M_P, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2,ErrMsg2, ErrStat, ErrMsg, RoutineName) + endif ! These are the motions for the line2 (distributed) loads associated viscous drag on the WAMIT body and/or filled/flooded distributed forces of the WAMIT body - CALL Transfer_Point_to_Line2( y_ED2%PlatformPtMesh, MeshMapData%u_HD_M_DistribMesh, MeshMapData%ED_P_2_HD_M_L, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2,ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (MeshMapData%u_HD_M_DistribMesh%Committed) then + CALL Transfer_Point_to_Line2( y_ED2%PlatformPtMesh, MeshMapData%u_HD_M_DistribMesh, MeshMapData%ED_P_2_HD_M_L, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2,ErrMsg2, ErrStat, ErrMsg, RoutineName) + endif !.................. ! Get ED loads input (from HD only) @@ -4057,7 +4073,7 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_P_2_HD_M_P' ) END IF - ! ElastoDyn point mesh to HydroDyn Morison line mesh (ED sets inputs, but gets outputs from HD%y%AllHdroOriginin floating case) + ! ElastoDyn point mesh to HydroDyn Morison line mesh (ED sets inputs, but gets outputs from HD%y%AllHdroOrigin in floating case) IF ( HD%Input(1)%Morison%DistribMesh%Committed ) THEN CALL MeshMapCreate( ED%Output(1)%PlatformPtMesh, HD%Input(1)%Morison%DistribMesh, MeshMapData%ED_P_2_HD_M_L, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_P_2_HD_M_L' )