Jrhoss commited on
Commit
b6bf2b8
·
verified ·
1 Parent(s): a437bbf

Update README with full dataset card

Browse files
Files changed (1) hide show
  1. README.md +209 -0
README.md ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-sa-4.0
3
+ task_categories:
4
+ - graph-ml
5
+ tags:
6
+ - cfd
7
+ - aerodynamics
8
+ - point-cloud
9
+ - surrogate-modeling
10
+ - automotive
11
+ - drivaer
12
+ - drivaerml
13
+ size_categories:
14
+ - n<1K
15
+ ---
16
+
17
+ # DrivAerML Point Clouds
18
+
19
+ A preprocessed, point-cloud version of the [**DrivAerML**](https://huggingface.co/datasets/neashton/drivaerml) high-fidelity CFD dataset, ready for training point-based deep learning surrogates (PointNet, PCT, DGCNN, Graph Neural Operators, etc.) for automotive external aerodynamics.
20
+
21
+ The original DrivAerML release contains 500 scale-resolving CFD simulations of parametrically morphed DrivAer notchback geometries and ships as ~31 TB of raw STL / VTP / VTU / OpenFOAM data. This release distills the **surface boundary** of each run down to a single compressed `.npz` file (~10 MB) containing the STL point coordinates and the CFD surface fields interpolated onto those points — so the full usable set fits in **~5 GB** instead of multiple terabytes.
22
+
23
+ ## What's in here
24
+
25
+ For each run:
26
+
27
+ - `point_cloud_{i}.npz` — STL surface points with interpolated CFD fields
28
+ - `force_mom_{i}.csv` — time-averaged force and moment coefficients (Cd, Cl, Clf, Clr, Cs)
29
+
30
+ Plus at the dataset root:
31
+
32
+ - `splits.json` — reproducible train/val/test assignment (seed 42, 80/10/10)
33
+ - `processing_log.json` — per-run processing status and nearest-neighbor distance diagnostics
34
+
35
+ ### Directory layout
36
+
37
+ ```
38
+ Drivaerml_point_clouds/
39
+ ├── train/ # 387 runs
40
+ │ ├── run_1/
41
+ │ │ ├── point_cloud_1.npz
42
+ │ │ └── force_mom_1.csv
43
+ │ └── ...
44
+ ├── val/ # 46 runs
45
+ │ └── ...
46
+ ├── test/ # 52 runs
47
+ │ └── ...
48
+ ├── splits.json
49
+ └── processing_log.json
50
+ ```
51
+
52
+ Total: **485 runs** (of the 500 original designs, 15 runs are missing from the source dataset: 167, 211, 218, 221, 248, 282, 291, 295, 316, 325, 329, 364, 370, 376, 403, 473).
53
+
54
+ > **Note on the Hugging Face dataset viewer:** the viewer only previews the tabular `force_mom_*.csv` files (the Cd/Cl/Clf/Clr/Cs coefficients). The actual point-cloud payload lives in the `.npz` files, which the viewer does not render — clone the repo or stream it with `huggingface_hub` to access the geometry and fields.
55
+
56
+ ## `.npz` contents
57
+
58
+ Each `point_cloud_{i}.npz` has three arrays:
59
+
60
+ | Key | Shape | Dtype | Description |
61
+ | ------------- | ------------ | ---------- | ----------------------------------------------------- |
62
+ | `points` | `(N, 3)` | `float32` | XYZ coordinates of STL surface points |
63
+ | `fields` | `(N, 5)` | `float32` | CFD surface fields interpolated to each STL point |
64
+ | `field_names` | `(5,)` | `str` | Names of the columns in `fields` |
65
+
66
+ `N` varies per run (roughly 300k points, matching the STL resolution).
67
+
68
+ The five field columns are:
69
+
70
+ 1. `CpMeanTrim` — time-averaged pressure coefficient
71
+ 2. `wallShearStressMeanTrim_mag` — magnitude of time-averaged wall shear stress
72
+ 3. `wallShearStressMeanTrim_x` — x-component
73
+ 4. `wallShearStressMeanTrim_y` — y-component
74
+ 5. `wallShearStressMeanTrim_z` — z-component
75
+
76
+ ## How the preprocessing works
77
+
78
+ The original DrivAerML surface data is stored in **`boundary_{i}.vtp`**: a high-resolution (~8M point) mesh with CFD fields attached as **cell data**. The STL geometry **`drivaer_{i}.stl`** is a lower-resolution (~300k point) representation of the same surface but without any fields.
79
+
80
+ To produce a clean point cloud where every geometry point carries its own CFD values, the pipeline runs the following per run:
81
+
82
+ 1. Load the `.vtp` boundary mesh and the `.stl` geometry.
83
+ 2. Convert the VTP's cell-centered fields to point-centered via PyVista's `cell_data_to_point_data()` (averaging adjacent cells to the shared vertex).
84
+ 3. Build a `scipy.spatial.cKDTree` over the VTP point coordinates.
85
+ 4. For each STL point, take the **K=1 nearest neighbor** in the VTP point cloud and copy its field values.
86
+ 5. Save `points`, `fields`, and `field_names` as a compressed `.npz`.
87
+ 6. Delete the raw VTP and STL to keep disk usage bounded while processing.
88
+
89
+ The K=1 nearest-neighbor mapping was chosen deliberately for **benchmark comparability** with existing DrivAerML / DrivAerNet++ leaderboard models (TripNet, FIGConvNet, RegDGCNN), all of which operate on the STL vertices directly. The nearest-neighbor distances are logged in `processing_log.json` for every run so this mapping can be audited.
90
+
91
+ The 80/10/10 train/val/test split is computed with `numpy.random.default_rng(seed=42)` over a sorted list of successfully-processed run IDs, making it fully reproducible from the `splits.json` manifest.
92
+
93
+ ## Loading
94
+
95
+ ### With `datasets` (CSV force/moment preview only)
96
+
97
+ The Hugging Face dataset loader will pick up the `force_mom_*.csv` files automatically:
98
+
99
+ ```python
100
+ from datasets import load_dataset
101
+ ds = load_dataset("Jrhoss/Drivaerml_point_clouds")
102
+ # ds["train"][0] -> {"Cd": 0.30, "Cl": 0.07, "Clf": -0.04, "Clr": 0.10, "Cs": 0.05}
103
+ ```
104
+
105
+ ### Point clouds (recommended)
106
+
107
+ Clone the repo or snapshot-download it, then load `.npz` files directly:
108
+
109
+ ```python
110
+ from huggingface_hub import snapshot_download
111
+ import numpy as np
112
+ from pathlib import Path
113
+
114
+ root = Path(snapshot_download("Jrhoss/Drivaerml_point_clouds", repo_type="dataset"))
115
+
116
+ run = np.load(root / "train" / "run_1" / "point_cloud_1.npz", allow_pickle=True)
117
+ points = run["points"] # (N, 3)
118
+ fields = run["fields"] # (N, 5)
119
+ names = run["field_names"] # ['CpMeanTrim', 'wallShearStressMeanTrim_mag', ...]
120
+ ```
121
+
122
+ ### Minimal PyTorch `Dataset`
123
+
124
+ ```python
125
+ import numpy as np
126
+ import pandas as pd
127
+ import torch
128
+ from pathlib import Path
129
+ from torch.utils.data import Dataset
130
+
131
+ class DrivAerMLPointClouds(Dataset):
132
+ def __init__(self, root, split="train", n_points=16384):
133
+ self.run_dirs = sorted((Path(root) / split).glob("run_*"),
134
+ key=lambda p: int(p.name.split("_")[1]))
135
+ self.n_points = n_points
136
+
137
+ def __len__(self):
138
+ return len(self.run_dirs)
139
+
140
+ def __getitem__(self, idx):
141
+ run_dir = self.run_dirs[idx]
142
+ run_id = int(run_dir.name.split("_")[1])
143
+
144
+ npz = np.load(run_dir / f"point_cloud_{run_id}.npz", allow_pickle=True)
145
+ points, fields = npz["points"], npz["fields"]
146
+
147
+ # Random subsample for batching
148
+ sel = np.random.choice(len(points), self.n_points, replace=False)
149
+ points, fields = points[sel], fields[sel]
150
+
151
+ # Integrated force/moment coefficients
152
+ fm = pd.read_csv(run_dir / f"force_mom_{run_id}.csv").iloc[0]
153
+ coeffs = torch.tensor([fm["Cd"], fm["Cl"], fm["Clf"], fm["Clr"], fm["Cs"]],
154
+ dtype=torch.float32)
155
+
156
+ return {
157
+ "points": torch.from_numpy(points), # (n_points, 3)
158
+ "fields": torch.from_numpy(fields), # (n_points, 5)
159
+ "coeffs": coeffs, # (5,)
160
+ "run_id": run_id,
161
+ }
162
+ ```
163
+
164
+ ## Suggested tasks
165
+
166
+ - **Per-point surface field regression** — predict `CpMeanTrim` and wall shear stress vectors from geometry alone. Comparable to the TripNet / FIGConvNet / RegDGCNN benchmarks (which report ~20% relative L2 error).
167
+ - **Integrated coefficient regression** — predict `Cd`, `Cl`, etc. from the point cloud (global pooling over the surface).
168
+ - **Coupled prediction** — joint learning of per-point fields and integrated coefficients, using the integrated values as a physics-informed auxiliary loss.
169
+
170
+ ## Known limitations
171
+
172
+ - **K=1 interpolation is not exact.** It preserves the CFD field values faithfully where VTP and STL points are co-located, but introduces small errors at points where the STL has higher local resolution than the VTP. `processing_log.json` reports `nn_dist_mean`, `nn_dist_max`, and `nn_dist_p99` per run so you can filter out any pathological cases.
173
+ - **Fields are time-averaged only.** Transient information (e.g. unsteady vortex shedding in the wake) is not preserved; the source dataset contains scale-resolving data but only the trim-averaged fields are interpolated here.
174
+ - **Surface only.** The volumetric flow field (the 50 GB-per-run `volume_{i}.vtu`) is not included — go to the source dataset for volumetric surrogate modeling.
175
+
176
+ ## Reproducing this dataset
177
+
178
+ The full preprocessing script is shipped alongside this repo (`process_drivaerml.py`). To regenerate from scratch:
179
+
180
+ ```bash
181
+ pip install pyvista numpy scipy tqdm huggingface_hub
182
+ python process_drivaerml.py --output_dir ./drivaerml_processed --start 1 --end 500
183
+ ```
184
+
185
+ The script streams one run at a time — downloading the VTP + STL + force/moment CSV from `neashton/drivaerml`, producing the `.npz`, then deleting the raw files — so it runs comfortably in a few tens of GB of free disk regardless of total dataset size.
186
+
187
+ ## License
188
+
189
+ **CC-BY-SA 4.0**, inherited from the source dataset. If you use this data you must give appropriate credit, indicate any changes, and distribute any derivative works under the same license.
190
+
191
+ ## Citation
192
+
193
+ Please cite the original DrivAerML paper:
194
+
195
+ ```bibtex
196
+ @article{ashton2024drivaer,
197
+ title = {DrivAerML: High-Fidelity Computational Fluid Dynamics Dataset for Road-Car External Aerodynamics},
198
+ author = {Ashton, N. and Mockett, C. and Fuchs, M. and Fliessbach, L. and Hetmann, H.
199
+ and Knacke, T. and Schonwald, N. and Skaperdas, V. and Fotiadis, G.
200
+ and Walle, A. and Hupertz, B. and Maddix, D.},
201
+ journal = {arXiv preprint arXiv:2408.11969},
202
+ year = {2024},
203
+ url = {https://arxiv.org/abs/2408.11969}
204
+ }
205
+ ```
206
+
207
+ ## Acknowledgments
208
+
209
+ All credit for the underlying CFD data goes to the DrivAerML team (Neil Ashton et al., AWS / UpstreamCFD / BETA-CAE / Siemens Energy / Ford). This repository only redistributes a preprocessed surface-point-cloud view of that work. For the full multi-terabyte dataset including volumetric fields, OpenFOAM meshes, slice images, and residual plots, see [`neashton/drivaerml`](https://huggingface.co/datasets/neashton/drivaerml).