From ccf66c41970d136852c2bcd4d1b0c814005f1a54 Mon Sep 17 00:00:00 2001 From: andrew-platt Date: Thu, 9 Oct 2025 11:00:26 -0600 Subject: [PATCH 1/2] FF: align initial wake grid with the blades This avoids a mesh mapping error we were occasionally seeing. No calculations are done with this mesh until after it has been reset, so we really don't care if it is "correct" or not. --- glue-codes/fast-farm/src/FASTWrapper.f90 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/glue-codes/fast-farm/src/FASTWrapper.f90 b/glue-codes/fast-farm/src/FASTWrapper.f90 index 65b8e90f1a..3eaa3678ff 100644 --- a/glue-codes/fast-farm/src/FASTWrapper.f90 +++ b/glue-codes/fast-farm/src/FASTWrapper.f90 @@ -76,6 +76,7 @@ SUBROUTINE FWrap_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init TYPE(FAST_ExternInitType) :: ExternInitData INTEGER(IntKi) :: j,k,nb + REAL(ReKi) :: p0(3) ! hub location (in FAST with 0,0,0 as turbine reference) INTEGER(IntKi) :: ErrStat2 ! local error status CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message @@ -196,10 +197,14 @@ SUBROUTINE FWrap_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init ) if (Failed()) return; - ! set node initial position/orientation - ! shortcut for - ! call MeshPositionNode(m%ADRotorDisk(k), j, [0,0,r(j)], errStat2, errMsg2) - m%ADRotorDisk(k)%Position(3,:) = p%r ! this will get overwritten later, but we check that we have no zero-length elements in MeshCommit() + ! set node initial position/orientation + ! NOTE: the mesh data for ADRotorDisk gets overwritten later, but should be aligned somewhat with + ! the blade during initialization to avoid mesh mapping errors. This puts it aligned with + ! the blade pitch axis now, but no calculations will be done until after it is reset properly + ! later. + do j=1,size(p%r) + m%ADRotorDisk(k)%Position(1:3,j) = m%Turbine%AD%u%rotors(1)%BladeRootMotion(k)%Position(1:3,1) + m%Turbine%AD%u%rotors(1)%BladeRootMotion(k)%TranslationDisp(1:3,1) + m%Turbine%AD%u%rotors(1)%BladeRootMotion(k)%Orientation(3,1:3,1) * p%r(j) + enddo m%ADRotorDisk(k)%TranslationDisp = 0.0_R8Ki ! this happens by default, anyway.... ! create line2 elements From 35339adab7f1d2ffa9c25f75ad5e6780788d9492 Mon Sep 17 00:00:00 2001 From: andrew-platt Date: Fri, 10 Oct 2025 17:06:57 -0600 Subject: [PATCH 2/2] FF awae: used wrong mesh on previous commit --- glue-codes/fast-farm/src/FASTWrapper.f90 | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/glue-codes/fast-farm/src/FASTWrapper.f90 b/glue-codes/fast-farm/src/FASTWrapper.f90 index 3eaa3678ff..3207a139b2 100644 --- a/glue-codes/fast-farm/src/FASTWrapper.f90 +++ b/glue-codes/fast-farm/src/FASTWrapper.f90 @@ -77,6 +77,7 @@ SUBROUTINE FWrap_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init TYPE(FAST_ExternInitType) :: ExternInitData INTEGER(IntKi) :: j,k,nb REAL(ReKi) :: p0(3) ! hub location (in FAST with 0,0,0 as turbine reference) + REAL(R8Ki) :: orientation(3,3) ! temp orientation array INTEGER(IntKi) :: ErrStat2 ! local error status CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message @@ -198,15 +199,18 @@ SUBROUTINE FWrap_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init if (Failed()) return; ! set node initial position/orientation - ! NOTE: the mesh data for ADRotorDisk gets overwritten later, but should be aligned somewhat with - ! the blade during initialization to avoid mesh mapping errors. This puts it aligned with - ! the blade pitch axis now, but no calculations will be done until after it is reset properly - ! later. - do j=1,size(p%r) - m%ADRotorDisk(k)%Position(1:3,j) = m%Turbine%AD%u%rotors(1)%BladeRootMotion(k)%Position(1:3,1) + m%Turbine%AD%u%rotors(1)%BladeRootMotion(k)%TranslationDisp(1:3,1) + m%Turbine%AD%u%rotors(1)%BladeRootMotion(k)%Orientation(3,1:3,1) * p%r(j) - enddo + ! NOTE: the mesh data for ADRotorDisk gets overwritten before use so it isn't actually important + ! that this match the method used later in the code. We can't use the method from later + ! in the code since the `hub_theta_x_root` is not known at this point. So instead, we + ! will use the input blade root orientation to set the direction. This does not result + ! in a flat disk, but should allow the mesh mapping to work. + p0 = m%Turbine%AD%Input(1)%rotors(1)%HubMotion%Position(:,1) + m%Turbine%AD%Input(1)%rotors(1)%HubMotion%TranslationDisp(:,1) + m%ADRotorDisk(k)%RefOrientation(:,:,1) = m%Turbine%AD%Input(1)%rotors(1)%BladeRootMotion(k)%Orientation(:,:,1) + do j=1,p%nr + m%ADRotorDisk(k)%Position(:,j) = p0 + p%r(j)*m%ADRotorDisk(k)%RefOrientation(3,:,1) + end do m%ADRotorDisk(k)%TranslationDisp = 0.0_R8Ki ! this happens by default, anyway.... - + ! create line2 elements do j=1,p%nr-1 call MeshConstructElement( m%ADRotorDisk(k), ELEMENT_LINE2, errStat2, errMsg2, p1=j, p2=j+1 ); if (Failed()) return;