Skip to content
Merged
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
31 changes: 26 additions & 5 deletions modules/aerodyn/src/AeroDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2559,13 +2559,23 @@ subroutine SetInputsForBEMT(p, u, m, indx, errStat, errMsg)

! Calculate Yaw and Tilt for use in xVelCorr
! Define a vector wrt which the yaw is defined
x_hat_wind = m%V_diskAvg/twonorm(m%V_diskAvg)
! Yaw
denom = twonorm(m%V_diskAvg)
if (EqualRealNos(denom, 0.0_ReKi)) then
x_hat_wind = 0.0_ReKi
else
x_hat_wind = m%V_diskAvg/denom
end if
! Yaw
tmpD = x_hat_disk
tmpD(3) = 0.0
tmpW = x_hat_wind
tmpW(3) = 0.0
yaw = acos(max(-1.0_ReKi,min(1.0_ReKi,dot_product(tmpD,tmpW)/(twonorm(tmpD)*TwoNorm(tmpW)))))
denom = TwoNorm(tmpD)*TwoNorm(tmpW)
if (EqualRealNos(denom, 0.0_ReKi)) then
yaw = 0.0_ReKi
else
yaw = acos(max(-1.0_ReKi,min(1.0_ReKi,dot_product(tmpD,tmpW)/denom)))
end if
tmp_skewVec = cross_product(tmpW,tmpD);
yaw = sign(yaw,tmp_skewVec(3))
m%Yaw = yaw
Expand All @@ -2575,7 +2585,13 @@ subroutine SetInputsForBEMT(p, u, m, indx, errStat, errMsg)
tmpD(2) = 0.0
tmpW = x_hat_wind
tmpW(2) = 0.0
tilt = acos(max(-1.0_ReKi,min(1.0_ReKi,dot_product(tmpD,tmpW)/(twonorm(tmpD)*TwoNorm(tmpW)))))
denom = TwoNorm(tmpD)*TwoNorm(tmpW)
if (EqualRealNos(denom, 0.0_Reki)) then
tilt = 0.0_ReKi
else
tilt = acos(max(-1.0_ReKi,min(1.0_ReKi,dot_product(tmpD,tmpW)/denom)))
end if

tmp_skewVec = cross_product(tmpW,tmpD)
tilt = sign(tilt,tmp_skewVec(2))
m%tilt = tilt
Expand Down Expand Up @@ -2699,7 +2715,12 @@ subroutine SetInputsForBEMT(p, u, m, indx, errStat, errMsg)
dr(:) = elemPosRotorProj(:,j) - elemPosRotorProj(:,j-1)
dz(:) = elemPosRelToHub(:,j) - elemPosRelToHub(:,j-1)

m%BEMT_u(indx)%drdz(j,k) = TwoNorm(dr(:)) / TwoNorm(dz(:))
denom = TwoNorm(dz(:))
if (EqualRealNos(denom,0.0_ReKi)) then ! this should not happen, but we'll check anyway
m%BEMT_u(indx)%drdz(j,k) = 0.0_ReKi
else
m%BEMT_u(indx)%drdz(j,k) = TwoNorm(dr(:)) / denom
end if
end do ! j
m%BEMT_u(indx)%drdz(1,k) = m%BEMT_u(indx)%drdz(2,k)
end do !k=blades
Expand Down