ecopus commited on
Commit
d8ae59a
·
verified ·
1 Parent(s): b3e7be2

Upload wing_generation_explained_katex.md

Browse files
Files changed (1) hide show
  1. wing_generation_explained_katex.md +225 -0
wing_generation_explained_katex.md ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # How the 500 Wing Samples Are Generated
3
+
4
+ This document explains how the Python pipeline creates the **500 aircraft‑style wings** in your dataset—what varies, what’s fixed, and the exact math behind the values stored.
5
+
6
+ ---
7
+
8
+ ## 1) Inputs & Reproducibility
9
+
10
+ - **Airfoil geometry**: Each airfoil file contains two columns \((x, y)\) forming a closed perimeter ordered **TE → upper → LE → lower → TE**.
11
+ - On load, \(x\) is normalized to \([0,1]\); the perimeter is rotated so the first point is closest to the **trailing edge** \((1,0)\) and the **upper surface** comes first.
12
+ - **Polars (optional)**: QBlade/XFOIL exports with \(\alpha, C_l, C_d, C_m\).
13
+ - Files are matched to airfoils by flexible filename heuristics.
14
+ - Polars are parsed (3–4 numeric columns), **deduplicated in \(\alpha\)**, and **sorted by \(\alpha\)**.
15
+ - **Random seed**: We use `np.random.default_rng(42)` so all 500 wings are reproducible bit‑for‑bit.
16
+
17
+ ---
18
+
19
+ ## 2) Per‑Wing Planform Sampling (What Varies)
20
+
21
+ We generate **500** wings. Airfoils are cycled round‑robin (≈50 wings per foil). For each wing we sample:
22
+
23
+ - **Half‑span** \(s\) (inches):
24
+ \(s \sim \mathcal{U}[60,\;120]\).
25
+ - **Root chord** \(c_{\text{root}}\) (inches):
26
+ \(c_{\text{root}} \sim \mathcal{U}[18,\;36]\).
27
+ - **Taper ratio** \(\lambda\):
28
+ \(\lambda \sim \mathcal{U}[0.25,\;0.50]\), so \(c_{\text{tip}}=\lambda\,c_{\text{root}}\).
29
+ - **Twist endpoints (washout)** (degrees):
30
+ \(i_{\text{root}} \sim \mathcal{U}[0,\;2]\), \(i_{\text{tip}} \sim \mathcal{U}[-6,\;-2]\).
31
+ - The final twist distribution is **linear** from root to tip; then we **pin** the very first station to **0°** so the wing “hinges” at the root plane (legacy convention).
32
+
33
+ We use **20 stations** along the half‑span:
34
+
35
+ $$
36
+ \text{Dis}[j] = y_j = \frac{j-1}{19}\; s,\quad j=1..20.
37
+ $$
38
+
39
+ ---
40
+
41
+ ## 3) Chord Distribution: Schrenk’s Approximation
42
+
43
+ We blend a trapezoid with an ellipse to approximate an elliptical lift distribution:
44
+
45
+ - Linear (trapezoid) chord:
46
+
47
+ $$
48
+ c_{\text{trap}}(y) = c_{\text{root}} + (c_{\text{tip}} - c_{\text{root}})\,\frac{y}{s}.
49
+ $$
50
+
51
+ - Elliptic surrogate:
52
+
53
+ $$
54
+ c_{\text{ell}}(y) = c_{\text{root}}\sqrt{1 - \left(\frac{y}{s}\right)^2}.
55
+ $$
56
+
57
+ - **Schrenk chord** at each station:
58
+
59
+ $$
60
+ c(y) = \tfrac{1}{2}\left[c_{\text{trap}}(y) + c_{\text{ell}}(y)\right].
61
+ $$
62
+
63
+ A small clamp prevents pathological tips for extreme tapers:
64
+
65
+ $$
66
+ c(y) \leftarrow \max\!\big(c(y),\;0.25\cdot\min\nolimits_y c_{\text{trap}}(y)\big).
67
+ $$
68
+
69
+ This yields the **Cho** vector (inches) over the 20 stations.
70
+
71
+ ---
72
+
73
+ ## 4) Twist (Washout) Distribution
74
+
75
+ With sampled endpoints \(i_{\text{root}}\) and \(i_{\text{tip}}\), define a **linear** twist:
76
+
77
+ $$
78
+ \text{Twi}[j] = i_{\text{root}} + \big(i_{\text{tip}} - i_{\text{root}}\big)\frac{y_j}{s},\quad j=1..20.
79
+ $$
80
+
81
+ Then set \(\text{Twi}[1]=0^\circ\) (root plane hinge).
82
+
83
+ ---
84
+
85
+ ## 5) Lofting the 3D Wing for Previews
86
+
87
+ Given the normalized perimeter \((\bar{x},\bar{y})\) (TE→upper→LE→lower→TE), we scale and twist each section about the **quarter‑chord** \(x_{\text{pivot}}=0.25\):
88
+
89
+ 1. Shift section to pivot origin: \(x_c = \bar{x} - 0.25\).
90
+ 2. Scale to local chord \(c_j\) (inches): \(X_s = x_c\,c_j,\; Y_s = \bar{y}\,c_j\).
91
+ 3. Rotate by \(\theta_j=\text{Twi}[j]\cdot\pi/180\):
92
+
93
+ $$
94
+ \begin{bmatrix} Y \\ Z \end{bmatrix}
95
+ = \begin{bmatrix} \cos\theta_j & -\sin\theta_j \\ \sin\theta_j & \cos\theta_j \end{bmatrix}
96
+ \begin{bmatrix} X_s \\ Y_s \end{bmatrix}.
97
+ $$
98
+
99
+ 4. Spanwise coordinate for the whole perimeter at station \(j\): \(S=y_j\) (inches).
100
+
101
+ The arrays \(S, Y, Z\) generate a fast **wireframe 3D PNG** used as the dataset’s `render_png` field.
102
+
103
+ ---
104
+
105
+ ## 6) Planform Integrals & Derived Metrics
106
+
107
+ Treat `Dis`/`Cho` as samples over the **half‑span** \([0,s]\) in **inches**. We integrate with the trapezoidal rule, then convert to SI for storage.
108
+
109
+ - **Wing area** (full wing):
110
+
111
+ $$
112
+ S_{\tfrac{1}{2}} = \int_0^s c(y)\,dy \;\approx\; \operatorname{trapz}(\text{Dis},\text{Cho})\quad [\text{in}^2],
113
+ \qquad
114
+ S_{\text{full}} = 2\,S_{\tfrac{1}{2}}.
115
+ $$
116
+
117
+ Convert: \(S_{\text{full (m}^2)} = S_{\text{full}}\cdot(0.0254)^2\).
118
+
119
+ - **Mean Aerodynamic Chord** (full wing):
120
+
121
+ $$
122
+ \text{MAC} = \frac{2}{S_{\text{full}}} \int_{-s}^{s} c(y)^2\,dy
123
+ = \frac{4}{S_{\text{full}}} \int_0^s c(y)^2\,dy.
124
+ $$
125
+
126
+ We integrate on the half‑span (inches), then convert MAC to meters.
127
+
128
+ - **Aspect Ratio** (full span \(b=2s\cdot 0.0254\) meters):
129
+
130
+ $$
131
+ \text{AR} = \frac{b^2}{S_{\text{full (m}^2)}}.
132
+ $$
133
+
134
+ - **Polar‑derived metrics** (if a polar is found):
135
+ - \(C_{l,\max}=\max C_l\) at \(\alpha_{C_{l,\max}}\).
136
+ - \(C_{d,\min}=\min C_d\) at \(\alpha_{C_{d,\min}}\).
137
+ - \((L/D)_{\max} = \max(C_l/C_d)\) at \(\alpha_{(L/D)_{\max}}\).
138
+ - Small‑angle lift slope and zero‑lift angle (linear fit on \(\alpha\in[-5^\circ,5^\circ]\)):
139
+
140
+ $$
141
+ C_l \approx m\,\alpha_{\deg} + b
142
+ \;\Rightarrow\;
143
+ C_{l_\alpha}\;[\text{per rad}] = m\cdot \frac{180}{\pi},
144
+ \quad
145
+ \alpha_{0L}\;[^\circ] = -\frac{b}{m}.
146
+ $$
147
+
148
+ - Also stored as objective‑style **scores**:
149
+ - `score_min_cd = min(C_d)`
150
+ - `score_max_cl = max(C_l)`
151
+ - `score_max_ld = max(C_l/C_d)`
152
+
153
+ If a polar is not found, these fields are **NaN**; geometry is still fully populated.
154
+
155
+ ---
156
+
157
+ ## 7) Station Count & Units
158
+
159
+ - **Stations**: always **20** over the half‑span (keeps compatibility with legacy builders).
160
+ - **Units**: dataset stores **SI** (`dis_m`, `chord_m`, `span_m`, `area_m2`, `mac_m`). Inches are used internally during generation for readability and then converted.
161
+
162
+ ---
163
+
164
+ ## 8) Image Preview Column
165
+
166
+ Each wing includes a 3D wireframe PNG (`render_png`) created from the lofted \(S,Y,Z\) arrays:
167
+ - Section loops at every station,
168
+ - ~14 spanwise polylines to suggest the surface,
169
+ - Isometric view (elev \(20^\circ\), azim \(35^\circ\)),
170
+ - Title string with span, root/tip chords, and taper.
171
+
172
+ This renders directly in the Hugging Face Dataset viewer.
173
+
174
+ ---
175
+
176
+ ## 9) Why These Look Like Transport Wings
177
+
178
+ - **Aspect ratio** typically in the 7–11 range (after area settles) due to sampled spans/cords.
179
+ - **Taper** \(0.25\to 0.50\) and **washout** \(-6^\circ\to -2^\circ\) are characteristic of transport wings aimed at cruise efficiency and benign stall.
180
+ - **Quarter‑chord pivot** is the standard torsion axis.
181
+ - **Schrenk chord** smooths the planform compared to pure linear taper, approximating more elliptical loading.
182
+
183
+ ---
184
+
185
+ ## 10) Worked Example (Representative Draw)
186
+
187
+ Let \(s=100\) in, \(c_{\text{root}}=30\) in, \(\lambda=0.35 \Rightarrow c_{\text{tip}}=10.5\) in, stations=20.
188
+ Twist endpoints: \(i_{\text{root}}=1.0^\circ\), \(i_{\text{tip}}=-4.0^\circ\), then \(\text{Twi}[1]=0^\circ\).
189
+
190
+ Mid‑span chord \(y=50\) in:
191
+
192
+ $$
193
+ c_{\text{trap}}(50) = 30 + (10.5-30)\cdot 0.5 = 20.25\text{ in},\quad
194
+ c_{\text{ell}}(50) = 30\sqrt{1-0.5^2} \approx 25.98\text{ in},
195
+ $$
196
+
197
+ $$
198
+ c(50) \approx \tfrac{1}{2}(20.25+25.98) \approx 23.11\text{ in}.
199
+ $$
200
+
201
+ If \(S_{\text{full}} \approx 5000\;\text{in}^2 \Rightarrow S_{\text{full}} \approx 3.226\;\text{m}^2\) and full span \(b=200\) in \(=5.08\) m, then:
202
+
203
+ $$
204
+ \text{AR} = \frac{b^2}{S} \approx \frac{(5.08)^2}{3.226} \approx 8.0.
205
+ $$
206
+
207
+ MAC comes from the \(c(y)^2\) integral and is often in the \(0.3\text{–}0.5\) m range here.
208
+
209
+ ---
210
+
211
+ ## 11) What Makes Each of the 500 Unique?
212
+
213
+ - **Airfoil choice** (≈50 samples per foil) → geometry & polar behavior differ.
214
+ - **Planform**: each wing draws a new \((s,\;c_{\text{root}},\;\lambda)\) → different area, AR, MAC.
215
+ - **Twist**: each wing draws \((i_{\text{root}}, i_{\text{tip}})\) → different load tendency.
216
+ - **Performance summaries**: objective‑style scores (\(\min C_d\), \(\max C_l\), \(\max C_l/C_d\)) and the \(\alpha\) at which they occur differ per wing.
217
+
218
+ ---
219
+
220
+ ### Notes for Objective‑Conditioned Training
221
+
222
+ To bias toward a given objective at training time:
223
+ - **Condition** on `objective ∈ {min Cd, max Cl, max Cl/Cd}` and **airfoil** (name or perimeter).
224
+ - Use the scalar **scores** as targets (e.g., regress `score_min_cd`) or form **ranking** pairs within the same airfoil.
225
+ - Optionally **post‑select** the top‑k wings per airfoil by the chosen objective as exemplar targets.