Datasets:
Languages:
English
Size:
10K - 100K
File size: 17,559 Bytes
8660f0c cc63030 8660f0c ba3aa73 c72624b 13b6b9f 8660f0c 84f500a 307a633 84f500a ba5f95f 570fb9a 7042140 8660f0c 570fb9a ba5f95f eb6eace b507d03 eb6eace b507d03 eb6eace b507d03 ba5f95f c712aae 1bf2ef1 ba5f95f 8660f0c 4862e1b ba5f95f 8660f0c e263a05 570fb9a ba5f95f 7042140 c712aae 63be6c2 570fb9a b507d03 c712aae b507d03 8660f0c ef1c2da ccace69 ef1c2da 43da752 b507d03 ccace69 b507d03 c712aae ef1c2da ccace69 c712aae 63f628e b507d03 c712aae b507d03 c712aae ef1c2da 7f7603f c712aae 43da752 b92ac56 ccace69 b92ac56 c712aae b507d03 c712aae 16f8013 ccace69 b92ac56 b507d03 89f62da 63f628e ccace69 6e52a8e 0ea20c7 6e52a8e 8660f0c ba3aa73 8660f0c 7675e40 8660f0c 83bb1c9 8660f0c 7675e40 8660f0c 83bb1c9 8660f0c 1ea1710 7675e40 1ea1710 8660f0c 7675e40 8660f0c 83bb1c9 8660f0c c6f3caa 9bbb296 c712aae 5a9fd93 c712aae 5a9fd93 c712aae 5a9fd93 88a7fbe c712aae 5a9fd93 c712aae 5a9fd93 88a7fbe c712aae 5a9fd93 c712aae 5a9fd93 88a7fbe c712aae 5a9fd93 c712aae 5a9fd93 88a7fbe c712aae 6e52a8e c712aae b92ac56 559c591 ab9cce6 90d2932 c6f3caa ba5f95f c6f3caa |
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 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 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
---
pretty_name: Wind Tunnel 20K Dataset
size_categories:
- 10K<n<100K
task_categories:
- feature-extraction
- graph-ml
- image-to-3d
language:
- en
tags:
- simulation
- openfoam
- physics
- windtunnel
- inductiva
- machine learning
- synthetic
---
<p align="center">
<img src="https://huggingface.co/datasets/inductiva/windtunnel/resolve/main/assets/pressure_field_mesh.png", width="500px">
</p>
# Wind Tunnel 20K Dataset
The Wind Tunnel Dataset contains 19,812 OpenFOAM simulations of 1,000 unique automobile-like objects placed in a virtual wind tunnel.
Each object is simulated under 20 distinct conditions: 4 random wind speeds ranging from 10 to 50 m/s, and 5 rotation angles
(0°, 180° and 3 random angles).
The meshes for these automobile-like objects were generated using the Instant Mesh model on images sourced from the Stanford Cars Dataset.
To ensure stable and reliable results, each simulation runs for 300 iterations.
The entire dataset of 20,000 simulations is organized into three subsets: 70% for training, 20% for validation, and 10% for testing.
The data generation process itself was orchestrated using the [Inductiva API](https://inductiva.ai/),
which allowed us to run hundreds of OpenFOAM simulations in parallel on the cloud.
# Motivation
Recently, there has been great interest in developing
ML methods to accelerate CFD simulations. Research
has shown that for well defined CFD simulation scenarios (e.g. a virtual wind tunnel), it is possible to train an ML model capable of “predicting” the end result of the simulation orders of magnitude faster than existing classical simulation methods, while maintaining comparable accuracy levels.
However, the ML/CFD communities still lack training data
for their research. We identified two main reasons for that.
First, there is a fundamental lack of datasets containing
3D meshes over which we can run CDF simulation. In fact existing 3D object datasets have many limitations: they are either small in size, closed source, or have low quality meshes. The absence of such input data has been a fundamental blocker for any attempt to generate large-scale training data in any realistic CFD scenario, which will naturally involve 3D meshes.
Second, even if you had all the 3D meshes you needed, it is still not trivial to orchestrate the thousands CFD
simulations that are required to generate a large and diverse enough dataset for training ML-based CFD methods. For creating such a dataset one has to be
able to define an initial simulation scenario (e.g. the windtunnel scenario), and run enough
variations of the simulation, with different meshes, different wind speeds, etc to cover a wide enough range of data points to train a generalizable and robust ML model. Now, using most CFD software, running one simulation alone may be difficult enough. Orchestrating thousands of them and managing all the resulting data is a challenge in itself.
While both of these problems are difficult to solve in general, we decided to focus on one common CFD scenario: a virtual wind tunnel for (static) automobiles and produce a large dataset of CFD simulation run using the popular simulation package OpenFOAM.
Next, we will explain how we tackled the data and the simulation orchestration issues.
## Generating a large quantity of Automobile-like 3D Meshes
Due to the lack of publicly available 3D meshes of automobile objects, we decided to use recent advances in image-to-mesh models to generate meshes from images of automobiles that are freely available.
More specifically, we used the [InstantMesh](https://github.com/TencentARC/InstantMesh) model, which is open-source (Apache-2.0) and is currently state-of-the-art in image-to-mesh generation. The automobile-like meshes were generated by running the InstatMesh image-to-mesh model on 1k images from the publicly available (Apache-2.0) [Stanford Cars Dataset](https://www.kaggle.com/datasets/jessicali9530/stanford-cars-dataset) consisting of 16,185 images of automobiles.
Naturally, running the image-to-mesh model leads to meshes that may have certain defects, such as irregular surfaces, asymmetry issues, holes and disconnected components. Therefore, after running the image-to-mesh model, we run a custom post-processing step where we try to improve the meshes quality. We used PCA to align the mesh with the main axis and we removed disconnected components.
The resulting set of meshes still have little defects, such as presence of "spikes" or "cavities" in supposedly flat areas, unexpected holes, asymmetry issues, among others. We consider these defects as valuable features of the dataset, since from the point of view of the learning problem, they bring certain challenges to ML models that we believe will make overfitting harder and will generally contribute to obtaining more robust and generalizable models.
## Orchestrating 20k simulations on the cloud (just using Python)
For solving the challenge of orchestrating 20k OpenFOAM simulations, we resorted to the Inductiva API. The Inductiva platform exposes a simple Python API for running simulation workflows on the cloud. Inductiva makes available several popular open-source simulation packages, including OpenFOAM. Here is an example of how to run an OpenFOAM simulation using Inductiva (point to the doc that Paulo is preparing).
Using the Inductiva API, it becomes easy to parametrise specific simulation scenarios and run variations of a base case by programatically changing the input parameters and starting conditions of the simulation. Additionally, users can build custom Python classes that wrap parameterized simulation scenarios, allowing them to have a simple Python interface to running simulations without the need to directly interface with the low level simulation packages. We leveraged [Inductiva API to create a Python class for the Wind Tunnel scenario](https://github.com/inductiva/wind-tunnel), which we then used to run 20k simulations over a range of input parameters.
For more information on how to transform complex simulation workflows in simple Python classes check this [blog post](https://inductiva.ai/blog/article/transform-complex-simulations).
# How did we generate the dataset?
1. **Generate Input Meshes**: First, input meshes are generated using the InstantMesh model with images from the Stanford Cars Dataset. Post-processing is then applied to these input meshes.
2. **Run OpenFOAM Simulations**: The Inductiva API is utilized to run OpenFOAM simulations on the input meshes at various wind speeds and object angles. This process produces an output mesh named `openfoam_mesh.obj`, which contains all relevant simulation information.
3. **Post-process OpenFOAM Output**: The OpenFOAM output is post-processed to generate streamlines and pressure map meshes.
The code used to generate the meshes and postprocess them is available on github: [https://github.com/inductiva/datasets-generation](https://github.com/inductiva/datasets-generation).
# Dataset Structure
```
data
├── train
│ ├── <SIMULATION_ID>
│ │ ├── input_mesh.obj
│ │ ├── openfoam_mesh.obj
│ │ ├── pressure_field_mesh.vtk
│ │ ├── simulation_metadata.json
│ │ └── streamlines_mesh.ply
│ └── ...
├── validation
│ └── ...
└── test
└── ...
```
## Dataset Files
Each simulation in the Wind Tunnel Dataset is accompanied by several key files that provide both the input and the output data of the simulations.
Here’s a breakdown of the files included in each simulation:
- **[input_mesh.obj](#input_meshobj)**: OBJ file with the input mesh.
- **[openfoam_mesh.obj](#openfoam_meshobj)**: OBJ file with the OpenFOAM mesh.
- **[pressure_field_mesh.vtk](#pressure_field_meshvtk)**: VTK file with the pressure field data.
- **[streamlines_mesh.ply](#streamlines_meshply)**: PLY file with the streamlines.
- **[metadata.json](#metadatajson)**: JSON with metadata about the input parameters and about some output results such as the force coefficients (obtained via simulation) and the path of the output files.
### input_mesh.obj
The input mesh was generated using the Instant Mesh model from images in the Stanford Cars Dataset. This mesh serves as the input for the subsequent OpenFOAM simulation.
Details on the mesh generation process can be found [here](#Generating-a-large-quantity-of-Automobile-like-3D-Meshes).
| **Input Mesh** | **Points Histogram** |
|-------------------------------|------------------------------|
| ![Input Mesh](https://huggingface.co/datasets/inductiva/windtunnel/resolve/main/assets/input_mesh.png) | ![Histogram](https://huggingface.co/datasets/inductiva/windtunnel/resolve/main/assets/histogram_of_points_input.png) |
```python
import pyvista as pv
# Load the mesh
mesh_path = "input_mesh.obj"
mesh = pv.read(mesh_path)
# Get the vertices (points)
vertices = mesh.points
# Get the faces (connections)
# The faces array contains the number of vertices per face followed by the vertex indices.
# For example: [3, v1, v2, v3, 3, v4, v5, v6, ...] where 3 means a triangle.
faces = mesh.faces
```
### openfoam_mesh.obj
This mesh was generated as a result of the OpenFOAM simulation. The number of points is reduced compared to the `input_mesh.obj`, due to mesh refinement and processing steps applied by OpenFOAM during the simulation.
| **Open Foam Mesh** | **Points Histogram** |
|-------------------------------|------------------------------|
| ![Input Mesh](https://huggingface.co/datasets/inductiva/windtunnel/resolve/main/assets/openfoam_mesh.png) | ![Input Mesh](https://huggingface.co/datasets/inductiva/windtunnel/resolve/main/assets/histogram_of_points_foam.png) |
```python
import pyvista as pv
# Load the mesh
mesh_path = "openfoam_mesh.obj"
mesh = pv.read(mesh_path)
# Get the vertices (points)
vertices = mesh.points
# Get the faces (connections)
# The faces array contains the number of vertices per face followed by the vertex indices.
# For example: [3, v1, v2, v3, 3, v4, v5, v6, ...] where 3 means a triangle.
faces = mesh.faces
```
### pressure_field_mesh.vtk
Pressure values were extracted from the `openfoam_mesh.obj` and then interpolated onto the `input_mesh.obj` using the closest point strategy. This approach allowed us to project the pressure values onto a higher-resolution mesh. As shown in the histogram, the distribution of points matches that of the `input_mesh.obj`.
More details can be found here [here](https://github.com/inductiva/wind-tunnel/blob/deab68a018531ff05d0d8ef9d63d8c108800f78f/windtunnel/windtunnel_outputs.py#L111).
| **Pressure Field Mesh** | **Points Histogram** |
|-------------------------------|------------------------------|
| ![Input Mesh](https://huggingface.co/datasets/inductiva/windtunnel/resolve/main/assets/pressure_field_mesh.png) | ![Input Mesh](https://huggingface.co/datasets/inductiva/windtunnel/resolve/main/assets/histogram_of_points_input.png)) |
```python
import pyvista as pv
mesh_path = "pressure_field_mesh.vtk"
mesh = pv.read(mesh_path)
# The vertices array contains the coordinates of each point in the mesh.
vertices = mesh.points
# The faces array contains the number of vertices per face followed by the vertex indices.
# For example: [3, v1, v2, v3, 3, v4, v5, v6, ...] where 3 means a triangle.
faces = mesh.faces
# Get the pressure data (scalar named "p")
# This retrieves the pressure values associated with each vertex in the mesh.
pressure_data = mesh.point_data["p"]
```
### streamlines_mesh.ply
Streamlines were generated from the `openfoam_mesh.obj`, providing a visual representation of the flow characteristics within the simulation. The streamlines help illustrate how the air flows around the object.
More information can be found [here](https://github.com/inductiva/wind-tunnel/blob/deab68a018531ff05d0d8ef9d63d8c108800f78f/windtunnel/windtunnel_outputs.py#L70).
| **Streamlines Mesh** | **Points Histogram** |
|-------------------------------|------------------------------|
| ![Input Mesh](https://huggingface.co/datasets/inductiva/windtunnel/resolve/main/assets/streamlines_mesh.png) | ![Input Mesh](https://huggingface.co/datasets/inductiva/windtunnel/resolve/main/assets/histogram_of_points_streamlines.png) |
### metadata.json
This file contains metadata related to the simulation, including input parameters such as `wind_speed`, `rotate_angle`, `num_iterations`, and `resolution`. Additionally, it includes output parameters like `drag_coefficient`, `moment_coefficient`, `lift_coefficient`, `front_lift_coefficient`, and `rear_lift_coefficient`. The file also specifies the locations of the generated output meshes.
```json
{
"id": "1w63au1gpxgyn9kun5q9r7eqa",
"object_file": "object_24.obj",
"wind_speed": 35,
"rotate_angle": 332,
"num_iterations": 300,
"resolution": 5,
"drag_coefficient": 0.8322182,
"moment_coefficient": 0.3425206,
"lift_coefficient": 0.1824983,
"front_lift_coefficient": 0.4337698,
"rear_lift_coefficient": -0.2512715,
"input_mesh_path": "data/train/1w63au1gpxgyn9kun5q9r7eqa/input_mesh.obj",
"openfoam_mesh_path": "data/train/1w63au1gpxgyn9kun5q9r7eqa/openfoam_mesh.obj",
"pressure_field_mesh_path": "data/train/1w63au1gpxgyn9kun5q9r7eqa/pressure_field_mesh.vtk",
"streamlines_mesh_path": "data/train/1w63au1gpxgyn9kun5q9r7eqa/streamlines_mesh.ply"
}
```
### Dataset Statistics
The dataset comprises 19,812 valid samples out of a total of 20,000 simulations, with [188 submissions failing](https://huggingface.co/datasets/inductiva/windtunnel/resolve/main/failed_tasks.txt) due to numerical errors in OpenFOAM.
The complete dataset requires about 300 GB of storage.
## Downloading the Dataset:
To download the dataset you have to install the [Datasets package](https://huggingface.co/docs/datasets/en/index) by HuggingFace:
```python
pip install datasets
```
### 1. Using snapshot_download()
```python
import huggingface_hub
dataset_name = "inductiva/windtunnel-20k"
# Download the entire dataset
huggingface_hub.snapshot_download(repo_id=dataset_name, repo_type="dataset")
# Download to a specific local directory
huggingface_hub.snapshot_download(
repo_id=dataset_name, repo_type="dataset", local_dir="local_folder"
)
# Download only the simulation metadata across all simulations
huggingface_hub.snapshot_download(
repo_id=dataset_name,
repo_type="dataset",
local_dir="local_folder",
allow_patterns=["*/*/*/simulation_metadata.json"]
)
```
### 2. Using load_dataset()
```python
import datasets
# Load the dataset (streaming is supported)
dataset = datasets.load_dataset("inductiva/windtunnel-20k", streaming=False)
# Display dataset information
print(dataset)
# Access a sample from the training set
sample = dataset["train"][0]
print("Sample from training set:", sample)
```
## OpenFoam Parameters
We used [Inductiva Template Manager](https://tutorials.inductiva.ai/intro_to_api/templating.html) to parameterize the OpenFoam configuration files.
Below are snippets from some of the templates used in the wind tunnel simulations.
initialConditions.jinja
```jinja
flowVelocity ({{ wind_speed }} 0 0);
```
blockMeshDict.jinja
```jinja
vertices
(
({{ x_min }} {{ y_min }} {{ z_min }})
({{ x_max }} {{ y_min }} {{ z_min }})
({{ x_max }} {{ y_max }} {{ z_min }})
({{ x_min }} {{ y_max }} {{ z_min }})
({{ x_min }} {{ y_min }} {{ z_max }})
({{ x_max }} {{ y_min }} {{ z_max }})
({{ x_max }} {{ y_max }} {{ z_max }})
({{ x_min }} {{ y_max }} {{ z_max }})
);
```
controlDict.jinja
```jinja
endTime {{ num_iterations }};
```
forceCoeffs.jinja
```jinja
magUInf {{ wind_speed }};
lRef {{ length }}; // Wheelbase length
Aref {{ area }}; // Estimated
```
snappyHexMeshDict.jinja
```jinja
geometry
{
object
{
type triSurfaceMesh;
file "object.obj";
}
refinementBox
{
type searchableBox;
min ({{ x_min }} {{ y_min }} {{ z_min }});
max ({{ x_max }} {{ y_max }} {{ z_max }});
}
};
features
(
{
file "object.eMesh";
level {{ resolution + 1 }};
}
);
refinementSurfaces
{
object
{
// Surface-wise min and max refinement level
level ({{ resolution }} {{ resolution + 1 }});
}
}
refinementRegions
{
refinementBox
{
mode inside;
levels ((1E15 {{ resolution - 1 }}));
}
}
locationInMesh ({{ x_min }} {{ y_min }} {{ z_min }});
```
You can find the full OpenFoam configuration on github: [https://github.com/inductiva/wind-tunnel/tree/main/windtunnel/templates](https://github.com/inductiva/wind-tunnel/tree/main/windtunnel/templates)
## What's next?
If you have any issues using this dataset, feel free to reach out to us at [support@intuctiva.ai](support@intuctiva.ai).
If you detect any clearly problematic mesh, please let us know so we can correct that issue for the next version of the
Windtunnel-20k dataset.
To learn more about how we created this dataset—or how you can generate synthetic datasets for Physics-AI models—visit [Inductiva.AI](inductiva.ai) or check out our blog post on [transforming complex simulation workflows into easy-to-use Python classes](https://inductiva.ai/blog/article/transform-complex-simulations). |