Geometry API¶
flowdesign.geometry
¶
Geometry helpers built around Kulfan/CST airfoil representations.
AirfoilCSTDataset
¶
Bases: Dataset
Dataset for airfoils parameterized by a Kulfan/CST vector.
Design vector length = 2 * n_weights_per_side.
It reads .dat files, fits CST parameters, and caches them to a .pt file.
Source code in flowdesign/geometry/airfoil.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
CSTAirfoilGeometry
¶
Problem-level CST/Kulfan airfoil parameterization.
Source code in flowdesign/geometry/airfoil.py
CSTGeometry
¶
Generic NeuralFoil-compatible Kulfan (CST) geometry representation.
Design vector (exposed to models): [upper_weights(n), lower_weights(n)] -> length = 2 * n_weights_per_side
Internally, we also keep: leading_edge_weight, TE_thickness, N1, N2 for geometric reconstruction, but they are not required to be part of the DV.
Source code in flowdesign/geometry/airfoil.py
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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
from_coordinates(coordinates, n_weights_per_side=8, N1=0.5, N2=1.0)
classmethod
¶
Fit Kulfan (CST) parameters from raw airfoil coordinates (N, 2).
Source code in flowdesign/geometry/airfoil.py
from_dat_file(dat_path, n_weights_per_side=8, N1=0.5, N2=1.0)
classmethod
¶
Build CSTGeometry from a .dat/.csv file with airfoil coordinates.
Source code in flowdesign/geometry/airfoil.py
to_coordinates(n_points_per_side=200)
¶
Reconstruct airfoil surface coordinates from stored Kulfan parameters.
Source code in flowdesign/geometry/airfoil.py
to_param_vector()
¶
Return design vector: [upper_weights, lower_weights]. Length = 2 * n_weights_per_side.
Source code in flowdesign/geometry/airfoil.py
to_tensor(device='cpu')
¶
Convert design vector to a PyTorch tensor on the given device.
SuperWingConfigDataset
¶
Bases: Dataset
Dataset for SuperWing geometry parameters from configs.dat.
SuperWing's current configs.dat contains one integer shape index followed by numeric columns. For geometry-only pretraining, the default behavior keeps the first 38 numeric columns after the index:
7 global planform + 10 spanwise airfoil/twist + 21 baseline airfoil terms
The remaining columns encode operating conditions and are intentionally not part of the generated design vector in this MVP.
Source code in flowdesign/geometry/superwing.py
SuperWingParameterGeometry
¶
Problem-level SuperWing parameter geometry.
Source code in flowdesign/geometry/superwing.py
SuperWingGeometry
dataclass
¶
Reference meshes reconstructed from SuperWing geometry parameters.
Source code in flowdesign/geometry/superwing_builder.py
TorchSuperWingGeometryBuilder
¶
Bases: Module
Differentiable SuperWing reference-mesh builder.
Input rows follow configs.dat after removing the leading shape index:
SA, DA, DA_kink, AR, TR, kink, rootadj, rtcs(3), cambers(3),
twists(4), cst_u(10), cst_l(10), tcroot.
The generated meshes follow the AeroTransformer/SuperWing reference format:
origingeom is a vertex mesh [B, 3, 129, 257]; geom0 is the cell-center
mesh [B, 3, 128, 256] used by ATsurf models. This implementation ports the
public cfdpost.wing.multi_section_wing.MultiSecWing meshing equations into
torch, with a differentiable cubic interpolation approximation for spanwise
distributions.
Source code in flowdesign/geometry/superwing_builder.py
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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
download_superwing_configs(path, url=SUPERWING_CONFIGS_URL)
¶
Download SuperWing configs.dat if it is not already present.
The file is small enough for an MVP workflow and avoids downloading the multi-TB field data.