@@ -750,8 +750,10 @@ function calc_residuals!(residuals::AbstractVector,
750750
751751 cd = calc_cd (ll. elements[ei], aoas[ei])
752752
753+ magUinf = sqrt (Uinfs[1 , ei]^ 2 + Uinfs[2 , ei]^ 2 + Uinfs[3 , ei]^ 2 )
754+
753755 # magU = sqrt(Us[1, ei]^2 + Us[2, ei]^2 + Us[3, ei]^2)
754- magU = sqrt (Uinfs[ 1 , ei] ^ 2 + Uinfs[ 2 , ei] ^ 2 + Uinfs[ 3 , ei] ^ 2 ) # <--- We can use Uinf instead of U to reduce nonlinearity
756+ magU = magUinf # <--- We can use Uinf instead of U to reduce nonlinearity
755757
756758 Lambda = cd * 0.5 * magU* ll. chords[ei] # Source filament strength
757759 sigma = Lambda/ ll. chords[ei] # Equivalent constant source panel strength
@@ -812,11 +814,57 @@ end
812814Calculate nonlinear lifting line strengths from the given AOAs and inflow
813815velocities
814816"""
817+ # function calc_Gammas!(Gammas::AbstractVector, ll::LiftingLine,
818+ # aoas::AbstractVector, Us::AbstractMatrix)
819+
820+ # for ei in 1:ll.nelements
821+
822+ # # Lifting filament direction
823+ # dl1 = ll.horseshoes[1, 3, ei] - ll.horseshoes[1, 2, ei]
824+ # dl2 = ll.horseshoes[2, 3, ei] - ll.horseshoes[2, 2, ei]
825+ # dl3 = ll.horseshoes[3, 3, ei] - ll.horseshoes[3, 2, ei]
826+ # magdl = sqrt(dl1^2 + dl2^2 + dl3^2)
827+
828+ # dl1 /= magdl
829+ # dl2 /= magdl
830+ # dl3 /= magdl
831+
832+ # # Velocity counter-projected on the filament direction
833+ # Uxdl1 = Us[2, ei]*dl3 - Us[3, ei]*dl2
834+ # Uxdl2 = Us[3, ei]*dl1 - Us[1, ei]*dl3
835+ # Uxdl3 = Us[1, ei]*dl2 - Us[2, ei]*dl1
836+ # magUxdl = sqrt(Uxdl1^2 + Uxdl2^2 + Uxdl3^2)
837+
838+ # # Calculate Gamma using Eq. 41 in Goates 2022 JoA paper
839+ # cl = calc_cl(ll.elements[ei], aoas[ei])
840+ # magU = sqrt(Us[1, ei]^2 + Us[2, ei]^2 + Us[3, ei]^2)
841+
842+ # Gammas[ei] = cl * 0.5*magU^2*ll.chords[ei] / magUxdl
843+
844+ # end
845+ # end
815846function calc_Gammas! (Gammas:: AbstractVector , ll:: LiftingLine ,
816- aoas:: AbstractVector , Us :: AbstractMatrix )
847+ aoas:: AbstractVector , Uinfs :: AbstractMatrix )
817848
818849 for ei in 1 : ll. nelements
819850
851+ cl = calc_cl (ll. elements[ei], aoas[ei])
852+
853+ magUinf = sqrt (Uinfs[1 , ei]^ 2 + Uinfs[2 , ei]^ 2 + Uinfs[3 , ei]^ 2 )
854+
855+ # Calculate local geometric twist relative to freestream
856+ beta = calc_aoa (ll, Uinfs, ei)
857+
858+ # Calculate inflow angle
859+ phi = aoas[ei] - beta
860+
861+ # Calculate velocity magnitude from the inflow angle as in Algorithm 1
862+ # of Martinez 2025 ASME paper
863+ # NOTE: this assumes that the lifting line induces no velocity in the
864+ # direction of the freestream, which doesn't really hold for
865+ # dihedral or winglets
866+ magU = magUinf / cosd (phi)
867+
820868 # Lifting filament direction
821869 dl1 = ll. horseshoes[1 , 3 , ei] - ll. horseshoes[1 , 2 , ei]
822870 dl2 = ll. horseshoes[2 , 3 , ei] - ll. horseshoes[2 , 2 , ei]
@@ -828,15 +876,15 @@ function calc_Gammas!(Gammas::AbstractVector, ll::LiftingLine,
828876 dl3 /= magdl
829877
830878 # Velocity counter-projected on the filament direction
831- Uxdl1 = Us [2 , ei]* dl3 - Us [3 , ei]* dl2
832- Uxdl2 = Us [3 , ei]* dl1 - Us [1 , ei]* dl3
833- Uxdl3 = Us [1 , ei]* dl2 - Us [2 , ei]* dl1
879+ Uxdl1 = Uinfs [2 , ei]* dl3 - Uinfs [3 , ei]* dl2
880+ Uxdl2 = Uinfs [3 , ei]* dl1 - Uinfs [1 , ei]* dl3
881+ Uxdl3 = Uinfs [1 , ei]* dl2 - Uinfs [2 , ei]* dl1
834882 magUxdl = sqrt (Uxdl1^ 2 + Uxdl2^ 2 + Uxdl3^ 2 )
835883
836- # Calculate Gamma using Eq. 41 in Goates 2022 JoA paper
837- cl = calc_cl (ll. elements[ei], aoas[ei])
838- magU = sqrt (Us[1 , ei]^ 2 + Us[2 , ei]^ 2 + Us[3 , ei]^ 2 )
884+ # Apply the same assumption to calculate the total velocity counter-projected
885+ magUxdl /= cosd (phi)
839886
887+ # Calculate Gamma using Eq. 41 in Goates 2022 JoA paper
840888 Gammas[ei] = cl * 0.5 * magU^ 2 * ll. chords[ei] / magUxdl
841889
842890 end
0 commit comments