Skip to content

Commit

Permalink
fix test typos
Browse files Browse the repository at this point in the history
  • Loading branch information
juddmehr committed Jul 1, 2024
1 parent 2d97bf7 commit 039ebc7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/C4Blade/airfoil_corrections.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

######################################################################
# #
# Robustness Adjustments #
Expand Down
28 changes: 14 additions & 14 deletions test/afcorrections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ println("\nAIRFOIL CORRECTION TESTS")
include("data/naca_4412_raw.jl")

# apply stall cutoffs
clext, cdext = dt.c4b.stalllimiters(alpha, cl, cdrag; cutoff_slope=0.1, N=20, blend_hardness=50)
clext, cdext = dt.c4b.stall_limiters(alpha, cl, cdrag; cutoff_slope=0.1, N=20, blend_hardness=50)

@test ismonotonic(clext, 1)
end
Expand All @@ -20,7 +20,7 @@ end
stagger = oneoversig05[:, 1] * pi / 180.0
for (i, s) in enumerate(stagger)
@test isapprox(
oneoversig05[i, 2], dt.c4b.solidityandstaggerfactorsmooth(solidity, s), atol=1e-2
oneoversig05[i, 2], dt.c4b.solidity_and_stagger_factor_smooth(solidity, s), atol=1e-2
)
end

Expand All @@ -29,7 +29,7 @@ end
stagger = oneoversig10[:, 1] * pi / 180.0
for (i, s) in enumerate(stagger)
@test isapprox(
oneoversig10[i, 2], dt.c4b.solidityandstaggerfactorsmooth(solidity, s), atol=1e-2
oneoversig10[i, 2], dt.c4b.solidity_and_stagger_factor_smooth(solidity, s), atol=1e-2
)
end

Expand All @@ -38,46 +38,46 @@ end
stagger = oneoversig15[:, 1] * pi / 180.0
for (i, s) in enumerate(stagger)
@test isapprox(
oneoversig15[i, 2], dt.c4b.solidityandstaggerfactorsmooth(solidity, s), atol=1e-2
oneoversig15[i, 2], dt.c4b.solidity_and_stagger_factor_smooth(solidity, s), atol=1e-2
)
end

# check that factor is constant below 20 degrees
solidity = 2.0
@test isapprox(
dt.c4b.solidityandstaggerfactorsmooth(solidity, 10.0 * pi / 180),
dt.c4b.solidityandstaggerfactorsmooth(solidity, 11.0 * pi / 180),
dt.c4b.solidity_and_stagger_factor_smooth(solidity, 10.0 * pi / 180),
dt.c4b.solidity_and_stagger_factor_smooth(solidity, 11.0 * pi / 180),
atol=1e-8,
)

# check that factor maxes out at 1.0
@test 1.0 == dt.c4b.solidityandstaggerfactorsmooth(0.5, 80.0 * pi / 180)
@test 1.0 == dt.c4b.solidity_and_stagger_factor_smooth(0.5, 80.0 * pi / 180)
end

@testset "Prandtl-Glauert Compressibility Corrections" begin
# - Check that things aren't weird - #
@test dt.c4b.prandtlglauertfactor(0.1) == 1.0 / sqrt(1.0 - 0.1^2)
@test dt.c4b.prandtl_glauert_factor(0.1) == 1.0 / sqrt(1.0 - 0.1^2)

# - Check that M=1 doesn't break - #
@test !isinf(dt.c4b.prandtlglauertfactor(1.0))
@test !isinf(dt.c4b.prandtl_glauert_factor(1.0))

# - Check that M>1 doesn't break - #
@test isreal(dt.c4b.prandtlglauertfactor(2.0))
@test isreal(dt.c4b.prandtl_glauert_factor(2.0))

# - Check that M>1 behavior is as expected - #
@test dt.c4b.prandtlglauertfactor(1.1) == 1.0 / sqrt(1.0 - 0.99^2)
@test dt.c4b.prandtl_glauert_factor(1.1) == 1.0 / sqrt(1.0 - 0.99^2)
end

@testset "Reynolds Number Corrections" begin
# - check that nothing is weird - #
@test dt.c4b.redrag(1.0, 2e6, 5e6; reexp=0.5) == (5e6 / 2e6)^0.5
@test dt.c4b.re_drag(1.0, 2e6, 5e6; re_exp=0.5) == (5e6 / 2e6)^0.5
end

@testset "Transonic Effects Corrections" begin

# - Check that lift is being limited after critical mach - #
@test all(
dt.c4b.transonicliftlimitersmooth!([-1.0, 1.0], 0.9, 0.1, 1.0, -1.0, 2 * pi) .< [1.0]
dt.c4b.transonic_lift_limiter_smooth!([-1.0, 1.0], 0.9, 0.1, 1.0, -1.0, 2 * pi) .< [1.0]
)
@test all(dt.c4b.transonicliftlimitersmooth!([-1.0], 0.9, 0.1, 1.0, -1.0, 2 * pi) .> [-1.0])
@test all(dt.c4b.transonic_lift_limiter_smooth!([-1.0], 0.9, 0.1, 1.0, -1.0, 2 * pi) .> [-1.0])
end

0 comments on commit 039ebc7

Please sign in to comment.