From 3f425168a7e0f59a6c0853bc330d4a2cabee2a0b Mon Sep 17 00:00:00 2001 From: andrew-platt Date: Fri, 3 Nov 2023 09:23:41 -0600 Subject: [PATCH] Adding mesh mapping for SF in jacobian calc --- modules/openfast-library/src/FAST_Solver.f90 | 22 +++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/modules/openfast-library/src/FAST_Solver.f90 b/modules/openfast-library/src/FAST_Solver.f90 index 9d4cca02f0..8177cdd87d 100644 --- a/modules/openfast-library/src/FAST_Solver.f90 +++ b/modules/openfast-library/src/FAST_Solver.f90 @@ -2407,12 +2407,12 @@ SUBROUTINE U_ED_SF_Residual( y_ED2, y_SF2, u_IN, U_Resid) integer(IntKi) :: j ! Generic counter TYPE(MeshType), POINTER :: SubstructureMotion TYPE(MeshType), POINTER :: PlatformMotions - TYPE(MeshType), POINTER :: SubstructureMotion2HD + TYPE(MeshType), POINTER :: SubstructureMotion2SF ! SD cannot be used, so these all point to the same place. Using separate variables so they match with values in the full option 1 solve PlatformMotions => y_ED2%PlatformPtMesh SubstructureMotion => y_ED2%PlatformPtMesh - SubstructureMotion2HD => y_ED2%PlatformPtMesh + SubstructureMotion2SF => y_ED2%PlatformPtMesh ! This is only called is there is no flexible substructure model (RIGID substructure) @@ -2435,7 +2435,7 @@ SUBROUTINE U_ED_SF_Residual( y_ED2, y_SF2, u_IN, U_Resid) ! we're mapping loads, so we also need the sibling meshes' displacements: IF ( ALLOCATED(y_SrvD%SStCLoadMesh) ) THEN ! Platform do j=1,size(y_SrvD%SStCLoadMesh) - IF (y_SrvD%SStCLoadMesh(j)%Committed) THEN + F (y_SrvD%SStCLoadMesh(j)%Committed) THEN CALL Transfer_Point_to_Point( y_SrvD%SStCLoadMesh(j), MeshMapData%SubstructureLoads_Tmp2, MeshMapData%SStC_P_P_2_SubStructure(j), ErrStat2, ErrMsg2, u_SrvD%SStCMotionMesh(j), SubstructureMotion ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%PlatformPtMesh' ) MeshMapData%SubstructureLoads_Tmp%Force = MeshMapData%SubstructureLoads_Tmp%Force + MeshMapData%SubstructureLoads_Tmp2%Force @@ -2445,10 +2445,22 @@ SUBROUTINE U_ED_SF_Residual( y_ED2, y_SF2, u_IN, U_Resid) ENDIF ENDIF + + ! we use copies of the input meshes (we don't need to update values in the original data structures): + + ! Need to transfer motions first + CALL Transfer_SubStructureMotion_to_SF( SubStructureMotionMesh2SF, u_SF%SeaFEMMesh, MeshMapData, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + if ( y_SF2%SeaFEMMesh%Committed ) then - MeshMapData%SubstructureLoads_Tmp%Force = y_SF2%SeaFEMMesh%Force - MeshMapData%SubstructureLoads_Tmp%Moment = y_SF2%SeaFEMMesh%Moment + ! we're mapping loads, so we also need the sibling meshes' displacements: + CALL Transfer_Point_to_Point( y_SF%SeaFEMMesh, MeshMapData%SubstructureLoads_Tmp2, MeshMapData%SF_P_2_SubStructure, ErrStat2, ErrMsg2, u_SF%SeaFEMMesh, SubStructureMotionMesh2SF ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + MeshMapData%SubstructureLoads_Tmp%Force = MeshMapData%SubstructureLoads_Tmp%Force + MeshMapData%SubstructureLoads_Tmp2%Force + MeshMapData%SubstructureLoads_Tmp%Moment = MeshMapData%SubstructureLoads_Tmp%Moment + MeshMapData%SubstructureLoads_Tmp2%Moment + end if