File size: 4,481 Bytes
8ae6fd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# DiffVOF Simulation Data / DiffVOF 仿真数据

OpenFOAM interFoam 2D VOF two-phase flow simulation data for the DiffVOF+NN paper revision.
用于 DiffVOF+NN 论文大修的 OpenFOAM interFoam 2D VOF 两相流仿真数据。

## Directory Structure / 目录结构

```
Exp/data/
├── templates/              ← Case templates / 仿真 case 模板
│   ├── dam_break/          ← 2D 溃坝 (128×128)
│   ├── rising_bubble/      ← 2D 气泡上升 (128×256)
│   ├── stokes_wave/        ← 2D Stokes 波 (256×128)
│   └── droplet_impact/     ← 2D 液滴撞击 (128×128)
│       └── base/           ← OpenFOAM case: 0/ constant/ system/
├── raw/                    ← Raw simulation data / 原始仿真数据
│   ├── {case_type}/tNN/    ← 50 trajectories per type, t00-t49
│   │   ├── 0/              ← Initial fields (U, p_rgh, alpha.water)
│   │   ├── constant/       ← Physical properties + mesh
│   │   ├── system/         ← Solver settings (controlDict, fvSchemes, ...)
│   │   ├── {time}/         ← Reconstructed field snapshots
│   │   ├── log.interFoam   ← Solver log (ends with "End" if complete)
│   │   └── log.blockMesh   ← Mesh generation log
│   └── ...
├── processed/              ← HDF5 processed data / 处理后 HDF5 数据
│   ├── {case_type}/
│   │   └── traj_NNNN.h5    ← 50 files per type (traj_0000.h5 - traj_0049.h5)
│   └── ...
├── scripts/                ← Processing & viz scripts / 后处理与可视化脚本
│   ├── postprocess_to_hdf5.py   ← OpenFOAM → HDF5 conversion
│   ├── visualize_hdf5.py        ← HDF5 → PNG visualization
│   ├── foam_viz.py              ← OpenFOAM field visualization
│   ├── viz_common.py            ← Shared visualization utilities
│   ├── gen_init_conditions.py   ← Random initial condition generator
│   ├── run_droplet_loop.sh      ← droplet_impact batch runner
│   ├── run_stokes_loop.sh       ← stokes_wave batch runner
│   └── run_postprocess_all.sh   ← HDF5 postprocessing wrapper
└── visualizations/         ← Visualization outputs / 可视化输出
    ├── arrow/              ← Velocity arrow plots (4 cases × foam+hdf5)
    └── streamline/         ← Streamline plots (4 cases × foam+hdf5)
```

## HDF5 Format / HDF5 格式

Each `traj_NNNN.h5` contains:

| Dataset    | Shape              | Type    | Description / 描述          |
|------------|--------------------|---------|-----------------------------|
| `u`        | (n_frames, nx, ny) | float32 | X-velocity / X 方向速度     |
| `v`        | (n_frames, nx, ny) | float32 | Y-velocity / Y 方向速度     |
| `p`        | (n_frames, nx, ny) | float32 | Pressure (p_rgh) / 压力     |
| `alpha`    | (n_frames, nx, ny) | float32 | Water volume fraction / 水相分数 |
| `x_grid`   | (nx, ny)           | float64 | X-coordinate mesh / X 坐标网格 |
| `y_grid`   | (nx, ny)           | float64 | Y-coordinate mesh / Y 坐标网格 |

Attributes / 属性: `nx`, `ny`, `n_saved`, `times`, `case_name`, `mesh_Lx`, `mesh_Ly`

## Case Types / 案例类型

| Case Type        | Mesh      | Domain (m)     | Physics / 物理场景          |
|------------------|-----------|----------------|-----------------------------|
| `dam_break`      | 128×128   | 0.584×0.584    | 2D dam break / 溃坝         |
| `rising_bubble`  | 128×256   | 1.0×2.0        | Buoyancy-driven bubble / 气泡上升 |
| `stokes_wave`    | 256×128   | varies         | Surface gravity wave / 表面重力波 |
| `droplet_impact` | 128×128   | 0.05×0.05      | Droplet impact / 液滴撞击壁面 |

## Simulation Config / 仿真配置

- **Solver**: OpenFOAM v1906 (Foundation) interFoam
- **Parallel**: MPI 16 processes, 2D hierarchical decomposition (n×n×1)
- **Adaptive dt**: maxCo=0.5, maxAlphaCo=0.5, maxDeltaT=1e-4
- **Random ICs**: generated by `gen_init_conditions.py` with per-type parameter ranges

## Reproducibility / 可复现性

Each trajectory's initial conditions are embedded in its `0/U`, `0/alpha.water`, and `0/p_rgh` files. To reproduce:

```bash
# Reconstruct and visualize a single case / 重建并可视化单个 case
cd raw/{case_type}/t00
blockMesh && decomposePar -force
mpirun -np 16 interFoam -parallel
reconstructPar -latestTime
```