File size: 10,382 Bytes
59cf334
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---

license: mit
task_categories:
- other
pretty_name: PreGen Navier-Stokes 2D Dataset
size_categories:
- 100K<n<1M
tags:
- physics
- fluid-dynamics
- navier-stokes
- pde
- scientific-computing
- neural-operators
- foundation-models
- difficulty-transfer
- reynolds-number
- openfoam
---


# PreGen Navier-Stokes 2D Dataset

## Dataset Description

This dataset accompanies the research paper **"Pre-Generating Multi-Difficulty PDE Data For Few-Shot Neural PDE Solvers"** (under review at ICLR 2026). It contains systematically generated 2D incompressible Navier-Stokes fluid flow simulations designed to study **difficulty transfer** in neural PDE solvers.

The key insight: by pre-generating many low and medium difficulty examples and including them with a small number of hard examples, neural PDE solvers can learn high-difficulty physics from far fewer samples. This dataset enables **8.9× reduction in compute time** while achieving comparable performance.

### Dataset Summary

- **Total Size:** ~421 GB
- **Format:** NumPy arrays (.npy files)
- **Number of Files:** 9
- **Simulations per file:** 6,400 trajectories
- **Timesteps:** 20 per trajectory
- **Spatial Resolution:** 128 × 128 grid
- **Solver:** OpenFOAM (icoFoam)
- **Domain:** 2D Incompressible Navier-Stokes equations

### Problem Setting

The dataset solves the 2D incompressible Navier-Stokes equations:

```

∂u/∂t + (u · ∇)u + ∇p = ν∆u

∇ · u = 0

```

where:
- `u(x,t)` is the velocity field
- `p(x,t)` is the kinematic pressure
- `ν` is the kinematic viscosity (1.5 × 10⁻⁵ m²/s)
- Domain: Ω ⊂ [0,1]²

## Difficulty Axes

The dataset systematically varies complexity along three axes:

### 1. **Geometry Axis** (Number of Obstacles)
Simulations in flow-past-object (FPO) configuration with varying obstacle complexity:

- **Easy:** No obstacles (open channel flow)
- **Medium:** Single square obstacle
- **Hard:** 2-10 randomly placed square obstacles

**Files:**
- `Geometry_Axis/FPO_Geometry_Easy_NoObstacle.npy` (47 GB)
- `Geometry_Axis/FPO_Geometry_Medium_SingleObstacle.npy` (47 GB)
- `Geometry_Axis/FPO_Geometry_Hard_MultiObstacle.npy` (47 GB)

### 2. **Physics Axis** (Reynolds Number)
Simulations with varying flow complexity via Reynolds number:

**Multi-Obstacle Flows:**
- **Easy:** Re ∈ [100, 1000] - laminar regime
- **Medium:** Re ∈ [2000, 4000] - transitional regime
- **Hard:** Re ∈ [8000, 10000] - turbulent regime

**Files:**
- `Physics_Axis/MultiObstacle/FPO_Physics_MultiObstacle_Easy_Re100-1000.npy` (47 GB)
- `Physics_Axis/MultiObstacle/FPO_Physics_MultiObstacle_Medium_Re2000-4000.npy` (47 GB)
- `Physics_Axis/MultiObstacle/FPO_Physics_MultiObstacle_Hard_Re8000-10000.npy` (47 GB)

**No-Obstacle Flows:**
- `Physics_Axis/NoObstacle/FPO_Physics_NoObstacle_Easy_Re100-1000.npy` (47 GB)

### 3. **Combined Axis** (Geometry + Physics)
Combined variations in both geometry and Reynolds number:

- **Easy:** No obstacles + low Re ([100, 1000])
- **Medium:** Single obstacle + medium Re ([2000, 4000])
- **Hard:** Multiple obstacles + high Re ([8000, 10000])

**File:**
- `Combined_Axis/FPO_Combined_Medium_SingleObstacle_MedRe.npy` (47 GB)

### 4. **Special Configuration**
- `Special/FPO_Cylinder_Hole_Location_6284.npy` (47 GB) - Cylinder with hole at specific location

## Data Format

Each `.npy` file contains a NumPy array with shape: `(6400, 20, 128, 128, 6)`

**Dimensions:**
- **6400**: Number of simulation trajectories
- **20**: Timesteps per trajectory
- **128 × 128**: Spatial grid resolution
- **6**: Channels (features)

**Channels (in order):**
1. **u** - Horizontal velocity component (m/s)
2. **v** - Vertical velocity component (m/s)
3. **p** - Kinematic pressure (m²/s²)
4. **Re_normalized** - Normalized Reynolds number

5. **Binary mask** - Geometry encoding (1 = obstacle, 0 = fluid)

6. **SDF** - Signed distance field to nearest obstacle boundary



## Simulation Details



### Boundary Conditions



**Flow Past Object (FPO):**

- **Left (inlet):** Parabolic velocity profile with peak velocity Umax

- **Right (outlet):** Zero-gradient pressure outlet

- **Top/Bottom:** No-slip walls (u = 0)

- **Obstacles:** No-slip walls (u = 0)



### Reynolds Number Sampling

Re is sampled from a truncated Gaussian distribution N(5000, 2000²) with support [100, 10000]. The inlet velocity is scaled to achieve the target Re:



```

Re = (U_avg × L) / ν

U_avg = (2/3) × U_max

```



### Time Integration

- **Scheme:** Backward Euler (1st order implicit)
- **Spatial discretization:** Finite volume method
- **Gradient terms:** Gauss linear (central differencing)
- **Convection:** Gauss linearUpwind with gradient reconstruction
- **Diffusion:** Gauss linear orthogonal

### Simulation Duration
Adaptive time scheduling based on Reynolds number to ensure flow development:
- **Low Re (10-100):** Fixed 2700s
- **Medium Re (100-1000):** 1-10× characteristic diffusion time
- **High Re (1000-10000):** 10-40× characteristic diffusion time

### Computational Cost
The harder the simulation, the more expensive to generate:

| Configuration | Average Time (seconds) |
|--------------|----------------------|
| No obstacle, Low Re | 176.7 |
| No obstacle, Medium Re | 261.1 |
| No obstacle, High Re | 350.4 |
| One obstacle, Low Re | 609.5 |
| One obstacle, Medium Re | 731.1 |
| One obstacle, High Re | 942.8 |
| Multiple obstacles, Low Re | 1550.9 |
| Multiple obstacles, Medium Re | 1599.2 |
| Multiple obstacles, High Re | 1653.3 |

## Key Research Findings

This dataset was specifically designed to study **difficulty transfer** in neural PDE solvers:

1. **Sample Efficiency**: Training on 10% hard data + 90% easy/medium data recovers ~96-98% of the performance of training on 100% hard data

2. **Compute Efficiency**: By mixing difficulties optimally, you can achieve the same error with **8.9× less compute** spent on data generation

3. **Medium > Easy**: For most budgets, generating fewer medium-difficulty examples outperforms generating more easy examples

4. **Foundation Dataset Potential**: Medium-difficulty data (single obstacle) improves few-shot performance on complex geometries (NURBS shapes from FlowBench)

## Usage

### Basic Loading

```python

import numpy as np

from huggingface_hub import hf_hub_download



# Download a specific difficulty level

file_path = hf_hub_download(

    repo_id="sage-lab/PreGen-NavierStokes-2D",

    filename="Geometry_Axis/FPO_Geometry_Easy_NoObstacle.npy",

    repo_type="dataset"

)



# Load the data

data = np.load(file_path)

print(f"Data shape: {data.shape}")  # (6400, 20, 128, 128, 6)



# Extract individual trajectories

trajectory_0 = data[0]  # Shape: (20, 128, 128, 6)



# Extract velocity and pressure

u = trajectory_0[:, :, :, 0]  # Horizontal velocity

v = trajectory_0[:, :, :, 1]  # Vertical velocity

p = trajectory_0[:, :, :, 2]  # Pressure

mask = trajectory_0[:, :, :, 4]  # Binary geometry mask

sdf = trajectory_0[:, :, :, 5]  # Signed distance field

```

### Difficulty Mixing for Training

```python

import numpy as np

from huggingface_hub import hf_hub_download



# Load different difficulty levels

easy_data = np.load(hf_hub_download(

    repo_id="sage-lab/PreGen-NavierStokes-2D",

    filename="Geometry_Axis/FPO_Geometry_Easy_NoObstacle.npy",

    repo_type="dataset"

))



medium_data = np.load(hf_hub_download(

    repo_id="sage-lab/PreGen-NavierStokes-2D",

    filename="Geometry_Axis/FPO_Geometry_Medium_SingleObstacle.npy",

    repo_type="dataset"

))



hard_data = np.load(hf_hub_download(

    repo_id="sage-lab/PreGen-NavierStokes-2D",

    filename="Geometry_Axis/FPO_Geometry_Hard_MultiObstacle.npy",

    repo_type="dataset"

))



# Recommended: Use 10% hard + 90% medium for cost-effective training

n_hard = 80

n_medium = 720



train_data = np.concatenate([

    hard_data[:n_hard],

    medium_data[:n_medium]

], axis=0)



# Hold out 100 hard examples for testing

test_data = hard_data[-100:]

```

### Computing Metrics

```python

def compute_nmae(y_true, y_pred):

    """

    Compute normalized Mean Absolute Error (nMAE)

    as used in the paper.



    Args:

        y_true: Ground truth, shape (N, T, H, W, C)

        y_pred: Predictions, shape (N, T, H, W, C)



    Returns:

        nMAE: Normalized mean absolute error

    """

    numerator = np.abs(y_true - y_pred).sum()

    denominator = np.abs(y_true).sum()

    return numerator / (denominator + 1e-10)

```

## Tested Models

The paper evaluates this dataset on:

### Supervised Neural Operators (trained from scratch)
- **CNO** (Convolutional Neural Operator) - 18M parameters
- **F-FNO** (Factorized Fourier Neural Operator) - 5-layer

### Foundation Models (fine-tuned)
- **Poseidon-T** (Tiny) - 21M parameters
- **Poseidon-B** (Base) - 158M parameters
- **Poseidon-L** (Large) - 629M parameters

All models are trained autoregressively with one-step-ahead prediction (t → t+1) using relative L1 loss.

## Citation

If you use this dataset, please cite:

```bibtex

@inproceedings{pregen2026,

  title={Pre-Generating Multi-Difficulty {PDE} Data For Few-Shot Neural {PDE} Solvers},

  author={Anonymous},

  booktitle={Under review at International Conference on Learning Representations (ICLR)},

  year={2026},

  url={https://openreview.net}

}

```

**Note:** Citation will be updated once the paper is published.

## Related Datasets

- **The Well** - Large-scale multi-physics PDE dataset
- **PDEBench** - Benchmark for scientific machine learning
- **FlowBench** - Flow simulation over complex geometries (NURBS shapes)

## License

MIT License

## Acknowledgments

This dataset was generated using:
- **OpenFOAM** (v2406) for CFD simulations
- Simulations performed on computational clusters
- Total compute time: Several thousand GPU/CPU hours

## Contact

For questions or issues:
- Open an issue in the dataset repository
- Contact the sage-lab organization on Hugging Face
- See the paper for additional contact information (once published)

## Dataset Maintainers

sage-lab organization

---

**Dataset Version:** 1.0
**Last Updated:** 2024
**Status:** Research dataset under peer review