File size: 7,692 Bytes
1a719b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
task_categories:
  - time-series-forecasting
tags:
  - physics
  - simulation
  - PDE
  - fluid-dynamics
  - equivariance
  - Navier-Stokes
  - MHD
  - turbulence
language:
  - en
pretty_name: ReViT - Datasets for Rotationally Equivariant Vision Transformers
size_categories:
  - 10G<n<100G
---

# ReViT: Datasets for Rotationally Equivariant Vision Transformers

This repository contains the datasets used in the **ReViT** project, which develops rotationally equivariant vision transformers for learning PDE dynamics.

## Datasets

We provide three benchmark datasets spanning 2D and 3D physics simulations:

| Dataset | Task | Dimensionality | Channels | Spatial Resolution | Source |
|---------|------|---------------|----------|-------------------|--------|
| **KF2D** | 2D Kolmogorov Flow | 2D | 2 (velocity) | 160×160 | [APEBench](https://github.com/Ceyron/apebench) |
| **MHD_64** | 3D Magnetohydrodynamics | 3D | 7 (density + velocity + magnetic) | 64×64×64 | [The Well](https://github.com/PolymathicAI/the_well) |
| **P3D** | 3D Periodic Channel Flow | 3D | 4 (velocity + pressure) | 96×96×96 | DNS Simulation |

---

## KF2D — 2D Kolmogorov Flow

**Physical scenario:** Forced 2D turbulence governed by the incompressible Navier-Stokes equations with sinusoidal forcing (Kolmogorov flow). The external forcing sustains turbulence, producing statistically stationary vortex dynamics.

### Files

| File | Shape | dtype | Size | Description |
|------|-------|-------|------|-------------|
| `KF2D/train_V.npy` | `(50, 51, 2, 160, 160)` | float64 | ~1.0 GB | Training trajectories |
| `KF2D/test_V.npy` | `(30, 201, 2, 160, 160)` | float64 | ~2.4 GB | Test trajectories |

### Data Layout
- **Axis 0** (`N`): Number of independent trajectory samples
- **Axis 1** (`T`): Time steps per trajectory (51 train / 201 test)
- **Axis 2** (`C=2`): Velocity channels `[u, v]`
- **Axes 3-4** (`H, W`): Spatial grid (160×160, periodic boundary conditions)

### Notes
- Data is stored as **velocity** fields (converted from vorticity via stream function inversion)
- Domain: `[0, 1]²` with periodic boundaries
- The original vorticity data was generated using [APEBench](https://github.com/Ceyron/apebench); velocity conversion was performed using `Generate_velocity.py` from the ReViT repository

---

## MHD_64 — 3D Magnetohydrodynamics

**Physical scenario:** Compressible ideal magnetohydrodynamics (MHD) simulation with Mach number Ma=0.7 and sonic Mach number Ms=0.5. The simulation evolves coupled density, velocity, and magnetic fields on a 3D periodic domain.

### Files

| File | Description |
|------|-------------|
| `MHD_64/data/train/MHD_Ma_0.7_Ms_0.5.hdf5` | Training data (~5.8 GB) |
| `MHD_64/data/valid/MHD_Ma_0.7_Ms_0.5.hdf5` | Validation data (~734 MB) |
| `MHD_64/stats.yaml` | Normalization statistics |

### HDF5 Structure

```
├── boundary_conditions/
│   ├── x_periodic/mask   (64,)  bool
│   ├── y_periodic/mask   (64,)  bool
│   └── z_periodic/mask   (64,)  bool
├── dimensions/
│   ├── time              (100,) float32
│   ├── x                 (64,)  float64
│   ├── y                 (64,)  float64
│   └── z                 (64,)  float64
├── scalars/
│   ├── Ma                ()     float32  (= 0.7)
│   └── Ms                ()     float32  (= 0.5)
├── t0_fields/
│   └── density           (5, 100, 64, 64, 64)       float32
└── t1_fields/
    ├── magnetic_field     (5, 100, 64, 64, 64, 3)    float32
    └── velocity           (5, 100, 64, 64, 64, 3)    float32
```

### Data Layout
- **5 trajectories** × **100 time steps** each
- **Density**: scalar field `(5, 100, 64, 64, 64)`
- **Velocity**: 3-component vector field `(5, 100, 64, 64, 64, 3)`
- **Magnetic field**: 3-component vector field `(5, 100, 64, 64, 64, 3)`
- All spatial dimensions are periodic

### Notes
- This dataset is a subset of [The Well](https://github.com/PolymathicAI/the_well) benchmark
- Only the `MHD_Ma_0.7_Ms_0.5` parameter combination is included (used in experiments)
- The model consumes channels in order: `[velocity(3), magnetic(3), density(1)]` = 7 channels total
- Note: the HDF5 stores fields in order `[density, velocity, magnetic]`; the data loader reorders them

---

## P3D — 3D Periodic Channel Flow

**Physical scenario:** Direct numerical simulation (DNS) of incompressible turbulent flow in a 3D periodic channel. The simulation resolves velocity and pressure fields at high resolution.

### Files

| File | Shape (velocity) | Shape (pressure) | Size | Description |
|------|-------------------|-------------------|------|-------------|
| `P3D/sim0_data_train.h5` | `(1, 180, 3, 96, 96, 96)` | `(1, 180, 1, 96, 96, 96)` | ~1.4 GB | Training |
| `P3D/sim0_data_test.h5` | `(1, 20, 3, 96, 96, 96)` | `(1, 20, 1, 96, 96, 96)` | ~157 MB | Test |

### HDF5 Structure

```
├── velocity    (1, T, 3, 96, 96, 96)  float32
├── pressure    (1, T, 1, 96, 96, 96)  float32
└── timesteps   (T,)                    int64
```

### Data Layout
- **Axis 0** (`B=1`): Batch dimension (single simulation)
- **Axis 1** (`T`): Time steps (180 train / 20 test)
- **Axis 2** (`C`): Channels — 3 for velocity `[u, v, w]`, 1 for pressure `[p]`
- **Axes 3-5** (`D, H, W`): Spatial grid (96×96×96)

### Notes
- The model uses 4 channels total: `[u, v, w, p]` (velocity + pressure)
- Only `sim0` is included (used in the default experiments)
- Spatial domain is periodic in all three directions

---

## Usage

### Quick Download

```python
from huggingface_hub import hf_hub_download, snapshot_download

# Download the entire repository
snapshot_download(
    repo_id="thuerey-group/ReViT",
    repo_type="dataset",
    local_dir="./Dataset"
)

# Or download a specific dataset
hf_hub_download(
    repo_id="thuerey-group/ReViT",
    repo_type="dataset",
    filename="KF2D/train_V.npy",
    local_dir="./Dataset"
)
```

### Using the Download Script

A convenience script is provided in the [ReViT repository](https://github.com/thuerey-group/ReViT):

```bash
# Download all datasets
python scripts/download_from_hf.py --output_dir ./Dataset

# Download specific dataset
python scripts/download_from_hf.py --dataset KF2D --output_dir ./Dataset

# List available datasets
python scripts/download_from_hf.py --list
```

### Loading Data in Python

```python
import numpy as np
import h5py

# === KF2D ===
train_data = np.load("Dataset/KF2D/train_V.npy")
# shape: (50, 51, 2, 160, 160) — [samples, timesteps, channels, H, W]

# === MHD_64 ===
with h5py.File("Dataset/MHD_64/data/train/MHD_Ma_0.7_Ms_0.5.hdf5", "r") as f:
    velocity = f["t1_fields/velocity"][:]       # (5, 100, 64, 64, 64, 3)
    magnetic = f["t1_fields/magnetic_field"][:]  # (5, 100, 64, 64, 64, 3)
    density  = f["t0_fields/density"][:]         # (5, 100, 64, 64, 64)

# === P3D ===
with h5py.File("Dataset/P3D/sim0_data_train.h5", "r") as f:
    velocity = f["velocity"][:]   # (1, 180, 3, 96, 96, 96)
    pressure = f["pressure"][:]   # (1, 180, 1, 96, 96, 96)
```

---

## Citation

If you use these datasets, please cite:

```bibtex
@article{revit2025,
    title={ReViT: Rotationally Equivariant Vision Transformers for PDE Dynamics},
    author={Thuerey Group},
    year={2025}
}
```

## License

This dataset is released under the [MIT License](https://opensource.org/licenses/MIT).

## Acknowledgments

- **KF2D**: Generated using the [APEBench](https://github.com/Ceyron/apebench) benchmark framework
- **MHD_64**: Subset from [The Well](https://github.com/PolymathicAI/the_well) benchmark
- **P3D**: Direct numerical simulation data