-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_liftingline.py
86 lines (56 loc) · 2.2 KB
/
test_liftingline.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import numpy as np
from wingstructure.aero.liftingline import multhopp
def test_multhopp_schlichting():
Λ = 6 # aspect ratio of wing
b = 15 # m span width
cs = np.array([b/Λ]*2) # depth of wing
ys = np.array([0,b/2]) # section positions
αs = np.array([1]*2) # angle of attack
dcls = np.array([2*np.pi]*2)
# reference result
ηs_ref = np.array([0,0.3827,0.7071,0.9239,1])
γs_ref = np.array([0.4320,0.4192,0.3710,0.2485,0])
# coarse calculation
M = 7
res = multhopp(αs, cs, ys, dcls, M = M, mode='gamma')
assert np.isclose(res[0][M//2:]/b*2, ηs_ref[:-1], atol=1e-4).all()
assert np.isclose(res[1][M//2:], γs_ref[:-1], atol=1e-4).all()
def test_multhopp_dcls_nan():
Λ = 6 # aspect ratio of wing
b = 15 # m span width
cs = np.array([b/Λ]*2) # depth of wing
ys = np.array([0,b/2]) # section positions
αs = np.array([1]*2) # angle of attack
dcls = np.nan
# reference result
ηs_ref = np.array([0,0.3827,0.7071,0.9239,1])
γs_ref = np.array([0.4320,0.4192,0.3710,0.2485,0])
# coarse calculation
M = 7
res = multhopp(αs, cs, ys, dcls, M = M, mode='gamma')
assert np.isclose(res[0][M//2:]/b*2, ηs_ref[:-1], atol=1e-4).all()
assert np.isclose(res[1][M//2:], γs_ref[:-1], atol=1e-4).all()
def test_multhopp_coefficients():
Λ = 6 # aspect ratio of wing
b = 15 # m span width
cs = [b/Λ]*2 # depth of wing
ys = [0,b/2] # section positions
αs = [np.radians(1)]*2 # angle of attack
dcls = [2*np.pi]*2
res = multhopp(αs, cs, ys, dcls, M = 91)
A = b * cs[0]
C_L = np.trapz(res.c_ls, res.ys)/b
# ensure lift coefficient matches local lift coefficents
assert np.isclose(C_L, res.C_L, rtol=1e-3)
def test_multhopp_coefficients2():
Λ = 6 # aspect ratio of wing
b = 15 # m span width
cs = [b/Λ]*3 # depth of wing
ys = [-b/2, 0, b/2] # section positions
αs = [np.radians(1)]*3 # angle of attack
dcls = [2*np.pi]*3
res = multhopp(αs, cs, ys, dcls, M = 91)
A = b * cs[0]
C_L = np.trapz(res.c_ls, res.ys)/b
# ensure lift coefficient matches local lift coefficents
assert np.isclose(C_L, res.C_L, rtol=1e-3)