-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathwing_example_box_wing.py
More file actions
executable file
·102 lines (78 loc) · 3.47 KB
/
Copy pathwing_example_box_wing.py
File metadata and controls
executable file
·102 lines (78 loc) · 3.47 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Example script for generating a UAV box wing
# ==============================================================================
# AirCONICS
# Aircraft CONfiguration through Integrated Cross-disciplinary Scripting
# version 0.2
# Andras Sobester, 2015.
# Bug reports to a.sobester@soton.ac.uk or @ASobester please.
# ==============================================================================
import math
import primitives, airconics_setup, liftingsurface, AirCONICStools as act
# Definition of the variation of spanwise parameters. Key here is the variation
# dihedral (which defines how the wing 'folds back') and the variation of the
# airfoil section (in sync with the variation of the fold to ensure the smooth
# reversal of the camber at the same time). See Section 9.3.1 (page 183) of the
# book for a detailed discussion of this example.
def myDihedralFunctionBoxWing(Epsilon):
# User-defined function describing the variation of dihedral as a function
# of the leading edge coordinate
D1 = 0
D2 = 180
Transition1 = 0.45
Transition2 = 0.55
if Epsilon < Transition1:
return D1
elif Epsilon > Transition2:
return D2
else:
return D1 + ((Epsilon - Transition1)/(Transition2 - Transition1))*(D2-D1)
def myTwistFunctionBoxWing(Epsilon):
# User-defined function describing the variation of twist as a function
# of the leading edge coordinate
RootTwist = 0
TipTwist = 0
return RootTwist + Epsilon*TipTwist
def myChordFunctionBoxWing(Epsilon):
# User-defined function describing the variation of chord as a function of
# the leading edge coordinate
return 1
def myAirfoilFunctionBoxWing(Epsilon, LEPoint, ChordFunct, ChordFactor, DihedralFunct, TwistFunct):
# Defines the variation of cross section as a function of Epsilon
AirfoilChordLength = (ChordFactor*ChordFunct(Epsilon))/math.cos(math.radians(TwistFunct(Epsilon)))
Af = primitives.Airfoil(LEPoint, AirfoilChordLength, DihedralFunct(Epsilon), TwistFunct(Epsilon))
SmoothingPasses = 1
Camber1 = 5.0
Camber2 = -5.0
Transition1 = 0.45
Transition2 = 0.55
if Epsilon < Transition1:
Camber = Camber1
elif Epsilon > Transition2:
Camber = Camber2
else:
Camber = Camber1 + ((Epsilon - Transition1)/(Transition2 - Transition1))*(Camber2-Camber1)
Airf, Chrd = primitives.Airfoil.AddNACA4(Af, Camber, 3, 10, SmoothingPasses)
return Airf, Chrd
def mySweepAngleFunctionBoxWing(Epsilon):
# User-defined function describing the variation of sweep angle as a function
# of the leading edge coordinate
S1 = 25
S2 = -25
Boundary1 = 0.45
Boundary2 = 0.55
if Epsilon < Boundary1:
return S1
elif Epsilon > Boundary2:
return S2
else:
return S1 + ((Epsilon - Boundary1)/(Boundary2 - Boundary1))*(S2-S1)
if __name__ == '__main__':
# Script for generating the box wing geometry
P = (0,0,0)
LooseSurf = 1
SegmentNo = 101
# The wing tip is turned off, as a box wing has no exposed tip
Wing = liftingsurface.LiftingSurface(P, mySweepAngleFunctionBoxWing, myDihedralFunctionBoxWing, myTwistFunctionBoxWing, myChordFunctionBoxWing, myAirfoilFunctionBoxWing, LooseSurf, SegmentNo, TipRequired = False)
ChordFactor = 0.1
ScaleFactor = 20
Wing.GenerateLiftingSurface(ChordFactor, ScaleFactor)