Skip to content

Commit f6e7f8d

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/panel-normal-quarter-chord
# Conflicts: # CHANGELOG.md
2 parents 7889b7a + 226fe70 commit f6e7f8d

13 files changed

Lines changed: 416 additions & 3 deletions

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Fixed
1010

11+
- The `VSMSolution` docstring gives `lift_dist`, `drag_dist` and `panel_moment_dist` in
12+
the per-unit-span units they hold, [N/m] and [Nm/m], instead of [N] and [Nm].
1113
- `panel_axes` takes the panel normal from the quarter-chord step, so the frame
1214
closes as `z_airf = x_airf × y_airf` and `z_airf` is square to the bound
1315
vortex. `alpha` is measured against that normal, so `cl`, `cd` and `cm` were

src/solver.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Struct for storing the solution of the [`solve!`](@ref) function. Must contain a
1414
- cl_dist::Vector{Float64}: Lift coefficients of the panels [-]
1515
- cd_dist::Vector{Float64}: Drag coefficients of the panels [-]
1616
- cm_dist::Vector{Float64}: Pitching moment coefficients of the panels [-]
17-
- lift_dist::Vector{Float64}: Lift force of the panels [N]
18-
- drag_dist::Vector{Float64}: Drag force of the panels [N]
19-
- panel_moment_dist::Vector{Float64}: Pitching moment around the spanwise vector of the panels [Nm]
17+
- lift_dist::Vector{Float64}: Lift force per unit span of the panels [N/m]
18+
- drag_dist::Vector{Float64}: Drag force per unit span of the panels [N/m]
19+
- panel_moment_dist::Vector{Float64}: Pitching moment per unit span about y_airf [Nm/m]
2020
- `f_body_3D`::Matrix{Float64}: Matrix of the aerodynamic forces (x, y, z vectors) [N]
2121
- `m_body_3D`::Matrix{Float64}: Matrix of the aerodynamic moments [Nm]
2222
- `gamma_distribution`::Union{Nothing, Vector{Float64}}: Vector containing the panel circulations.

test/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ test/
6060
│ └── test_polars.jl
6161
├── ram_geometry/ # Tests for src/ram_geometry.jl
6262
│ └── test_kite_geometry.jl
63+
├── verification/ # Python verification cases: wings against theory, CFD and RANS
64+
│ ├── test_verification.jl
65+
│ └── data/ # Section polars and reference results
6366
├── wake/ # Tests for src/wake.jl
6467
│ └── test_wake.jl
6568
├── wing_geometry/ # Tests for src/wing_geometry.jl

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ function include_selected_tests()
5353
should_run_test("settings/test_settings.jl") && include("settings/test_settings.jl")
5454
should_run_test("solver/test_solver.jl") && include("solver/test_solver.jl")
5555
should_run_test("solver/test_flow_curvature.jl") && include("solver/test_flow_curvature.jl")
56+
should_run_test("solver/test_moment_units.jl") && include("solver/test_moment_units.jl")
5657
should_run_test("solver/test_forwarddiff.jl") && include("solver/test_forwarddiff.jl")
5758
should_run_test("solver/test_backend_comparison.jl") && include("solver/test_backend_comparison.jl")
5859
should_run_test("solver/test_unrefined_dist.jl") && include("solver/test_unrefined_dist.jl")
60+
should_run_test("verification/test_verification.jl") && include("verification/test_verification.jl")
5961
should_run_test("VortexStepMethod/test_VortexStepMethod.jl") && include("VortexStepMethod/test_VortexStepMethod.jl")
6062
should_run_test("wake/test_wake.jl") && include("wake/test_wake.jl")
6163
should_run_test("wing_geometry/test_wing_geometry.jl") && include("wing_geometry/test_wing_geometry.jl")

test/solver/test_moment_units.jl

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using VortexStepMethod
2+
using LinearAlgebra
3+
using Test
4+
5+
"""
6+
scaled_wing_aero(scale)
7+
8+
A rectangular wing with a constant nonzero `cm`, every length multiplied by `scale`,
9+
at an inflow that does not depend on it.
10+
"""
11+
function scaled_wing_aero(scale)
12+
chord, span = 1.5scale, 6.0scale
13+
alpha_range = deg2rad.([-10.0, 0.0, 10.0])
14+
polar = (alpha_range, [-0.6, 0.4, 1.4], fill(0.02, 3), fill(-0.08, 3))
15+
wing = Wing(10)
16+
add_section!(wing, [0.0, span / 2, 0.0], [chord, span / 2, 0.0], POLAR_VECTORS, polar)
17+
add_section!(wing, [0.0, -span / 2, 0.0], [chord, -span / 2, 0.0], POLAR_VECTORS,
18+
polar)
19+
refine!(wing)
20+
body_aero = BodyAerodynamics([wing])
21+
set_va!(body_aero, [20.0, 0.0, 2.0])
22+
return body_aero
23+
end
24+
25+
@testset "moments carry N·m: lengths scaled by k scale them by k³" begin
26+
# at fixed inflow and coefficients, N scales as k², N·m as k³, and N·m per
27+
# unit span as k²; a moment short of one chord factor scales as k² instead
28+
k = 2.0
29+
reference_point(scale) = scale .* [-0.4, 0.3, 0.2]
30+
31+
@testset "solve!" begin
32+
small, large = map((1.0, k)) do scale
33+
body_aero = scaled_wing_aero(scale)
34+
solve!(Solver(body_aero; reference_point=reference_point(scale)), body_aero)
35+
end
36+
@test small.solver_status == large.solver_status == FEASIBLE
37+
@test all(!iszero, small.panel_moment_dist)
38+
@test large.force k^2 .* small.force rtol = 1e-6
39+
@test large.moment k^3 .* small.moment rtol = 1e-6
40+
@test large.m_body_3D k^3 .* small.m_body_3D rtol = 1e-6
41+
@test large.moment_dist k^3 .* small.moment_dist rtol = 1e-6
42+
@test large.moment_unrefined_dist k^3 .* small.moment_unrefined_dist rtol = 1e-6
43+
@test large.panel_moment_dist k^2 .* small.panel_moment_dist rtol = 1e-6
44+
@test large.moment_coeffs small.moment_coeffs rtol = 1e-6
45+
@test large.moment_coeff_dist small.moment_coeff_dist rtol = 1e-6
46+
end
47+
48+
@testset "solve" begin
49+
small, large = map((1.0, k)) do scale
50+
body_aero = scaled_wing_aero(scale)
51+
solve(Solver(body_aero), body_aero; reference_point=reference_point(scale))
52+
end
53+
for key in ("Mx", "My", "Mz", "M_distribution")
54+
@test large[key] k^3 .* small[key] rtol = 1e-6
55+
end
56+
for key in ("cmx", "cmy", "cmz")
57+
@test large[key] small[key] rtol = 1e-6
58+
end
59+
end
60+
end

test/verification/data/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Verification data
2+
3+
Copied from `tests/verification_cases` of
4+
[ocayon/Vortex-Step-Method](https://github.com/ocayon/Vortex-Step-Method) at
5+
commit `c82d521` (MIT licence). Angles in degrees.
6+
7+
| File | Contents | Python source |
8+
| --- | --- | --- |
9+
| `clarky_polar.csv` | Clark Y 2D section polar, CFD to 18°, polynomial fit above | `curved_wing/polars/clarky_maneia.csv`, first of its three identical 20–32° blocks |
10+
| `curved_wing_rans.csv` | curved Clark Y wing, 3D RANS (Maneia) | `curved_wing/polars/curved_wing_polars_maneia.csv` |
11+
| `naca4415_cfd_polar.csv` | NACA 4415 2D section lift, CFD at Re 3e6 | `swept_wing/polars/NACA4415_CFD_Re3e6.csv` |
12+
| `rectangular_wing_ar12_cfd.csv` | unswept AR 12 NACA 4415 wing, 3D CFD | `swept_wing/polars/0sweepAR12_CFD.csv` |
13+
| `v3_kite_rans_cl.csv`, `v3_kite_rans_cd.csv` | TU Delft V3 kite with struts, RANS (Lebesque) | `TUDELFT_V3_KITE/CFD_data/RANS_C{L,D}_alpha_struts.csv` |
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
alpha,cl,cd,cm
2+
-6,-0.068555,0.011860,-0.078934
3+
-4,0.146491,0.010834,-0.078392
4+
-2,0.366288,0.011170,-0.078640
5+
0,0.585605,0.012992,-0.079281
6+
2,0.801316,0.015835,-0.080152
7+
4,1.008785,0.019661,-0.081132
8+
6,1.202819,0.024769,-0.081787
9+
8,1.379125,0.031083,-0.081996
10+
10,1.533132,0.038588,-0.081774
11+
12,1.657004,0.047540,-0.080114
12+
14,1.734089,0.058231,-0.075239
13+
16,1.743243,0.071472,-0.066718
14+
18,1.631352,0.095276,-0.059093
15+
20.0,1.3979999999999997,0.238,0.0
16+
22.0,1.1243200000000009,0.272,0.0
17+
24.0,0.957279999999999,0.306,0.0
18+
26.0,0.8968799999999995,0.34,0.0
19+
28.0,0.9431200000000004,0.374,0.0
20+
30.0,1.096,0.425,0.0
21+
32.0,1.3555200000000003,0.459,0.0
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
alpha,CL,CD,CM
2+
-8.5,-0.147145,0.010120,-0.068776
3+
0,0.332445,0.013025,-0.062255
4+
6,0.652710,0.048509,-0.057211
5+
10,0.838511,0.083921,-0.053186
6+
14,0.990132,0.128428,-0.048977
7+
16,1.052356,0.154072,-0.047311
8+
18,1.084836,0.181022,-0.044766
9+
20,1.032335,0.218830,-0.056895
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
alpha,cl
2+
0,0.42891561364483577
3+
2.499999222548095,0.6987949807313732
4+
6.03261006464357,1.0554216713346283
5+
8.586956285123335,1.3132530288448963
6+
10.054350107739287,1.4361445189710538
7+
11.52173978394508,1.5493976473964057
8+
13.097827602424369,1.6506024445240153
9+
14.728262418835318,1.7204819341711142
10+
15.92391295897262,1.734939798443795
11+
17.500000777451906,1.698795218192461
12+
18.478263325862535,1.6506024445240153
13+
20.16304514020516,1.5421687037700127
14+
21.684781814342625,1.4313253151405458
15+
22.98913049675341,1.3325301199281903
16+
24.945651447164533,1.2867469941352092
17+
26.6304374079173,1.240963868342228
18+
27.98913308825977,1.2000000383001754
19+
30.1630461768077,1.1831324572117143
20+
32.71739239728746,1.1927710946737824
21+
34.94565248376708,1.1975903904247112
22+
37.01087157645168,1.1855421970075997
23+
39.836956932999925,1.2048192880908937
24+
42.44565429782151,1.221686777258934
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
alpha,CL
2+
0.11428397042410689,0.35012001200943416
3+
2.171425955636161,0.5347721967329728
4+
4.1142839704241085,0.7098321112581492
5+
6.057141985212056,0.8872901619425717
6+
8.000000000000002,1.055155850949091
7+
9.82856968470982,1.2182254048564292
8+
11.999999999999996,1.3717025970858643
9+
14.057146344866077,1.4964027957611308
10+
16.114283970424104,1.5947241370414749
11+
18.171430315290177,1.6282972428249394
12+
20,1.5923260237521137
13+
21.942853655133923,1.527577879734775
14+
23.999999999999996,1.3932852279020647
15+
26.05714634486607,1.261390757968371
16+
27.999999999999993,1.177457913465111
17+
30.171430315290177,1.1127098380574283
18+
32.114283970424104,1.0863308891829648
19+
34.05714634486607,1.0767386189846027
20+
36.22856794084821,1.071942438145651
21+
38.05714634486607,1.0575538956287964
22+
39.885716029575896,1.0503596701101394
23+
42.05714634486607,1.0503596701101394
24+
43.88571602957589,1.0215826765559708

0 commit comments

Comments
 (0)