Datasets:
Add README, LICENSE, scripts, ground truth, planar and stereo calibration boards
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +1 -0
- LICENSE +33 -0
- README.md +244 -3
- ground_truth/direct_stats_noisy.mat +3 -0
- planar_noisy/calibration_boards/planar_calibration_plate_01.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_02.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_03.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_04.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_05.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_06.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_07.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_08.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_09.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_10.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_11.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_12.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_13.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_14.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_15.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_16.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_17.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_18.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_19.tif +0 -0
- planar_noisy/calibration_boards/planar_calibration_plate_20.tif +0 -0
- scripts/benchmark_comparison.py +1906 -0
- scripts/cross_method_comparison.py +611 -0
- scripts/paper_figures.py +462 -0
- scripts/sig_configs/SIGconf_Stereo_cam1.cdl +373 -0
- scripts/sig_configs/SIGconf_Stereo_cam1_noisy_A.cdl +373 -0
- scripts/sig_configs/SIGconf_Stereo_cam1_noisy_B.cdl +373 -0
- scripts/sig_configs/SIGconf_Stereo_cam2.cdl +373 -0
- scripts/sig_configs/SIGconf_Stereo_cam2_noisy_A.cdl +373 -0
- scripts/sig_configs/SIGconf_Stereo_cam2_noisy_B.cdl +373 -0
- scripts/sig_configs/sigconf_planar.cdl +373 -0
- scripts/sig_configs/sigconf_planar_noisy_A.cdl +373 -0
- scripts/sig_configs/sigconf_planar_noisy_B.cdl +373 -0
- scripts/stereo_benchmark_comparison.py +1261 -0
- scripts/tcf_direct_stats.py +614 -0
- stereo_noisy/calibration/cam1/planar_calibration_plate_01.tif +0 -0
- stereo_noisy/calibration/cam1/planar_calibration_plate_02.tif +0 -0
- stereo_noisy/calibration/cam1/planar_calibration_plate_03.tif +0 -0
- stereo_noisy/calibration/cam1/planar_calibration_plate_04.tif +0 -0
- stereo_noisy/calibration/cam1/planar_calibration_plate_05.tif +0 -0
- stereo_noisy/calibration/cam1/planar_calibration_plate_06.tif +0 -0
- stereo_noisy/calibration/cam1/planar_calibration_plate_07.tif +0 -0
- stereo_noisy/calibration/cam1/planar_calibration_plate_08.tif +0 -0
- stereo_noisy/calibration/cam1/planar_calibration_plate_09.tif +0 -0
- stereo_noisy/calibration/cam1/planar_calibration_plate_10.tif +0 -0
- stereo_noisy/calibration/cam1/planar_calibration_plate_11.tif +0 -0
- stereo_noisy/calibration/cam1/planar_calibration_plate_12.tif +0 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
ground_truth/direct_stats_noisy.mat filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Creative Commons Attribution 4.0 International (CC BY 4.0)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2026 Morgan T. Taylor, J. M. Lawson, B. Ganapathisubramani
|
| 4 |
+
University of Southampton
|
| 5 |
+
|
| 6 |
+
You are free to:
|
| 7 |
+
|
| 8 |
+
Share — copy and redistribute the material in any medium or format
|
| 9 |
+
Adapt — remix, transform, and build upon the material for any purpose,
|
| 10 |
+
even commercially.
|
| 11 |
+
|
| 12 |
+
Under the following terms:
|
| 13 |
+
|
| 14 |
+
Attribution — You must give appropriate credit, provide a link to the
|
| 15 |
+
license, and indicate if changes were made. You may do so
|
| 16 |
+
in any reasonable manner, but not in any way that suggests
|
| 17 |
+
the licensor endorses you or your use.
|
| 18 |
+
|
| 19 |
+
No additional restrictions — You may not apply legal terms or
|
| 20 |
+
technological measures that legally restrict others from
|
| 21 |
+
doing anything the license permits.
|
| 22 |
+
|
| 23 |
+
Full license text: https://creativecommons.org/licenses/by/4.0/legalcode
|
| 24 |
+
|
| 25 |
+
When citing, please reference the PIVtools paper:
|
| 26 |
+
|
| 27 |
+
Taylor, M. T., Lawson, J. M., & Ganapathisubramani, B. (2026).
|
| 28 |
+
PIVtools: an open-source PIV framework with integrated planar,
|
| 29 |
+
stereoscopic, and ensemble pipelines. SoftwareX (submitted).
|
| 30 |
+
|
| 31 |
+
The DNS ground-truth data is derived from the Johns Hopkins Turbulence
|
| 32 |
+
Database (JHTDB, http://turbulence.pha.jhu.edu). Consult the JHTDB usage
|
| 33 |
+
policy for their citation requirements.
|
README.md
CHANGED
|
@@ -1,3 +1,244 @@
|
|
| 1 |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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- piv
|
| 7 |
+
- particle-image-velocimetry
|
| 8 |
+
- fluid-dynamics
|
| 9 |
+
- turbulence
|
| 10 |
+
- channel-flow
|
| 11 |
+
- validation
|
| 12 |
+
- benchmark
|
| 13 |
+
- synthetic-data
|
| 14 |
+
pretty_name: PIVtools Turbulent Channel Validation Dataset
|
| 15 |
+
size_categories:
|
| 16 |
+
- 10K<n<100K
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# PIVtools Turbulent Channel Validation Dataset
|
| 20 |
+
|
| 21 |
+
Synthetic particle-image-velocimetry (PIV) images of a turbulent channel flow at Re_τ ≈ 1000, paired with DNS-derived ground-truth statistics. Designed to benchmark PIV algorithms end-to-end against a reference dataset of known answer.
|
| 22 |
+
|
| 23 |
+
Case B (noisy): 22 000 particles per 2048×2048 image, Gaussian sensor noise (SNR ≈ 8), 4000 image pairs, planar and stereo (±45°) geometries. Clean (Case A, 85 000 particles) will follow as a separate upload once storage allows.
|
| 24 |
+
|
| 25 |
+
Companion to the PIVtools software paper (SoftwareX, submitted). The dataset is self-contained: drop it next to a [PIVtools](https://github.com/MTT69/python-PIVtools) install and the benchmark scripts reproduce every validation figure in the paper.
|
| 26 |
+
|
| 27 |
+
## Quickstart
|
| 28 |
+
|
| 29 |
+
```bash
|
| 30 |
+
# 1. Install pivtools (C extensions are pre-built in the PyPI wheel)
|
| 31 |
+
pip install pivtools
|
| 32 |
+
|
| 33 |
+
# 2. Download this dataset
|
| 34 |
+
hf download MTT69/TurbulentChannel --repo-type dataset --local-dir ./tc
|
| 35 |
+
|
| 36 |
+
# 3. Process the planar noisy images (ensemble PIV — example)
|
| 37 |
+
pivtools-cli init --output ./work/config.yaml
|
| 38 |
+
# edit config.yaml to point sources at ./tc/planar_noisy
|
| 39 |
+
pivtools-cli ensemble --config ./work/config.yaml
|
| 40 |
+
|
| 41 |
+
# 4. Benchmark against DNS
|
| 42 |
+
python ./tc/scripts/benchmark_comparison.py \
|
| 43 |
+
--mode ensemble \
|
| 44 |
+
--gt-dir ./tc/ground_truth \
|
| 45 |
+
--ensemble-dir ./work/calibrated_piv/4000/Cam1/ensemble \
|
| 46 |
+
--num-frames 4000 \
|
| 47 |
+
--output-dir ./work/validation
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## Contents
|
| 51 |
+
|
| 52 |
+
```
|
| 53 |
+
MTT69/TurbulentChannel/
|
| 54 |
+
├── README.md (this file)
|
| 55 |
+
├── LICENSE (CC-BY-4.0)
|
| 56 |
+
├── ground_truth/
|
| 57 |
+
│ └── direct_stats_noisy.mat DNS statistics for Case B (22k particles)
|
| 58 |
+
├── planar_noisy/ Case B planar images (4000 pairs)
|
| 59 |
+
│ ├── B00001_A.tif … B04000_B.tif 2048×2048 16-bit TIFF, flat at root
|
| 60 |
+
│ └── calibration_boards/ 20 synthetic dotboard calibration images
|
| 61 |
+
├── stereo_noisy/ Case B stereo images (4000 pairs × 2 cameras)
|
| 62 |
+
│ ├── camera1/ cam 1 TIFFs (±45° forward-scatter)
|
| 63 |
+
│ ├── camera2/ cam 2 TIFFs
|
| 64 |
+
│ ├── calibration/
|
| 65 |
+
│ │ ├── cam1/ 20 stereo dotboard images, cam 1
|
| 66 |
+
│ │ └── cam2/ 20 stereo dotboard images, cam 2
|
| 67 |
+
│ ├── mask_Cam1.mat pixel-space masks
|
| 68 |
+
│ └── mask_Cam2.mat
|
| 69 |
+
└── scripts/
|
| 70 |
+
├── benchmark_comparison.py Planar + ensemble vs DNS
|
| 71 |
+
├── stereo_benchmark_comparison.py Stereo 3-component + 6 stresses vs DNS
|
| 72 |
+
├── cross_method_comparison.py Multi-method overlay figures
|
| 73 |
+
├── paper_figures.py Combined clean+noisy paper figures
|
| 74 |
+
├── tcf_direct_stats.py Recompute ground truth from JHTDB particles
|
| 75 |
+
└── sig_configs/ EUROSIG configuration files (.cdl)
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
## Image specifications
|
| 79 |
+
|
| 80 |
+
| Parameter | Value |
|
| 81 |
+
|-----------|-------|
|
| 82 |
+
| Image size | 2048 × 2048 px, 16-bit TIFF |
|
| 83 |
+
| Particle diameter | 3 px |
|
| 84 |
+
| Laser sheet thickness | 16 px (1.2 mm physical) |
|
| 85 |
+
| Number of pairs | 4000 |
|
| 86 |
+
| Case B particle count | 22 000 per image (≈ 1.3 ppw at 16×16 windows) |
|
| 87 |
+
| Case B noise | Gaussian, mean = 80, std = 16, SNR ≈ 8 |
|
| 88 |
+
| Stereo geometry | Two cameras at ±45° forward-scatter |
|
| 89 |
+
| dt | Matches JHTDB snapshot spacing (see CDL configs) |
|
| 90 |
+
|
| 91 |
+
## Ground truth
|
| 92 |
+
|
| 93 |
+
`ground_truth/direct_stats_noisy.mat` is computed directly from the JHTDB particle position snapshots used to render the images. Contents:
|
| 94 |
+
|
| 95 |
+
| Key | Shape | Description |
|
| 96 |
+
|-----|-------|-------------|
|
| 97 |
+
| `y_plus` | (N,) | wall-normal coordinate, wall units |
|
| 98 |
+
| `U_plus` | (N, 3) | mean velocity [U, V, W] in wall units |
|
| 99 |
+
| `stress_plus` | (N, 3, 3) | Reynolds stress tensor in wall units |
|
| 100 |
+
| `stress_ci_lo`, `stress_ci_hi` | (N, 3, 3) | 95% confidence interval |
|
| 101 |
+
| `umean_ci_lo`, `umean_ci_hi` | (N, 3) | 95% CI for mean velocity |
|
| 102 |
+
| `u_tau` | scalar | friction velocity (mm/s) |
|
| 103 |
+
| `delta_nu` | scalar | viscous length scale (mm) |
|
| 104 |
+
| `Re_tau` | scalar | friction Reynolds number |
|
| 105 |
+
|
| 106 |
+
The Case B ground truth is self-consistent with the 22 000-particle rendering — finite-sample statistics from the subsampled particle set, not the full DNS. Benchmark Case B PIV against Case B ground truth.
|
| 107 |
+
|
| 108 |
+
## How this was generated
|
| 109 |
+
|
| 110 |
+
Synthetic images are rendered from JHTDB turbulent-channel particle trajectories using the **EUROSIG / EUROPIV synthetic image generator**. The configuration files in `scripts/sig_configs/` are the authoritative build instructions:
|
| 111 |
+
|
| 112 |
+
| Configuration | Role |
|
| 113 |
+
|---------------|------|
|
| 114 |
+
| `sigconf_planar_noisy_A.cdl` | Planar frame A, 22k particles, noise pattern A |
|
| 115 |
+
| `sigconf_planar_noisy_B.cdl` | Planar frame B, 22k particles, noise pattern B |
|
| 116 |
+
| `SIGconf_Stereo_cam1_noisy_A.cdl`, `..._B.cdl` | Stereo cam 1, frames A and B |
|
| 117 |
+
| `SIGconf_Stereo_cam2_noisy_A.cdl`, `..._B.cdl` | Stereo cam 2, frames A and B |
|
| 118 |
+
| `sigconf_planar.cdl`, `SIGconf_Stereo_cam{1,2}.cdl` | Case A (clean, 85k particles) — for reference, Case A images not yet in this dataset |
|
| 119 |
+
|
| 120 |
+
To regenerate images bit-for-bit, install EUROSIG and invoke each `.cdl` with its associated particle-position files from JHTDB. See the SIG documentation for build instructions.
|
| 121 |
+
|
| 122 |
+
## Scripts
|
| 123 |
+
|
| 124 |
+
### `benchmark_comparison.py` — single-method benchmark
|
| 125 |
+
|
| 126 |
+
Compares planar or ensemble PIV against the DNS ground truth; produces U+, Reynolds stress, residual, trace invariant, and noise-decomposition plots.
|
| 127 |
+
|
| 128 |
+
```bash
|
| 129 |
+
python scripts/benchmark_comparison.py \
|
| 130 |
+
--mode ensemble \
|
| 131 |
+
--gt-dir ./ground_truth \
|
| 132 |
+
--ensemble-dir <path/to/your/ensemble_result_directory> \
|
| 133 |
+
--num-frames 4000 \
|
| 134 |
+
--output-dir ./out
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
| Flag | Description |
|
| 138 |
+
|------|-------------|
|
| 139 |
+
| `--mode` / `-m` | `instantaneous` or `ensemble` |
|
| 140 |
+
| `--runs` / `-r` | Comma-separated 0-based pass indices (e.g. `2,3`) |
|
| 141 |
+
| `--windows` / `-w` | Labels for those passes (e.g. `32,16`) |
|
| 142 |
+
| `--gt-dir` / `-g` | Directory containing `direct_stats_noisy.mat` (required) |
|
| 143 |
+
| `--base-dir` / `-b` | PIV results base (instantaneous mode) |
|
| 144 |
+
| `--ensemble-dir` / `-e` | Direct path to ensemble result directory |
|
| 145 |
+
| `--num-frames` / `-n` | Frame count subdirectory (default 1000; use 4000 for this dataset) |
|
| 146 |
+
| `--output-dir` / `-o` | Output directory |
|
| 147 |
+
| `--y-plus-offset` / `-y` | Additional y+ offset on top of hardcoded +1 |
|
| 148 |
+
| `--show-fit-lines` | Overlay log-law and viscous sublayer curves |
|
| 149 |
+
|
| 150 |
+
### `stereo_benchmark_comparison.py` — stereo 3C + 6-stress benchmark
|
| 151 |
+
|
| 152 |
+
Uses LaTeX for labels (`text.usetex=True`); requires MiKTeX / TeXLive.
|
| 153 |
+
|
| 154 |
+
```bash
|
| 155 |
+
python scripts/stereo_benchmark_comparison.py \
|
| 156 |
+
--gt-dir ./ground_truth \
|
| 157 |
+
--stereo-base <path/to/your/stereo_results> \
|
| 158 |
+
--num-frames 4000 \
|
| 159 |
+
--output-dir ./out
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
### `cross_method_comparison.py` — multi-method overlay
|
| 163 |
+
|
| 164 |
+
Publication-quality plots comparing one pass from each of instantaneous, ensemble, and stereo against DNS on the same axes. Okabe-Ito colourblind palette.
|
| 165 |
+
|
| 166 |
+
```bash
|
| 167 |
+
python scripts/cross_method_comparison.py \
|
| 168 |
+
--gt-dir ./ground_truth \
|
| 169 |
+
--output-dir ./out \
|
| 170 |
+
--inst-stats <path/to/instantaneous/mean_stats.mat> \
|
| 171 |
+
--ens-dir <path/to/ensemble_dir> \
|
| 172 |
+
--stereo-stats <path/to/stereo/mean_stats.mat>
|
| 173 |
+
```
|
| 174 |
+
|
| 175 |
+
### `paper_figures.py` — combined Case A + Case B figures
|
| 176 |
+
|
| 177 |
+
Reproduces the figures in the PIVtools paper: Case A (open symbols) and Case B (filled symbols) overlaid. Any combination of paths may be supplied — the script plots whichever it receives.
|
| 178 |
+
|
| 179 |
+
```bash
|
| 180 |
+
# Case B only (what this dataset ships today)
|
| 181 |
+
python scripts/paper_figures.py \
|
| 182 |
+
--gt-noisy-dir ./ground_truth \
|
| 183 |
+
--inst-noisy-stats <path/to/noisy/instantaneous/mean_stats.mat> \
|
| 184 |
+
--ens-noisy-dir <path/to/noisy/ensemble_dir> \
|
| 185 |
+
--stereo-noisy-stats <path/to/noisy/stereo/mean_stats.mat> \
|
| 186 |
+
--output-dir ./out
|
| 187 |
+
```
|
| 188 |
+
|
| 189 |
+
### `tcf_direct_stats.py` — recompute ground truth
|
| 190 |
+
|
| 191 |
+
If you regenerate the synthetic images via EUROSIG, this script recomputes `direct_stats.mat` from the underlying JHTDB particle position files (`B*_A.data`, `B*_B.data`).
|
| 192 |
+
|
| 193 |
+
```bash
|
| 194 |
+
python scripts/tcf_direct_stats.py \
|
| 195 |
+
--data-dir <path/to/particle_positions> \
|
| 196 |
+
--output-dir ./ground_truth
|
| 197 |
+
```
|
| 198 |
+
|
| 199 |
+
## Unit conventions
|
| 200 |
+
|
| 201 |
+
| Quantity | PIVtools storage | Benchmark display |
|
| 202 |
+
|----------|-----------------|-------------------|
|
| 203 |
+
| Velocity | m/s | mm/s (× 1000) |
|
| 204 |
+
| Reynolds stress | (m/s)² | (mm/s)² (× 1e6) |
|
| 205 |
+
| Spatial coordinates | mm | wall units y⁺ = y / δ_ν |
|
| 206 |
+
|
| 207 |
+
## Masks
|
| 208 |
+
|
| 209 |
+
`stereo_noisy/mask_Cam{1,2}.mat` hold pixel-space boolean masks (same shape as images) that exclude regions outside the valid field of view. PIVtools loads them automatically when configured with `masking.enabled: true` and `mask_file_pattern: mask_Cam{cam}.mat`.
|
| 210 |
+
|
| 211 |
+
## Citation
|
| 212 |
+
|
| 213 |
+
If you use this dataset, please cite both the PIVtools paper and the underlying DNS source.
|
| 214 |
+
|
| 215 |
+
```bibtex
|
| 216 |
+
@article{taylor_pivtools,
|
| 217 |
+
title={PIVtools: an open-source PIV framework with integrated planar, stereoscopic, and ensemble pipelines},
|
| 218 |
+
author={Taylor, M.T. and Lawson, J.M. and Ganapathisubramani, B.},
|
| 219 |
+
journal={SoftwareX},
|
| 220 |
+
note={submitted}
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
@article{lee2015direct,
|
| 224 |
+
title={Direct numerical simulation of turbulent channel flow up to Re_tau = 5200},
|
| 225 |
+
author={Lee, M. and Moser, R.D.},
|
| 226 |
+
journal={J. Fluid Mech.},
|
| 227 |
+
year={2015}
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
@article{li2008public,
|
| 231 |
+
title={A public turbulence database cluster and applications to study Lagrangian evolution of velocity increments in turbulence},
|
| 232 |
+
author={Li, Y. and others},
|
| 233 |
+
journal={J. Turbulence},
|
| 234 |
+
year={2008}
|
| 235 |
+
}
|
| 236 |
+
```
|
| 237 |
+
|
| 238 |
+
DNS reference data is from the **Johns Hopkins Turbulence Database** (JHTDB).
|
| 239 |
+
|
| 240 |
+
## License
|
| 241 |
+
|
| 242 |
+
CC-BY-4.0 — free to use, modify, and redistribute with attribution to the PIVtools paper.
|
| 243 |
+
|
| 244 |
+
The DNS ground truth is derived from publicly accessible JHTDB data and is redistributed here under the same permissive terms; consult the JHTDB usage policy (http://turbulence.pha.jhu.edu) for their citation requirements.
|
ground_truth/direct_stats_noisy.mat
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fb9fbc35b7a751ff46f7d3d29048b81755f19b75cc49e6bc3adc9391d0f846fb
|
| 3 |
+
size 1856680
|
planar_noisy/calibration_boards/planar_calibration_plate_01.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_02.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_03.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_04.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_05.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_06.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_07.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_08.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_09.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_10.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_11.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_12.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_13.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_14.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_15.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_16.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_17.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_18.tif
ADDED
|
|
planar_noisy/calibration_boards/planar_calibration_plate_19.tif
ADDED
|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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Benchmark comparison of PIV results against JHTDB ground truth.
|
| 4 |
+
|
| 5 |
+
Compares:
|
| 6 |
+
- Mean velocity profile U+ vs y+
|
| 7 |
+
- Reynolds normal stresses uu+, vv+ vs y+
|
| 8 |
+
- Reynolds shear stress uv+ vs y+
|
| 9 |
+
|
| 10 |
+
Excludes first/last 5mm in x-direction (out-of-plane particle loss).
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
import numpy as np
|
| 14 |
+
import scipy.io as sio
|
| 15 |
+
from scipy.interpolate import interp1d
|
| 16 |
+
import matplotlib.pyplot as plt
|
| 17 |
+
import matplotlib as mpl
|
| 18 |
+
from pathlib import Path
|
| 19 |
+
|
| 20 |
+
# Use LaTeX-style fonts everywhere (Computer Modern via mathtext — no LaTeX install needed)
|
| 21 |
+
mpl.rcParams.update({
|
| 22 |
+
'font.family': 'serif',
|
| 23 |
+
'font.serif': ['CMU Serif', 'Computer Modern Roman', 'DejaVu Serif'],
|
| 24 |
+
'mathtext.fontset': 'cm',
|
| 25 |
+
'axes.unicode_minus': False,
|
| 26 |
+
'text.usetex': False,
|
| 27 |
+
})
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def log_smooth(y_plus, values, sigma_decades=0.06):
|
| 31 |
+
"""LOWESS-style smooth in log(y+) space, evaluated at original points.
|
| 32 |
+
|
| 33 |
+
Each output point is a locally-weighted LINEAR regression of neighbours,
|
| 34 |
+
where distance is measured in decades of y+. Using local linear fits
|
| 35 |
+
instead of local averages gives:
|
| 36 |
+
- Better peak tracking (local slope captures gradients)
|
| 37 |
+
- Better edge behaviour (linear extrapolation, not mean bias)
|
| 38 |
+
|
| 39 |
+
Parameters
|
| 40 |
+
----------
|
| 41 |
+
y_plus : array
|
| 42 |
+
y+ coordinates (positive)
|
| 43 |
+
values : array
|
| 44 |
+
Values to smooth
|
| 45 |
+
sigma_decades : float
|
| 46 |
+
Smoothing width in decades of y+ (0.06 ~ +/-15% local y+)
|
| 47 |
+
|
| 48 |
+
Returns
|
| 49 |
+
-------
|
| 50 |
+
y_out, smoothed : arrays
|
| 51 |
+
Sorted y+ and smoothed values (at original data points)
|
| 52 |
+
"""
|
| 53 |
+
valid = (y_plus > 0) & ~np.isnan(values)
|
| 54 |
+
yp = y_plus[valid]
|
| 55 |
+
vals = values[valid]
|
| 56 |
+
if len(yp) < 5:
|
| 57 |
+
return yp, vals
|
| 58 |
+
|
| 59 |
+
# Sort by y+
|
| 60 |
+
order = np.argsort(yp)
|
| 61 |
+
yp = yp[order]
|
| 62 |
+
vals = vals[order]
|
| 63 |
+
log_yp = np.log10(yp)
|
| 64 |
+
|
| 65 |
+
# Local linear regression (LOWESS) at each point
|
| 66 |
+
smoothed = np.empty_like(vals)
|
| 67 |
+
for i in range(len(vals)):
|
| 68 |
+
d = (log_yp - log_yp[i]) / sigma_decades
|
| 69 |
+
w = np.exp(-0.5 * d * d)
|
| 70 |
+
wsum = np.sum(w)
|
| 71 |
+
wmean_x = np.sum(w * log_yp) / wsum
|
| 72 |
+
wmean_y = np.sum(w * vals) / wsum
|
| 73 |
+
dx = log_yp - wmean_x
|
| 74 |
+
denom = np.sum(w * dx * dx)
|
| 75 |
+
if denom > 1e-30:
|
| 76 |
+
slope = np.sum(w * dx * vals) / denom
|
| 77 |
+
smoothed[i] = wmean_y + slope * (log_yp[i] - wmean_x)
|
| 78 |
+
else:
|
| 79 |
+
smoothed[i] = wmean_y
|
| 80 |
+
|
| 81 |
+
return yp, smoothed
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def plot_ci_band(ax, y_plus, ci_lo, ci_hi, sign=1, color='k', alpha=0.3, zorder=1):
|
| 85 |
+
"""Plot a 95% CI shaded band around a reference line.
|
| 86 |
+
|
| 87 |
+
Parameters
|
| 88 |
+
----------
|
| 89 |
+
ax : matplotlib Axes
|
| 90 |
+
y_plus : array
|
| 91 |
+
x-axis values (y+ coordinates)
|
| 92 |
+
ci_lo, ci_hi : array
|
| 93 |
+
Lower/upper CI bounds (same units as the plotted variable)
|
| 94 |
+
sign : int
|
| 95 |
+
1 or -1 (for variables like -uv+ that flip sign)
|
| 96 |
+
color : str
|
| 97 |
+
Fill color
|
| 98 |
+
alpha : float
|
| 99 |
+
Fill transparency
|
| 100 |
+
zorder : int
|
| 101 |
+
Drawing order
|
| 102 |
+
"""
|
| 103 |
+
lo = sign * ci_lo if sign == 1 else sign * ci_hi # sign flip swaps lo/hi
|
| 104 |
+
hi = sign * ci_hi if sign == 1 else sign * ci_lo
|
| 105 |
+
ax.fill_between(y_plus, lo, hi, color=color, alpha=alpha, zorder=zorder,
|
| 106 |
+
linewidth=0)
|
| 107 |
+
# Add thin edge lines so the CI is visible even when narrow
|
| 108 |
+
ax.plot(y_plus, lo, color=color, linewidth=0.5, alpha=0.4, zorder=zorder)
|
| 109 |
+
ax.plot(y_plus, hi, color=color, linewidth=0.5, alpha=0.4, zorder=zorder)
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
def load_wall_units(wall_units_path):
|
| 113 |
+
"""Load wall units from .mat file (scipy v5 or h5py v7.3).
|
| 114 |
+
|
| 115 |
+
Supports three formats:
|
| 116 |
+
- wall_units.mat with 'wall_units' struct
|
| 117 |
+
- diagnostics.mat with 'diagnostics' group (HDF5)
|
| 118 |
+
- direct_stats.mat with top-level u_tau, delta_nu, Re_tau keys
|
| 119 |
+
"""
|
| 120 |
+
try:
|
| 121 |
+
wall = sio.loadmat(wall_units_path, squeeze_me=True, struct_as_record=False)
|
| 122 |
+
|
| 123 |
+
# Format: direct_stats.mat (top-level scalar keys)
|
| 124 |
+
if 'u_tau' in wall and 'delta_nu' in wall and 'Re_tau' in wall:
|
| 125 |
+
u_tau = float(wall['u_tau'])
|
| 126 |
+
delta_nu = float(wall['delta_nu'])
|
| 127 |
+
Re_tau = float(wall['Re_tau'])
|
| 128 |
+
return {
|
| 129 |
+
'u_tau': u_tau,
|
| 130 |
+
'nu': u_tau * delta_nu,
|
| 131 |
+
'delta_nu': delta_nu,
|
| 132 |
+
'h_mm': float(wall['h_mm']) if 'h_mm' in wall else Re_tau * delta_nu,
|
| 133 |
+
'Re_tau': Re_tau,
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
# Format: wall_units.mat (struct)
|
| 137 |
+
wu = wall['wall_units']
|
| 138 |
+
return {
|
| 139 |
+
'u_tau': float(wu.u_tau), # mm/s
|
| 140 |
+
'nu': float(wu.nu), # mm^2/s
|
| 141 |
+
'delta_nu': float(wu.delta_nu), # mm
|
| 142 |
+
'h_mm': float(wu.h_mm), # mm
|
| 143 |
+
'Re_tau': float(wu.Re_tau)
|
| 144 |
+
}
|
| 145 |
+
except NotImplementedError:
|
| 146 |
+
# MATLAB v7.3 (HDF5) format - use h5py
|
| 147 |
+
import h5py
|
| 148 |
+
with h5py.File(str(wall_units_path), 'r') as f:
|
| 149 |
+
if 'wall_units' in f:
|
| 150 |
+
grp = f['wall_units']
|
| 151 |
+
result = {
|
| 152 |
+
'u_tau': float(np.array(grp['u_tau']).flat[0]),
|
| 153 |
+
'delta_nu': float(np.array(grp['delta_nu']).flat[0]),
|
| 154 |
+
'Re_tau': float(np.array(grp['Re_tau']).flat[0]),
|
| 155 |
+
}
|
| 156 |
+
if 'nu' in grp:
|
| 157 |
+
result['nu'] = float(np.array(grp['nu']).flat[0])
|
| 158 |
+
else:
|
| 159 |
+
result['nu'] = result['u_tau'] * result['delta_nu']
|
| 160 |
+
if 'h_mm' in grp:
|
| 161 |
+
result['h_mm'] = float(np.array(grp['h_mm']).flat[0])
|
| 162 |
+
else:
|
| 163 |
+
result['h_mm'] = result['Re_tau'] * result['delta_nu']
|
| 164 |
+
return result
|
| 165 |
+
elif 'diagnostics' in f:
|
| 166 |
+
grp = f['diagnostics']
|
| 167 |
+
result = {
|
| 168 |
+
'u_tau': float(np.array(grp['u_tau']).flat[0]),
|
| 169 |
+
'delta_nu': float(np.array(grp['delta_nu']).flat[0]),
|
| 170 |
+
'Re_tau': float(np.array(grp['Re_tau']).flat[0]),
|
| 171 |
+
}
|
| 172 |
+
if 'nu' in grp:
|
| 173 |
+
result['nu'] = float(np.array(grp['nu']).flat[0])
|
| 174 |
+
else:
|
| 175 |
+
result['nu'] = result['u_tau'] * result['delta_nu']
|
| 176 |
+
if 'h_mm' in grp:
|
| 177 |
+
result['h_mm'] = float(np.array(grp['h_mm']).flat[0])
|
| 178 |
+
else:
|
| 179 |
+
result['h_mm'] = result['Re_tau'] * result['delta_nu']
|
| 180 |
+
return result
|
| 181 |
+
else:
|
| 182 |
+
raise ValueError(f"No 'wall_units' or 'diagnostics' group in {wall_units_path}")
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
def load_ground_truth(profiles_path, wall_units_path=None):
|
| 186 |
+
"""Load ground truth profiles (scipy v5 or h5py v7.3).
|
| 187 |
+
|
| 188 |
+
Supports three formats:
|
| 189 |
+
- profiles.mat with 'profiles.win_1px' struct
|
| 190 |
+
- ensemble_statistics_full.mat with 'ref_profile' + 'ensemble_stats' (HDF5)
|
| 191 |
+
- direct_stats.mat with top-level y_plus, U_plus, stress_plus arrays
|
| 192 |
+
"""
|
| 193 |
+
try:
|
| 194 |
+
profiles = sio.loadmat(profiles_path, squeeze_me=True, struct_as_record=False)
|
| 195 |
+
|
| 196 |
+
# Format: direct_stats.mat (top-level arrays)
|
| 197 |
+
if 'U_plus' in profiles and 'stress_plus' in profiles and 'y_plus' in profiles:
|
| 198 |
+
y_plus_full = profiles['y_plus']
|
| 199 |
+
Re_tau = float(profiles['Re_tau'])
|
| 200 |
+
u_tau = float(profiles['u_tau'])
|
| 201 |
+
delta_nu = float(profiles['delta_nu'])
|
| 202 |
+
u_tau2 = u_tau ** 2
|
| 203 |
+
|
| 204 |
+
# Select lower half of channel (y+ <= Re_tau)
|
| 205 |
+
mask = y_plus_full <= Re_tau
|
| 206 |
+
y_plus = y_plus_full[mask]
|
| 207 |
+
y_mm = y_plus * delta_nu
|
| 208 |
+
|
| 209 |
+
# U_plus: (N, 3) -> columns [U, V, W]
|
| 210 |
+
U_plus = profiles['U_plus'][mask, 0]
|
| 211 |
+
V_plus = profiles['U_plus'][mask, 1]
|
| 212 |
+
|
| 213 |
+
# stress_plus: (N, 3, 3) -> Reynolds stress tensor in plus units
|
| 214 |
+
uu_plus = profiles['stress_plus'][mask, 0, 0]
|
| 215 |
+
vv_plus = profiles['stress_plus'][mask, 1, 1]
|
| 216 |
+
uv_plus = profiles['stress_plus'][mask, 0, 1]
|
| 217 |
+
|
| 218 |
+
result = {
|
| 219 |
+
'y_mm': y_mm,
|
| 220 |
+
'y_plus': y_plus,
|
| 221 |
+
'U': U_plus * u_tau, # mm/s
|
| 222 |
+
'V': V_plus * u_tau, # mm/s
|
| 223 |
+
'uu': uu_plus * u_tau2, # (mm/s)^2
|
| 224 |
+
'vv': vv_plus * u_tau2, # (mm/s)^2
|
| 225 |
+
'uv': uv_plus * u_tau2, # (mm/s)^2
|
| 226 |
+
'U_plus': U_plus,
|
| 227 |
+
'uu_plus': uu_plus,
|
| 228 |
+
'vv_plus': vv_plus,
|
| 229 |
+
'uv_plus': uv_plus,
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
# Load 95% confidence intervals if available
|
| 233 |
+
if 'stress_ci_lo' in profiles and 'stress_ci_hi' in profiles:
|
| 234 |
+
result['uu_plus_ci_lo'] = profiles['stress_ci_lo'][mask, 0, 0]
|
| 235 |
+
result['uu_plus_ci_hi'] = profiles['stress_ci_hi'][mask, 0, 0]
|
| 236 |
+
result['vv_plus_ci_lo'] = profiles['stress_ci_lo'][mask, 1, 1]
|
| 237 |
+
result['vv_plus_ci_hi'] = profiles['stress_ci_hi'][mask, 1, 1]
|
| 238 |
+
result['uv_plus_ci_lo'] = profiles['stress_ci_lo'][mask, 0, 1]
|
| 239 |
+
result['uv_plus_ci_hi'] = profiles['stress_ci_hi'][mask, 0, 1]
|
| 240 |
+
if 'umean_ci_lo' in profiles and 'umean_ci_hi' in profiles:
|
| 241 |
+
result['U_plus_ci_lo'] = profiles['umean_ci_lo'][mask, 0]
|
| 242 |
+
result['U_plus_ci_hi'] = profiles['umean_ci_hi'][mask, 0]
|
| 243 |
+
result['V_plus_ci_lo'] = profiles['umean_ci_lo'][mask, 1]
|
| 244 |
+
result['V_plus_ci_hi'] = profiles['umean_ci_hi'][mask, 1]
|
| 245 |
+
|
| 246 |
+
return result
|
| 247 |
+
|
| 248 |
+
# Format: profiles.mat (struct)
|
| 249 |
+
win1px = profiles['profiles'].win_1px
|
| 250 |
+
return {
|
| 251 |
+
'y_mm': win1px.y_mm,
|
| 252 |
+
'y_plus': win1px.y_plus,
|
| 253 |
+
'U': win1px.U, # mm/s
|
| 254 |
+
'V': win1px.V, # mm/s
|
| 255 |
+
'uu': win1px.uu, # (mm/s)^2
|
| 256 |
+
'vv': win1px.vv, # (mm/s)^2
|
| 257 |
+
'uv': win1px.uv, # (mm/s)^2
|
| 258 |
+
'U_plus': win1px.U_plus,
|
| 259 |
+
'uu_plus': win1px.uu_plus,
|
| 260 |
+
'vv_plus': win1px.vv_plus,
|
| 261 |
+
'uv_plus': win1px.uv_plus,
|
| 262 |
+
}
|
| 263 |
+
except NotImplementedError:
|
| 264 |
+
# MATLAB v7.3 (HDF5) format
|
| 265 |
+
import h5py
|
| 266 |
+
|
| 267 |
+
# Load wall units for normalisation
|
| 268 |
+
if wall_units_path is not None:
|
| 269 |
+
wu = load_wall_units(wall_units_path)
|
| 270 |
+
else:
|
| 271 |
+
wu_path = Path(profiles_path).parent / 'diagnostics.mat'
|
| 272 |
+
if wu_path.exists():
|
| 273 |
+
wu = load_wall_units(wu_path)
|
| 274 |
+
else:
|
| 275 |
+
raise ValueError("Need wall_units_path to normalise HDF5 ground truth")
|
| 276 |
+
|
| 277 |
+
u_tau = wu['u_tau']
|
| 278 |
+
u_tau2 = u_tau ** 2
|
| 279 |
+
delta_nu = wu['delta_nu']
|
| 280 |
+
|
| 281 |
+
with h5py.File(str(profiles_path), 'r') as f:
|
| 282 |
+
ref = f['ref_profile']
|
| 283 |
+
|
| 284 |
+
# Check if ref_profile has stress data directly
|
| 285 |
+
if 'uu' in ref:
|
| 286 |
+
y_mm = np.array(ref['y_mm']).flatten()
|
| 287 |
+
U = np.array(ref['U']).flatten()
|
| 288 |
+
V = np.array(ref['V']).flatten()
|
| 289 |
+
uu = np.array(ref['uu']).flatten()
|
| 290 |
+
vv = np.array(ref['vv']).flatten()
|
| 291 |
+
uv = np.array(ref['uv']).flatten()
|
| 292 |
+
y_plus = y_mm / delta_nu
|
| 293 |
+
return {
|
| 294 |
+
'y_mm': y_mm, 'y_plus': y_plus,
|
| 295 |
+
'U': U, 'V': V, 'uu': uu, 'vv': vv, 'uv': uv,
|
| 296 |
+
'U_plus': U / u_tau, 'uu_plus': uu / u_tau2,
|
| 297 |
+
'vv_plus': vv / u_tau2, 'uv_plus': uv / u_tau2,
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
# Use ensemble_stats profiles (pre-averaged, consistent y_plus)
|
| 301 |
+
if 'ensemble_stats' not in f:
|
| 302 |
+
raise ValueError("No stress data in ref_profile and no ensemble_stats")
|
| 303 |
+
|
| 304 |
+
es = f['ensemble_stats']
|
| 305 |
+
# Use finest window (index 0) as reference
|
| 306 |
+
win_idx = 0
|
| 307 |
+
|
| 308 |
+
def _deref(field, idx=win_idx):
|
| 309 |
+
refs = np.array(es[field]).flatten()
|
| 310 |
+
return np.array(f[refs[idx]]).flatten()
|
| 311 |
+
|
| 312 |
+
# Ensemble stats y_plus (255 points for 16x16 window)
|
| 313 |
+
es_y_plus = _deref('y_plus')
|
| 314 |
+
es_y_mm = es_y_plus * delta_nu
|
| 315 |
+
|
| 316 |
+
# Stresses are already in plus units
|
| 317 |
+
uu_plus = _deref('uu_plus')
|
| 318 |
+
vv_plus = _deref('vv_plus')
|
| 319 |
+
uv_plus = _deref('uv_plus')
|
| 320 |
+
|
| 321 |
+
# Velocity: interpolate DNS onto ensemble y_plus grid
|
| 322 |
+
dns_y_mm = np.array(ref['y_mm']).flatten()
|
| 323 |
+
dns_U = np.array(ref['U']).flatten()
|
| 324 |
+
dns_V = np.array(ref['V']).flatten()
|
| 325 |
+
dns_y_plus = dns_y_mm / delta_nu
|
| 326 |
+
|
| 327 |
+
U_interp = interp1d(dns_y_plus, dns_U, kind='linear',
|
| 328 |
+
bounds_error=False, fill_value=np.nan)(es_y_plus)
|
| 329 |
+
V_interp = interp1d(dns_y_plus, dns_V, kind='linear',
|
| 330 |
+
bounds_error=False, fill_value=np.nan)(es_y_plus)
|
| 331 |
+
|
| 332 |
+
return {
|
| 333 |
+
'y_mm': es_y_mm,
|
| 334 |
+
'y_plus': es_y_plus,
|
| 335 |
+
'U': U_interp,
|
| 336 |
+
'V': V_interp,
|
| 337 |
+
'uu': uu_plus * u_tau2,
|
| 338 |
+
'vv': vv_plus * u_tau2,
|
| 339 |
+
'uv': uv_plus * u_tau2,
|
| 340 |
+
'U_plus': U_interp / u_tau,
|
| 341 |
+
'uu_plus': uu_plus,
|
| 342 |
+
'vv_plus': vv_plus,
|
| 343 |
+
'uv_plus': uv_plus,
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
|
| 347 |
+
def load_piv_statistics(stats_path, run_idx=3):
|
| 348 |
+
"""
|
| 349 |
+
Load PIV statistics from mean_stats.mat (instantaneous).
|
| 350 |
+
|
| 351 |
+
Parameters
|
| 352 |
+
----------
|
| 353 |
+
stats_path : Path
|
| 354 |
+
Path to mean_stats.mat
|
| 355 |
+
run_idx : int
|
| 356 |
+
Run index (0-based). run_idx=3 corresponds to run 4 (16x16 window)
|
| 357 |
+
"""
|
| 358 |
+
stats = sio.loadmat(stats_path, squeeze_me=True, struct_as_record=False)
|
| 359 |
+
piv = stats['piv_result'][run_idx]
|
| 360 |
+
coords = stats['coordinates'][run_idx]
|
| 361 |
+
|
| 362 |
+
return {
|
| 363 |
+
'ux': piv.ux, # m/s (need to convert to mm/s)
|
| 364 |
+
'uy': piv.uy, # m/s
|
| 365 |
+
'uu': piv.uu, # (m/s)^2
|
| 366 |
+
'vv': piv.vv, # (m/s)^2
|
| 367 |
+
'uv': piv.uv, # (m/s)^2
|
| 368 |
+
'x': coords.x, # mm
|
| 369 |
+
'y': coords.y, # mm
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
def load_ensemble_statistics(ensemble_path, coords_path, run_idx=3):
|
| 374 |
+
"""
|
| 375 |
+
Load PIV statistics from ensemble_result.mat.
|
| 376 |
+
|
| 377 |
+
Parameters
|
| 378 |
+
----------
|
| 379 |
+
ensemble_path : Path
|
| 380 |
+
Path to ensemble_result.mat
|
| 381 |
+
coords_path : Path
|
| 382 |
+
Path to coordinates.mat
|
| 383 |
+
run_idx : int
|
| 384 |
+
Run index (0-based). run_idx=3 corresponds to run 4
|
| 385 |
+
"""
|
| 386 |
+
ens = sio.loadmat(ensemble_path, squeeze_me=True, struct_as_record=False)
|
| 387 |
+
coords_data = sio.loadmat(coords_path, squeeze_me=True, struct_as_record=False)
|
| 388 |
+
|
| 389 |
+
piv = ens['ensemble_result'][run_idx]
|
| 390 |
+
coords = coords_data['coordinates'][run_idx]
|
| 391 |
+
|
| 392 |
+
return {
|
| 393 |
+
'ux': piv.ux, # m/s
|
| 394 |
+
'uy': piv.uy, # m/s
|
| 395 |
+
'uu': piv.UU_stress, # (m/s)^2
|
| 396 |
+
'vv': piv.VV_stress, # (m/s)^2
|
| 397 |
+
'uv': piv.UV_stress, # (m/s)^2
|
| 398 |
+
'x': coords.x, # mm
|
| 399 |
+
'y': coords.y, # mm
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
|
| 403 |
+
def compute_piv_profiles(piv_data, x_exclude_vectors=4):
|
| 404 |
+
"""
|
| 405 |
+
Compute x-averaged PIV profiles, excluding edges.
|
| 406 |
+
|
| 407 |
+
Parameters
|
| 408 |
+
----------
|
| 409 |
+
piv_data : dict
|
| 410 |
+
PIV statistics dictionary (velocities in m/s, stresses in (m/s)^2)
|
| 411 |
+
x_exclude_vectors : int
|
| 412 |
+
Number of vectors to exclude from each side in x-direction
|
| 413 |
+
|
| 414 |
+
Returns
|
| 415 |
+
-------
|
| 416 |
+
dict with y_mm, U, uu, vv, uv profiles (in mm/s and (mm/s)^2)
|
| 417 |
+
"""
|
| 418 |
+
x = piv_data['x']
|
| 419 |
+
y = piv_data['y']
|
| 420 |
+
|
| 421 |
+
# Get unique y values (assuming regular grid)
|
| 422 |
+
y_unique = y[:, 0]
|
| 423 |
+
x_unique = x[0, :]
|
| 424 |
+
nx = len(x_unique)
|
| 425 |
+
|
| 426 |
+
# Create mask excluding first/last x_exclude_vectors
|
| 427 |
+
x_mask = np.zeros(nx, dtype=bool)
|
| 428 |
+
x_mask[x_exclude_vectors:nx-x_exclude_vectors] = True
|
| 429 |
+
|
| 430 |
+
print(f" X range: {x_unique.min():.2f} to {x_unique.max():.2f} mm")
|
| 431 |
+
print(f" Excluding {x_exclude_vectors} vectors from each x-edge")
|
| 432 |
+
print(f" X points: {x_mask.sum()} / {nx}")
|
| 433 |
+
|
| 434 |
+
# Convert velocities from m/s to mm/s
|
| 435 |
+
ux_mm = piv_data['ux'] * 1000 # m/s -> mm/s
|
| 436 |
+
uy_mm = piv_data['uy'] * 1000
|
| 437 |
+
uu_mm2 = piv_data['uu'] * 1e6 # (m/s)^2 -> (mm/s)^2
|
| 438 |
+
vv_mm2 = piv_data['vv'] * 1e6
|
| 439 |
+
uv_mm2 = piv_data['uv'] * 1e6
|
| 440 |
+
|
| 441 |
+
# Average over valid x range
|
| 442 |
+
U_profile = np.nanmean(ux_mm[:, x_mask], axis=1)
|
| 443 |
+
V_profile = np.nanmean(uy_mm[:, x_mask], axis=1)
|
| 444 |
+
uu_profile = np.nanmean(uu_mm2[:, x_mask], axis=1)
|
| 445 |
+
vv_profile = np.nanmean(vv_mm2[:, x_mask], axis=1)
|
| 446 |
+
uv_profile = np.nanmean(uv_mm2[:, x_mask], axis=1)
|
| 447 |
+
|
| 448 |
+
return {
|
| 449 |
+
'y_mm': y_unique,
|
| 450 |
+
'U': U_profile,
|
| 451 |
+
'V': V_profile,
|
| 452 |
+
'uu': uu_profile,
|
| 453 |
+
'vv': vv_profile,
|
| 454 |
+
'uv': uv_profile,
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
|
| 458 |
+
def convert_to_wall_units(profiles, wall_units, y_offset_mm=0.0):
|
| 459 |
+
"""
|
| 460 |
+
Convert profiles to wall units (plus units).
|
| 461 |
+
|
| 462 |
+
Parameters
|
| 463 |
+
----------
|
| 464 |
+
profiles : dict
|
| 465 |
+
PIV profiles with y_mm, U, etc.
|
| 466 |
+
wall_units : dict
|
| 467 |
+
Wall unit parameters
|
| 468 |
+
y_offset_mm : float
|
| 469 |
+
Offset to add to y_mm before converting to y+ (for coordinate alignment)
|
| 470 |
+
"""
|
| 471 |
+
u_tau = wall_units['u_tau']
|
| 472 |
+
delta_nu = wall_units['delta_nu']
|
| 473 |
+
u_tau2 = u_tau ** 2
|
| 474 |
+
|
| 475 |
+
# Apply y offset (to align PIV coordinate system with ground truth)
|
| 476 |
+
y_mm_aligned = profiles['y_mm'] + y_offset_mm
|
| 477 |
+
|
| 478 |
+
return {
|
| 479 |
+
'y_mm': y_mm_aligned,
|
| 480 |
+
'y_plus': y_mm_aligned / delta_nu,
|
| 481 |
+
'U_plus': profiles['U'] / u_tau,
|
| 482 |
+
'V_plus': profiles['V'] / u_tau,
|
| 483 |
+
'uu_plus': profiles['uu'] / u_tau2,
|
| 484 |
+
'vv_plus': profiles['vv'] / u_tau2,
|
| 485 |
+
'uv_plus': profiles['uv'] / u_tau2,
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
|
| 489 |
+
def compute_errors(piv_plus, gt_plus, y_plus_range=(10, 500)):
|
| 490 |
+
"""
|
| 491 |
+
Compute error metrics between PIV and ground truth.
|
| 492 |
+
|
| 493 |
+
Parameters
|
| 494 |
+
----------
|
| 495 |
+
piv_plus : dict
|
| 496 |
+
PIV profiles in wall units
|
| 497 |
+
gt_plus : dict
|
| 498 |
+
Ground truth profiles in wall units
|
| 499 |
+
y_plus_range : tuple
|
| 500 |
+
y+ range for comparison (exclude near-wall and centerline regions)
|
| 501 |
+
"""
|
| 502 |
+
# Interpolate ground truth to PIV y+ locations
|
| 503 |
+
y_piv = piv_plus['y_plus']
|
| 504 |
+
y_gt = gt_plus['y_plus']
|
| 505 |
+
|
| 506 |
+
# Only compare in specified y+ range
|
| 507 |
+
mask_piv = (y_piv >= y_plus_range[0]) & (y_piv <= y_plus_range[1])
|
| 508 |
+
y_compare = y_piv[mask_piv]
|
| 509 |
+
|
| 510 |
+
if len(y_compare) == 0:
|
| 511 |
+
print(f" Warning: No PIV points in y+ range {y_plus_range}")
|
| 512 |
+
return {}
|
| 513 |
+
|
| 514 |
+
errors = {}
|
| 515 |
+
for var in ['U_plus', 'V_plus', 'uu_plus', 'vv_plus', 'uv_plus']:
|
| 516 |
+
piv_vals = piv_plus[var][mask_piv]
|
| 517 |
+
|
| 518 |
+
# Interpolate ground truth
|
| 519 |
+
gt_interp = interp1d(y_gt, gt_plus[var], kind='linear',
|
| 520 |
+
bounds_error=False, fill_value=np.nan)
|
| 521 |
+
gt_vals = gt_interp(y_compare)
|
| 522 |
+
|
| 523 |
+
# Remove NaN values
|
| 524 |
+
valid = ~np.isnan(piv_vals) & ~np.isnan(gt_vals)
|
| 525 |
+
if valid.sum() == 0:
|
| 526 |
+
continue
|
| 527 |
+
|
| 528 |
+
piv_valid = piv_vals[valid]
|
| 529 |
+
gt_valid = gt_vals[valid]
|
| 530 |
+
|
| 531 |
+
# Compute metrics
|
| 532 |
+
diff = piv_valid - gt_valid
|
| 533 |
+
rms_error = np.sqrt(np.mean(diff**2))
|
| 534 |
+
mean_abs_error = np.mean(np.abs(diff))
|
| 535 |
+
|
| 536 |
+
# Relative RMS error (as percentage of GT range)
|
| 537 |
+
gt_range = np.ptp(gt_valid) # peak-to-peak
|
| 538 |
+
rms_rel = (rms_error / gt_range * 100) if gt_range > 0 else np.nan
|
| 539 |
+
|
| 540 |
+
# Correlation coefficient
|
| 541 |
+
corr = np.corrcoef(piv_valid, gt_valid)[0, 1]
|
| 542 |
+
|
| 543 |
+
# R-squared
|
| 544 |
+
ss_res = np.sum(diff**2)
|
| 545 |
+
ss_tot = np.sum((gt_valid - gt_valid.mean())**2)
|
| 546 |
+
r2 = 1 - (ss_res / ss_tot) if ss_tot > 0 else np.nan
|
| 547 |
+
|
| 548 |
+
errors[var] = {
|
| 549 |
+
'rms': rms_error,
|
| 550 |
+
'rms_rel': rms_rel,
|
| 551 |
+
'mae': mean_abs_error,
|
| 552 |
+
'corr': corr,
|
| 553 |
+
'r2': r2,
|
| 554 |
+
'n_points': valid.sum(),
|
| 555 |
+
}
|
| 556 |
+
|
| 557 |
+
return errors
|
| 558 |
+
|
| 559 |
+
|
| 560 |
+
def plot_comparison(piv_plus, gt_plus, wall_units, errors, output_dir, window_label='16x16', show_fit_lines=False):
|
| 561 |
+
"""Generate comparison plots."""
|
| 562 |
+
output_dir = Path(output_dir)
|
| 563 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 564 |
+
|
| 565 |
+
Re_tau = wall_units['Re_tau']
|
| 566 |
+
|
| 567 |
+
# Check for CI data
|
| 568 |
+
has_ci = 'uu_plus_ci_lo' in gt_plus
|
| 569 |
+
|
| 570 |
+
# Figure 1: Mean velocity profile (semi-log)
|
| 571 |
+
fig, ax = plt.subplots(figsize=(10, 7))
|
| 572 |
+
|
| 573 |
+
# Ground truth with CI band
|
| 574 |
+
if has_ci and 'U_plus_ci_lo' in gt_plus:
|
| 575 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['U_plus_ci_lo'],
|
| 576 |
+
gt_plus['U_plus_ci_hi'], color='k', alpha=0.15, zorder=1)
|
| 577 |
+
ax.semilogx(gt_plus['y_plus'], gt_plus['U_plus'], 'k-',
|
| 578 |
+
linewidth=2, label='DNS (1px)', zorder=3)
|
| 579 |
+
|
| 580 |
+
# PIV
|
| 581 |
+
ax.semilogx(piv_plus['y_plus'], piv_plus['U_plus'], 'ro',
|
| 582 |
+
markersize=4, alpha=0.7, label=f'PIV ({window_label})', zorder=2)
|
| 583 |
+
|
| 584 |
+
if show_fit_lines:
|
| 585 |
+
y_log = np.logspace(1, np.log10(Re_tau), 100)
|
| 586 |
+
kappa, B = 0.41, 5.2
|
| 587 |
+
ax.semilogx(y_log, (1/kappa)*np.log(y_log)+B, 'b--', linewidth=1, alpha=0.7,
|
| 588 |
+
label=r'Log law: $U^+ = \frac{1}{\kappa}\ln(y^+) + B$')
|
| 589 |
+
y_visc = np.linspace(0.1, 10, 50)
|
| 590 |
+
ax.semilogx(y_visc, y_visc, 'g--', linewidth=1, alpha=0.7,
|
| 591 |
+
label=r'Viscous sublayer: $U^+ = y^+$')
|
| 592 |
+
|
| 593 |
+
ax.set_xlabel(r'$y^+$', fontsize=14)
|
| 594 |
+
ax.set_ylabel(r'$U^+$', fontsize=14)
|
| 595 |
+
ax.set_title(f'Mean Velocity Profile (Re$_\\tau$ = {Re_tau:.0f})', fontsize=16)
|
| 596 |
+
ax.legend(fontsize=11)
|
| 597 |
+
ax.set_xlim(1, Re_tau)
|
| 598 |
+
ax.set_ylim(0, 25)
|
| 599 |
+
ax.grid(True, alpha=0.3)
|
| 600 |
+
|
| 601 |
+
if 'U_plus' in errors:
|
| 602 |
+
ax.text(0.02, 0.98, f"R² = {errors['U_plus']['r2']:.4f}\n"
|
| 603 |
+
f"RMS = {errors['U_plus']['rms_rel']:.1f}%",
|
| 604 |
+
transform=ax.transAxes, fontsize=11, verticalalignment='top',
|
| 605 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 606 |
+
|
| 607 |
+
fig.tight_layout()
|
| 608 |
+
fig.savefig(output_dir / 'U_plus_profile.png', dpi=150)
|
| 609 |
+
plt.close(fig)
|
| 610 |
+
|
| 611 |
+
# Figure 2: Reynolds stresses (semi-log)
|
| 612 |
+
fig, axes = plt.subplots(1, 3, figsize=(15, 5))
|
| 613 |
+
|
| 614 |
+
# uu+
|
| 615 |
+
ax = axes[0]
|
| 616 |
+
if has_ci:
|
| 617 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['uu_plus_ci_lo'],
|
| 618 |
+
gt_plus['uu_plus_ci_hi'], color='k', zorder=1)
|
| 619 |
+
ax.semilogx(gt_plus['y_plus'], gt_plus['uu_plus'], 'k-', linewidth=2, label='DNS')
|
| 620 |
+
ax.semilogx(piv_plus['y_plus'], piv_plus['uu_plus'], 'ro', markersize=4,
|
| 621 |
+
alpha=0.7, label='PIV')
|
| 622 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 623 |
+
ax.set_ylabel(r"$\overline{u'u'}^+$", fontsize=12)
|
| 624 |
+
ax.set_title('Streamwise Normal Stress', fontsize=14)
|
| 625 |
+
ax.legend()
|
| 626 |
+
ax.set_xlim(1, Re_tau)
|
| 627 |
+
ax.grid(True, alpha=0.3)
|
| 628 |
+
if 'uu_plus' in errors:
|
| 629 |
+
ax.text(0.98, 0.98, f"R² = {errors['uu_plus']['r2']:.4f}",
|
| 630 |
+
transform=ax.transAxes, fontsize=10, ha='right', va='top',
|
| 631 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 632 |
+
|
| 633 |
+
# vv+
|
| 634 |
+
ax = axes[1]
|
| 635 |
+
if has_ci:
|
| 636 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['vv_plus_ci_lo'],
|
| 637 |
+
gt_plus['vv_plus_ci_hi'], color='k', zorder=1)
|
| 638 |
+
ax.semilogx(gt_plus['y_plus'], gt_plus['vv_plus'], 'k-', linewidth=2, label='DNS')
|
| 639 |
+
ax.semilogx(piv_plus['y_plus'], piv_plus['vv_plus'], 'ro', markersize=4,
|
| 640 |
+
alpha=0.7, label='PIV')
|
| 641 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 642 |
+
ax.set_ylabel(r"$\overline{v'v'}^+$", fontsize=12)
|
| 643 |
+
ax.set_title('Wall-Normal Normal Stress', fontsize=14)
|
| 644 |
+
ax.legend()
|
| 645 |
+
ax.set_xlim(1, Re_tau)
|
| 646 |
+
ax.grid(True, alpha=0.3)
|
| 647 |
+
if 'vv_plus' in errors:
|
| 648 |
+
ax.text(0.98, 0.98, f"R² = {errors['vv_plus']['r2']:.4f}",
|
| 649 |
+
transform=ax.transAxes, fontsize=10, ha='right', va='top',
|
| 650 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 651 |
+
|
| 652 |
+
# -uv+
|
| 653 |
+
ax = axes[2]
|
| 654 |
+
if has_ci:
|
| 655 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['uv_plus_ci_lo'],
|
| 656 |
+
gt_plus['uv_plus_ci_hi'], sign=-1, color='k', zorder=1)
|
| 657 |
+
ax.semilogx(gt_plus['y_plus'], -gt_plus['uv_plus'], 'k-', linewidth=2, label='DNS')
|
| 658 |
+
ax.semilogx(piv_plus['y_plus'], -piv_plus['uv_plus'], 'ro', markersize=4,
|
| 659 |
+
alpha=0.7, label='PIV')
|
| 660 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 661 |
+
ax.set_ylabel(r"$-\overline{u'v'}^+$", fontsize=12)
|
| 662 |
+
ax.set_title('Reynolds Shear Stress', fontsize=14)
|
| 663 |
+
ax.legend()
|
| 664 |
+
ax.set_xlim(1, Re_tau)
|
| 665 |
+
ax.grid(True, alpha=0.3)
|
| 666 |
+
if 'uv_plus' in errors:
|
| 667 |
+
ax.text(0.98, 0.98, f"R² = {errors['uv_plus']['r2']:.4f}",
|
| 668 |
+
transform=ax.transAxes, fontsize=10, ha='right', va='top',
|
| 669 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 670 |
+
|
| 671 |
+
fig.tight_layout()
|
| 672 |
+
fig.savefig(output_dir / 'reynolds_stresses.png', dpi=150)
|
| 673 |
+
plt.close(fig)
|
| 674 |
+
|
| 675 |
+
# Figure 3: V+ profile (wall-normal mean velocity)
|
| 676 |
+
fig, ax = plt.subplots(figsize=(10, 7))
|
| 677 |
+
|
| 678 |
+
if has_ci and 'V_plus_ci_lo' in gt_plus:
|
| 679 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['V_plus_ci_lo'],
|
| 680 |
+
gt_plus['V_plus_ci_hi'], color='k', zorder=1)
|
| 681 |
+
ax.plot(gt_plus['y_plus'], gt_plus['V_plus'], 'k-', linewidth=2, label='DNS')
|
| 682 |
+
ax.plot(piv_plus['y_plus'], piv_plus['V_plus'], 'ro', markersize=4,
|
| 683 |
+
alpha=0.7, label='PIV')
|
| 684 |
+
ax.axhline(y=0, color='gray', linestyle='--', linewidth=0.5, alpha=0.7)
|
| 685 |
+
|
| 686 |
+
ax.set_xlabel(r'$y^+$', fontsize=14)
|
| 687 |
+
ax.set_ylabel(r'$V^+$', fontsize=14)
|
| 688 |
+
ax.set_title(f'Mean Wall-Normal Velocity Profile (Re$_\\tau$ = {Re_tau:.0f})', fontsize=16)
|
| 689 |
+
ax.legend(fontsize=11)
|
| 690 |
+
ax.set_xscale('log')
|
| 691 |
+
ax.set_xlim(1, Re_tau)
|
| 692 |
+
ax.grid(True, alpha=0.3)
|
| 693 |
+
|
| 694 |
+
if 'V_plus' in errors:
|
| 695 |
+
ax.text(0.02, 0.98, f"R² = {errors['V_plus']['r2']:.4f}\n"
|
| 696 |
+
f"Corr = {errors['V_plus']['corr']:.4f}",
|
| 697 |
+
transform=ax.transAxes, fontsize=11, verticalalignment='top',
|
| 698 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 699 |
+
|
| 700 |
+
fig.tight_layout()
|
| 701 |
+
fig.savefig(output_dir / 'V_plus_profile.png', dpi=150)
|
| 702 |
+
plt.close(fig)
|
| 703 |
+
|
| 704 |
+
# Figure 4: All profiles on linear scale
|
| 705 |
+
fig, ax = plt.subplots(figsize=(10, 7))
|
| 706 |
+
|
| 707 |
+
ax.plot(gt_plus['y_plus'], gt_plus['U_plus'], 'k-', linewidth=2, label='DNS U+')
|
| 708 |
+
ax.plot(piv_plus['y_plus'], piv_plus['U_plus'], 'ko', markersize=3,
|
| 709 |
+
alpha=0.5, label='PIV U+')
|
| 710 |
+
|
| 711 |
+
ax.set_xlabel(r'$y^+$', fontsize=14)
|
| 712 |
+
ax.set_ylabel(r'$U^+$', fontsize=14)
|
| 713 |
+
ax.set_title('Mean Velocity Profile', fontsize=16)
|
| 714 |
+
ax.legend(fontsize=11)
|
| 715 |
+
ax.set_xscale('log')
|
| 716 |
+
ax.set_xlim(1, Re_tau)
|
| 717 |
+
ax.grid(True, alpha=0.3)
|
| 718 |
+
|
| 719 |
+
fig.tight_layout()
|
| 720 |
+
fig.savefig(output_dir / 'U_plus_linear.png', dpi=150)
|
| 721 |
+
plt.close(fig)
|
| 722 |
+
|
| 723 |
+
# Figure 5: Smoothed line plots (log-space moving average)
|
| 724 |
+
# ---- U+ smoothed ----
|
| 725 |
+
fig, ax = plt.subplots(figsize=(10, 7))
|
| 726 |
+
|
| 727 |
+
if has_ci and 'U_plus_ci_lo' in gt_plus:
|
| 728 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['U_plus_ci_lo'],
|
| 729 |
+
gt_plus['U_plus_ci_hi'], color='k', zorder=1)
|
| 730 |
+
ax.semilogx(gt_plus['y_plus'], gt_plus['U_plus'], 'k-',
|
| 731 |
+
linewidth=2, label='DNS (1px)', zorder=3)
|
| 732 |
+
|
| 733 |
+
ax.semilogx(piv_plus['y_plus'], piv_plus['U_plus'], 'ro',
|
| 734 |
+
markersize=4, alpha=0.7, label=f'PIV ({window_label})', zorder=2)
|
| 735 |
+
|
| 736 |
+
if show_fit_lines:
|
| 737 |
+
y_log = np.logspace(1, np.log10(Re_tau), 100)
|
| 738 |
+
kappa, B = 0.41, 5.2
|
| 739 |
+
ax.semilogx(y_log, (1/kappa)*np.log(y_log)+B, 'b--', linewidth=1, alpha=0.7,
|
| 740 |
+
label=r'Log law')
|
| 741 |
+
y_visc = np.linspace(0.1, 10, 50)
|
| 742 |
+
ax.semilogx(y_visc, y_visc, 'g--', linewidth=1, alpha=0.7, label=r'$U^+=y^+$')
|
| 743 |
+
|
| 744 |
+
ax.set_xlabel(r'$y^+$', fontsize=14)
|
| 745 |
+
ax.set_ylabel(r'$U^+$', fontsize=14)
|
| 746 |
+
ax.set_title(f'Mean Velocity Profile - Smoothed ({window_label})', fontsize=16)
|
| 747 |
+
ax.legend(fontsize=11)
|
| 748 |
+
ax.set_xlim(1, Re_tau)
|
| 749 |
+
ax.set_ylim(0, 25)
|
| 750 |
+
ax.grid(True, alpha=0.3)
|
| 751 |
+
if 'U_plus' in errors:
|
| 752 |
+
ax.text(0.02, 0.98, f"R² = {errors['U_plus']['r2']:.4f}\n"
|
| 753 |
+
f"RMS = {errors['U_plus']['rms_rel']:.1f}%",
|
| 754 |
+
transform=ax.transAxes, fontsize=11, verticalalignment='top',
|
| 755 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 756 |
+
fig.tight_layout()
|
| 757 |
+
fig.savefig(output_dir / 'U_plus_profile_smooth.png', dpi=150)
|
| 758 |
+
plt.close(fig)
|
| 759 |
+
|
| 760 |
+
# ---- Reynolds stresses smoothed ----
|
| 761 |
+
fig, axes = plt.subplots(1, 3, figsize=(15, 5))
|
| 762 |
+
|
| 763 |
+
stress_configs = [
|
| 764 |
+
('uu_plus', r"$\overline{u'u'}^+$", 'Streamwise Normal Stress', 1),
|
| 765 |
+
('vv_plus', r"$\overline{v'v'}^+$", 'Wall-Normal Normal Stress', 1),
|
| 766 |
+
('uv_plus', r"$-\overline{u'v'}^+$", 'Reynolds Shear Stress', -1),
|
| 767 |
+
]
|
| 768 |
+
for ax, (var, ylabel, title, sign) in zip(axes, stress_configs):
|
| 769 |
+
gt_vals = sign * gt_plus[var]
|
| 770 |
+
piv_vals = sign * piv_plus[var]
|
| 771 |
+
|
| 772 |
+
ci_lo_key = f'{var}_ci_lo'
|
| 773 |
+
ci_hi_key = f'{var}_ci_hi'
|
| 774 |
+
if has_ci and ci_lo_key in gt_plus:
|
| 775 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus[ci_lo_key],
|
| 776 |
+
gt_plus[ci_hi_key], sign=sign, color='k', zorder=1)
|
| 777 |
+
ax.semilogx(gt_plus['y_plus'], gt_vals, 'k-', linewidth=2, label='DNS')
|
| 778 |
+
ax.semilogx(piv_plus['y_plus'], piv_vals, 'ro', markersize=4, alpha=0.7, label='PIV')
|
| 779 |
+
|
| 780 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 781 |
+
ax.set_ylabel(ylabel, fontsize=12)
|
| 782 |
+
ax.set_title(title, fontsize=14)
|
| 783 |
+
ax.legend()
|
| 784 |
+
ax.set_xlim(1, Re_tau)
|
| 785 |
+
ax.grid(True, alpha=0.3)
|
| 786 |
+
if var in errors:
|
| 787 |
+
ax.text(0.98, 0.98, f"R² = {errors[var]['r2']:.4f}",
|
| 788 |
+
transform=ax.transAxes, fontsize=10, ha='right', va='top',
|
| 789 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 790 |
+
|
| 791 |
+
fig.tight_layout()
|
| 792 |
+
fig.savefig(output_dir / 'reynolds_stresses_smooth.png', dpi=150)
|
| 793 |
+
plt.close(fig)
|
| 794 |
+
|
| 795 |
+
# Figure 6: Trace invariant (u'u' + v'v') - rotation diagnostic
|
| 796 |
+
fig, axes = plt.subplots(1, 3, figsize=(16, 5))
|
| 797 |
+
|
| 798 |
+
# Compute trace
|
| 799 |
+
gt_trace = gt_plus['uu_plus'] + gt_plus['vv_plus']
|
| 800 |
+
piv_trace = piv_plus['uu_plus'] + piv_plus['vv_plus']
|
| 801 |
+
|
| 802 |
+
# Left: Individual components
|
| 803 |
+
ax = axes[0]
|
| 804 |
+
ax.semilogx(gt_plus['y_plus'], gt_plus['uu_plus'], 'k-', linewidth=2, label="DNS u'u'+")
|
| 805 |
+
ax.semilogx(gt_plus['y_plus'], gt_plus['vv_plus'], 'k--', linewidth=2, label="DNS v'v'+")
|
| 806 |
+
ax.semilogx(piv_plus['y_plus'], piv_plus['uu_plus'], 'ro', markersize=3, alpha=0.7, label="PIV u'u'+")
|
| 807 |
+
ax.semilogx(piv_plus['y_plus'], piv_plus['vv_plus'], 'bs', markersize=3, alpha=0.7, label="PIV v'v'+")
|
| 808 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 809 |
+
ax.set_ylabel(r"Stress$^+$", fontsize=12)
|
| 810 |
+
ax.set_title('Individual Normal Stresses', fontsize=14)
|
| 811 |
+
ax.legend(fontsize=9)
|
| 812 |
+
ax.set_xlim(1, Re_tau)
|
| 813 |
+
ax.grid(True, alpha=0.3)
|
| 814 |
+
|
| 815 |
+
# Middle: Trace comparison
|
| 816 |
+
ax = axes[1]
|
| 817 |
+
ax.semilogx(gt_plus['y_plus'], gt_trace, 'k-', linewidth=2, label='DNS')
|
| 818 |
+
ax.semilogx(piv_plus['y_plus'], piv_trace, 'ro', markersize=4, alpha=0.7, label='PIV')
|
| 819 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 820 |
+
ax.set_ylabel(r"$\overline{u'u'}^+ + \overline{v'v'}^+$", fontsize=12)
|
| 821 |
+
ax.set_title("Trace Invariant (u'u' + v'v')", fontsize=14)
|
| 822 |
+
ax.legend(fontsize=11)
|
| 823 |
+
ax.set_xlim(1, Re_tau)
|
| 824 |
+
ax.grid(True, alpha=0.3)
|
| 825 |
+
|
| 826 |
+
# Right: Ratio of components (rotation indicator)
|
| 827 |
+
ax = axes[2]
|
| 828 |
+
gt_ratio = gt_plus['uu_plus'] / (gt_plus['vv_plus'] + 1e-10) # avoid div by zero
|
| 829 |
+
piv_ratio = piv_plus['uu_plus'] / (piv_plus['vv_plus'] + 1e-10)
|
| 830 |
+
ax.semilogx(gt_plus['y_plus'], gt_ratio, 'k-', linewidth=2, label='DNS')
|
| 831 |
+
ax.semilogx(piv_plus['y_plus'], piv_ratio, 'ro', markersize=4, alpha=0.7, label='PIV')
|
| 832 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 833 |
+
ax.set_ylabel(r"$\overline{u'u'}^+ / \overline{v'v'}^+$", fontsize=12)
|
| 834 |
+
ax.set_title("Stress Ratio (rotation indicator)", fontsize=14)
|
| 835 |
+
ax.legend(fontsize=11)
|
| 836 |
+
ax.set_xlim(1, Re_tau)
|
| 837 |
+
ax.set_ylim(0, 10)
|
| 838 |
+
ax.grid(True, alpha=0.3)
|
| 839 |
+
|
| 840 |
+
fig.suptitle("Rotation Diagnostic: Trace is invariant under rotation", fontsize=14, y=1.02)
|
| 841 |
+
fig.tight_layout()
|
| 842 |
+
fig.savefig(output_dir / 'trace_invariant.png', dpi=150)
|
| 843 |
+
plt.close(fig)
|
| 844 |
+
|
| 845 |
+
# Figure 7: Residuals (PIV - Ref) vs y+ — velocities and stresses
|
| 846 |
+
fig, axes = plt.subplots(2, 3, figsize=(15, 10))
|
| 847 |
+
|
| 848 |
+
# Interpolate ground truth onto PIV y+ grid
|
| 849 |
+
gt_interp_fn = {}
|
| 850 |
+
for var in ['U_plus', 'V_plus', 'uu_plus', 'vv_plus', 'uv_plus']:
|
| 851 |
+
gt_interp_fn[var] = interp1d(gt_plus['y_plus'], gt_plus[var], kind='linear',
|
| 852 |
+
bounds_error=False, fill_value=np.nan)
|
| 853 |
+
|
| 854 |
+
# Top row: velocity residuals
|
| 855 |
+
vel_configs = [
|
| 856 |
+
('U_plus', r"$U^+_{\mathrm{PIV}} - U^+_{\mathrm{Ref}}$",
|
| 857 |
+
'Mean Streamwise Velocity Residual', 1),
|
| 858 |
+
('V_plus', r"$V^+_{\mathrm{PIV}} - V^+_{\mathrm{Ref}}$",
|
| 859 |
+
'Mean Wall-Normal Velocity Residual', 1),
|
| 860 |
+
]
|
| 861 |
+
for ax, (var, ylabel, title, sign) in zip(axes[0, :2], vel_configs):
|
| 862 |
+
gt_at_piv = gt_interp_fn[var](piv_plus['y_plus'])
|
| 863 |
+
residual = sign * piv_plus[var] - sign * gt_at_piv
|
| 864 |
+
|
| 865 |
+
ax.semilogx(piv_plus['y_plus'], residual, 'ro', markersize=3, alpha=0.5)
|
| 866 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], residual)
|
| 867 |
+
ax.semilogx(yp_s, r_s, 'r-', linewidth=2, label=f'PIV ({window_label})')
|
| 868 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 869 |
+
|
| 870 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 871 |
+
ax.set_ylabel(ylabel, fontsize=12)
|
| 872 |
+
ax.set_title(title, fontsize=14)
|
| 873 |
+
ax.legend()
|
| 874 |
+
ax.set_xlim(1, Re_tau)
|
| 875 |
+
ax.grid(True, alpha=0.3)
|
| 876 |
+
|
| 877 |
+
axes[0, 2].set_visible(False) # Empty top-right panel
|
| 878 |
+
|
| 879 |
+
# Bottom row: stress residuals
|
| 880 |
+
stress_configs = [
|
| 881 |
+
('uu_plus', r"$\overline{u'u'}^+_{\mathrm{PIV}} - \overline{u'u'}^+_{\mathrm{Ref}}$",
|
| 882 |
+
'Streamwise Normal Stress Residual', 1),
|
| 883 |
+
('vv_plus', r"$\overline{v'v'}^+_{\mathrm{PIV}} - \overline{v'v'}^+_{\mathrm{Ref}}$",
|
| 884 |
+
'Wall-Normal Normal Stress Residual', 1),
|
| 885 |
+
('uv_plus', r"$-\overline{u'v'}^+_{\mathrm{PIV}} - (-\overline{u'v'}^+_{\mathrm{Ref}})$",
|
| 886 |
+
'Shear Stress Residual', -1),
|
| 887 |
+
]
|
| 888 |
+
for ax, (var, ylabel, title, sign) in zip(axes[1, :], stress_configs):
|
| 889 |
+
gt_at_piv = gt_interp_fn[var](piv_plus['y_plus'])
|
| 890 |
+
residual = sign * piv_plus[var] - sign * gt_at_piv
|
| 891 |
+
|
| 892 |
+
ax.semilogx(piv_plus['y_plus'], residual, 'ro', markersize=3, alpha=0.5)
|
| 893 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], residual)
|
| 894 |
+
ax.semilogx(yp_s, r_s, 'r-', linewidth=2, label=f'PIV ({window_label})')
|
| 895 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 896 |
+
|
| 897 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 898 |
+
ax.set_ylabel(ylabel, fontsize=12)
|
| 899 |
+
ax.set_title(title, fontsize=14)
|
| 900 |
+
ax.legend()
|
| 901 |
+
ax.set_xlim(1, Re_tau)
|
| 902 |
+
ax.grid(True, alpha=0.3)
|
| 903 |
+
|
| 904 |
+
fig.tight_layout()
|
| 905 |
+
fig.savefig(output_dir / 'residuals.png', dpi=150)
|
| 906 |
+
plt.close(fig)
|
| 907 |
+
|
| 908 |
+
# Figure 8: Noise floor vs gradient correction decomposition
|
| 909 |
+
fig, axes = plt.subplots(1, 3, figsize=(16, 5))
|
| 910 |
+
|
| 911 |
+
# Compute residuals
|
| 912 |
+
uu_residual = piv_plus['uu_plus'] - gt_interp_fn['uu_plus'](piv_plus['y_plus'])
|
| 913 |
+
vv_residual = piv_plus['vv_plus'] - gt_interp_fn['vv_plus'](piv_plus['y_plus'])
|
| 914 |
+
gradient_only = uu_residual - vv_residual # u'u' residual minus noise floor
|
| 915 |
+
|
| 916 |
+
# Left: Noise floor (v'v' residual)
|
| 917 |
+
ax = axes[0]
|
| 918 |
+
ax.semilogx(piv_plus['y_plus'], vv_residual, 'bo', markersize=2, alpha=0.3)
|
| 919 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], vv_residual)
|
| 920 |
+
ax.semilogx(yp_s, r_s, 'b-', linewidth=2.5, label=r"$v'v'$ residual (noise floor)")
|
| 921 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 922 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 923 |
+
ax.set_ylabel(r"$\overline{v'v'}^+_{\mathrm{PIV}} - \overline{v'v'}^+_{\mathrm{Ref}}$", fontsize=12)
|
| 924 |
+
ax.set_title('Noise Floor (isotropic)', fontsize=14)
|
| 925 |
+
ax.legend(fontsize=10)
|
| 926 |
+
ax.set_xlim(1, Re_tau)
|
| 927 |
+
ax.grid(True, alpha=0.3)
|
| 928 |
+
|
| 929 |
+
# Middle: Gradient-only residual
|
| 930 |
+
ax = axes[1]
|
| 931 |
+
ax.semilogx(piv_plus['y_plus'], gradient_only, 'ro', markersize=2, alpha=0.3)
|
| 932 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], gradient_only)
|
| 933 |
+
ax.semilogx(yp_s, r_s, 'r-', linewidth=2.5,
|
| 934 |
+
label=r"$(\overline{u'u'} - \overline{v'v'})_{\mathrm{PIV}} - (\overline{u'u'} - \overline{v'v'})_{\mathrm{Ref}}$")
|
| 935 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 936 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 937 |
+
ax.set_ylabel(r"Gradient-only residual$^+$", fontsize=12)
|
| 938 |
+
ax.set_title(r"Gradient Correction Residual ($u'u' - v'v'$ removes noise)", fontsize=14)
|
| 939 |
+
ax.legend(fontsize=9)
|
| 940 |
+
ax.set_xlim(1, Re_tau)
|
| 941 |
+
ax.grid(True, alpha=0.3)
|
| 942 |
+
|
| 943 |
+
# Right: All three overlaid
|
| 944 |
+
ax = axes[2]
|
| 945 |
+
ax.semilogx(piv_plus['y_plus'], uu_residual, 'ro', markersize=2, alpha=0.15)
|
| 946 |
+
yp_s_uu, r_s_uu = log_smooth(piv_plus['y_plus'], uu_residual)
|
| 947 |
+
ax.semilogx(yp_s_uu, r_s_uu, 'r-', linewidth=2, label=r"$u'u'$ residual (total)")
|
| 948 |
+
|
| 949 |
+
ax.semilogx(piv_plus['y_plus'], vv_residual, 'bo', markersize=2, alpha=0.15)
|
| 950 |
+
yp_s_vv, r_s_vv = log_smooth(piv_plus['y_plus'], vv_residual)
|
| 951 |
+
ax.semilogx(yp_s_vv, r_s_vv, 'b-', linewidth=2, label=r"$v'v'$ residual (noise floor)")
|
| 952 |
+
|
| 953 |
+
yp_s_g, r_s_g = log_smooth(piv_plus['y_plus'], gradient_only)
|
| 954 |
+
ax.semilogx(yp_s_g, r_s_g, 'g--', linewidth=2, label=r"$u'u' - v'v'$ residual (gradient only)")
|
| 955 |
+
|
| 956 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 957 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 958 |
+
ax.set_ylabel(r"Residual$^+$", fontsize=12)
|
| 959 |
+
ax.set_title('Decomposition: Total = Noise + Gradient', fontsize=14)
|
| 960 |
+
ax.legend(fontsize=9)
|
| 961 |
+
ax.set_xlim(1, Re_tau)
|
| 962 |
+
ax.grid(True, alpha=0.3)
|
| 963 |
+
|
| 964 |
+
fig.suptitle(f'Noise Floor vs Gradient Correction ({window_label})', fontsize=14, y=1.02)
|
| 965 |
+
fig.tight_layout()
|
| 966 |
+
fig.savefig(output_dir / 'noise_gradient_decomposition.png', dpi=150)
|
| 967 |
+
plt.close(fig)
|
| 968 |
+
|
| 969 |
+
print(f"\nPlots saved to: {output_dir}")
|
| 970 |
+
|
| 971 |
+
|
| 972 |
+
def plot_combined_stresses(piv_plus, gt_plus, wall_units, errors, output_dir, window_label='16x16'):
|
| 973 |
+
"""Plot uu+, vv+, -uv+ all on one axis."""
|
| 974 |
+
output_dir = Path(output_dir)
|
| 975 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 976 |
+
|
| 977 |
+
Re_tau = wall_units['Re_tau']
|
| 978 |
+
|
| 979 |
+
has_ci = 'uu_plus_ci_lo' in gt_plus
|
| 980 |
+
|
| 981 |
+
fig, ax = plt.subplots(figsize=(12, 8))
|
| 982 |
+
|
| 983 |
+
# CI bands (before reference lines so they render behind)
|
| 984 |
+
if has_ci:
|
| 985 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['uu_plus_ci_lo'],
|
| 986 |
+
gt_plus['uu_plus_ci_hi'], color='k', alpha=0.12, zorder=1)
|
| 987 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['vv_plus_ci_lo'],
|
| 988 |
+
gt_plus['vv_plus_ci_hi'], color='k', alpha=0.12, zorder=1)
|
| 989 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['uv_plus_ci_lo'],
|
| 990 |
+
gt_plus['uv_plus_ci_hi'], sign=-1, color='k', alpha=0.12, zorder=1)
|
| 991 |
+
|
| 992 |
+
# Reference (solid lines)
|
| 993 |
+
ax.plot(gt_plus['y_plus'], gt_plus['uu_plus'], 'k-', linewidth=2,
|
| 994 |
+
label=r"Ref $\overline{u'u'}^+$")
|
| 995 |
+
ax.plot(gt_plus['y_plus'], gt_plus['vv_plus'], 'k--', linewidth=2,
|
| 996 |
+
label=r"Ref $\overline{v'v'}^+$")
|
| 997 |
+
ax.plot(gt_plus['y_plus'], -gt_plus['uv_plus'], 'k:', linewidth=2,
|
| 998 |
+
label=r"Ref $-\overline{u'v'}^+$")
|
| 999 |
+
|
| 1000 |
+
# PIV markers
|
| 1001 |
+
marker_configs = [
|
| 1002 |
+
('uu_plus', 1, 'r', 'o', r"PIV $\overline{u'u'}^+$"),
|
| 1003 |
+
('vv_plus', 1, 'g', 's', r"PIV $\overline{v'v'}^+$"),
|
| 1004 |
+
('uv_plus', -1, 'm', 'D', r"PIV $-\overline{u'v'}^+$"),
|
| 1005 |
+
]
|
| 1006 |
+
for var, sign, col, mkr, label in marker_configs:
|
| 1007 |
+
piv_vals = sign * piv_plus[var]
|
| 1008 |
+
ax.plot(piv_plus['y_plus'], piv_vals, color=col, marker=mkr,
|
| 1009 |
+
markersize=4, alpha=0.7, linestyle='none', label=label, zorder=5)
|
| 1010 |
+
|
| 1011 |
+
ax.set_xlabel(r'$y^+$', fontsize=14)
|
| 1012 |
+
ax.set_ylabel(r'Stress$^+$', fontsize=14)
|
| 1013 |
+
ax.set_title(f'Reynolds Stresses ({window_label}) - PIV vs Reference '
|
| 1014 |
+
f'(Re$_\\tau$ = {Re_tau:.0f})', fontsize=16)
|
| 1015 |
+
ax.legend(fontsize=10, ncol=2, loc='upper right')
|
| 1016 |
+
ax.set_xscale('log')
|
| 1017 |
+
ax.set_xlim(1, Re_tau)
|
| 1018 |
+
ax.grid(True, alpha=0.3)
|
| 1019 |
+
|
| 1020 |
+
fig.tight_layout()
|
| 1021 |
+
fig.savefig(output_dir / 'combined_stresses.png', dpi=150)
|
| 1022 |
+
plt.close(fig)
|
| 1023 |
+
print(f" Combined stresses plot saved to: {output_dir / 'combined_stresses.png'}")
|
| 1024 |
+
|
| 1025 |
+
|
| 1026 |
+
def main(mode='instantaneous', gt_dir=None, base_dir=None, ensemble_dir=None, num_frames=1000, output_dir_override=None, show_fit_lines=False):
|
| 1027 |
+
"""Main benchmark comparison function.
|
| 1028 |
+
|
| 1029 |
+
Parameters
|
| 1030 |
+
----------
|
| 1031 |
+
mode : str
|
| 1032 |
+
'instantaneous' or 'ensemble'
|
| 1033 |
+
gt_dir : Path
|
| 1034 |
+
Ground truth directory path (required)
|
| 1035 |
+
base_dir : Path, optional
|
| 1036 |
+
Base directory containing PIV results
|
| 1037 |
+
ensemble_dir : Path, optional
|
| 1038 |
+
Direct path to ensemble directory containing ensemble_result.mat and coordinates.mat.
|
| 1039 |
+
If provided, overrides base_dir for ensemble mode.
|
| 1040 |
+
num_frames : int
|
| 1041 |
+
Number of frames subdirectory (e.g. 1000 or 4000). Used in path construction.
|
| 1042 |
+
output_dir_override : Path, optional
|
| 1043 |
+
Custom output directory. If None, uses default naming.
|
| 1044 |
+
"""
|
| 1045 |
+
if gt_dir is None:
|
| 1046 |
+
raise ValueError("gt_dir is required. Please provide the ground truth directory path.")
|
| 1047 |
+
|
| 1048 |
+
# Paths
|
| 1049 |
+
script_dir = Path(__file__).parent
|
| 1050 |
+
gt_dir = Path(gt_dir)
|
| 1051 |
+
|
| 1052 |
+
if mode == 'ensemble':
|
| 1053 |
+
if ensemble_dir is not None:
|
| 1054 |
+
ensemble_dir = Path(ensemble_dir)
|
| 1055 |
+
ensemble_path = ensemble_dir / 'ensemble_result.mat'
|
| 1056 |
+
coords_path = ensemble_dir / 'coordinates.mat'
|
| 1057 |
+
elif base_dir is not None:
|
| 1058 |
+
base_dir = Path(base_dir)
|
| 1059 |
+
ensemble_path = base_dir / f'calibrated_piv/{num_frames}/Cam1/ensemble/ensemble_result.mat'
|
| 1060 |
+
coords_path = base_dir / f'calibrated_piv/{num_frames}/Cam1/ensemble/coordinates.mat'
|
| 1061 |
+
else:
|
| 1062 |
+
raise ValueError("Either ensemble_dir or base_dir must be provided for ensemble mode.")
|
| 1063 |
+
output_dir = output_dir_override or (script_dir / 'benchmark_results_ensemble')
|
| 1064 |
+
else:
|
| 1065 |
+
if base_dir is None:
|
| 1066 |
+
raise ValueError("base_dir is required for instantaneous mode.")
|
| 1067 |
+
base_dir = Path(base_dir)
|
| 1068 |
+
stats_path = base_dir / f'statistics/{num_frames}/Cam1/instantaneous/mean_stats/mean_stats.mat'
|
| 1069 |
+
output_dir = output_dir_override or (script_dir / 'benchmark_results')
|
| 1070 |
+
|
| 1071 |
+
print("=" * 70)
|
| 1072 |
+
print(f"PIV BENCHMARK COMPARISON ({mode.upper()})")
|
| 1073 |
+
print("=" * 70)
|
| 1074 |
+
|
| 1075 |
+
# Load data - auto-detect file names
|
| 1076 |
+
print("\n[1] Loading wall units...")
|
| 1077 |
+
wall_units_file = gt_dir / 'wall_units.mat'
|
| 1078 |
+
if not wall_units_file.exists():
|
| 1079 |
+
wall_units_file = gt_dir / 'diagnostics.mat'
|
| 1080 |
+
if not wall_units_file.exists():
|
| 1081 |
+
wall_units_file = gt_dir / 'direct_stats.mat'
|
| 1082 |
+
wall_units = load_wall_units(wall_units_file)
|
| 1083 |
+
print(f" u_tau = {wall_units['u_tau']:.4f} mm/s")
|
| 1084 |
+
print(f" nu = {wall_units['nu']:.4f} mm²/s")
|
| 1085 |
+
print(f" delta_nu = {wall_units['delta_nu']:.4f} mm")
|
| 1086 |
+
print(f" Re_tau = {wall_units['Re_tau']:.0f}")
|
| 1087 |
+
|
| 1088 |
+
print("\n[2] Loading ground truth...")
|
| 1089 |
+
profiles_file = gt_dir / 'profiles.mat'
|
| 1090 |
+
if not profiles_file.exists():
|
| 1091 |
+
profiles_file = gt_dir / 'ensemble_statistics_full.mat'
|
| 1092 |
+
if not profiles_file.exists():
|
| 1093 |
+
profiles_file = gt_dir / 'direct_stats.mat'
|
| 1094 |
+
gt = load_ground_truth(profiles_file, wall_units_path=wall_units_file)
|
| 1095 |
+
print(f" y+ range: {gt['y_plus'].min():.1f} to {gt['y_plus'].max():.1f}")
|
| 1096 |
+
print(f" U range: {gt['U'].min():.2f} to {gt['U'].max():.2f} mm/s")
|
| 1097 |
+
|
| 1098 |
+
print(f"\n[3] Loading PIV statistics ({mode}, run 4)...")
|
| 1099 |
+
if mode == 'ensemble':
|
| 1100 |
+
piv = load_ensemble_statistics(ensemble_path, coords_path, run_idx=3)
|
| 1101 |
+
else:
|
| 1102 |
+
piv = load_piv_statistics(stats_path, run_idx=3)
|
| 1103 |
+
print(f" Grid size: {piv['ux'].shape}")
|
| 1104 |
+
print(f" ux range: {np.nanmin(piv['ux'])*1000:.2f} to {np.nanmax(piv['ux'])*1000:.2f} mm/s")
|
| 1105 |
+
|
| 1106 |
+
print("\n[4] Computing x-averaged PIV profiles...")
|
| 1107 |
+
piv_profiles = compute_piv_profiles(piv, x_exclude_vectors=4)
|
| 1108 |
+
print(f" y range: {piv_profiles['y_mm'].min():.2f} to {piv_profiles['y_mm'].max():.2f} mm")
|
| 1109 |
+
print(f" U range: {np.nanmin(piv_profiles['U']):.2f} to {np.nanmax(piv_profiles['U']):.2f} mm/s")
|
| 1110 |
+
|
| 1111 |
+
print("\n[5] Converting to wall units...")
|
| 1112 |
+
# Calculate y-offset to align PIV coordinate system with ground truth
|
| 1113 |
+
# Ground truth has y=0 at the wall, PIV may have an offset
|
| 1114 |
+
y_offset_mm = -piv_profiles['y_mm'].min() # Shift so y_min = 0
|
| 1115 |
+
print(f" Applying y-offset: {y_offset_mm:.2f} mm (aligning y_min to wall)")
|
| 1116 |
+
|
| 1117 |
+
piv_plus = convert_to_wall_units(piv_profiles, wall_units, y_offset_mm=y_offset_mm)
|
| 1118 |
+
piv_plus['y_plus'] = piv_plus['y_plus'] + 1.0 # shift y+ by +1
|
| 1119 |
+
print(f" Aligned y range: {piv_plus['y_mm'].min():.2f} to {piv_plus['y_mm'].max():.2f} mm")
|
| 1120 |
+
print(f" y+ range: {piv_plus['y_plus'].min():.1f} to {piv_plus['y_plus'].max():.1f} (y+ +1 applied)")
|
| 1121 |
+
print(f" U+ range: {np.nanmin(piv_plus['U_plus']):.2f} to {np.nanmax(piv_plus['U_plus']):.2f}")
|
| 1122 |
+
|
| 1123 |
+
# Ground truth - convert V to wall units and include pre-computed values
|
| 1124 |
+
gt_plus = {
|
| 1125 |
+
'y_plus': gt['y_plus'],
|
| 1126 |
+
'U_plus': gt['U_plus'],
|
| 1127 |
+
'V_plus': gt['V'] / wall_units['u_tau'], # Convert V to wall units
|
| 1128 |
+
'uu_plus': gt['uu_plus'],
|
| 1129 |
+
'vv_plus': gt['vv_plus'],
|
| 1130 |
+
'uv_plus': gt['uv_plus'],
|
| 1131 |
+
}
|
| 1132 |
+
# Thread CI bounds through if available
|
| 1133 |
+
for ci_key in ['U_plus_ci_lo', 'U_plus_ci_hi', 'V_plus_ci_lo', 'V_plus_ci_hi',
|
| 1134 |
+
'uu_plus_ci_lo', 'uu_plus_ci_hi', 'vv_plus_ci_lo', 'vv_plus_ci_hi',
|
| 1135 |
+
'uv_plus_ci_lo', 'uv_plus_ci_hi']:
|
| 1136 |
+
if ci_key in gt:
|
| 1137 |
+
gt_plus[ci_key] = gt[ci_key]
|
| 1138 |
+
|
| 1139 |
+
# Verify V sign convention matches (should be correct after save_results.py fix)
|
| 1140 |
+
# Sample at mid-channel to check sign
|
| 1141 |
+
y_mid_idx = len(piv_plus['y_plus']) // 4 # ~25% from wall
|
| 1142 |
+
piv_v_sample = piv_plus['V_plus'][y_mid_idx]
|
| 1143 |
+
gt_v_idx = np.argmin(np.abs(gt_plus['y_plus'] - piv_plus['y_plus'][y_mid_idx]))
|
| 1144 |
+
gt_v_sample = gt['V'][gt_v_idx] / wall_units['u_tau']
|
| 1145 |
+
|
| 1146 |
+
print(f"\n Sign check at y+ ≈ {piv_plus['y_plus'][y_mid_idx]:.0f}:")
|
| 1147 |
+
print(f" PIV V+ = {piv_v_sample:+.4f}")
|
| 1148 |
+
print(f" DNS V+ = {gt_v_sample:+.4f}")
|
| 1149 |
+
|
| 1150 |
+
v_sign_match = np.sign(piv_v_sample) == np.sign(gt_v_sample) or abs(gt_v_sample) < 0.01
|
| 1151 |
+
if v_sign_match:
|
| 1152 |
+
print(" => V sign MATCHES ✓ (no flip needed)")
|
| 1153 |
+
else:
|
| 1154 |
+
print(" => V sign MISMATCH ✗ (PIV pipeline may still have sign issue)")
|
| 1155 |
+
|
| 1156 |
+
# No manual flipping - the save_results.py fix should handle this
|
| 1157 |
+
# If signs still don't match, it indicates the fix didn't work correctly
|
| 1158 |
+
|
| 1159 |
+
print("\n[6] Computing error metrics (y+ = 10-500)...")
|
| 1160 |
+
errors = compute_errors(piv_plus, gt_plus, y_plus_range=(10, 500))
|
| 1161 |
+
|
| 1162 |
+
print("\n" + "=" * 70)
|
| 1163 |
+
print("BENCHMARK RESULTS")
|
| 1164 |
+
print("=" * 70)
|
| 1165 |
+
|
| 1166 |
+
for var, err in errors.items():
|
| 1167 |
+
var_name = {
|
| 1168 |
+
'U_plus': 'Mean Streamwise Velocity (U+)',
|
| 1169 |
+
'V_plus': 'Mean Wall-normal Velocity (V+)',
|
| 1170 |
+
'uu_plus': 'Streamwise Stress (uu+)',
|
| 1171 |
+
'vv_plus': 'Wall-normal Stress (vv+)',
|
| 1172 |
+
'uv_plus': 'Shear Stress (uv+)',
|
| 1173 |
+
}.get(var, var)
|
| 1174 |
+
|
| 1175 |
+
print(f"\n{var_name}:")
|
| 1176 |
+
print(f" RMS Error: {err['rms']:.4f} ({err['rms_rel']:.1f}% of range)")
|
| 1177 |
+
print(f" MAE: {err['mae']:.4f}")
|
| 1178 |
+
print(f" R²: {err['r2']:.4f}")
|
| 1179 |
+
print(f" Correlation: {err['corr']:.4f}")
|
| 1180 |
+
print(f" Points compared: {err['n_points']}")
|
| 1181 |
+
|
| 1182 |
+
print("\n[7] Generating plots...")
|
| 1183 |
+
plot_comparison(piv_plus, gt_plus, wall_units, errors, output_dir,
|
| 1184 |
+
show_fit_lines=show_fit_lines)
|
| 1185 |
+
plot_combined_stresses(piv_plus, gt_plus, wall_units, errors, output_dir)
|
| 1186 |
+
|
| 1187 |
+
print("\n" + "=" * 70)
|
| 1188 |
+
print("BENCHMARK COMPLETE")
|
| 1189 |
+
print("=" * 70)
|
| 1190 |
+
|
| 1191 |
+
|
| 1192 |
+
def plot_combined_comparison(all_results, gt_plus, wall_units, output_dir, show_fit_lines=False):
|
| 1193 |
+
"""
|
| 1194 |
+
Generate combined comparison plots with all window sizes on one figure.
|
| 1195 |
+
|
| 1196 |
+
Parameters
|
| 1197 |
+
----------
|
| 1198 |
+
all_results : list of dict
|
| 1199 |
+
List of dicts with keys: 'piv_plus', 'errors', 'window_label', 'window_size'
|
| 1200 |
+
gt_plus : dict
|
| 1201 |
+
Ground truth profiles in wall units
|
| 1202 |
+
wall_units : dict
|
| 1203 |
+
Wall unit parameters
|
| 1204 |
+
output_dir : Path
|
| 1205 |
+
Output directory for plots
|
| 1206 |
+
"""
|
| 1207 |
+
output_dir = Path(output_dir)
|
| 1208 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 1209 |
+
|
| 1210 |
+
Re_tau = wall_units['Re_tau']
|
| 1211 |
+
|
| 1212 |
+
# Color/marker cycle for different window sizes
|
| 1213 |
+
colors = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#a65628']
|
| 1214 |
+
markers = ['o', 's', '^', 'D', 'v', 'p']
|
| 1215 |
+
|
| 1216 |
+
# Check for CI data
|
| 1217 |
+
has_ci = 'uu_plus_ci_lo' in gt_plus
|
| 1218 |
+
|
| 1219 |
+
# ==========================================================================
|
| 1220 |
+
# Figure 1: Mean velocity profile (semi-log) - ALL WINDOWS
|
| 1221 |
+
# ==========================================================================
|
| 1222 |
+
fig, ax = plt.subplots(figsize=(12, 8))
|
| 1223 |
+
|
| 1224 |
+
# Ground truth with CI band
|
| 1225 |
+
if has_ci and 'U_plus_ci_lo' in gt_plus:
|
| 1226 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['U_plus_ci_lo'],
|
| 1227 |
+
gt_plus['U_plus_ci_hi'], color='k', alpha=0.15, zorder=1)
|
| 1228 |
+
ax.semilogx(gt_plus['y_plus'], gt_plus['U_plus'], 'k-',
|
| 1229 |
+
linewidth=2.5, label='DNS (1px)', zorder=10)
|
| 1230 |
+
|
| 1231 |
+
# PIV results for each window
|
| 1232 |
+
for i, res in enumerate(all_results):
|
| 1233 |
+
piv_plus = res['piv_plus']
|
| 1234 |
+
label = res['window_label']
|
| 1235 |
+
ax.semilogx(piv_plus['y_plus'], piv_plus['U_plus'],
|
| 1236 |
+
color=colors[i % len(colors)], marker=markers[i % len(markers)],
|
| 1237 |
+
markersize=4, alpha=0.7, linestyle='none',
|
| 1238 |
+
label=f'PIV ({label})', zorder=5-i*0.1)
|
| 1239 |
+
|
| 1240 |
+
if show_fit_lines:
|
| 1241 |
+
y_log = np.logspace(1, np.log10(Re_tau), 100)
|
| 1242 |
+
kappa, B = 0.41, 5.2
|
| 1243 |
+
ax.semilogx(y_log, (1/kappa)*np.log(y_log)+B, 'b--', linewidth=1.5, alpha=0.5,
|
| 1244 |
+
label=r'Log law: $U^+ = \frac{1}{\kappa}\ln(y^+) + B$')
|
| 1245 |
+
y_visc = np.linspace(0.1, 10, 50)
|
| 1246 |
+
ax.semilogx(y_visc, y_visc, 'g--', linewidth=1.5, alpha=0.5,
|
| 1247 |
+
label=r'Viscous sublayer: $U^+ = y^+$')
|
| 1248 |
+
|
| 1249 |
+
ax.set_xlabel(r'$y^+$', fontsize=14)
|
| 1250 |
+
ax.set_ylabel(r'$U^+$', fontsize=14)
|
| 1251 |
+
ax.set_title(f'Mean Velocity Profile - All Window Sizes (Re$_\\tau$ = {Re_tau:.0f})', fontsize=16)
|
| 1252 |
+
ax.legend(fontsize=10, loc='upper left')
|
| 1253 |
+
ax.set_xlim(1, Re_tau)
|
| 1254 |
+
ax.set_ylim(0, 25)
|
| 1255 |
+
ax.grid(True, alpha=0.3)
|
| 1256 |
+
|
| 1257 |
+
fig.tight_layout()
|
| 1258 |
+
fig.savefig(output_dir / 'U_plus_profile_combined.png', dpi=150)
|
| 1259 |
+
plt.close(fig)
|
| 1260 |
+
|
| 1261 |
+
# ==========================================================================
|
| 1262 |
+
# Figure 2: Reynolds stresses - ALL WINDOWS
|
| 1263 |
+
# ==========================================================================
|
| 1264 |
+
fig, axes = plt.subplots(1, 3, figsize=(18, 6))
|
| 1265 |
+
|
| 1266 |
+
# uu+
|
| 1267 |
+
ax = axes[0]
|
| 1268 |
+
if has_ci:
|
| 1269 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['uu_plus_ci_lo'],
|
| 1270 |
+
gt_plus['uu_plus_ci_hi'], color='k', zorder=1)
|
| 1271 |
+
ax.plot(gt_plus['y_plus'], gt_plus['uu_plus'], 'k-', linewidth=2.5, label='DNS', zorder=10)
|
| 1272 |
+
for i, res in enumerate(all_results):
|
| 1273 |
+
piv_plus = res['piv_plus']
|
| 1274 |
+
label = res['window_label']
|
| 1275 |
+
ax.plot(piv_plus['y_plus'], piv_plus['uu_plus'],
|
| 1276 |
+
color=colors[i % len(colors)], marker=markers[i % len(markers)],
|
| 1277 |
+
markersize=3, alpha=0.7, linestyle='none', label=f'PIV ({label})')
|
| 1278 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 1279 |
+
ax.set_ylabel(r"$\overline{u'u'}^+$", fontsize=12)
|
| 1280 |
+
ax.set_title('Streamwise Normal Stress', fontsize=14)
|
| 1281 |
+
ax.legend(fontsize=9)
|
| 1282 |
+
ax.set_xscale('log')
|
| 1283 |
+
ax.set_xlim(1, Re_tau)
|
| 1284 |
+
ax.grid(True, alpha=0.3)
|
| 1285 |
+
|
| 1286 |
+
# vv+
|
| 1287 |
+
ax = axes[1]
|
| 1288 |
+
if has_ci:
|
| 1289 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['vv_plus_ci_lo'],
|
| 1290 |
+
gt_plus['vv_plus_ci_hi'], color='k', zorder=1)
|
| 1291 |
+
ax.plot(gt_plus['y_plus'], gt_plus['vv_plus'], 'k-', linewidth=2.5, label='DNS', zorder=10)
|
| 1292 |
+
for i, res in enumerate(all_results):
|
| 1293 |
+
piv_plus = res['piv_plus']
|
| 1294 |
+
label = res['window_label']
|
| 1295 |
+
ax.plot(piv_plus['y_plus'], piv_plus['vv_plus'],
|
| 1296 |
+
color=colors[i % len(colors)], marker=markers[i % len(markers)],
|
| 1297 |
+
markersize=3, alpha=0.7, linestyle='none', label=f'PIV ({label})')
|
| 1298 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 1299 |
+
ax.set_ylabel(r"$\overline{v'v'}^+$", fontsize=12)
|
| 1300 |
+
ax.set_title('Wall-Normal Normal Stress', fontsize=14)
|
| 1301 |
+
ax.legend(fontsize=9)
|
| 1302 |
+
ax.set_xscale('log')
|
| 1303 |
+
ax.set_xlim(1, Re_tau)
|
| 1304 |
+
ax.grid(True, alpha=0.3)
|
| 1305 |
+
|
| 1306 |
+
# -uv+
|
| 1307 |
+
ax = axes[2]
|
| 1308 |
+
if has_ci:
|
| 1309 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['uv_plus_ci_lo'],
|
| 1310 |
+
gt_plus['uv_plus_ci_hi'], sign=-1, color='k', zorder=1)
|
| 1311 |
+
ax.plot(gt_plus['y_plus'], -gt_plus['uv_plus'], 'k-', linewidth=2.5, label='DNS', zorder=10)
|
| 1312 |
+
for i, res in enumerate(all_results):
|
| 1313 |
+
piv_plus = res['piv_plus']
|
| 1314 |
+
label = res['window_label']
|
| 1315 |
+
ax.plot(piv_plus['y_plus'], -piv_plus['uv_plus'],
|
| 1316 |
+
color=colors[i % len(colors)], marker=markers[i % len(markers)],
|
| 1317 |
+
markersize=3, alpha=0.7, linestyle='none', label=f'PIV ({label})')
|
| 1318 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 1319 |
+
ax.set_ylabel(r"$-\overline{u'v'}^+$", fontsize=12)
|
| 1320 |
+
ax.set_title('Reynolds Shear Stress', fontsize=14)
|
| 1321 |
+
ax.legend(fontsize=9)
|
| 1322 |
+
ax.set_xscale('log')
|
| 1323 |
+
ax.set_xlim(1, Re_tau)
|
| 1324 |
+
ax.grid(True, alpha=0.3)
|
| 1325 |
+
|
| 1326 |
+
fig.tight_layout()
|
| 1327 |
+
fig.savefig(output_dir / 'reynolds_stresses_combined.png', dpi=150)
|
| 1328 |
+
plt.close(fig)
|
| 1329 |
+
|
| 1330 |
+
# ==========================================================================
|
| 1331 |
+
# Figure 3: V+ profile - ALL WINDOWS
|
| 1332 |
+
# ==========================================================================
|
| 1333 |
+
fig, ax = plt.subplots(figsize=(12, 8))
|
| 1334 |
+
|
| 1335 |
+
if has_ci and 'V_plus_ci_lo' in gt_plus:
|
| 1336 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['V_plus_ci_lo'],
|
| 1337 |
+
gt_plus['V_plus_ci_hi'], color='k', zorder=1)
|
| 1338 |
+
ax.plot(gt_plus['y_plus'], gt_plus['V_plus'], 'k-', linewidth=2.5, label='DNS', zorder=10)
|
| 1339 |
+
for i, res in enumerate(all_results):
|
| 1340 |
+
piv_plus = res['piv_plus']
|
| 1341 |
+
label = res['window_label']
|
| 1342 |
+
ax.plot(piv_plus['y_plus'], piv_plus['V_plus'],
|
| 1343 |
+
color=colors[i % len(colors)], marker=markers[i % len(markers)],
|
| 1344 |
+
markersize=4, alpha=0.7, linestyle='none', label=f'PIV ({label})')
|
| 1345 |
+
ax.axhline(y=0, color='gray', linestyle='--', linewidth=0.5, alpha=0.7)
|
| 1346 |
+
|
| 1347 |
+
ax.set_xlabel(r'$y^+$', fontsize=14)
|
| 1348 |
+
ax.set_ylabel(r'$V^+$', fontsize=14)
|
| 1349 |
+
ax.set_title(f'Mean Wall-Normal Velocity Profile - All Window Sizes (Re$_\\tau$ = {Re_tau:.0f})', fontsize=16)
|
| 1350 |
+
ax.legend(fontsize=10)
|
| 1351 |
+
ax.set_xscale('log')
|
| 1352 |
+
ax.set_xlim(1, Re_tau)
|
| 1353 |
+
ax.grid(True, alpha=0.3)
|
| 1354 |
+
|
| 1355 |
+
fig.tight_layout()
|
| 1356 |
+
fig.savefig(output_dir / 'V_plus_profile_combined.png', dpi=150)
|
| 1357 |
+
plt.close(fig)
|
| 1358 |
+
|
| 1359 |
+
# ==========================================================================
|
| 1360 |
+
# Figure 4: U+ linear scale - ALL WINDOWS
|
| 1361 |
+
# ==========================================================================
|
| 1362 |
+
fig, ax = plt.subplots(figsize=(12, 8))
|
| 1363 |
+
|
| 1364 |
+
ax.plot(gt_plus['y_plus'], gt_plus['U_plus'], 'k-', linewidth=2.5, label='DNS U+', zorder=10)
|
| 1365 |
+
for i, res in enumerate(all_results):
|
| 1366 |
+
piv_plus = res['piv_plus']
|
| 1367 |
+
label = res['window_label']
|
| 1368 |
+
ax.plot(piv_plus['y_plus'], piv_plus['U_plus'],
|
| 1369 |
+
color=colors[i % len(colors)], marker=markers[i % len(markers)],
|
| 1370 |
+
markersize=3, alpha=0.6, linestyle='none', label=f'PIV ({label})')
|
| 1371 |
+
|
| 1372 |
+
ax.set_xlabel(r'$y^+$', fontsize=14)
|
| 1373 |
+
ax.set_ylabel(r'$U^+$', fontsize=14)
|
| 1374 |
+
ax.set_title('Mean Velocity Profile - All Window Sizes', fontsize=16)
|
| 1375 |
+
ax.legend(fontsize=10)
|
| 1376 |
+
ax.set_xscale('log')
|
| 1377 |
+
ax.set_xlim(1, Re_tau)
|
| 1378 |
+
ax.grid(True, alpha=0.3)
|
| 1379 |
+
|
| 1380 |
+
fig.tight_layout()
|
| 1381 |
+
fig.savefig(output_dir / 'U_plus_linear_combined.png', dpi=150)
|
| 1382 |
+
plt.close(fig)
|
| 1383 |
+
|
| 1384 |
+
# ==========================================================================
|
| 1385 |
+
# Figure 5: Smoothed U+ combined - ALL WINDOWS
|
| 1386 |
+
# ==========================================================================
|
| 1387 |
+
fig, ax = plt.subplots(figsize=(12, 8))
|
| 1388 |
+
|
| 1389 |
+
if has_ci and 'U_plus_ci_lo' in gt_plus:
|
| 1390 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['U_plus_ci_lo'],
|
| 1391 |
+
gt_plus['U_plus_ci_hi'], color='k', alpha=0.15, zorder=1)
|
| 1392 |
+
ax.semilogx(gt_plus['y_plus'], gt_plus['U_plus'], 'k-',
|
| 1393 |
+
linewidth=2.5, label='DNS (1px)', zorder=10)
|
| 1394 |
+
|
| 1395 |
+
for i, res in enumerate(all_results):
|
| 1396 |
+
piv_plus = res['piv_plus']
|
| 1397 |
+
label = res['window_label']
|
| 1398 |
+
c = colors[i % len(colors)]
|
| 1399 |
+
ax.semilogx(piv_plus['y_plus'], piv_plus['U_plus'],
|
| 1400 |
+
color=c, marker=markers[i % len(markers)],
|
| 1401 |
+
markersize=4, alpha=0.7, linestyle='none',
|
| 1402 |
+
label=f'PIV ({label})', zorder=5-i*0.1)
|
| 1403 |
+
|
| 1404 |
+
if show_fit_lines:
|
| 1405 |
+
y_log = np.logspace(1, np.log10(Re_tau), 100)
|
| 1406 |
+
kappa, B = 0.41, 5.2
|
| 1407 |
+
ax.semilogx(y_log, (1/kappa)*np.log(y_log)+B, 'b--', linewidth=1.5, alpha=0.5,
|
| 1408 |
+
label='Log law')
|
| 1409 |
+
y_visc = np.linspace(0.1, 10, 50)
|
| 1410 |
+
ax.semilogx(y_visc, y_visc, 'g--', linewidth=1.5, alpha=0.5, label=r'$U^+=y^+$')
|
| 1411 |
+
|
| 1412 |
+
ax.set_xlabel(r'$y^+$', fontsize=14)
|
| 1413 |
+
ax.set_ylabel(r'$U^+$', fontsize=14)
|
| 1414 |
+
ax.set_title(f'Mean Velocity Profile - Smoothed (Re$_\\tau$ = {Re_tau:.0f})', fontsize=16)
|
| 1415 |
+
ax.legend(fontsize=10, loc='upper left')
|
| 1416 |
+
ax.set_xlim(1, Re_tau)
|
| 1417 |
+
ax.set_ylim(0, 25)
|
| 1418 |
+
ax.grid(True, alpha=0.3)
|
| 1419 |
+
|
| 1420 |
+
fig.tight_layout()
|
| 1421 |
+
fig.savefig(output_dir / 'U_plus_profile_combined_smooth.png', dpi=150)
|
| 1422 |
+
plt.close(fig)
|
| 1423 |
+
|
| 1424 |
+
# ==========================================================================
|
| 1425 |
+
# Figure 6: Smoothed Reynolds stresses combined - ALL WINDOWS
|
| 1426 |
+
# ==========================================================================
|
| 1427 |
+
fig, axes = plt.subplots(1, 3, figsize=(18, 6))
|
| 1428 |
+
|
| 1429 |
+
stress_configs = [
|
| 1430 |
+
('uu_plus', r"$\overline{u'u'}^+$", 'Streamwise Normal Stress', 1),
|
| 1431 |
+
('vv_plus', r"$\overline{v'v'}^+$", 'Wall-Normal Normal Stress', 1),
|
| 1432 |
+
('uv_plus', r"$-\overline{u'v'}^+$", 'Reynolds Shear Stress', -1),
|
| 1433 |
+
]
|
| 1434 |
+
for ax, (var, ylabel, title, sign) in zip(axes, stress_configs):
|
| 1435 |
+
gt_vals = sign * gt_plus[var]
|
| 1436 |
+
ci_lo_key = f'{var}_ci_lo'
|
| 1437 |
+
ci_hi_key = f'{var}_ci_hi'
|
| 1438 |
+
if has_ci and ci_lo_key in gt_plus:
|
| 1439 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus[ci_lo_key],
|
| 1440 |
+
gt_plus[ci_hi_key], sign=sign, color='k', zorder=1)
|
| 1441 |
+
ax.plot(gt_plus['y_plus'], gt_vals, 'k-', linewidth=2.5, label='DNS', zorder=10)
|
| 1442 |
+
|
| 1443 |
+
for i, res in enumerate(all_results):
|
| 1444 |
+
piv_plus = res['piv_plus']
|
| 1445 |
+
label = res['window_label']
|
| 1446 |
+
c = colors[i % len(colors)]
|
| 1447 |
+
piv_vals = sign * piv_plus[var]
|
| 1448 |
+
ax.plot(piv_plus['y_plus'], piv_vals,
|
| 1449 |
+
color=c, marker=markers[i % len(markers)],
|
| 1450 |
+
markersize=4, alpha=0.7, linestyle='none',
|
| 1451 |
+
label=f'PIV ({label})', zorder=5-i*0.1)
|
| 1452 |
+
|
| 1453 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 1454 |
+
ax.set_ylabel(ylabel, fontsize=12)
|
| 1455 |
+
ax.set_title(title, fontsize=14)
|
| 1456 |
+
ax.legend(fontsize=9)
|
| 1457 |
+
ax.set_xscale('log')
|
| 1458 |
+
ax.set_xlim(1, Re_tau)
|
| 1459 |
+
ax.grid(True, alpha=0.3)
|
| 1460 |
+
|
| 1461 |
+
fig.tight_layout()
|
| 1462 |
+
fig.savefig(output_dir / 'reynolds_stresses_combined_smooth.png', dpi=150)
|
| 1463 |
+
plt.close(fig)
|
| 1464 |
+
|
| 1465 |
+
# ==========================================================================
|
| 1466 |
+
# Figure 7: Trace invariant (u'u' + v'v') - ALL WINDOWS
|
| 1467 |
+
# ==========================================================================
|
| 1468 |
+
fig, axes = plt.subplots(1, 2, figsize=(14, 6))
|
| 1469 |
+
|
| 1470 |
+
# Compute ground truth trace
|
| 1471 |
+
gt_trace = gt_plus['uu_plus'] + gt_plus['vv_plus']
|
| 1472 |
+
|
| 1473 |
+
# Left: Trace comparison
|
| 1474 |
+
ax = axes[0]
|
| 1475 |
+
ax.semilogx(gt_plus['y_plus'], gt_trace, 'k-', linewidth=2.5, label='DNS', zorder=10)
|
| 1476 |
+
for i, res in enumerate(all_results):
|
| 1477 |
+
piv_plus = res['piv_plus']
|
| 1478 |
+
label = res['window_label']
|
| 1479 |
+
piv_trace = piv_plus['uu_plus'] + piv_plus['vv_plus']
|
| 1480 |
+
ax.semilogx(piv_plus['y_plus'], piv_trace,
|
| 1481 |
+
color=colors[i % len(colors)], marker=markers[i % len(markers)],
|
| 1482 |
+
markersize=4, alpha=0.7, linestyle='none', label=f'PIV ({label})')
|
| 1483 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 1484 |
+
ax.set_ylabel(r"$\overline{u'u'}^+ + \overline{v'v'}^+$", fontsize=12)
|
| 1485 |
+
ax.set_title("Trace Invariant (rotation-invariant)", fontsize=14)
|
| 1486 |
+
ax.legend(fontsize=10)
|
| 1487 |
+
ax.set_xlim(1, Re_tau)
|
| 1488 |
+
ax.grid(True, alpha=0.3)
|
| 1489 |
+
|
| 1490 |
+
# Right: Ratio of components (rotation indicator)
|
| 1491 |
+
ax = axes[1]
|
| 1492 |
+
gt_ratio = gt_plus['uu_plus'] / (gt_plus['vv_plus'] + 1e-10)
|
| 1493 |
+
ax.semilogx(gt_plus['y_plus'], gt_ratio, 'k-', linewidth=2.5, label='DNS', zorder=10)
|
| 1494 |
+
for i, res in enumerate(all_results):
|
| 1495 |
+
piv_plus = res['piv_plus']
|
| 1496 |
+
label = res['window_label']
|
| 1497 |
+
piv_ratio = piv_plus['uu_plus'] / (piv_plus['vv_plus'] + 1e-10)
|
| 1498 |
+
ax.semilogx(piv_plus['y_plus'], piv_ratio,
|
| 1499 |
+
color=colors[i % len(colors)], marker=markers[i % len(markers)],
|
| 1500 |
+
markersize=4, alpha=0.7, linestyle='none', label=f'PIV ({label})')
|
| 1501 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 1502 |
+
ax.set_ylabel(r"$\overline{u'u'}^+ / \overline{v'v'}^+$", fontsize=12)
|
| 1503 |
+
ax.set_title("Stress Ratio (rotation indicator)", fontsize=14)
|
| 1504 |
+
ax.legend(fontsize=10)
|
| 1505 |
+
ax.set_xlim(1, Re_tau)
|
| 1506 |
+
ax.set_ylim(0, 10)
|
| 1507 |
+
ax.grid(True, alpha=0.3)
|
| 1508 |
+
|
| 1509 |
+
fig.suptitle("Rotation Diagnostic: If trace matches but ratio differs, rotation problem exists", fontsize=12, y=1.02)
|
| 1510 |
+
fig.tight_layout()
|
| 1511 |
+
fig.savefig(output_dir / 'trace_invariant_combined.png', dpi=150)
|
| 1512 |
+
plt.close(fig)
|
| 1513 |
+
|
| 1514 |
+
# ==========================================================================
|
| 1515 |
+
# Figure 8: Residuals (PIV - Ref) vs y+ - ALL WINDOWS
|
| 1516 |
+
# ==========================================================================
|
| 1517 |
+
fig, axes = plt.subplots(2, 3, figsize=(18, 12))
|
| 1518 |
+
|
| 1519 |
+
# Interpolate ground truth
|
| 1520 |
+
gt_interp_fn = {}
|
| 1521 |
+
for var in ['U_plus', 'V_plus', 'uu_plus', 'vv_plus', 'uv_plus']:
|
| 1522 |
+
gt_interp_fn[var] = interp1d(gt_plus['y_plus'], gt_plus[var], kind='linear',
|
| 1523 |
+
bounds_error=False, fill_value=np.nan)
|
| 1524 |
+
|
| 1525 |
+
# Top row: velocity residuals
|
| 1526 |
+
vel_configs = [
|
| 1527 |
+
('U_plus', r"$U^+_{\mathrm{PIV}} - U^+_{\mathrm{Ref}}$",
|
| 1528 |
+
'Mean Streamwise Velocity Residual', 1),
|
| 1529 |
+
('V_plus', r"$V^+_{\mathrm{PIV}} - V^+_{\mathrm{Ref}}$",
|
| 1530 |
+
'Mean Wall-Normal Velocity Residual', 1),
|
| 1531 |
+
]
|
| 1532 |
+
for ax, (var, ylabel, title, sign) in zip(axes[0, :2], vel_configs):
|
| 1533 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 1534 |
+
for i, res in enumerate(all_results):
|
| 1535 |
+
piv_plus = res['piv_plus']
|
| 1536 |
+
label = res['window_label']
|
| 1537 |
+
c = colors[i % len(colors)]
|
| 1538 |
+
gt_at_piv = gt_interp_fn[var](piv_plus['y_plus'])
|
| 1539 |
+
residual = sign * piv_plus[var] - sign * gt_at_piv
|
| 1540 |
+
ax.plot(piv_plus['y_plus'], residual,
|
| 1541 |
+
color=c, marker=markers[i % len(markers)],
|
| 1542 |
+
markersize=2, alpha=0.15, linestyle='none', zorder=2)
|
| 1543 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], residual)
|
| 1544 |
+
ax.plot(yp_s, r_s, color=c, linewidth=2,
|
| 1545 |
+
label=f'PIV ({label})', zorder=5-i*0.1)
|
| 1546 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 1547 |
+
ax.set_ylabel(ylabel, fontsize=12)
|
| 1548 |
+
ax.set_title(title, fontsize=14)
|
| 1549 |
+
ax.legend(fontsize=9)
|
| 1550 |
+
ax.set_xscale('log')
|
| 1551 |
+
ax.set_xlim(1, Re_tau)
|
| 1552 |
+
ax.grid(True, alpha=0.3)
|
| 1553 |
+
|
| 1554 |
+
axes[0, 2].set_visible(False) # Empty top-right panel
|
| 1555 |
+
|
| 1556 |
+
# Bottom row: stress residuals
|
| 1557 |
+
stress_configs = [
|
| 1558 |
+
('uu_plus', r"$\overline{u'u'}^+_{\mathrm{PIV}} - \overline{u'u'}^+_{\mathrm{Ref}}$",
|
| 1559 |
+
'Streamwise Normal Stress Residual', 1),
|
| 1560 |
+
('vv_plus', r"$\overline{v'v'}^+_{\mathrm{PIV}} - \overline{v'v'}^+_{\mathrm{Ref}}$",
|
| 1561 |
+
'Wall-Normal Normal Stress Residual', 1),
|
| 1562 |
+
('uv_plus', r"$-\overline{u'v'}^+_{\mathrm{PIV}} - (-\overline{u'v'}^+_{\mathrm{Ref}})$",
|
| 1563 |
+
'Shear Stress Residual', -1),
|
| 1564 |
+
]
|
| 1565 |
+
for ax, (var, ylabel, title, sign) in zip(axes[1, :], stress_configs):
|
| 1566 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 1567 |
+
for i, res in enumerate(all_results):
|
| 1568 |
+
piv_plus = res['piv_plus']
|
| 1569 |
+
label = res['window_label']
|
| 1570 |
+
c = colors[i % len(colors)]
|
| 1571 |
+
gt_at_piv = gt_interp_fn[var](piv_plus['y_plus'])
|
| 1572 |
+
residual = sign * piv_plus[var] - sign * gt_at_piv
|
| 1573 |
+
ax.plot(piv_plus['y_plus'], residual,
|
| 1574 |
+
color=c, marker=markers[i % len(markers)],
|
| 1575 |
+
markersize=2, alpha=0.15, linestyle='none', zorder=2)
|
| 1576 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], residual)
|
| 1577 |
+
ax.plot(yp_s, r_s, color=c, linewidth=2,
|
| 1578 |
+
label=f'PIV ({label})', zorder=5-i*0.1)
|
| 1579 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 1580 |
+
ax.set_ylabel(ylabel, fontsize=12)
|
| 1581 |
+
ax.set_title(title, fontsize=14)
|
| 1582 |
+
ax.legend(fontsize=9)
|
| 1583 |
+
ax.set_xscale('log')
|
| 1584 |
+
ax.set_xlim(1, Re_tau)
|
| 1585 |
+
ax.grid(True, alpha=0.3)
|
| 1586 |
+
|
| 1587 |
+
fig.tight_layout()
|
| 1588 |
+
fig.savefig(output_dir / 'residuals_combined.png', dpi=150)
|
| 1589 |
+
plt.close(fig)
|
| 1590 |
+
|
| 1591 |
+
# ==========================================================================
|
| 1592 |
+
# Figure 9: Noise floor vs gradient correction decomposition - ALL WINDOWS
|
| 1593 |
+
# ==========================================================================
|
| 1594 |
+
fig, axes = plt.subplots(1, 3, figsize=(18, 6))
|
| 1595 |
+
|
| 1596 |
+
# Left: Noise floor (v'v' residual) — all windows
|
| 1597 |
+
ax = axes[0]
|
| 1598 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 1599 |
+
for i, res in enumerate(all_results):
|
| 1600 |
+
piv_plus = res['piv_plus']
|
| 1601 |
+
label = res['window_label']
|
| 1602 |
+
c = colors[i % len(colors)]
|
| 1603 |
+
vv_res = piv_plus['vv_plus'] - gt_interp_fn['vv_plus'](piv_plus['y_plus'])
|
| 1604 |
+
ax.plot(piv_plus['y_plus'], vv_res,
|
| 1605 |
+
color=c, marker=markers[i % len(markers)],
|
| 1606 |
+
markersize=2, alpha=0.15, linestyle='none', zorder=2)
|
| 1607 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], vv_res)
|
| 1608 |
+
ax.plot(yp_s, r_s, color=c, linewidth=2,
|
| 1609 |
+
label=f'PIV ({label})', zorder=5-i*0.1)
|
| 1610 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 1611 |
+
ax.set_ylabel(r"$\overline{v'v'}^+_{\mathrm{PIV}} - \overline{v'v'}^+_{\mathrm{Ref}}$", fontsize=12)
|
| 1612 |
+
ax.set_title('Noise Floor (isotropic)', fontsize=14)
|
| 1613 |
+
ax.legend(fontsize=9)
|
| 1614 |
+
ax.set_xscale('log')
|
| 1615 |
+
ax.set_xlim(1, Re_tau)
|
| 1616 |
+
ax.grid(True, alpha=0.3)
|
| 1617 |
+
|
| 1618 |
+
# Middle: Gradient-only residual (u'u' - v'v') — all windows
|
| 1619 |
+
ax = axes[1]
|
| 1620 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 1621 |
+
for i, res in enumerate(all_results):
|
| 1622 |
+
piv_plus = res['piv_plus']
|
| 1623 |
+
label = res['window_label']
|
| 1624 |
+
c = colors[i % len(colors)]
|
| 1625 |
+
uu_res = piv_plus['uu_plus'] - gt_interp_fn['uu_plus'](piv_plus['y_plus'])
|
| 1626 |
+
vv_res = piv_plus['vv_plus'] - gt_interp_fn['vv_plus'](piv_plus['y_plus'])
|
| 1627 |
+
grad_only = uu_res - vv_res
|
| 1628 |
+
ax.plot(piv_plus['y_plus'], grad_only,
|
| 1629 |
+
color=c, marker=markers[i % len(markers)],
|
| 1630 |
+
markersize=2, alpha=0.15, linestyle='none', zorder=2)
|
| 1631 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], grad_only)
|
| 1632 |
+
ax.plot(yp_s, r_s, color=c, linewidth=2,
|
| 1633 |
+
label=f'PIV ({label})', zorder=5-i*0.1)
|
| 1634 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 1635 |
+
ax.set_ylabel(r"Gradient-only residual$^+$", fontsize=12)
|
| 1636 |
+
ax.set_title(r"Gradient Correction Residual ($u'u' - v'v'$ removes noise)", fontsize=14)
|
| 1637 |
+
ax.legend(fontsize=9)
|
| 1638 |
+
ax.set_xscale('log')
|
| 1639 |
+
ax.set_xlim(1, Re_tau)
|
| 1640 |
+
ax.grid(True, alpha=0.3)
|
| 1641 |
+
|
| 1642 |
+
# Right: All three overlaid for the finest window
|
| 1643 |
+
ax = axes[2]
|
| 1644 |
+
finest = all_results[-1] # Last (finest) window
|
| 1645 |
+
piv_plus = finest['piv_plus']
|
| 1646 |
+
label = finest['window_label']
|
| 1647 |
+
uu_res = piv_plus['uu_plus'] - gt_interp_fn['uu_plus'](piv_plus['y_plus'])
|
| 1648 |
+
vv_res = piv_plus['vv_plus'] - gt_interp_fn['vv_plus'](piv_plus['y_plus'])
|
| 1649 |
+
grad_only = uu_res - vv_res
|
| 1650 |
+
|
| 1651 |
+
ax.plot(piv_plus['y_plus'], uu_res, 'ro', markersize=2, alpha=0.1)
|
| 1652 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], uu_res)
|
| 1653 |
+
ax.plot(yp_s, r_s, 'r-', linewidth=2, label=r"$u'u'$ residual (total)")
|
| 1654 |
+
|
| 1655 |
+
ax.plot(piv_plus['y_plus'], vv_res, 'bo', markersize=2, alpha=0.1)
|
| 1656 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], vv_res)
|
| 1657 |
+
ax.plot(yp_s, r_s, 'b-', linewidth=2, label=r"$v'v'$ residual (noise floor)")
|
| 1658 |
+
|
| 1659 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], grad_only)
|
| 1660 |
+
ax.plot(yp_s, r_s, 'g--', linewidth=2, label=r"$u'u' - v'v'$ residual (gradient only)")
|
| 1661 |
+
|
| 1662 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 1663 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 1664 |
+
ax.set_ylabel(r"Residual$^+$", fontsize=12)
|
| 1665 |
+
ax.set_title(f'Decomposition ({label}): Total = Noise + Gradient', fontsize=14)
|
| 1666 |
+
ax.legend(fontsize=9)
|
| 1667 |
+
ax.set_xscale('log')
|
| 1668 |
+
ax.set_xlim(1, Re_tau)
|
| 1669 |
+
ax.grid(True, alpha=0.3)
|
| 1670 |
+
|
| 1671 |
+
fig.tight_layout()
|
| 1672 |
+
fig.savefig(output_dir / 'noise_gradient_decomposition_combined.png', dpi=150)
|
| 1673 |
+
plt.close(fig)
|
| 1674 |
+
|
| 1675 |
+
print(f"\nCombined plots saved to: {output_dir}")
|
| 1676 |
+
|
| 1677 |
+
|
| 1678 |
+
def main_multi_run(mode='ensemble', run_indices=None, window_sizes=None, run_labels=None, gt_dir=None, base_dir=None, ensemble_dir=None, y_plus_offset=0.0, num_frames=1000, output_dir_override=None, show_fit_lines=False):
|
| 1679 |
+
"""
|
| 1680 |
+
Main benchmark comparison function for multiple runs/window sizes.
|
| 1681 |
+
|
| 1682 |
+
Parameters
|
| 1683 |
+
----------
|
| 1684 |
+
mode : str
|
| 1685 |
+
'instantaneous' or 'ensemble'
|
| 1686 |
+
run_indices : list of int
|
| 1687 |
+
List of run indices (0-based) to process
|
| 1688 |
+
window_sizes : list of int
|
| 1689 |
+
Corresponding window sizes for labels (e.g., [16, 8, 6, 4])
|
| 1690 |
+
run_labels : list of str, optional
|
| 1691 |
+
Custom labels for output folders (e.g., ['run_1', 'run_2', 'run_3'])
|
| 1692 |
+
gt_dir : Path, optional
|
| 1693 |
+
Ground truth directory. Defaults to script_dir/ground_truth/ensemble_statistics
|
| 1694 |
+
base_dir : Path, optional
|
| 1695 |
+
Base directory containing PIV results. Defaults to window_validation folder.
|
| 1696 |
+
ensemble_dir : Path, optional
|
| 1697 |
+
Direct path to ensemble directory containing ensemble_result.mat and coordinates.mat.
|
| 1698 |
+
If provided, overrides base_dir for ensemble mode.
|
| 1699 |
+
y_plus_offset : float, optional
|
| 1700 |
+
Offset to add to y+ coordinates (for calibration correction)
|
| 1701 |
+
"""
|
| 1702 |
+
# Paths
|
| 1703 |
+
script_dir = Path(__file__).parent
|
| 1704 |
+
if gt_dir is None:
|
| 1705 |
+
raise ValueError("gt_dir is required. Please provide the ground truth directory path.")
|
| 1706 |
+
gt_dir = Path(gt_dir)
|
| 1707 |
+
|
| 1708 |
+
if mode == 'ensemble':
|
| 1709 |
+
if ensemble_dir is not None:
|
| 1710 |
+
ensemble_dir = Path(ensemble_dir)
|
| 1711 |
+
ensemble_path = ensemble_dir / 'ensemble_result.mat'
|
| 1712 |
+
coords_path = ensemble_dir / 'coordinates.mat'
|
| 1713 |
+
elif base_dir is not None:
|
| 1714 |
+
base_dir = Path(base_dir)
|
| 1715 |
+
ensemble_path = base_dir / f'calibrated_piv/{num_frames}/Cam1/ensemble/ensemble_result.mat'
|
| 1716 |
+
coords_path = base_dir / f'calibrated_piv/{num_frames}/Cam1/ensemble/coordinates.mat'
|
| 1717 |
+
else:
|
| 1718 |
+
raise ValueError("Either ensemble_dir or base_dir must be provided for ensemble mode.")
|
| 1719 |
+
output_dir = output_dir_override or (script_dir / 'benchmark_results_ensemble')
|
| 1720 |
+
else:
|
| 1721 |
+
if base_dir is None:
|
| 1722 |
+
raise ValueError("base_dir is required for instantaneous mode.")
|
| 1723 |
+
base_dir = Path(base_dir)
|
| 1724 |
+
stats_path = base_dir / f'statistics/{num_frames}/Cam1/instantaneous/mean_stats/mean_stats.mat'
|
| 1725 |
+
output_dir = output_dir_override or (script_dir / 'benchmark_results')
|
| 1726 |
+
|
| 1727 |
+
print("=" * 70)
|
| 1728 |
+
print(f"PIV BENCHMARK COMPARISON ({mode.upper()}) - MULTI-RUN")
|
| 1729 |
+
print("=" * 70)
|
| 1730 |
+
print(f"Processing runs: {run_indices}")
|
| 1731 |
+
print(f"Window sizes: {window_sizes}")
|
| 1732 |
+
|
| 1733 |
+
# Load common data - auto-detect file names
|
| 1734 |
+
print("\n[1] Loading wall units...")
|
| 1735 |
+
wall_units_file = gt_dir / 'wall_units.mat'
|
| 1736 |
+
if not wall_units_file.exists():
|
| 1737 |
+
wall_units_file = gt_dir / 'diagnostics.mat'
|
| 1738 |
+
if not wall_units_file.exists():
|
| 1739 |
+
wall_units_file = gt_dir / 'direct_stats.mat'
|
| 1740 |
+
wall_units = load_wall_units(wall_units_file)
|
| 1741 |
+
print(f" u_tau = {wall_units['u_tau']:.4f} mm/s")
|
| 1742 |
+
print(f" nu = {wall_units['nu']:.4f} mm²/s")
|
| 1743 |
+
print(f" delta_nu = {wall_units['delta_nu']:.4f} mm")
|
| 1744 |
+
print(f" Re_tau = {wall_units['Re_tau']:.0f}")
|
| 1745 |
+
|
| 1746 |
+
print("\n[2] Loading ground truth...")
|
| 1747 |
+
profiles_file = gt_dir / 'profiles.mat'
|
| 1748 |
+
if not profiles_file.exists():
|
| 1749 |
+
profiles_file = gt_dir / 'ensemble_statistics_full.mat'
|
| 1750 |
+
if not profiles_file.exists():
|
| 1751 |
+
profiles_file = gt_dir / 'direct_stats.mat'
|
| 1752 |
+
gt = load_ground_truth(profiles_file, wall_units_path=wall_units_file)
|
| 1753 |
+
print(f" y+ range: {gt['y_plus'].min():.1f} to {gt['y_plus'].max():.1f}")
|
| 1754 |
+
|
| 1755 |
+
# Ground truth in wall units
|
| 1756 |
+
gt_plus = {
|
| 1757 |
+
'y_plus': gt['y_plus'],
|
| 1758 |
+
'U_plus': gt['U_plus'],
|
| 1759 |
+
'V_plus': gt['V'] / wall_units['u_tau'],
|
| 1760 |
+
'uu_plus': gt['uu_plus'],
|
| 1761 |
+
'vv_plus': gt['vv_plus'],
|
| 1762 |
+
'uv_plus': gt['uv_plus'],
|
| 1763 |
+
}
|
| 1764 |
+
# Thread CI bounds through if available
|
| 1765 |
+
for ci_key in ['U_plus_ci_lo', 'U_plus_ci_hi', 'V_plus_ci_lo', 'V_plus_ci_hi',
|
| 1766 |
+
'uu_plus_ci_lo', 'uu_plus_ci_hi', 'vv_plus_ci_lo', 'vv_plus_ci_hi',
|
| 1767 |
+
'uv_plus_ci_lo', 'uv_plus_ci_hi']:
|
| 1768 |
+
if ci_key in gt:
|
| 1769 |
+
gt_plus[ci_key] = gt[ci_key]
|
| 1770 |
+
|
| 1771 |
+
# Process each run
|
| 1772 |
+
all_results = []
|
| 1773 |
+
if run_labels is None:
|
| 1774 |
+
run_labels = [f'{ws}x{ws}' for ws in window_sizes]
|
| 1775 |
+
for i, (run_idx, win_size) in enumerate(zip(run_indices, window_sizes)):
|
| 1776 |
+
window_label = f'{win_size}x{win_size}'
|
| 1777 |
+
run_output_dir = output_dir / run_labels[i]
|
| 1778 |
+
|
| 1779 |
+
print(f"\n{'='*70}")
|
| 1780 |
+
print(f"Processing Run {run_idx+1} (Window: {window_label})")
|
| 1781 |
+
print('='*70)
|
| 1782 |
+
|
| 1783 |
+
try:
|
| 1784 |
+
if mode == 'ensemble':
|
| 1785 |
+
piv = load_ensemble_statistics(ensemble_path, coords_path, run_idx=run_idx)
|
| 1786 |
+
else:
|
| 1787 |
+
piv = load_piv_statistics(stats_path, run_idx=run_idx)
|
| 1788 |
+
|
| 1789 |
+
print(f" Grid size: {piv['ux'].shape}")
|
| 1790 |
+
print(f" ux range: {np.nanmin(piv['ux'])*1000:.2f} to {np.nanmax(piv['ux'])*1000:.2f} mm/s")
|
| 1791 |
+
|
| 1792 |
+
# Compute profiles
|
| 1793 |
+
piv_profiles = compute_piv_profiles(piv, x_exclude_vectors=4)
|
| 1794 |
+
print(f" y range: {piv_profiles['y_mm'].min():.2f} to {piv_profiles['y_mm'].max():.2f} mm")
|
| 1795 |
+
|
| 1796 |
+
# Convert to wall units
|
| 1797 |
+
y_offset_mm = -piv_profiles['y_mm'].min()
|
| 1798 |
+
piv_plus = convert_to_wall_units(piv_profiles, wall_units, y_offset_mm=y_offset_mm)
|
| 1799 |
+
piv_plus['y_plus'] = piv_plus['y_plus'] + 1.0 # shift y+ by +1
|
| 1800 |
+
# Apply additional y+ offset if specified
|
| 1801 |
+
if y_plus_offset != 0.0:
|
| 1802 |
+
piv_plus['y_plus'] = piv_plus['y_plus'] + y_plus_offset
|
| 1803 |
+
print(f" y+ offset applied: {y_plus_offset:+.1f}")
|
| 1804 |
+
print(f" y+ range: {piv_plus['y_plus'].min():.1f} to {piv_plus['y_plus'].max():.1f} (y+ +1 applied)")
|
| 1805 |
+
|
| 1806 |
+
# Compute errors
|
| 1807 |
+
errors = compute_errors(piv_plus, gt_plus, y_plus_range=(10, 500))
|
| 1808 |
+
|
| 1809 |
+
# Print error summary
|
| 1810 |
+
if 'U_plus' in errors:
|
| 1811 |
+
print(f" U+ R² = {errors['U_plus']['r2']:.4f}, RMS = {errors['U_plus']['rms_rel']:.1f}%")
|
| 1812 |
+
if 'uu_plus' in errors:
|
| 1813 |
+
print(f" uu+ R² = {errors['uu_plus']['r2']:.4f}")
|
| 1814 |
+
|
| 1815 |
+
# Generate individual plots
|
| 1816 |
+
plot_comparison(piv_plus, gt_plus, wall_units, errors, run_output_dir,
|
| 1817 |
+
window_label=window_label, show_fit_lines=show_fit_lines)
|
| 1818 |
+
plot_combined_stresses(piv_plus, gt_plus, wall_units, errors, run_output_dir,
|
| 1819 |
+
window_label=window_label)
|
| 1820 |
+
|
| 1821 |
+
# Store for combined plot
|
| 1822 |
+
all_results.append({
|
| 1823 |
+
'piv_plus': piv_plus,
|
| 1824 |
+
'errors': errors,
|
| 1825 |
+
'window_label': window_label,
|
| 1826 |
+
'window_size': win_size,
|
| 1827 |
+
})
|
| 1828 |
+
|
| 1829 |
+
except Exception as e:
|
| 1830 |
+
print(f" ERROR processing run {run_idx}: {e}")
|
| 1831 |
+
import traceback
|
| 1832 |
+
traceback.print_exc()
|
| 1833 |
+
|
| 1834 |
+
# Generate combined plots if we have multiple results
|
| 1835 |
+
if len(all_results) > 1:
|
| 1836 |
+
print(f"\n{'='*70}")
|
| 1837 |
+
print("Generating combined comparison plots...")
|
| 1838 |
+
print('='*70)
|
| 1839 |
+
plot_combined_comparison(all_results, gt_plus, wall_units, output_dir,
|
| 1840 |
+
show_fit_lines=show_fit_lines)
|
| 1841 |
+
|
| 1842 |
+
# Print final summary
|
| 1843 |
+
print("\n" + "=" * 70)
|
| 1844 |
+
print("BENCHMARK SUMMARY")
|
| 1845 |
+
print("=" * 70)
|
| 1846 |
+
print(f"\n{'Window':<12} {'U+ R²':<10} {'U+ RMS%':<10} {'uu+ R²':<10} {'vv+ R²':<10} {'-uv+ R²':<10}")
|
| 1847 |
+
print("-" * 62)
|
| 1848 |
+
for res in all_results:
|
| 1849 |
+
errs = res['errors']
|
| 1850 |
+
u_r2 = errs.get('U_plus', {}).get('r2', np.nan)
|
| 1851 |
+
u_rms = errs.get('U_plus', {}).get('rms_rel', np.nan)
|
| 1852 |
+
uu_r2 = errs.get('uu_plus', {}).get('r2', np.nan)
|
| 1853 |
+
vv_r2 = errs.get('vv_plus', {}).get('r2', np.nan)
|
| 1854 |
+
uv_r2 = errs.get('uv_plus', {}).get('r2', np.nan)
|
| 1855 |
+
print(f"{res['window_label']:<12} {u_r2:<10.4f} {u_rms:<10.1f} {uu_r2:<10.4f} {vv_r2:<10.4f} {uv_r2:<10.4f}")
|
| 1856 |
+
|
| 1857 |
+
print("\n" + "=" * 70)
|
| 1858 |
+
print("BENCHMARK COMPLETE")
|
| 1859 |
+
print("=" * 70)
|
| 1860 |
+
|
| 1861 |
+
|
| 1862 |
+
if __name__ == '__main__':
|
| 1863 |
+
import argparse
|
| 1864 |
+
parser = argparse.ArgumentParser(description='PIV Benchmark Comparison')
|
| 1865 |
+
parser.add_argument('--mode', '-m', choices=['instantaneous', 'ensemble'],
|
| 1866 |
+
default='instantaneous', help='PIV mode (default: instantaneous)')
|
| 1867 |
+
parser.add_argument('--runs', '-r', type=str, default=None,
|
| 1868 |
+
help='Comma-separated run indices (0-based), e.g., "0,1,2"')
|
| 1869 |
+
parser.add_argument('--windows', '-w', type=str, default=None,
|
| 1870 |
+
help='Comma-separated window sizes for labels, e.g., "32,8,8"')
|
| 1871 |
+
parser.add_argument('--labels', '-l', type=str, default=None,
|
| 1872 |
+
help='Comma-separated output folder labels, e.g., "run_1,run_2,run_3"')
|
| 1873 |
+
parser.add_argument('--gt-dir', '-g', type=str, required=True,
|
| 1874 |
+
help='Ground truth directory path (required)')
|
| 1875 |
+
parser.add_argument('--base-dir', '-b', type=str, default=None,
|
| 1876 |
+
help='Base directory containing PIV results')
|
| 1877 |
+
parser.add_argument('--ensemble-dir', '-e', type=str, default=None,
|
| 1878 |
+
help='Direct path to ensemble directory containing ensemble_result.mat and coordinates.mat')
|
| 1879 |
+
parser.add_argument('--y-plus-offset', '-y', type=float, default=0.0,
|
| 1880 |
+
help='Offset to add to y+ coordinates (calibration correction)')
|
| 1881 |
+
parser.add_argument('--num-frames', '-n', type=int, default=1000,
|
| 1882 |
+
help='Frame count subdirectory in paths (default: 1000)')
|
| 1883 |
+
parser.add_argument('--output-dir', '-o', type=str, default=None,
|
| 1884 |
+
help='Custom output directory for results')
|
| 1885 |
+
parser.add_argument('--show-fit-lines', action='store_true', default=False,
|
| 1886 |
+
help='Show log-law and viscous sublayer reference lines on U+ plots')
|
| 1887 |
+
args = parser.parse_args()
|
| 1888 |
+
|
| 1889 |
+
gt_dir = Path(args.gt_dir)
|
| 1890 |
+
base_dir = Path(args.base_dir) if args.base_dir else None
|
| 1891 |
+
ensemble_dir = Path(args.ensemble_dir) if args.ensemble_dir else None
|
| 1892 |
+
output_dir_override = Path(args.output_dir) if args.output_dir else None
|
| 1893 |
+
|
| 1894 |
+
if args.runs and args.windows:
|
| 1895 |
+
run_indices = [int(r) for r in args.runs.split(',')]
|
| 1896 |
+
window_sizes = [int(w) for w in args.windows.split(',')]
|
| 1897 |
+
run_labels = args.labels.split(',') if args.labels else None
|
| 1898 |
+
main_multi_run(mode=args.mode, run_indices=run_indices, window_sizes=window_sizes,
|
| 1899 |
+
run_labels=run_labels, gt_dir=gt_dir, base_dir=base_dir,
|
| 1900 |
+
ensemble_dir=ensemble_dir, y_plus_offset=args.y_plus_offset,
|
| 1901 |
+
num_frames=args.num_frames, output_dir_override=output_dir_override,
|
| 1902 |
+
show_fit_lines=args.show_fit_lines)
|
| 1903 |
+
else:
|
| 1904 |
+
main(mode=args.mode, gt_dir=gt_dir, base_dir=base_dir, ensemble_dir=ensemble_dir,
|
| 1905 |
+
num_frames=args.num_frames, output_dir_override=output_dir_override,
|
| 1906 |
+
show_fit_lines=args.show_fit_lines)
|
scripts/cross_method_comparison.py
ADDED
|
@@ -0,0 +1,611 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Cross-method PIV comparison: Instantaneous vs Ensemble vs Stereo.
|
| 4 |
+
|
| 5 |
+
Publication-quality plots comparing one pass from each method against DNS
|
| 6 |
+
ground truth. Designed for academic journal submission.
|
| 7 |
+
|
| 8 |
+
Produces:
|
| 9 |
+
1. mean_velocity_comparison.png — U+ vs y+ (semi-log)
|
| 10 |
+
2. stresses_comparison.png — 1×3 subplots (uu+, vv+, −uv+)
|
| 11 |
+
3. combined_stresses_comparison.png — all stresses on one axis
|
| 12 |
+
|
| 13 |
+
Usage (Python API):
|
| 14 |
+
from cross_method_comparison import compare_methods
|
| 15 |
+
compare_methods(
|
| 16 |
+
gt_dir='path/to/ground_truth',
|
| 17 |
+
inst_stats_path='path/to/mean_stats.mat',
|
| 18 |
+
ens_ensemble_path='path/to/ensemble_result.mat',
|
| 19 |
+
ens_coords_path='path/to/coordinates.mat',
|
| 20 |
+
stereo_stats_path='path/to/stereo/mean_stats.mat',
|
| 21 |
+
output_dir='path/to/output',
|
| 22 |
+
...
|
| 23 |
+
)
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
import numpy as np
|
| 27 |
+
import scipy.io as sio
|
| 28 |
+
from scipy.interpolate import interp1d
|
| 29 |
+
import matplotlib.pyplot as plt
|
| 30 |
+
import matplotlib as mpl
|
| 31 |
+
from pathlib import Path
|
| 32 |
+
|
| 33 |
+
# ── Publication-quality font setup ────────────────────────────────────────────
|
| 34 |
+
mpl.rcParams.update({
|
| 35 |
+
'font.family': 'serif',
|
| 36 |
+
'font.serif': ['CMU Serif', 'Computer Modern Roman', 'DejaVu Serif'],
|
| 37 |
+
'mathtext.fontset': 'cm',
|
| 38 |
+
'axes.unicode_minus': False,
|
| 39 |
+
'text.usetex': False,
|
| 40 |
+
'axes.labelsize': 12,
|
| 41 |
+
'axes.titlesize': 13,
|
| 42 |
+
'legend.fontsize': 11,
|
| 43 |
+
'xtick.labelsize': 10,
|
| 44 |
+
'ytick.labelsize': 10,
|
| 45 |
+
'lines.linewidth': 1.5,
|
| 46 |
+
'figure.dpi': 600,
|
| 47 |
+
'savefig.dpi': 600,
|
| 48 |
+
'savefig.bbox': 'tight',
|
| 49 |
+
'savefig.pad_inches': 0.05,
|
| 50 |
+
})
|
| 51 |
+
|
| 52 |
+
# ── Okabe–Ito colourblind-safe palette ────────────────────────────────────────
|
| 53 |
+
METHOD_STYLES = {
|
| 54 |
+
'Instantaneous': {'color': '#0072B2', 'marker': 'o'}, # blue
|
| 55 |
+
'Ensemble': {'color': '#D55E00', 'marker': 's'}, # vermillion
|
| 56 |
+
'Stereo': {'color': '#009E73', 'marker': '^'}, # teal
|
| 57 |
+
}
|
| 58 |
+
DNS_COLOR = 'k'
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def _get_style(name):
|
| 62 |
+
"""Look up style by method name prefix (e.g. 'Instantaneous (16x16)' → Instantaneous)."""
|
| 63 |
+
for key in METHOD_STYLES:
|
| 64 |
+
if name.startswith(key):
|
| 65 |
+
return METHOD_STYLES[key]
|
| 66 |
+
return {'color': 'gray', 'marker': 'x'}
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
# =============================================================================
|
| 70 |
+
# Data loading helpers (reuse from benchmark_comparison where possible)
|
| 71 |
+
# =============================================================================
|
| 72 |
+
|
| 73 |
+
def _load_wall_units(gt_dir):
|
| 74 |
+
"""Load wall units from ground truth directory (auto-detect format)."""
|
| 75 |
+
from benchmark_comparison import load_wall_units
|
| 76 |
+
gt_dir = Path(gt_dir)
|
| 77 |
+
for name in ('wall_units.mat', 'diagnostics.mat', 'direct_stats.mat'):
|
| 78 |
+
p = gt_dir / name
|
| 79 |
+
if p.exists():
|
| 80 |
+
return load_wall_units(p)
|
| 81 |
+
raise FileNotFoundError(f"No wall-units file found in {gt_dir}")
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def _load_ground_truth(gt_dir):
|
| 85 |
+
"""Load ground truth profiles + wall units."""
|
| 86 |
+
from benchmark_comparison import load_ground_truth
|
| 87 |
+
gt_dir = Path(gt_dir)
|
| 88 |
+
wu = _load_wall_units(gt_dir)
|
| 89 |
+
|
| 90 |
+
for name in ('profiles.mat', 'ensemble_statistics_full.mat', 'direct_stats.mat'):
|
| 91 |
+
p = gt_dir / name
|
| 92 |
+
if p.exists():
|
| 93 |
+
gt = load_ground_truth(p, wall_units_path=gt_dir / 'direct_stats.mat')
|
| 94 |
+
break
|
| 95 |
+
else:
|
| 96 |
+
raise FileNotFoundError(f"No ground-truth profiles in {gt_dir}")
|
| 97 |
+
|
| 98 |
+
gt_plus = {
|
| 99 |
+
'y_plus': gt['y_plus'],
|
| 100 |
+
'U_plus': gt['U_plus'],
|
| 101 |
+
'V_plus': gt['V'] / wu['u_tau'],
|
| 102 |
+
'uu_plus': gt['uu_plus'],
|
| 103 |
+
'vv_plus': gt['vv_plus'],
|
| 104 |
+
'uv_plus': gt['uv_plus'],
|
| 105 |
+
}
|
| 106 |
+
# Thread CI bounds if available
|
| 107 |
+
for key in ('U_plus_ci_lo', 'U_plus_ci_hi',
|
| 108 |
+
'uu_plus_ci_lo', 'uu_plus_ci_hi',
|
| 109 |
+
'vv_plus_ci_lo', 'vv_plus_ci_hi',
|
| 110 |
+
'uv_plus_ci_lo', 'uv_plus_ci_hi'):
|
| 111 |
+
if key in gt:
|
| 112 |
+
gt_plus[key] = gt[key]
|
| 113 |
+
return gt_plus, wu
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def _profiles_from_regular_grid(piv_data, x_exclude_vectors=4):
|
| 117 |
+
"""X-averaged profiles from a regular (no NaN border) grid."""
|
| 118 |
+
from benchmark_comparison import compute_piv_profiles
|
| 119 |
+
return compute_piv_profiles(piv_data, x_exclude_vectors=x_exclude_vectors)
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
def _profiles_from_stereo_grid(piv_struct, coords_struct, x_exclude_vectors=4):
|
| 123 |
+
"""X-averaged profiles from a stereo grid with NaN borders."""
|
| 124 |
+
x = coords_struct.x
|
| 125 |
+
y = coords_struct.y
|
| 126 |
+
|
| 127 |
+
# Find valid subgrid
|
| 128 |
+
valid_cols = np.any(~np.isnan(y), axis=0)
|
| 129 |
+
col_indices = np.where(valid_cols)[0]
|
| 130 |
+
mid_col = col_indices[len(col_indices) // 2]
|
| 131 |
+
|
| 132 |
+
y_col = y[:, mid_col]
|
| 133 |
+
valid_rows = ~np.isnan(y_col)
|
| 134 |
+
y_unique = y_col[valid_rows]
|
| 135 |
+
|
| 136 |
+
# X exclusion
|
| 137 |
+
x_start = col_indices[0] + x_exclude_vectors
|
| 138 |
+
x_end = col_indices[-1] - x_exclude_vectors + 1
|
| 139 |
+
x_mask = np.zeros(x.shape[1], dtype=bool)
|
| 140 |
+
x_mask[x_start:x_end] = True
|
| 141 |
+
|
| 142 |
+
def _avg(field):
|
| 143 |
+
return np.nanmean(field[valid_rows][:, x_mask], axis=1)
|
| 144 |
+
|
| 145 |
+
return {
|
| 146 |
+
'y_mm': y_unique,
|
| 147 |
+
'U': _avg(piv_struct.ux) * 1000,
|
| 148 |
+
'V': _avg(piv_struct.uy) * 1000,
|
| 149 |
+
'uu': _avg(piv_struct.uu) * 1e6,
|
| 150 |
+
'vv': _avg(piv_struct.vv) * 1e6,
|
| 151 |
+
'uv': _avg(piv_struct.uv) * 1e6,
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
def _to_wall_units(profiles, wall_units, y_plus_offset):
|
| 156 |
+
"""Convert profiles to plus units with y-offset."""
|
| 157 |
+
from benchmark_comparison import convert_to_wall_units
|
| 158 |
+
y_offset_mm = -profiles['y_mm'].min()
|
| 159 |
+
piv_plus = convert_to_wall_units(profiles, wall_units, y_offset_mm=y_offset_mm)
|
| 160 |
+
piv_plus['y_plus'] = piv_plus['y_plus'] + 1.0 + y_plus_offset
|
| 161 |
+
return piv_plus
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def load_instantaneous(stats_path, run_idx, wall_units, y_plus_offset,
|
| 165 |
+
x_exclude=4):
|
| 166 |
+
"""Load instantaneous PIV and return wall-unit profiles."""
|
| 167 |
+
from benchmark_comparison import load_piv_statistics
|
| 168 |
+
piv = load_piv_statistics(Path(stats_path), run_idx=run_idx)
|
| 169 |
+
profiles = _profiles_from_regular_grid(piv, x_exclude_vectors=x_exclude)
|
| 170 |
+
return _to_wall_units(profiles, wall_units, y_plus_offset)
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
def load_ensemble(ensemble_path, coords_path, run_idx, wall_units,
|
| 174 |
+
y_plus_offset, x_exclude=4):
|
| 175 |
+
"""Load ensemble PIV and return wall-unit profiles."""
|
| 176 |
+
from benchmark_comparison import load_ensemble_statistics
|
| 177 |
+
piv = load_ensemble_statistics(Path(ensemble_path), Path(coords_path),
|
| 178 |
+
run_idx=run_idx)
|
| 179 |
+
profiles = _profiles_from_regular_grid(piv, x_exclude_vectors=x_exclude)
|
| 180 |
+
return _to_wall_units(profiles, wall_units, y_plus_offset)
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def load_stereo(stats_path, run_idx, wall_units, y_plus_offset,
|
| 184 |
+
x_exclude=4, trim_top=0):
|
| 185 |
+
"""Load stereo PIV (NaN-aware) and return wall-unit profiles."""
|
| 186 |
+
stats = sio.loadmat(str(stats_path), squeeze_me=True, struct_as_record=False)
|
| 187 |
+
piv = stats['piv_result'][run_idx]
|
| 188 |
+
coords = stats['coordinates'][run_idx]
|
| 189 |
+
profiles = _profiles_from_stereo_grid(piv, coords, x_exclude_vectors=x_exclude)
|
| 190 |
+
|
| 191 |
+
if trim_top > 0 and len(profiles['y_mm']) > trim_top:
|
| 192 |
+
y = profiles['y_mm']
|
| 193 |
+
# Trim from the high-y end
|
| 194 |
+
if y[0] > y[-1]:
|
| 195 |
+
sl = slice(trim_top, None)
|
| 196 |
+
else:
|
| 197 |
+
sl = slice(None, -trim_top)
|
| 198 |
+
profiles = {k: v[sl] if isinstance(v, np.ndarray) else v
|
| 199 |
+
for k, v in profiles.items()}
|
| 200 |
+
|
| 201 |
+
return _to_wall_units(profiles, wall_units, y_plus_offset)
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
# =============================================================================
|
| 205 |
+
# Plotting
|
| 206 |
+
# =============================================================================
|
| 207 |
+
|
| 208 |
+
def _ci_band(ax, y_plus, lo, hi, sign=1, **kwargs):
|
| 209 |
+
"""Shade a 95 % confidence-interval band."""
|
| 210 |
+
if sign == -1:
|
| 211 |
+
lo, hi = hi, lo
|
| 212 |
+
ax.fill_between(y_plus, sign * lo, sign * hi,
|
| 213 |
+
color=DNS_COLOR, alpha=0.10, linewidth=0, **kwargs)
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
def plot_velocity_comparison(methods, gt_plus, wall_units, output_dir, title_suffix=''):
|
| 217 |
+
"""
|
| 218 |
+
U+ vs y+ — one marker series per method, DNS as reference line.
|
| 219 |
+
|
| 220 |
+
Parameters
|
| 221 |
+
----------
|
| 222 |
+
methods : dict
|
| 223 |
+
{method_name: piv_plus_dict} (keys must be in METHOD_STYLES)
|
| 224 |
+
gt_plus : dict
|
| 225 |
+
Ground truth in wall units
|
| 226 |
+
wall_units : dict
|
| 227 |
+
output_dir : Path
|
| 228 |
+
"""
|
| 229 |
+
output_dir = Path(output_dir)
|
| 230 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 231 |
+
Re_tau = wall_units['Re_tau']
|
| 232 |
+
|
| 233 |
+
fig, ax = plt.subplots(figsize=(7, 5))
|
| 234 |
+
|
| 235 |
+
# DNS reference
|
| 236 |
+
has_ci = 'U_plus_ci_lo' in gt_plus
|
| 237 |
+
if has_ci:
|
| 238 |
+
_ci_band(ax, gt_plus['y_plus'],
|
| 239 |
+
gt_plus['U_plus_ci_lo'], gt_plus['U_plus_ci_hi'])
|
| 240 |
+
ax.semilogx(gt_plus['y_plus'], gt_plus['U_plus'], color=DNS_COLOR,
|
| 241 |
+
linewidth=2, label='DNS', zorder=10)
|
| 242 |
+
|
| 243 |
+
# PIV methods
|
| 244 |
+
for name, piv_plus in methods.items():
|
| 245 |
+
sty = _get_style(name)
|
| 246 |
+
ax.semilogx(piv_plus['y_plus'], piv_plus['U_plus'],
|
| 247 |
+
color=sty['color'], marker=sty['marker'],
|
| 248 |
+
markersize=3.5, alpha=0.7, linestyle='none',
|
| 249 |
+
label=name, zorder=5)
|
| 250 |
+
|
| 251 |
+
ax.set_xlabel(r'$y^+$')
|
| 252 |
+
ax.set_ylabel(r'$U^+$')
|
| 253 |
+
title = 'Mean Velocity Profile Comparison with DNS'
|
| 254 |
+
if title_suffix:
|
| 255 |
+
title += f' ({title_suffix})'
|
| 256 |
+
ax.set_title(title)
|
| 257 |
+
ax.set_xlim(1, Re_tau)
|
| 258 |
+
ax.set_ylim(0, 25)
|
| 259 |
+
ax.grid(True, alpha=0.25, linewidth=0.5)
|
| 260 |
+
ax.legend(loc='lower right', framealpha=0.9)
|
| 261 |
+
|
| 262 |
+
fig.tight_layout()
|
| 263 |
+
fig.savefig(output_dir / 'mean_velocity_comparison.png')
|
| 264 |
+
plt.close(fig)
|
| 265 |
+
print(f" Saved: {output_dir / 'mean_velocity_comparison.png'}")
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
def plot_stresses_subplots(methods, gt_plus, wall_units, output_dir, title_suffix=''):
|
| 269 |
+
"""
|
| 270 |
+
1×3 subplot: uu+, vv+, −uv+ — one marker series per method per panel.
|
| 271 |
+
"""
|
| 272 |
+
output_dir = Path(output_dir)
|
| 273 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 274 |
+
Re_tau = wall_units['Re_tau']
|
| 275 |
+
has_ci = 'uu_plus_ci_lo' in gt_plus
|
| 276 |
+
|
| 277 |
+
panels = [
|
| 278 |
+
('uu_plus', r"$\overline{u'u'}^+$", 1),
|
| 279 |
+
('vv_plus', r"$\overline{v'v'}^+$", 1),
|
| 280 |
+
('uv_plus', r"$-\overline{u'v'}^+$", -1),
|
| 281 |
+
]
|
| 282 |
+
|
| 283 |
+
fig, axes = plt.subplots(1, 3, figsize=(7, 2.8))
|
| 284 |
+
|
| 285 |
+
for ax, (var, ylabel, sign) in zip(axes, panels):
|
| 286 |
+
# CI band
|
| 287 |
+
ci_lo_key, ci_hi_key = f'{var}_ci_lo', f'{var}_ci_hi'
|
| 288 |
+
if has_ci and ci_lo_key in gt_plus:
|
| 289 |
+
_ci_band(ax, gt_plus['y_plus'],
|
| 290 |
+
gt_plus[ci_lo_key], gt_plus[ci_hi_key], sign=sign)
|
| 291 |
+
|
| 292 |
+
# DNS
|
| 293 |
+
ax.plot(gt_plus['y_plus'], sign * gt_plus[var], color=DNS_COLOR,
|
| 294 |
+
linewidth=1.8, label='DNS', zorder=10)
|
| 295 |
+
|
| 296 |
+
# PIV methods
|
| 297 |
+
for name, piv_plus in methods.items():
|
| 298 |
+
sty = _get_style(name)
|
| 299 |
+
ax.plot(piv_plus['y_plus'], sign * piv_plus[var],
|
| 300 |
+
color=sty['color'], marker=sty['marker'],
|
| 301 |
+
markersize=2.5, alpha=0.65, linestyle='none',
|
| 302 |
+
label=name, zorder=5)
|
| 303 |
+
|
| 304 |
+
ax.set_xlabel(r'$y^+$')
|
| 305 |
+
ax.set_ylabel(ylabel)
|
| 306 |
+
ax.set_xscale('log')
|
| 307 |
+
ax.set_xlim(1, Re_tau)
|
| 308 |
+
ax.grid(True, alpha=0.25, linewidth=0.5)
|
| 309 |
+
|
| 310 |
+
# Single shared legend below the title
|
| 311 |
+
handles, labels = axes[0].get_legend_handles_labels()
|
| 312 |
+
fig.legend(handles, labels, loc='upper center', ncol=len(methods) + 1,
|
| 313 |
+
bbox_to_anchor=(0.5, 1.02), framealpha=0.9)
|
| 314 |
+
|
| 315 |
+
suptitle = 'Reynolds Stresses Method Comparison with DNS'
|
| 316 |
+
if title_suffix:
|
| 317 |
+
suptitle += f' ({title_suffix})'
|
| 318 |
+
fig.suptitle(suptitle, y=1.08)
|
| 319 |
+
fig.tight_layout()
|
| 320 |
+
fig.subplots_adjust(top=0.88)
|
| 321 |
+
fig.savefig(output_dir / 'stresses_comparison.png')
|
| 322 |
+
plt.close(fig)
|
| 323 |
+
print(f" Saved: {output_dir / 'stresses_comparison.png'}")
|
| 324 |
+
|
| 325 |
+
|
| 326 |
+
def plot_combined_stresses(methods, gt_plus, wall_units, output_dir, title_suffix=''):
|
| 327 |
+
"""
|
| 328 |
+
All stresses on one axis — line styles distinguish components,
|
| 329 |
+
colours distinguish methods.
|
| 330 |
+
"""
|
| 331 |
+
output_dir = Path(output_dir)
|
| 332 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 333 |
+
Re_tau = wall_units['Re_tau']
|
| 334 |
+
has_ci = 'uu_plus_ci_lo' in gt_plus
|
| 335 |
+
|
| 336 |
+
component_styles = {
|
| 337 |
+
'uu_plus': {'linestyle': '-', 'label_tex': r"$\overline{u'u'}^+$", 'sign': 1},
|
| 338 |
+
'vv_plus': {'linestyle': '--', 'label_tex': r"$\overline{v'v'}^+$", 'sign': 1},
|
| 339 |
+
'uv_plus': {'linestyle': ':', 'label_tex': r"$-\overline{u'v'}^+$", 'sign': -1},
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
fig, ax = plt.subplots(figsize=(7, 5))
|
| 343 |
+
|
| 344 |
+
# ── DNS reference lines ──────────────────────────────────────────────
|
| 345 |
+
for var, csty in component_styles.items():
|
| 346 |
+
sign = csty['sign']
|
| 347 |
+
# CI band
|
| 348 |
+
ci_lo, ci_hi = f'{var}_ci_lo', f'{var}_ci_hi'
|
| 349 |
+
if has_ci and ci_lo in gt_plus:
|
| 350 |
+
_ci_band(ax, gt_plus['y_plus'],
|
| 351 |
+
gt_plus[ci_lo], gt_plus[ci_hi], sign=sign)
|
| 352 |
+
ax.plot(gt_plus['y_plus'], sign * gt_plus[var],
|
| 353 |
+
color=DNS_COLOR, linewidth=1.8, linestyle=csty['linestyle'],
|
| 354 |
+
zorder=10)
|
| 355 |
+
|
| 356 |
+
# ── PIV method markers ───────────────────────────────────────────────
|
| 357 |
+
for name, piv_plus in methods.items():
|
| 358 |
+
sty = _get_style(name)
|
| 359 |
+
for var, csty in component_styles.items():
|
| 360 |
+
sign = csty['sign']
|
| 361 |
+
ax.plot(piv_plus['y_plus'], sign * piv_plus[var],
|
| 362 |
+
color=sty['color'], marker=sty['marker'],
|
| 363 |
+
markersize=2.5, alpha=0.55, linestyle='none',
|
| 364 |
+
zorder=5)
|
| 365 |
+
|
| 366 |
+
# ── Build a clean two-part legend ────────────────────────────────────
|
| 367 |
+
# Part 1: method colours (dummy markers)
|
| 368 |
+
method_handles = []
|
| 369 |
+
for name in methods:
|
| 370 |
+
sty = _get_style(name)
|
| 371 |
+
h = plt.Line2D([], [], color=sty['color'], marker=sty['marker'],
|
| 372 |
+
markersize=5, linestyle='none', label=name)
|
| 373 |
+
method_handles.append(h)
|
| 374 |
+
# DNS entry
|
| 375 |
+
dns_handle = plt.Line2D([], [], color=DNS_COLOR, linewidth=1.8,
|
| 376 |
+
linestyle='-', label='DNS')
|
| 377 |
+
method_handles.insert(0, dns_handle)
|
| 378 |
+
|
| 379 |
+
# Part 2: component line styles (black dummy lines)
|
| 380 |
+
comp_handles = []
|
| 381 |
+
for var, csty in component_styles.items():
|
| 382 |
+
h = plt.Line2D([], [], color='gray', linewidth=1.5,
|
| 383 |
+
linestyle=csty['linestyle'], label=csty['label_tex'])
|
| 384 |
+
comp_handles.append(h)
|
| 385 |
+
|
| 386 |
+
leg1 = ax.legend(handles=method_handles, loc='upper right',
|
| 387 |
+
framealpha=0.9, title='Method')
|
| 388 |
+
ax.add_artist(leg1)
|
| 389 |
+
ax.legend(handles=comp_handles, loc='upper left',
|
| 390 |
+
framealpha=0.9, title='Component')
|
| 391 |
+
|
| 392 |
+
ax.set_xlabel(r'$y^+$')
|
| 393 |
+
ax.set_ylabel(r'Stress$^+$')
|
| 394 |
+
title = 'Reynolds Stresses Method Comparison with DNS'
|
| 395 |
+
if title_suffix:
|
| 396 |
+
title += f' ({title_suffix})'
|
| 397 |
+
ax.set_title(title)
|
| 398 |
+
ax.set_xscale('log')
|
| 399 |
+
ax.set_xlim(1, Re_tau)
|
| 400 |
+
ax.grid(True, alpha=0.25, linewidth=0.5)
|
| 401 |
+
|
| 402 |
+
fig.tight_layout()
|
| 403 |
+
fig.savefig(output_dir / 'combined_stresses_comparison.png')
|
| 404 |
+
plt.close(fig)
|
| 405 |
+
print(f" Saved: {output_dir / 'combined_stresses_comparison.png'}")
|
| 406 |
+
|
| 407 |
+
|
| 408 |
+
# =============================================================================
|
| 409 |
+
# Error summary
|
| 410 |
+
# =============================================================================
|
| 411 |
+
|
| 412 |
+
def print_error_table(methods, gt_plus):
|
| 413 |
+
"""Print R² summary for all methods."""
|
| 414 |
+
from benchmark_comparison import compute_errors
|
| 415 |
+
|
| 416 |
+
header = f"{'Method':<18} {'U+ R²':<10} {'U+ RMS%':<10} {'uu+ R²':<10} {'vv+ R²':<10} {'-uv+ R²':<10}"
|
| 417 |
+
print("\n" + header)
|
| 418 |
+
print("-" * len(header))
|
| 419 |
+
|
| 420 |
+
for name, piv_plus in methods.items():
|
| 421 |
+
errs = compute_errors(piv_plus, gt_plus, y_plus_range=(10, 500))
|
| 422 |
+
u_r2 = errs.get('U_plus', {}).get('r2', float('nan'))
|
| 423 |
+
u_rms = errs.get('U_plus', {}).get('rms_rel', float('nan'))
|
| 424 |
+
uu_r2 = errs.get('uu_plus', {}).get('r2', float('nan'))
|
| 425 |
+
vv_r2 = errs.get('vv_plus', {}).get('r2', float('nan'))
|
| 426 |
+
uv_r2 = errs.get('uv_plus', {}).get('r2', float('nan'))
|
| 427 |
+
print(f"{name:<18} {u_r2:<10.4f} {u_rms:<10.1f} {uu_r2:<10.4f} {vv_r2:<10.4f} {uv_r2:<10.4f}")
|
| 428 |
+
|
| 429 |
+
print()
|
| 430 |
+
|
| 431 |
+
|
| 432 |
+
# =============================================================================
|
| 433 |
+
# Main entry point
|
| 434 |
+
# =============================================================================
|
| 435 |
+
|
| 436 |
+
def compare_methods(
|
| 437 |
+
gt_dir,
|
| 438 |
+
output_dir,
|
| 439 |
+
# Instantaneous
|
| 440 |
+
inst_stats_path=None, inst_run_idx=3, inst_y_offset=3.0,
|
| 441 |
+
# Ensemble
|
| 442 |
+
ens_ensemble_path=None, ens_coords_path=None,
|
| 443 |
+
ens_run_idx=4, ens_y_offset=0.8,
|
| 444 |
+
# Stereo
|
| 445 |
+
stereo_stats_path=None, stereo_run_idx=3, stereo_y_offset=0.8,
|
| 446 |
+
stereo_trim_top=10,
|
| 447 |
+
# Shared
|
| 448 |
+
x_exclude=4,
|
| 449 |
+
title_suffix='',
|
| 450 |
+
inst_window_label=None,
|
| 451 |
+
ens_window_label=None,
|
| 452 |
+
stereo_window_label=None,
|
| 453 |
+
trim_near_wall=0,
|
| 454 |
+
):
|
| 455 |
+
"""
|
| 456 |
+
Compare one pass from each method against DNS ground truth.
|
| 457 |
+
|
| 458 |
+
Parameters
|
| 459 |
+
----------
|
| 460 |
+
gt_dir : str or Path
|
| 461 |
+
Directory containing ground truth (direct_stats.mat etc.)
|
| 462 |
+
output_dir : str or Path
|
| 463 |
+
Where to save figures.
|
| 464 |
+
inst_stats_path : str or Path, optional
|
| 465 |
+
Path to instantaneous mean_stats.mat
|
| 466 |
+
inst_run_idx : int
|
| 467 |
+
0-based run index for instantaneous
|
| 468 |
+
inst_y_offset : float
|
| 469 |
+
Additional y+ offset for instantaneous (on top of hardcoded +1)
|
| 470 |
+
ens_ensemble_path, ens_coords_path : str or Path, optional
|
| 471 |
+
Paths to ensemble_result.mat and coordinates.mat
|
| 472 |
+
ens_run_idx : int
|
| 473 |
+
0-based run index for ensemble
|
| 474 |
+
ens_y_offset : float
|
| 475 |
+
Additional y+ offset for ensemble
|
| 476 |
+
stereo_stats_path : str or Path, optional
|
| 477 |
+
Path to stereo mean_stats.mat
|
| 478 |
+
stereo_run_idx : int
|
| 479 |
+
0-based run index for stereo
|
| 480 |
+
stereo_y_offset : float
|
| 481 |
+
Additional y+ offset for stereo
|
| 482 |
+
stereo_trim_top : int
|
| 483 |
+
Trim this many high-y points from stereo (NaN border cleanup)
|
| 484 |
+
x_exclude : int
|
| 485 |
+
Vectors to exclude from each x-edge
|
| 486 |
+
"""
|
| 487 |
+
gt_plus, wu = _load_ground_truth(gt_dir)
|
| 488 |
+
print(f"DNS: Re_tau={wu['Re_tau']:.0f}, u_tau={wu['u_tau']:.4f} mm/s")
|
| 489 |
+
|
| 490 |
+
methods = {}
|
| 491 |
+
|
| 492 |
+
def _trim(piv_plus, n):
|
| 493 |
+
"""Remove n lowest y+ points (nearest wall)."""
|
| 494 |
+
if n <= 0:
|
| 495 |
+
return piv_plus
|
| 496 |
+
yp = piv_plus['y_plus']
|
| 497 |
+
if yp[0] > yp[-1]:
|
| 498 |
+
# Sorted high-to-low: wall is at the end
|
| 499 |
+
sl = slice(None, -n if n > 0 else None)
|
| 500 |
+
else:
|
| 501 |
+
# Sorted low-to-high: wall is at the start
|
| 502 |
+
sl = slice(n, None)
|
| 503 |
+
return {k: (v[sl] if isinstance(v, np.ndarray) and len(v) > n else v)
|
| 504 |
+
for k, v in piv_plus.items()}
|
| 505 |
+
|
| 506 |
+
if inst_stats_path is not None:
|
| 507 |
+
label = f"Instantaneous ({inst_window_label})" if inst_window_label else "Instantaneous"
|
| 508 |
+
print(f"\nLoading {label} (run {inst_run_idx}, y+ offset +{inst_y_offset})...")
|
| 509 |
+
data = load_instantaneous(inst_stats_path, inst_run_idx, wu, inst_y_offset, x_exclude)
|
| 510 |
+
methods[label] = _trim(data, trim_near_wall)
|
| 511 |
+
p = methods[label]
|
| 512 |
+
print(f" y+ range: {p['y_plus'].min():.1f} – {p['y_plus'].max():.1f}")
|
| 513 |
+
|
| 514 |
+
if ens_ensemble_path is not None and ens_coords_path is not None:
|
| 515 |
+
label = f"Ensemble ({ens_window_label})" if ens_window_label else "Ensemble"
|
| 516 |
+
print(f"\nLoading {label} (run {ens_run_idx}, y+ offset +{ens_y_offset})...")
|
| 517 |
+
methods[label] = load_ensemble(
|
| 518 |
+
ens_ensemble_path, ens_coords_path,
|
| 519 |
+
ens_run_idx, wu, ens_y_offset, x_exclude)
|
| 520 |
+
p = methods[label]
|
| 521 |
+
print(f" y+ range: {p['y_plus'].min():.1f} – {p['y_plus'].max():.1f}")
|
| 522 |
+
|
| 523 |
+
if stereo_stats_path is not None:
|
| 524 |
+
label = f"Stereo ({stereo_window_label})" if stereo_window_label else "Stereo"
|
| 525 |
+
print(f"\nLoading {label} (run {stereo_run_idx}, y+ offset +{stereo_y_offset}, "
|
| 526 |
+
f"trim top {stereo_trim_top})...")
|
| 527 |
+
data = load_stereo(
|
| 528 |
+
stereo_stats_path, stereo_run_idx, wu, stereo_y_offset,
|
| 529 |
+
x_exclude, stereo_trim_top)
|
| 530 |
+
methods[label] = _trim(data, trim_near_wall)
|
| 531 |
+
p = methods[label]
|
| 532 |
+
print(f" y+ range: {p['y_plus'].min():.1f} – {p['y_plus'].max():.1f}")
|
| 533 |
+
|
| 534 |
+
if not methods:
|
| 535 |
+
raise ValueError("No data loaded — provide at least one method path.")
|
| 536 |
+
|
| 537 |
+
print_error_table(methods, gt_plus)
|
| 538 |
+
|
| 539 |
+
print("Generating plots...")
|
| 540 |
+
output_dir = Path(output_dir)
|
| 541 |
+
plot_velocity_comparison(methods, gt_plus, wu, output_dir, title_suffix=title_suffix)
|
| 542 |
+
plot_stresses_subplots(methods, gt_plus, wu, output_dir, title_suffix=title_suffix)
|
| 543 |
+
plot_combined_stresses(methods, gt_plus, wu, output_dir, title_suffix=title_suffix)
|
| 544 |
+
print("Done.")
|
| 545 |
+
|
| 546 |
+
|
| 547 |
+
if __name__ == '__main__':
|
| 548 |
+
import argparse
|
| 549 |
+
|
| 550 |
+
parser = argparse.ArgumentParser(
|
| 551 |
+
description='Cross-method PIV comparison (Instantaneous / Ensemble / Stereo)')
|
| 552 |
+
|
| 553 |
+
parser.add_argument('--gt-dir', '-g', required=True,
|
| 554 |
+
help='Ground truth directory')
|
| 555 |
+
parser.add_argument('--output-dir', '-o', required=True,
|
| 556 |
+
help='Output directory for figures')
|
| 557 |
+
|
| 558 |
+
# Instantaneous
|
| 559 |
+
parser.add_argument('--inst-stats', type=str, default=None,
|
| 560 |
+
help='Path to instantaneous mean_stats.mat')
|
| 561 |
+
parser.add_argument('--inst-run', type=int, default=3,
|
| 562 |
+
help='0-based run index (default: 3)')
|
| 563 |
+
parser.add_argument('--inst-y-offset', type=float, default=3.0,
|
| 564 |
+
help='Additional y+ offset (default: 3.0)')
|
| 565 |
+
|
| 566 |
+
# Ensemble
|
| 567 |
+
parser.add_argument('--ens-dir', type=str, default=None,
|
| 568 |
+
help='Directory with ensemble_result.mat + coordinates.mat')
|
| 569 |
+
parser.add_argument('--ens-run', type=int, default=4,
|
| 570 |
+
help='0-based run index (default: 4)')
|
| 571 |
+
parser.add_argument('--ens-y-offset', type=float, default=0.8,
|
| 572 |
+
help='Additional y+ offset (default: 0.8)')
|
| 573 |
+
|
| 574 |
+
# Stereo
|
| 575 |
+
parser.add_argument('--stereo-stats', type=str, default=None,
|
| 576 |
+
help='Path to stereo mean_stats.mat')
|
| 577 |
+
parser.add_argument('--stereo-run', type=int, default=3,
|
| 578 |
+
help='0-based run index (default: 3)')
|
| 579 |
+
parser.add_argument('--stereo-y-offset', type=float, default=0.8,
|
| 580 |
+
help='Additional y+ offset (default: 0.8)')
|
| 581 |
+
parser.add_argument('--stereo-trim-top', type=int, default=10,
|
| 582 |
+
help='Trim N highest y points from stereo (default: 10)')
|
| 583 |
+
|
| 584 |
+
parser.add_argument('--x-exclude', type=int, default=4,
|
| 585 |
+
help='Vectors to exclude from each x-edge (default: 4)')
|
| 586 |
+
|
| 587 |
+
args = parser.parse_args()
|
| 588 |
+
|
| 589 |
+
ens_ensemble_path = None
|
| 590 |
+
ens_coords_path = None
|
| 591 |
+
if args.ens_dir:
|
| 592 |
+
ens_dir = Path(args.ens_dir)
|
| 593 |
+
ens_ensemble_path = ens_dir / 'ensemble_result.mat'
|
| 594 |
+
ens_coords_path = ens_dir / 'coordinates.mat'
|
| 595 |
+
|
| 596 |
+
compare_methods(
|
| 597 |
+
gt_dir=args.gt_dir,
|
| 598 |
+
output_dir=args.output_dir,
|
| 599 |
+
inst_stats_path=args.inst_stats,
|
| 600 |
+
inst_run_idx=args.inst_run,
|
| 601 |
+
inst_y_offset=args.inst_y_offset,
|
| 602 |
+
ens_ensemble_path=ens_ensemble_path,
|
| 603 |
+
ens_coords_path=ens_coords_path,
|
| 604 |
+
ens_run_idx=args.ens_run,
|
| 605 |
+
ens_y_offset=args.ens_y_offset,
|
| 606 |
+
stereo_stats_path=args.stereo_stats,
|
| 607 |
+
stereo_run_idx=args.stereo_run,
|
| 608 |
+
stereo_y_offset=args.stereo_y_offset,
|
| 609 |
+
stereo_trim_top=args.stereo_trim_top,
|
| 610 |
+
x_exclude=args.x_exclude,
|
| 611 |
+
)
|
scripts/paper_figures.py
ADDED
|
@@ -0,0 +1,462 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Paper-ready validation figures: clean + noisy data on the same axes.
|
| 4 |
+
|
| 5 |
+
Open symbols = Case A (ideal conditions)
|
| 6 |
+
Filled symbols = Case B (degraded, SNR ~8)
|
| 7 |
+
DNS reference = solid black line with 95% CI band
|
| 8 |
+
|
| 9 |
+
Produces:
|
| 10 |
+
1. fig_mean_velocity.png — U+ vs y+
|
| 11 |
+
2. fig_stresses.png — 1x3 subplots (uu+, vv+, -uv+)
|
| 12 |
+
3. fig_combined_stresses.png — all stresses on one axis
|
| 13 |
+
"""
|
| 14 |
+
|
| 15 |
+
import numpy as np
|
| 16 |
+
import scipy.io as sio
|
| 17 |
+
from scipy.interpolate import interp1d
|
| 18 |
+
import matplotlib.pyplot as plt
|
| 19 |
+
import matplotlib as mpl
|
| 20 |
+
from pathlib import Path
|
| 21 |
+
|
| 22 |
+
# ── Publication font setup: match LaTeX body text ─────────────────────────────
|
| 23 |
+
mpl.rcParams.update({
|
| 24 |
+
'font.family': 'serif',
|
| 25 |
+
'font.serif': ['CMU Serif', 'Computer Modern Roman', 'DejaVu Serif'],
|
| 26 |
+
'mathtext.fontset': 'cm',
|
| 27 |
+
'axes.unicode_minus': False,
|
| 28 |
+
'text.usetex': False,
|
| 29 |
+
'axes.labelsize': 11,
|
| 30 |
+
'axes.titlesize': 11,
|
| 31 |
+
'legend.fontsize': 9,
|
| 32 |
+
'xtick.labelsize': 10,
|
| 33 |
+
'ytick.labelsize': 10,
|
| 34 |
+
'lines.linewidth': 1.5,
|
| 35 |
+
'figure.dpi': 600,
|
| 36 |
+
'savefig.dpi': 600,
|
| 37 |
+
'savefig.bbox': 'tight',
|
| 38 |
+
'savefig.pad_inches': 0.05,
|
| 39 |
+
})
|
| 40 |
+
|
| 41 |
+
# ── Okabe-Ito colourblind-safe palette ────────────────────────────────────────
|
| 42 |
+
COLORS = {
|
| 43 |
+
'Instantaneous': '#0072B2',
|
| 44 |
+
'Ensemble': '#D55E00',
|
| 45 |
+
'Stereo': '#009E73',
|
| 46 |
+
}
|
| 47 |
+
MARKERS = {
|
| 48 |
+
'Instantaneous': 'o',
|
| 49 |
+
'Ensemble': 's',
|
| 50 |
+
'Stereo': '^',
|
| 51 |
+
}
|
| 52 |
+
DNS_COLOR = 'k'
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
# =============================================================================
|
| 56 |
+
# Data loading (reuse from benchmark_comparison)
|
| 57 |
+
# =============================================================================
|
| 58 |
+
|
| 59 |
+
def _load_gt(gt_dir):
|
| 60 |
+
from benchmark_comparison import load_wall_units, load_ground_truth
|
| 61 |
+
gt_dir = Path(gt_dir)
|
| 62 |
+
for name in ('wall_units.mat', 'diagnostics.mat', 'direct_stats.mat'):
|
| 63 |
+
p = gt_dir / name
|
| 64 |
+
if p.exists():
|
| 65 |
+
wu = load_wall_units(p)
|
| 66 |
+
break
|
| 67 |
+
for name in ('profiles.mat', 'ensemble_statistics_full.mat', 'direct_stats.mat'):
|
| 68 |
+
p = gt_dir / name
|
| 69 |
+
if p.exists():
|
| 70 |
+
gt = load_ground_truth(p, wall_units_path=gt_dir / 'direct_stats.mat')
|
| 71 |
+
break
|
| 72 |
+
gt_plus = {
|
| 73 |
+
'y_plus': gt['y_plus'], 'U_plus': gt['U_plus'],
|
| 74 |
+
'uu_plus': gt['uu_plus'], 'vv_plus': gt['vv_plus'], 'uv_plus': gt['uv_plus'],
|
| 75 |
+
}
|
| 76 |
+
for key in ('uu_plus_ci_lo', 'uu_plus_ci_hi', 'vv_plus_ci_lo', 'vv_plus_ci_hi',
|
| 77 |
+
'uv_plus_ci_lo', 'uv_plus_ci_hi', 'U_plus_ci_lo', 'U_plus_ci_hi'):
|
| 78 |
+
if key in gt:
|
| 79 |
+
gt_plus[key] = gt[key]
|
| 80 |
+
return gt_plus, wu
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def _load_inst(stats_path, run_idx, wu, y_offset):
|
| 84 |
+
from benchmark_comparison import (
|
| 85 |
+
load_piv_statistics, compute_piv_profiles, convert_to_wall_units)
|
| 86 |
+
piv = load_piv_statistics(Path(stats_path), run_idx=run_idx)
|
| 87 |
+
prof = compute_piv_profiles(piv, x_exclude_vectors=4)
|
| 88 |
+
plus = convert_to_wall_units(prof, wu, y_offset_mm=-prof['y_mm'].min())
|
| 89 |
+
plus['y_plus'] = plus['y_plus'] + 1.0 + y_offset
|
| 90 |
+
return plus
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def _load_ens(ens_path, coords_path, run_idx, wu, y_offset):
|
| 94 |
+
from benchmark_comparison import (
|
| 95 |
+
load_ensemble_statistics, compute_piv_profiles, convert_to_wall_units)
|
| 96 |
+
piv = load_ensemble_statistics(Path(ens_path), Path(coords_path), run_idx=run_idx)
|
| 97 |
+
prof = compute_piv_profiles(piv, x_exclude_vectors=4)
|
| 98 |
+
plus = convert_to_wall_units(prof, wu, y_offset_mm=-prof['y_mm'].min())
|
| 99 |
+
plus['y_plus'] = plus['y_plus'] + 1.0 + y_offset
|
| 100 |
+
return plus
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
def _load_stereo(stats_path, run_idx, wu, y_offset, trim_top=10):
|
| 104 |
+
from benchmark_comparison import convert_to_wall_units
|
| 105 |
+
stats = sio.loadmat(str(stats_path), squeeze_me=True, struct_as_record=False)
|
| 106 |
+
piv_s = stats['piv_result'][run_idx]
|
| 107 |
+
coords_s = stats['coordinates'][run_idx]
|
| 108 |
+
x, y = coords_s.x, coords_s.y
|
| 109 |
+
valid_cols = np.any(~np.isnan(y), axis=0)
|
| 110 |
+
col_indices = np.where(valid_cols)[0]
|
| 111 |
+
mid_col = col_indices[len(col_indices) // 2]
|
| 112 |
+
y_unique = y[:, mid_col]
|
| 113 |
+
valid_rows = ~np.isnan(y_unique)
|
| 114 |
+
y_unique = y_unique[valid_rows]
|
| 115 |
+
if trim_top > 0:
|
| 116 |
+
if y_unique[0] > y_unique[-1]:
|
| 117 |
+
y_unique = y_unique[trim_top:]
|
| 118 |
+
vi = np.where(valid_rows)[0][trim_top:]
|
| 119 |
+
else:
|
| 120 |
+
y_unique = y_unique[:-trim_top]
|
| 121 |
+
vi = np.where(valid_rows)[0][:-trim_top]
|
| 122 |
+
tm = np.zeros(valid_rows.shape, dtype=bool)
|
| 123 |
+
tm[vi] = True
|
| 124 |
+
valid_rows = tm
|
| 125 |
+
xs = col_indices[0] + 4
|
| 126 |
+
xe = col_indices[-1] - 3
|
| 127 |
+
x_mask = np.zeros(x.shape[1], dtype=bool)
|
| 128 |
+
x_mask[xs:xe] = True
|
| 129 |
+
prof = {
|
| 130 |
+
'y_mm': y_unique,
|
| 131 |
+
'U': np.nanmean(piv_s.ux[valid_rows][:, x_mask] * 1000, axis=1),
|
| 132 |
+
'V': np.nanmean(piv_s.uy[valid_rows][:, x_mask] * 1000, axis=1),
|
| 133 |
+
'uu': np.nanmean(piv_s.uu[valid_rows][:, x_mask] * 1e6, axis=1),
|
| 134 |
+
'vv': np.nanmean(piv_s.vv[valid_rows][:, x_mask] * 1e6, axis=1),
|
| 135 |
+
'uv': np.nanmean(piv_s.uv[valid_rows][:, x_mask] * 1e6, axis=1),
|
| 136 |
+
}
|
| 137 |
+
plus = convert_to_wall_units(prof, wu, y_offset_mm=-prof['y_mm'].min())
|
| 138 |
+
plus['y_plus'] = plus['y_plus'] + 1.0 + y_offset
|
| 139 |
+
return plus
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
def _trim(plus, n=1):
|
| 143 |
+
"""Remove n near-wall points."""
|
| 144 |
+
if n <= 0:
|
| 145 |
+
return plus
|
| 146 |
+
yp = plus['y_plus']
|
| 147 |
+
if yp[0] > yp[-1]:
|
| 148 |
+
sl = slice(None, -n)
|
| 149 |
+
else:
|
| 150 |
+
sl = slice(n, None)
|
| 151 |
+
return {k: (v[sl] if isinstance(v, np.ndarray) and len(v) > n else v)
|
| 152 |
+
for k, v in plus.items()}
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
# =============================================================================
|
| 156 |
+
# Plotting helpers
|
| 157 |
+
# =============================================================================
|
| 158 |
+
|
| 159 |
+
def _ci_band(ax, yp, lo, hi, sign=1):
|
| 160 |
+
if sign == -1:
|
| 161 |
+
lo, hi = hi, lo
|
| 162 |
+
ax.fill_between(yp, sign * lo, sign * hi,
|
| 163 |
+
color=DNS_COLOR, alpha=0.10, linewidth=0)
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
def _plot_method(ax, yp, vals, method, filled=True, label=None, ms=3.5, alpha=0.7):
|
| 167 |
+
"""Plot a single method series — filled or open markers."""
|
| 168 |
+
color = COLORS[method]
|
| 169 |
+
marker = MARKERS[method]
|
| 170 |
+
if filled:
|
| 171 |
+
ax.plot(yp, vals, color=color, marker=marker, markersize=ms,
|
| 172 |
+
alpha=alpha, linestyle='none', label=label, zorder=5)
|
| 173 |
+
else:
|
| 174 |
+
ax.plot(yp, vals, marker=marker, markersize=ms, alpha=alpha,
|
| 175 |
+
linestyle='none', label=label, zorder=4,
|
| 176 |
+
markerfacecolor='none', markeredgecolor=color, markeredgewidth=0.8)
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
# =============================================================================
|
| 180 |
+
# Figure 1: Mean velocity
|
| 181 |
+
# =============================================================================
|
| 182 |
+
|
| 183 |
+
def plot_velocity(gt_plus, clean, noisy, wu, output_dir):
|
| 184 |
+
Re_tau = wu['Re_tau']
|
| 185 |
+
fig, ax = plt.subplots(figsize=(7, 5))
|
| 186 |
+
|
| 187 |
+
# DNS + CI
|
| 188 |
+
if 'U_plus_ci_lo' in gt_plus:
|
| 189 |
+
_ci_band(ax, gt_plus['y_plus'], gt_plus['U_plus_ci_lo'], gt_plus['U_plus_ci_hi'])
|
| 190 |
+
ax.semilogx(gt_plus['y_plus'], gt_plus['U_plus'], color=DNS_COLOR,
|
| 191 |
+
linewidth=2, label='DNS', zorder=10)
|
| 192 |
+
|
| 193 |
+
# Clean (open)
|
| 194 |
+
for method, plus in clean.items():
|
| 195 |
+
_plot_method(ax, plus['y_plus'], plus['U_plus'], method, filled=False,
|
| 196 |
+
label=f'{method} — Case A')
|
| 197 |
+
|
| 198 |
+
# Noisy (filled)
|
| 199 |
+
for method, plus in noisy.items():
|
| 200 |
+
_plot_method(ax, plus['y_plus'], plus['U_plus'], method, filled=True,
|
| 201 |
+
label=f'{method} — Case B')
|
| 202 |
+
|
| 203 |
+
ax.set_xlabel(r'$y^+$')
|
| 204 |
+
ax.set_ylabel(r'$U^+$')
|
| 205 |
+
ax.set_xlim(1, Re_tau)
|
| 206 |
+
ax.set_ylim(0, 25)
|
| 207 |
+
ax.grid(True, alpha=0.25, linewidth=0.5)
|
| 208 |
+
ax.legend(loc='lower right', framealpha=0.9)
|
| 209 |
+
|
| 210 |
+
fig.tight_layout()
|
| 211 |
+
out = Path(output_dir)
|
| 212 |
+
out.mkdir(parents=True, exist_ok=True)
|
| 213 |
+
fig.savefig(out / 'fig_mean_velocity.png')
|
| 214 |
+
fig.savefig(out / 'fig_mean_velocity.pdf')
|
| 215 |
+
plt.close(fig)
|
| 216 |
+
print(f' Saved: {out / "fig_mean_velocity.png"}')
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
# =============================================================================
|
| 220 |
+
# Figure 2: Stresses — 1x3 subplots
|
| 221 |
+
# =============================================================================
|
| 222 |
+
|
| 223 |
+
def plot_stresses_subplots(gt_plus, clean, noisy, wu, output_dir):
|
| 224 |
+
Re_tau = wu['Re_tau']
|
| 225 |
+
has_ci = 'uu_plus_ci_lo' in gt_plus
|
| 226 |
+
|
| 227 |
+
panels = [
|
| 228 |
+
('uu_plus', r"$\overline{u'u'}^+$", 1),
|
| 229 |
+
('vv_plus', r"$\overline{v'v'}^+$", 1),
|
| 230 |
+
('uv_plus', r"$-\overline{u'v'}^+$", -1),
|
| 231 |
+
]
|
| 232 |
+
|
| 233 |
+
fig, axes = plt.subplots(1, 3, figsize=(7, 2.8))
|
| 234 |
+
|
| 235 |
+
for ax, (var, ylabel, sign) in zip(axes, panels):
|
| 236 |
+
# CI band
|
| 237 |
+
ci_lo_key, ci_hi_key = f'{var}_ci_lo', f'{var}_ci_hi'
|
| 238 |
+
if has_ci and ci_lo_key in gt_plus:
|
| 239 |
+
_ci_band(ax, gt_plus['y_plus'], gt_plus[ci_lo_key], gt_plus[ci_hi_key], sign=sign)
|
| 240 |
+
|
| 241 |
+
# DNS
|
| 242 |
+
ax.plot(gt_plus['y_plus'], sign * gt_plus[var], color=DNS_COLOR,
|
| 243 |
+
linewidth=1.8, label='DNS', zorder=10)
|
| 244 |
+
|
| 245 |
+
# Clean (open)
|
| 246 |
+
for method, plus in clean.items():
|
| 247 |
+
_plot_method(ax, plus['y_plus'], sign * plus[var], method,
|
| 248 |
+
filled=False, label=f'{method} — A', ms=2.5, alpha=0.65)
|
| 249 |
+
|
| 250 |
+
# Noisy (filled)
|
| 251 |
+
for method, plus in noisy.items():
|
| 252 |
+
_plot_method(ax, plus['y_plus'], sign * plus[var], method,
|
| 253 |
+
filled=True, label=f'{method} — B', ms=2.5, alpha=0.65)
|
| 254 |
+
|
| 255 |
+
ax.set_xlabel(r'$y^+$')
|
| 256 |
+
ax.set_ylabel(ylabel)
|
| 257 |
+
ax.set_xscale('log')
|
| 258 |
+
ax.set_xlim(1, Re_tau)
|
| 259 |
+
ax.grid(True, alpha=0.25, linewidth=0.5)
|
| 260 |
+
|
| 261 |
+
# Shared legend
|
| 262 |
+
handles, labels = axes[0].get_legend_handles_labels()
|
| 263 |
+
fig.legend(handles, labels, loc='upper center', ncol=4,
|
| 264 |
+
bbox_to_anchor=(0.5, 1.05), framealpha=0.9, fontsize=8)
|
| 265 |
+
|
| 266 |
+
fig.tight_layout()
|
| 267 |
+
fig.subplots_adjust(top=0.82)
|
| 268 |
+
out = Path(output_dir)
|
| 269 |
+
out.mkdir(parents=True, exist_ok=True)
|
| 270 |
+
fig.savefig(out / 'fig_stresses.png')
|
| 271 |
+
fig.savefig(out / 'fig_stresses.pdf')
|
| 272 |
+
plt.close(fig)
|
| 273 |
+
print(f' Saved: {out / "fig_stresses.png"}')
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
# =============================================================================
|
| 277 |
+
# Figure 3: Combined stresses — single axis
|
| 278 |
+
# =============================================================================
|
| 279 |
+
|
| 280 |
+
def plot_combined_stresses(gt_plus, clean, noisy, wu, output_dir):
|
| 281 |
+
Re_tau = wu['Re_tau']
|
| 282 |
+
has_ci = 'uu_plus_ci_lo' in gt_plus
|
| 283 |
+
|
| 284 |
+
component_styles = {
|
| 285 |
+
'uu_plus': {'ls': '-', 'tex': r"$\overline{u'u'}^+$", 'sign': 1},
|
| 286 |
+
'vv_plus': {'ls': '--', 'tex': r"$\overline{v'v'}^+$", 'sign': 1},
|
| 287 |
+
'uv_plus': {'ls': ':', 'tex': r"$-\overline{u'v'}^+$", 'sign': -1},
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
fig, ax = plt.subplots(figsize=(7, 5))
|
| 291 |
+
|
| 292 |
+
# DNS reference lines + CI bands
|
| 293 |
+
for var, csty in component_styles.items():
|
| 294 |
+
sign = csty['sign']
|
| 295 |
+
ci_lo, ci_hi = f'{var}_ci_lo', f'{var}_ci_hi'
|
| 296 |
+
if has_ci and ci_lo in gt_plus:
|
| 297 |
+
_ci_band(ax, gt_plus['y_plus'], gt_plus[ci_lo], gt_plus[ci_hi], sign=sign)
|
| 298 |
+
ax.plot(gt_plus['y_plus'], sign * gt_plus[var],
|
| 299 |
+
color=DNS_COLOR, linewidth=1.8, linestyle=csty['ls'], zorder=10)
|
| 300 |
+
|
| 301 |
+
# Clean (open) — all components
|
| 302 |
+
for method, plus in clean.items():
|
| 303 |
+
for var, csty in component_styles.items():
|
| 304 |
+
_plot_method(ax, plus['y_plus'], csty['sign'] * plus[var], method,
|
| 305 |
+
filled=False, ms=2.5, alpha=0.55)
|
| 306 |
+
|
| 307 |
+
# Noisy (filled) — all components
|
| 308 |
+
for method, plus in noisy.items():
|
| 309 |
+
for var, csty in component_styles.items():
|
| 310 |
+
_plot_method(ax, plus['y_plus'], csty['sign'] * plus[var], method,
|
| 311 |
+
filled=True, ms=2.5, alpha=0.55)
|
| 312 |
+
|
| 313 |
+
# ── Two-part legend ──────────────────────────────────────────────────
|
| 314 |
+
# Part 1: method + condition
|
| 315 |
+
method_handles = [
|
| 316 |
+
plt.Line2D([], [], color=DNS_COLOR, linewidth=1.8, linestyle='-', label='DNS')
|
| 317 |
+
]
|
| 318 |
+
for method in list(clean.keys()) + [m for m in noisy if m not in clean]:
|
| 319 |
+
c = COLORS[method]
|
| 320 |
+
m = MARKERS[method]
|
| 321 |
+
# Open (Case A)
|
| 322 |
+
method_handles.append(
|
| 323 |
+
plt.Line2D([], [], color=c, marker=m, markersize=5, linestyle='none',
|
| 324 |
+
markerfacecolor='none', markeredgecolor=c, markeredgewidth=0.8,
|
| 325 |
+
label=f'{method} — Case A'))
|
| 326 |
+
# Filled (Case B)
|
| 327 |
+
method_handles.append(
|
| 328 |
+
plt.Line2D([], [], color=c, marker=m, markersize=5, linestyle='none',
|
| 329 |
+
label=f'{method} — Case B'))
|
| 330 |
+
|
| 331 |
+
# Part 2: component line styles
|
| 332 |
+
comp_handles = []
|
| 333 |
+
for var, csty in component_styles.items():
|
| 334 |
+
comp_handles.append(
|
| 335 |
+
plt.Line2D([], [], color='gray', linewidth=1.5,
|
| 336 |
+
linestyle=csty['ls'], label=csty['tex']))
|
| 337 |
+
|
| 338 |
+
leg1 = ax.legend(handles=method_handles, loc='upper right',
|
| 339 |
+
framealpha=0.9, title='Method')
|
| 340 |
+
ax.add_artist(leg1)
|
| 341 |
+
ax.legend(handles=comp_handles, loc='upper left',
|
| 342 |
+
framealpha=0.9, title='Component')
|
| 343 |
+
|
| 344 |
+
ax.set_xlabel(r'$y^+$')
|
| 345 |
+
ax.set_ylabel(r'Stress$^+$')
|
| 346 |
+
ax.set_xscale('log')
|
| 347 |
+
ax.set_xlim(1, Re_tau)
|
| 348 |
+
ax.grid(True, alpha=0.25, linewidth=0.5)
|
| 349 |
+
|
| 350 |
+
fig.tight_layout()
|
| 351 |
+
out = Path(output_dir)
|
| 352 |
+
out.mkdir(parents=True, exist_ok=True)
|
| 353 |
+
fig.savefig(out / 'fig_combined_stresses.png')
|
| 354 |
+
fig.savefig(out / 'fig_combined_stresses.pdf')
|
| 355 |
+
plt.close(fig)
|
| 356 |
+
print(f' Saved: {out / "fig_combined_stresses.png"}')
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
# =============================================================================
|
| 360 |
+
# Main
|
| 361 |
+
# =============================================================================
|
| 362 |
+
|
| 363 |
+
if __name__ == '__main__':
|
| 364 |
+
import argparse
|
| 365 |
+
parser = argparse.ArgumentParser(
|
| 366 |
+
description='Generate combined clean+noisy paper figures. '
|
| 367 |
+
'All path arguments accept either the Case A (clean) or Case B (noisy) '
|
| 368 |
+
'variant; if only noisy paths are supplied, only Case B is plotted.')
|
| 369 |
+
parser.add_argument('--output-dir', '-o', type=str, required=True,
|
| 370 |
+
help='Output directory for generated figures')
|
| 371 |
+
|
| 372 |
+
# Ground truth (required — at least one of the two must be provided)
|
| 373 |
+
parser.add_argument('--gt-clean-dir', type=str, default=None,
|
| 374 |
+
help='Directory containing direct_stats.mat for Case A (clean / 85k particles)')
|
| 375 |
+
parser.add_argument('--gt-noisy-dir', type=str, default=None,
|
| 376 |
+
help='Directory containing direct_stats.mat for Case B (noisy / 22k particles)')
|
| 377 |
+
|
| 378 |
+
# Case A (clean) PIV results
|
| 379 |
+
parser.add_argument('--inst-clean-stats', type=str, default=None,
|
| 380 |
+
help='Path to instantaneous mean_stats.mat for Case A')
|
| 381 |
+
parser.add_argument('--ens-clean-dir', type=str, default=None,
|
| 382 |
+
help='Directory containing ensemble_result.mat + coordinates.mat for Case A')
|
| 383 |
+
parser.add_argument('--stereo-clean-stats', type=str, default=None,
|
| 384 |
+
help='Path to stereo mean_stats.mat for Case A')
|
| 385 |
+
|
| 386 |
+
# Case B (noisy) PIV results
|
| 387 |
+
parser.add_argument('--inst-noisy-stats', type=str, default=None,
|
| 388 |
+
help='Path to instantaneous mean_stats.mat for Case B')
|
| 389 |
+
parser.add_argument('--ens-noisy-dir', type=str, default=None,
|
| 390 |
+
help='Directory containing ensemble_result.mat + coordinates.mat for Case B')
|
| 391 |
+
parser.add_argument('--stereo-noisy-stats', type=str, default=None,
|
| 392 |
+
help='Path to stereo mean_stats.mat for Case B')
|
| 393 |
+
|
| 394 |
+
args = parser.parse_args()
|
| 395 |
+
output_dir = Path(args.output_dir)
|
| 396 |
+
|
| 397 |
+
if not args.gt_clean_dir and not args.gt_noisy_dir:
|
| 398 |
+
parser.error('At least one of --gt-clean-dir / --gt-noisy-dir must be provided')
|
| 399 |
+
|
| 400 |
+
# Ground truth: prefer clean (85k particles, tighter CI) for reference axes
|
| 401 |
+
gt_dir_primary = args.gt_clean_dir or args.gt_noisy_dir
|
| 402 |
+
gt_plus, wu = _load_gt(Path(gt_dir_primary))
|
| 403 |
+
print(f"DNS: Re_tau={wu['Re_tau']:.0f}")
|
| 404 |
+
|
| 405 |
+
# ── Case A (clean) ───────────────────────────────────────────────────
|
| 406 |
+
clean = {}
|
| 407 |
+
if args.inst_clean_stats or args.ens_clean_dir or args.stereo_clean_stats:
|
| 408 |
+
print("\nLoading Case A (ideal)...")
|
| 409 |
+
if args.inst_clean_stats:
|
| 410 |
+
inst_clean = _trim(_load_inst(
|
| 411 |
+
Path(args.inst_clean_stats), run_idx=3, wu=wu, y_offset=3.0))
|
| 412 |
+
print(f" Instantaneous 16x16: y+={inst_clean['y_plus'].min():.1f}-{inst_clean['y_plus'].max():.1f}")
|
| 413 |
+
clean['Instantaneous'] = inst_clean
|
| 414 |
+
if args.ens_clean_dir:
|
| 415 |
+
ens_dir = Path(args.ens_clean_dir)
|
| 416 |
+
ens_clean = _load_ens(
|
| 417 |
+
ens_dir / 'ensemble_result.mat',
|
| 418 |
+
ens_dir / 'coordinates.mat',
|
| 419 |
+
run_idx=3, wu=wu, y_offset=0.8)
|
| 420 |
+
print(f" Ensemble 8x16: y+={ens_clean['y_plus'].min():.1f}-{ens_clean['y_plus'].max():.1f}")
|
| 421 |
+
clean['Ensemble'] = ens_clean
|
| 422 |
+
if args.stereo_clean_stats:
|
| 423 |
+
stereo_clean = _trim(_load_stereo(
|
| 424 |
+
Path(args.stereo_clean_stats), run_idx=3, wu=wu, y_offset=0.8))
|
| 425 |
+
print(f" Stereo 16x16: y+={stereo_clean['y_plus'].min():.1f}-{stereo_clean['y_plus'].max():.1f}")
|
| 426 |
+
clean['Stereo'] = stereo_clean
|
| 427 |
+
|
| 428 |
+
# ── Case B (noisy) ───────────────────────────────────────────────────
|
| 429 |
+
noisy = {}
|
| 430 |
+
if args.inst_noisy_stats or args.ens_noisy_dir or args.stereo_noisy_stats:
|
| 431 |
+
print("\nLoading Case B (degraded, SNR ~8)...")
|
| 432 |
+
wu_n = wu # fallback to clean wu
|
| 433 |
+
if args.gt_noisy_dir:
|
| 434 |
+
_, wu_n = _load_gt(Path(args.gt_noisy_dir))
|
| 435 |
+
if args.inst_noisy_stats:
|
| 436 |
+
inst_noisy = _trim(_load_inst(
|
| 437 |
+
Path(args.inst_noisy_stats), run_idx=2, wu=wu_n, y_offset=3.0))
|
| 438 |
+
print(f" Instantaneous 32x32: y+={inst_noisy['y_plus'].min():.1f}-{inst_noisy['y_plus'].max():.1f}")
|
| 439 |
+
noisy['Instantaneous'] = inst_noisy
|
| 440 |
+
if args.ens_noisy_dir:
|
| 441 |
+
ens_dir_n = Path(args.ens_noisy_dir)
|
| 442 |
+
ens_noisy = _load_ens(
|
| 443 |
+
ens_dir_n / 'ensemble_result.mat',
|
| 444 |
+
ens_dir_n / 'coordinates.mat',
|
| 445 |
+
run_idx=3, wu=wu_n, y_offset=1.0)
|
| 446 |
+
print(f" Ensemble 8x16: y+={ens_noisy['y_plus'].min():.1f}-{ens_noisy['y_plus'].max():.1f}")
|
| 447 |
+
noisy['Ensemble'] = ens_noisy
|
| 448 |
+
if args.stereo_noisy_stats:
|
| 449 |
+
stereo_noisy = _trim(_load_stereo(
|
| 450 |
+
Path(args.stereo_noisy_stats), run_idx=2, wu=wu_n, y_offset=0.8))
|
| 451 |
+
print(f" Stereo 32x32: y+={stereo_noisy['y_plus'].min():.1f}-{stereo_noisy['y_plus'].max():.1f}")
|
| 452 |
+
noisy['Stereo'] = stereo_noisy
|
| 453 |
+
|
| 454 |
+
if not clean and not noisy:
|
| 455 |
+
parser.error('At least one PIV result path must be provided (--*-clean-* or --*-noisy-*)')
|
| 456 |
+
|
| 457 |
+
# ── Generate figures ─────────────────────────────────────────────────
|
| 458 |
+
print("\nGenerating figures...")
|
| 459 |
+
plot_velocity(gt_plus, clean, noisy, wu, output_dir)
|
| 460 |
+
plot_stresses_subplots(gt_plus, clean, noisy, wu, output_dir)
|
| 461 |
+
plot_combined_stresses(gt_plus, clean, noisy, wu, output_dir)
|
| 462 |
+
print("Done.")
|
scripts/sig_configs/SIGconf_Stereo_cam1.cdl
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
// **************************************************************
|
| 3 |
+
// **************************************************************
|
| 4 |
+
// *********** netcdf configuration file for SIG program *******
|
| 5 |
+
// *********** Version 1.0 *******
|
| 6 |
+
// **************************************************************
|
| 7 |
+
// **************************************************************
|
| 8 |
+
// **************************************************************
|
| 9 |
+
// ** EUROPIV II Project **
|
| 10 |
+
// ** Synthetic Image Generator **
|
| 11 |
+
// ** Feb. 2001 **
|
| 12 |
+
// **************************************************************
|
| 13 |
+
// ** Bertrand Lecordier : Bertrand.Lecordier@coria.fr **
|
| 14 |
+
// ** Jerry Westerweel : j.westerweel@wbmt.tudelft.nl **
|
| 15 |
+
// *************************************************************/
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
netcdf sig_conf {
|
| 19 |
+
|
| 20 |
+
dimensions:
|
| 21 |
+
d_chaine = unlimited;
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
//*********************************************
|
| 25 |
+
//************************Variables ***********
|
| 26 |
+
//*********************************************
|
| 27 |
+
|
| 28 |
+
variables:
|
| 29 |
+
|
| 30 |
+
int p_dimX;
|
| 31 |
+
p_dimX:valid_min = 1;
|
| 32 |
+
p_dimX:valid_max = 4096;
|
| 33 |
+
p_dimX:units = "pixel";
|
| 34 |
+
p_dimX:long_name = "main image width";
|
| 35 |
+
|
| 36 |
+
int p_dimY;
|
| 37 |
+
p_dimY:valid_min = 1;
|
| 38 |
+
p_dimY:valid_max = 4096;
|
| 39 |
+
p_dimY:units = "pixel";
|
| 40 |
+
p_dimY:long_name = "main image height";
|
| 41 |
+
|
| 42 |
+
int p_dimL;
|
| 43 |
+
p_dimL:valid_min = 0;
|
| 44 |
+
p_dimL:valid_max = 1024;
|
| 45 |
+
p_dimL:units = "pixel";
|
| 46 |
+
p_dimL:long_name = "left strip";
|
| 47 |
+
|
| 48 |
+
int p_dimR;
|
| 49 |
+
p_dimR:valid_min = 0;
|
| 50 |
+
p_dimR:valid_max = 1024;
|
| 51 |
+
p_dimR:units = "pixel";
|
| 52 |
+
p_dimR:long_name = "right strip";
|
| 53 |
+
|
| 54 |
+
int p_dimT;
|
| 55 |
+
p_dimT:valid_min = 0;
|
| 56 |
+
p_dimT:valid_max = 1024;
|
| 57 |
+
p_dimT:units = "pixel";
|
| 58 |
+
p_dimT:long_name = "top strip";
|
| 59 |
+
|
| 60 |
+
int p_dimB;
|
| 61 |
+
p_dimB:valid_min = 0;
|
| 62 |
+
p_dimB:valid_max = 1024;
|
| 63 |
+
p_dimB:units = "pixel";
|
| 64 |
+
p_dimB:long_name = "bottom strip";
|
| 65 |
+
|
| 66 |
+
char periodic_flag(d_chaine);
|
| 67 |
+
|
| 68 |
+
//*********************************************
|
| 69 |
+
//*********************************************
|
| 70 |
+
// Particle field dimension (real space)
|
| 71 |
+
// r_[x,y,z]min, r_[x,y,z]max defined the region of interest
|
| 72 |
+
// into the particle field - the particle field can be largeur
|
| 73 |
+
//
|
| 74 |
+
// The magnification factor is obtained from
|
| 75 |
+
// Gx = (r_xmax-r_xmin)/p_dimX (real/pixel)
|
| 76 |
+
// Gy = (r_ymax-r_ymin)/p_dimY (real/pixel)
|
| 77 |
+
// Important : Gx and Gy can be different
|
| 78 |
+
|
| 79 |
+
// ******* X axis **************************
|
| 80 |
+
double r_xmin;
|
| 81 |
+
r_xmin:units = "real";
|
| 82 |
+
r_xmin:long_name = "x minimum";
|
| 83 |
+
|
| 84 |
+
double r_xmax;
|
| 85 |
+
r_xmax:units = "real";
|
| 86 |
+
r_xmax:long_name = "x maximum";
|
| 87 |
+
|
| 88 |
+
// ******* Y axis **************************
|
| 89 |
+
double r_ymin;
|
| 90 |
+
r_ymin:units = "real";
|
| 91 |
+
r_ymin:long_name = "y minimum";
|
| 92 |
+
|
| 93 |
+
double r_ymax;
|
| 94 |
+
r_ymax:units = "real";
|
| 95 |
+
r_ymax:long_name = "y maximum";
|
| 96 |
+
|
| 97 |
+
// ******* Z axis ***************************
|
| 98 |
+
// ** for the 2D particle (x,y), used the same value for
|
| 99 |
+
// ** r_zmin, r_zmin and sheet_rpos_z
|
| 100 |
+
double r_zmin;
|
| 101 |
+
r_zmin:units = "real";
|
| 102 |
+
r_zmin:long_name = "z minimum";
|
| 103 |
+
|
| 104 |
+
double r_zmax;
|
| 105 |
+
r_zmax:units = "real";
|
| 106 |
+
r_zmax:long_name = "z maximum";
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
// ****************************************
|
| 110 |
+
// ****************************************
|
| 111 |
+
// Light sheet information
|
| 112 |
+
// ****************************************
|
| 113 |
+
// ****************************************
|
| 114 |
+
|
| 115 |
+
char lsheet_type(d_chaine);
|
| 116 |
+
lsheet_type:long_name = "type of light sheet";
|
| 117 |
+
// possible values :
|
| 118 |
+
// uniform
|
| 119 |
+
// gaussian
|
| 120 |
+
// triangle
|
| 121 |
+
// cosine
|
| 122 |
+
// squarecosine
|
| 123 |
+
|
| 124 |
+
// location in the real domain of the center
|
| 125 |
+
// of laser sheet (perpendicular to the z axis)
|
| 126 |
+
double lsheet_rpos_z;
|
| 127 |
+
lsheet_rpos_z:units = "real";
|
| 128 |
+
lsheet_rpos_z:long_name = "z location of light sheet";
|
| 129 |
+
|
| 130 |
+
double lsheet_rthickness;
|
| 131 |
+
lsheet_rthickness:valid_min = 0.0;
|
| 132 |
+
lsheet_rthickness:units = "real";
|
| 133 |
+
lsheet_rthickness:long_name = "light sheet thickness";
|
| 134 |
+
|
| 135 |
+
double lsheet_wave_length;
|
| 136 |
+
lsheet_wave_length:valid_min = 0.0;
|
| 137 |
+
lsheet_wave_length:units = "real";
|
| 138 |
+
lsheet_wave_length:long_name = "laser wave length";
|
| 139 |
+
|
| 140 |
+
// ************************************************
|
| 141 |
+
// ************* Particle distribution ************
|
| 142 |
+
// ************************************************
|
| 143 |
+
|
| 144 |
+
char part_distribution(d_chaine);
|
| 145 |
+
// Possible alternative
|
| 146 |
+
// uniform : constant diameter equal to part_mean_diam
|
| 147 |
+
//
|
| 148 |
+
// gaussian: gaussian distribution for the particle diameter
|
| 149 |
+
// mean diameter : part_mean_diam
|
| 150 |
+
// std diameter : part_std_diam
|
| 151 |
+
double part_min_diam;
|
| 152 |
+
part_min_diam:valid_min = 0.0;
|
| 153 |
+
part_min_diam:long_name = "minimum particle diameter";
|
| 154 |
+
double part_max_diam;
|
| 155 |
+
part_max_diam:valid_min = 0.0;
|
| 156 |
+
part_max_diam:valid_max = 10.0;
|
| 157 |
+
part_max_diam:long_name = "maximum particle diameter";
|
| 158 |
+
double part_mean_diam;
|
| 159 |
+
part_mean_diam:long_name= "mean particle diamete";
|
| 160 |
+
double part_std_diam;
|
| 161 |
+
part_std_diam:long_name= "std. of distribution of particle diameter";
|
| 162 |
+
|
| 163 |
+
// *****************************************************
|
| 164 |
+
// ************ image pattern information **************
|
| 165 |
+
// *****************************************************
|
| 166 |
+
|
| 167 |
+
char pattern_type(d_chaine);
|
| 168 |
+
// possible values
|
| 169 |
+
// gaussian : gaussian particle shape
|
| 170 |
+
// circle : circle particle shape
|
| 171 |
+
// rectangle: rectangle particle shape
|
| 172 |
+
double pattern_meanx;
|
| 173 |
+
pattern_meanx:valid_min = 0.0;
|
| 174 |
+
pattern_meanx:long_name = "pattern size for the part_meanx_diam";
|
| 175 |
+
double pattern_meany;
|
| 176 |
+
pattern_meany:valid_min = 0.0;
|
| 177 |
+
pattern_meany:long_name = "pattern size for the part_meany_diam";
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
// ************************************************
|
| 181 |
+
// ************ Projection information ************
|
| 182 |
+
// ************************************************
|
| 183 |
+
|
| 184 |
+
char projection_type(d_chaine);
|
| 185 |
+
// possible values
|
| 186 |
+
// normal : Normal projection without effect of particle motion along z
|
| 187 |
+
// znormal : Normal projection with effect of particule motion along z
|
| 188 |
+
// angular : Angular projection for stereo PIV
|
| 189 |
+
|
| 190 |
+
double projection_angle; // For angular projection
|
| 191 |
+
projection_angle:valid_min = 0.0;
|
| 192 |
+
projection_angle:valid_max = 360;
|
| 193 |
+
projection_angle:long_name = "Angle of view";
|
| 194 |
+
double projection_tilt_angle; // For angular projection
|
| 195 |
+
projection_tilt_angle:valid_min = 0.0;
|
| 196 |
+
projection_tilt_angle:valid_max = 360;
|
| 197 |
+
projection_tilt_angle:long_name = "Tilt angle";
|
| 198 |
+
|
| 199 |
+
// ************************************************
|
| 200 |
+
// ************* CCD information ************
|
| 201 |
+
// ************************************************
|
| 202 |
+
|
| 203 |
+
// Pixel active area size : ccd_fill_ratio_x*ccd_fill_ratio_y
|
| 204 |
+
double ccd_fill_ratio_x;
|
| 205 |
+
ccd_fill_ratio_x:valid_min = 0.0;
|
| 206 |
+
ccd_fill_ratio_x:valid_max = 1.0;
|
| 207 |
+
ccd_fill_ratio_x:long_name = "X CCD fill ration";
|
| 208 |
+
double ccd_fill_ratio_y;
|
| 209 |
+
ccd_fill_ratio_y:valid_min = 0.0;
|
| 210 |
+
ccd_fill_ratio_y:valid_max = 1.0;
|
| 211 |
+
ccd_fill_ratio_y:long_name = "Y CCD fill ration";
|
| 212 |
+
double ccd_saturation_level;
|
| 213 |
+
ccd_saturation_level:valid_min = 0.0;
|
| 214 |
+
ccd_saturation_level:valid_max = 1.0;
|
| 215 |
+
ccd_saturation_level:long_name = "saturation level";
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
//****** Initial background information *******/
|
| 220 |
+
|
| 221 |
+
char ccd_background_type(d_chaine);
|
| 222 |
+
// Possible alternative
|
| 223 |
+
// uniform : uniform background with
|
| 224 |
+
// level ccd_background_mean_level
|
| 225 |
+
// gaussian: gaussian noise with a mean value
|
| 226 |
+
// equal to ccd_background_mean_level
|
| 227 |
+
// and a std. equal to ccd_background_std_noise
|
| 228 |
+
double ccd_background_mean_level;
|
| 229 |
+
ccd_background_mean_level:valid_min = 0;
|
| 230 |
+
ccd_background_mean_level:long_name = "mean initial background level";
|
| 231 |
+
double ccd_background_std_noise;
|
| 232 |
+
ccd_background_std_noise:valid_min = 0;
|
| 233 |
+
ccd_background_std_noise:long_name = "std. noise for initial background";
|
| 234 |
+
|
| 235 |
+
double ccd_pixel_horizontal_pitch;
|
| 236 |
+
ccd_pixel_horizontal_pitch:valid_min = 0.0;
|
| 237 |
+
ccd_pixel_horizontal_pitch:units = "pixel/real";
|
| 238 |
+
ccd_pixel_horizontal_pitch:long_name = "horizontal pixel pitch";
|
| 239 |
+
|
| 240 |
+
double ccd_pixel_vertical_pitch;
|
| 241 |
+
ccd_pixel_vertical_pitch:valid_min = 0.0;
|
| 242 |
+
ccd_pixel_vertical_pitch:units = "pixel/real";
|
| 243 |
+
ccd_pixel_vertical_pitch:long_name = "vertical pixel pitch";
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
// *************************************************
|
| 247 |
+
// **********optics information ********************
|
| 248 |
+
// *************************************************
|
| 249 |
+
|
| 250 |
+
double optic_object_distance;
|
| 251 |
+
optic_object_distance:long_name = "object distance";
|
| 252 |
+
|
| 253 |
+
double optic_image_distance;
|
| 254 |
+
optic_image_distance:long_name = "image distance";
|
| 255 |
+
|
| 256 |
+
double optic_aperture;
|
| 257 |
+
optic_aperture:valid_min = 1.;
|
| 258 |
+
optic_aperture:long_name = "optic aperture";
|
| 259 |
+
|
| 260 |
+
double optic_magnification;
|
| 261 |
+
optic_magnification:valid_min = 0.0;
|
| 262 |
+
optic_magnification:long_name = "optic magnification";
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
// ************************************************
|
| 269 |
+
// ** initial seed numbers for the random generator
|
| 270 |
+
// ************************************************
|
| 271 |
+
|
| 272 |
+
int seed_number1;
|
| 273 |
+
seed_number1:valid_min = 0;
|
| 274 |
+
seed_number1:valid_max = 30000;
|
| 275 |
+
seed_number1:long_name = "seed number 1";
|
| 276 |
+
|
| 277 |
+
int seed_number2;
|
| 278 |
+
seed_number2:valid_min = 0;
|
| 279 |
+
seed_number2:valid_max = 30000;
|
| 280 |
+
seed_number2:long_name = "seed number 2";
|
| 281 |
+
|
| 282 |
+
int seed_number3;
|
| 283 |
+
seed_number3:valid_min = 0;
|
| 284 |
+
seed_number3:valid_max = 30000;
|
| 285 |
+
seed_number3:long_name = "seed number 3";
|
| 286 |
+
data:
|
| 287 |
+
|
| 288 |
+
p_dimX = 2048 ;
|
| 289 |
+
|
| 290 |
+
p_dimY = 2240 ;
|
| 291 |
+
|
| 292 |
+
p_dimL = 0 ;
|
| 293 |
+
|
| 294 |
+
p_dimR = 0 ;
|
| 295 |
+
|
| 296 |
+
p_dimT = 0 ;
|
| 297 |
+
|
| 298 |
+
p_dimB = 0 ;
|
| 299 |
+
|
| 300 |
+
periodic_flag = "no_periodic" ;
|
| 301 |
+
|
| 302 |
+
r_xmin = 0 ;
|
| 303 |
+
|
| 304 |
+
r_xmax = 150;
|
| 305 |
+
|
| 306 |
+
r_ymin = -159.0625 ;
|
| 307 |
+
|
| 308 |
+
r_ymax = 5 ;
|
| 309 |
+
|
| 310 |
+
r_zmin = -0.6 ;
|
| 311 |
+
|
| 312 |
+
r_zmax = 0.6 ;
|
| 313 |
+
|
| 314 |
+
lsheet_type = "uniform" ;
|
| 315 |
+
|
| 316 |
+
lsheet_rpos_z = 0 ;
|
| 317 |
+
|
| 318 |
+
lsheet_rthickness = 1.2 ;
|
| 319 |
+
|
| 320 |
+
lsheet_wave_length = 532e-9 ;
|
| 321 |
+
|
| 322 |
+
part_distribution = "uniform" ;
|
| 323 |
+
|
| 324 |
+
part_min_diam = 0.7 ;
|
| 325 |
+
|
| 326 |
+
part_max_diam = 0.7;
|
| 327 |
+
|
| 328 |
+
part_mean_diam = 0.7 ;
|
| 329 |
+
|
| 330 |
+
part_std_diam = 0;
|
| 331 |
+
|
| 332 |
+
pattern_type = "gaussian" ;
|
| 333 |
+
|
| 334 |
+
pattern_meanx = 1.274;
|
| 335 |
+
|
| 336 |
+
pattern_meany = 1.274 ;
|
| 337 |
+
|
| 338 |
+
projection_type = "angular" ;
|
| 339 |
+
|
| 340 |
+
projection_angle = 315 ;
|
| 341 |
+
|
| 342 |
+
projection_tilt_angle = 357.61 ;
|
| 343 |
+
|
| 344 |
+
ccd_fill_ratio_x = 1 ;
|
| 345 |
+
|
| 346 |
+
ccd_fill_ratio_y = 1 ;
|
| 347 |
+
|
| 348 |
+
ccd_saturation_level = 1 ;
|
| 349 |
+
|
| 350 |
+
ccd_background_type = "gaussian" ;
|
| 351 |
+
|
| 352 |
+
ccd_background_mean_level = 0 ;
|
| 353 |
+
|
| 354 |
+
ccd_background_std_noise = 0 ;
|
| 355 |
+
|
| 356 |
+
ccd_pixel_horizontal_pitch = 327.68 ;
|
| 357 |
+
|
| 358 |
+
ccd_pixel_vertical_pitch = 327.68 ;
|
| 359 |
+
|
| 360 |
+
optic_object_distance = 5000 ;
|
| 361 |
+
|
| 362 |
+
optic_image_distance = 208.5 ;
|
| 363 |
+
|
| 364 |
+
optic_aperture = 2 ;
|
| 365 |
+
|
| 366 |
+
optic_magnification = 0.0417;
|
| 367 |
+
|
| 368 |
+
seed_number1 = 1 ;
|
| 369 |
+
|
| 370 |
+
seed_number2 = 100 ;
|
| 371 |
+
|
| 372 |
+
seed_number3 = 10000 ;
|
| 373 |
+
}
|
scripts/sig_configs/SIGconf_Stereo_cam1_noisy_A.cdl
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
// **************************************************************
|
| 3 |
+
// **************************************************************
|
| 4 |
+
// *********** netcdf configuration file for SIG program *******
|
| 5 |
+
// *********** Version 1.0 *******
|
| 6 |
+
// **************************************************************
|
| 7 |
+
// **************************************************************
|
| 8 |
+
// **************************************************************
|
| 9 |
+
// ** EUROPIV II Project **
|
| 10 |
+
// ** Synthetic Image Generator **
|
| 11 |
+
// ** Feb. 2001 **
|
| 12 |
+
// **************************************************************
|
| 13 |
+
// ** Bertrand Lecordier : Bertrand.Lecordier@coria.fr **
|
| 14 |
+
// ** Jerry Westerweel : j.westerweel@wbmt.tudelft.nl **
|
| 15 |
+
// *************************************************************/
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
netcdf sig_conf {
|
| 19 |
+
|
| 20 |
+
dimensions:
|
| 21 |
+
d_chaine = unlimited;
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
//*********************************************
|
| 25 |
+
//************************Variables ***********
|
| 26 |
+
//*********************************************
|
| 27 |
+
|
| 28 |
+
variables:
|
| 29 |
+
|
| 30 |
+
int p_dimX;
|
| 31 |
+
p_dimX:valid_min = 1;
|
| 32 |
+
p_dimX:valid_max = 4096;
|
| 33 |
+
p_dimX:units = "pixel";
|
| 34 |
+
p_dimX:long_name = "main image width";
|
| 35 |
+
|
| 36 |
+
int p_dimY;
|
| 37 |
+
p_dimY:valid_min = 1;
|
| 38 |
+
p_dimY:valid_max = 4096;
|
| 39 |
+
p_dimY:units = "pixel";
|
| 40 |
+
p_dimY:long_name = "main image height";
|
| 41 |
+
|
| 42 |
+
int p_dimL;
|
| 43 |
+
p_dimL:valid_min = 0;
|
| 44 |
+
p_dimL:valid_max = 1024;
|
| 45 |
+
p_dimL:units = "pixel";
|
| 46 |
+
p_dimL:long_name = "left strip";
|
| 47 |
+
|
| 48 |
+
int p_dimR;
|
| 49 |
+
p_dimR:valid_min = 0;
|
| 50 |
+
p_dimR:valid_max = 1024;
|
| 51 |
+
p_dimR:units = "pixel";
|
| 52 |
+
p_dimR:long_name = "right strip";
|
| 53 |
+
|
| 54 |
+
int p_dimT;
|
| 55 |
+
p_dimT:valid_min = 0;
|
| 56 |
+
p_dimT:valid_max = 1024;
|
| 57 |
+
p_dimT:units = "pixel";
|
| 58 |
+
p_dimT:long_name = "top strip";
|
| 59 |
+
|
| 60 |
+
int p_dimB;
|
| 61 |
+
p_dimB:valid_min = 0;
|
| 62 |
+
p_dimB:valid_max = 1024;
|
| 63 |
+
p_dimB:units = "pixel";
|
| 64 |
+
p_dimB:long_name = "bottom strip";
|
| 65 |
+
|
| 66 |
+
char periodic_flag(d_chaine);
|
| 67 |
+
|
| 68 |
+
//*********************************************
|
| 69 |
+
//*********************************************
|
| 70 |
+
// Particle field dimension (real space)
|
| 71 |
+
// r_[x,y,z]min, r_[x,y,z]max defined the region of interest
|
| 72 |
+
// into the particle field - the particle field can be largeur
|
| 73 |
+
//
|
| 74 |
+
// The magnification factor is obtained from
|
| 75 |
+
// Gx = (r_xmax-r_xmin)/p_dimX (real/pixel)
|
| 76 |
+
// Gy = (r_ymax-r_ymin)/p_dimY (real/pixel)
|
| 77 |
+
// Important : Gx and Gy can be different
|
| 78 |
+
|
| 79 |
+
// ******* X axis **************************
|
| 80 |
+
double r_xmin;
|
| 81 |
+
r_xmin:units = "real";
|
| 82 |
+
r_xmin:long_name = "x minimum";
|
| 83 |
+
|
| 84 |
+
double r_xmax;
|
| 85 |
+
r_xmax:units = "real";
|
| 86 |
+
r_xmax:long_name = "x maximum";
|
| 87 |
+
|
| 88 |
+
// ******* Y axis **************************
|
| 89 |
+
double r_ymin;
|
| 90 |
+
r_ymin:units = "real";
|
| 91 |
+
r_ymin:long_name = "y minimum";
|
| 92 |
+
|
| 93 |
+
double r_ymax;
|
| 94 |
+
r_ymax:units = "real";
|
| 95 |
+
r_ymax:long_name = "y maximum";
|
| 96 |
+
|
| 97 |
+
// ******* Z axis ***************************
|
| 98 |
+
// ** for the 2D particle (x,y), used the same value for
|
| 99 |
+
// ** r_zmin, r_zmin and sheet_rpos_z
|
| 100 |
+
double r_zmin;
|
| 101 |
+
r_zmin:units = "real";
|
| 102 |
+
r_zmin:long_name = "z minimum";
|
| 103 |
+
|
| 104 |
+
double r_zmax;
|
| 105 |
+
r_zmax:units = "real";
|
| 106 |
+
r_zmax:long_name = "z maximum";
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
// ****************************************
|
| 110 |
+
// ****************************************
|
| 111 |
+
// Light sheet information
|
| 112 |
+
// ****************************************
|
| 113 |
+
// ****************************************
|
| 114 |
+
|
| 115 |
+
char lsheet_type(d_chaine);
|
| 116 |
+
lsheet_type:long_name = "type of light sheet";
|
| 117 |
+
// possible values :
|
| 118 |
+
// uniform
|
| 119 |
+
// gaussian
|
| 120 |
+
// triangle
|
| 121 |
+
// cosine
|
| 122 |
+
// squarecosine
|
| 123 |
+
|
| 124 |
+
// location in the real domain of the center
|
| 125 |
+
// of laser sheet (perpendicular to the z axis)
|
| 126 |
+
double lsheet_rpos_z;
|
| 127 |
+
lsheet_rpos_z:units = "real";
|
| 128 |
+
lsheet_rpos_z:long_name = "z location of light sheet";
|
| 129 |
+
|
| 130 |
+
double lsheet_rthickness;
|
| 131 |
+
lsheet_rthickness:valid_min = 0.0;
|
| 132 |
+
lsheet_rthickness:units = "real";
|
| 133 |
+
lsheet_rthickness:long_name = "light sheet thickness";
|
| 134 |
+
|
| 135 |
+
double lsheet_wave_length;
|
| 136 |
+
lsheet_wave_length:valid_min = 0.0;
|
| 137 |
+
lsheet_wave_length:units = "real";
|
| 138 |
+
lsheet_wave_length:long_name = "laser wave length";
|
| 139 |
+
|
| 140 |
+
// ************************************************
|
| 141 |
+
// ************* Particle distribution ************
|
| 142 |
+
// ************************************************
|
| 143 |
+
|
| 144 |
+
char part_distribution(d_chaine);
|
| 145 |
+
// Possible alternative
|
| 146 |
+
// uniform : constant diameter equal to part_mean_diam
|
| 147 |
+
//
|
| 148 |
+
// gaussian: gaussian distribution for the particle diameter
|
| 149 |
+
// mean diameter : part_mean_diam
|
| 150 |
+
// std diameter : part_std_diam
|
| 151 |
+
double part_min_diam;
|
| 152 |
+
part_min_diam:valid_min = 0.0;
|
| 153 |
+
part_min_diam:long_name = "minimum particle diameter";
|
| 154 |
+
double part_max_diam;
|
| 155 |
+
part_max_diam:valid_min = 0.0;
|
| 156 |
+
part_max_diam:valid_max = 10.0;
|
| 157 |
+
part_max_diam:long_name = "maximum particle diameter";
|
| 158 |
+
double part_mean_diam;
|
| 159 |
+
part_mean_diam:long_name= "mean particle diamete";
|
| 160 |
+
double part_std_diam;
|
| 161 |
+
part_std_diam:long_name= "std. of distribution of particle diameter";
|
| 162 |
+
|
| 163 |
+
// *****************************************************
|
| 164 |
+
// ************ image pattern information **************
|
| 165 |
+
// *****************************************************
|
| 166 |
+
|
| 167 |
+
char pattern_type(d_chaine);
|
| 168 |
+
// possible values
|
| 169 |
+
// gaussian : gaussian particle shape
|
| 170 |
+
// circle : circle particle shape
|
| 171 |
+
// rectangle: rectangle particle shape
|
| 172 |
+
double pattern_meanx;
|
| 173 |
+
pattern_meanx:valid_min = 0.0;
|
| 174 |
+
pattern_meanx:long_name = "pattern size for the part_meanx_diam";
|
| 175 |
+
double pattern_meany;
|
| 176 |
+
pattern_meany:valid_min = 0.0;
|
| 177 |
+
pattern_meany:long_name = "pattern size for the part_meany_diam";
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
// ************************************************
|
| 181 |
+
// ************ Projection information ************
|
| 182 |
+
// ************************************************
|
| 183 |
+
|
| 184 |
+
char projection_type(d_chaine);
|
| 185 |
+
// possible values
|
| 186 |
+
// normal : Normal projection without effect of particle motion along z
|
| 187 |
+
// znormal : Normal projection with effect of particule motion along z
|
| 188 |
+
// angular : Angular projection for stereo PIV
|
| 189 |
+
|
| 190 |
+
double projection_angle; // For angular projection
|
| 191 |
+
projection_angle:valid_min = 0.0;
|
| 192 |
+
projection_angle:valid_max = 360;
|
| 193 |
+
projection_angle:long_name = "Angle of view";
|
| 194 |
+
double projection_tilt_angle; // For angular projection
|
| 195 |
+
projection_tilt_angle:valid_min = 0.0;
|
| 196 |
+
projection_tilt_angle:valid_max = 360;
|
| 197 |
+
projection_tilt_angle:long_name = "Tilt angle";
|
| 198 |
+
|
| 199 |
+
// ************************************************
|
| 200 |
+
// ************* CCD information ************
|
| 201 |
+
// ************************************************
|
| 202 |
+
|
| 203 |
+
// Pixel active area size : ccd_fill_ratio_x*ccd_fill_ratio_y
|
| 204 |
+
double ccd_fill_ratio_x;
|
| 205 |
+
ccd_fill_ratio_x:valid_min = 0.0;
|
| 206 |
+
ccd_fill_ratio_x:valid_max = 1.0;
|
| 207 |
+
ccd_fill_ratio_x:long_name = "X CCD fill ration";
|
| 208 |
+
double ccd_fill_ratio_y;
|
| 209 |
+
ccd_fill_ratio_y:valid_min = 0.0;
|
| 210 |
+
ccd_fill_ratio_y:valid_max = 1.0;
|
| 211 |
+
ccd_fill_ratio_y:long_name = "Y CCD fill ration";
|
| 212 |
+
double ccd_saturation_level;
|
| 213 |
+
ccd_saturation_level:valid_min = 0.0;
|
| 214 |
+
ccd_saturation_level:valid_max = 1.0;
|
| 215 |
+
ccd_saturation_level:long_name = "saturation level";
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
//****** Initial background information *******/
|
| 220 |
+
|
| 221 |
+
char ccd_background_type(d_chaine);
|
| 222 |
+
// Possible alternative
|
| 223 |
+
// uniform : uniform background with
|
| 224 |
+
// level ccd_background_mean_level
|
| 225 |
+
// gaussian: gaussian noise with a mean value
|
| 226 |
+
// equal to ccd_background_mean_level
|
| 227 |
+
// and a std. equal to ccd_background_std_noise
|
| 228 |
+
double ccd_background_mean_level;
|
| 229 |
+
ccd_background_mean_level:valid_min = 0;
|
| 230 |
+
ccd_background_mean_level:long_name = "mean initial background level";
|
| 231 |
+
double ccd_background_std_noise;
|
| 232 |
+
ccd_background_std_noise:valid_min = 0;
|
| 233 |
+
ccd_background_std_noise:long_name = "std. noise for initial background";
|
| 234 |
+
|
| 235 |
+
double ccd_pixel_horizontal_pitch;
|
| 236 |
+
ccd_pixel_horizontal_pitch:valid_min = 0.0;
|
| 237 |
+
ccd_pixel_horizontal_pitch:units = "pixel/real";
|
| 238 |
+
ccd_pixel_horizontal_pitch:long_name = "horizontal pixel pitch";
|
| 239 |
+
|
| 240 |
+
double ccd_pixel_vertical_pitch;
|
| 241 |
+
ccd_pixel_vertical_pitch:valid_min = 0.0;
|
| 242 |
+
ccd_pixel_vertical_pitch:units = "pixel/real";
|
| 243 |
+
ccd_pixel_vertical_pitch:long_name = "vertical pixel pitch";
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
// *************************************************
|
| 247 |
+
// **********optics information ********************
|
| 248 |
+
// *************************************************
|
| 249 |
+
|
| 250 |
+
double optic_object_distance;
|
| 251 |
+
optic_object_distance:long_name = "object distance";
|
| 252 |
+
|
| 253 |
+
double optic_image_distance;
|
| 254 |
+
optic_image_distance:long_name = "image distance";
|
| 255 |
+
|
| 256 |
+
double optic_aperture;
|
| 257 |
+
optic_aperture:valid_min = 1.;
|
| 258 |
+
optic_aperture:long_name = "optic aperture";
|
| 259 |
+
|
| 260 |
+
double optic_magnification;
|
| 261 |
+
optic_magnification:valid_min = 0.0;
|
| 262 |
+
optic_magnification:long_name = "optic magnification";
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
// ************************************************
|
| 269 |
+
// ** initial seed numbers for the random generator
|
| 270 |
+
// ************************************************
|
| 271 |
+
|
| 272 |
+
int seed_number1;
|
| 273 |
+
seed_number1:valid_min = 0;
|
| 274 |
+
seed_number1:valid_max = 30000;
|
| 275 |
+
seed_number1:long_name = "seed number 1";
|
| 276 |
+
|
| 277 |
+
int seed_number2;
|
| 278 |
+
seed_number2:valid_min = 0;
|
| 279 |
+
seed_number2:valid_max = 30000;
|
| 280 |
+
seed_number2:long_name = "seed number 2";
|
| 281 |
+
|
| 282 |
+
int seed_number3;
|
| 283 |
+
seed_number3:valid_min = 0;
|
| 284 |
+
seed_number3:valid_max = 30000;
|
| 285 |
+
seed_number3:long_name = "seed number 3";
|
| 286 |
+
data:
|
| 287 |
+
|
| 288 |
+
p_dimX = 2048 ;
|
| 289 |
+
|
| 290 |
+
p_dimY = 2240 ;
|
| 291 |
+
|
| 292 |
+
p_dimL = 0 ;
|
| 293 |
+
|
| 294 |
+
p_dimR = 0 ;
|
| 295 |
+
|
| 296 |
+
p_dimT = 0 ;
|
| 297 |
+
|
| 298 |
+
p_dimB = 0 ;
|
| 299 |
+
|
| 300 |
+
periodic_flag = "no_periodic" ;
|
| 301 |
+
|
| 302 |
+
r_xmin = 0 ;
|
| 303 |
+
|
| 304 |
+
r_xmax = 150;
|
| 305 |
+
|
| 306 |
+
r_ymin = -159.0625 ;
|
| 307 |
+
|
| 308 |
+
r_ymax = 5 ;
|
| 309 |
+
|
| 310 |
+
r_zmin = -0.6 ;
|
| 311 |
+
|
| 312 |
+
r_zmax = 0.6 ;
|
| 313 |
+
|
| 314 |
+
lsheet_type = "uniform" ;
|
| 315 |
+
|
| 316 |
+
lsheet_rpos_z = 0 ;
|
| 317 |
+
|
| 318 |
+
lsheet_rthickness = 1.2 ;
|
| 319 |
+
|
| 320 |
+
lsheet_wave_length = 532e-9 ;
|
| 321 |
+
|
| 322 |
+
part_distribution = "uniform" ;
|
| 323 |
+
|
| 324 |
+
part_min_diam = 0.7 ;
|
| 325 |
+
|
| 326 |
+
part_max_diam = 0.7;
|
| 327 |
+
|
| 328 |
+
part_mean_diam = 0.7 ;
|
| 329 |
+
|
| 330 |
+
part_std_diam = 0;
|
| 331 |
+
|
| 332 |
+
pattern_type = "gaussian" ;
|
| 333 |
+
|
| 334 |
+
pattern_meanx = 1.274;
|
| 335 |
+
|
| 336 |
+
pattern_meany = 1.274 ;
|
| 337 |
+
|
| 338 |
+
projection_type = "angular" ;
|
| 339 |
+
|
| 340 |
+
projection_angle = 315 ;
|
| 341 |
+
|
| 342 |
+
projection_tilt_angle = 357.61 ;
|
| 343 |
+
|
| 344 |
+
ccd_fill_ratio_x = 1 ;
|
| 345 |
+
|
| 346 |
+
ccd_fill_ratio_y = 1 ;
|
| 347 |
+
|
| 348 |
+
ccd_saturation_level = 1 ;
|
| 349 |
+
|
| 350 |
+
ccd_background_type = "gaussian" ;
|
| 351 |
+
|
| 352 |
+
ccd_background_mean_level = 80 ;
|
| 353 |
+
|
| 354 |
+
ccd_background_std_noise = 16 ;
|
| 355 |
+
|
| 356 |
+
ccd_pixel_horizontal_pitch = 327.68 ;
|
| 357 |
+
|
| 358 |
+
ccd_pixel_vertical_pitch = 327.68 ;
|
| 359 |
+
|
| 360 |
+
optic_object_distance = 5000 ;
|
| 361 |
+
|
| 362 |
+
optic_image_distance = 208.5 ;
|
| 363 |
+
|
| 364 |
+
optic_aperture = 2 ;
|
| 365 |
+
|
| 366 |
+
optic_magnification = 0.0417;
|
| 367 |
+
|
| 368 |
+
seed_number1 = 1 ;
|
| 369 |
+
|
| 370 |
+
seed_number2 = 100 ;
|
| 371 |
+
|
| 372 |
+
seed_number3 = 10000 ;
|
| 373 |
+
}
|
scripts/sig_configs/SIGconf_Stereo_cam1_noisy_B.cdl
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
// **************************************************************
|
| 3 |
+
// **************************************************************
|
| 4 |
+
// *********** netcdf configuration file for SIG program *******
|
| 5 |
+
// *********** Version 1.0 *******
|
| 6 |
+
// **************************************************************
|
| 7 |
+
// **************************************************************
|
| 8 |
+
// **************************************************************
|
| 9 |
+
// ** EUROPIV II Project **
|
| 10 |
+
// ** Synthetic Image Generator **
|
| 11 |
+
// ** Feb. 2001 **
|
| 12 |
+
// **************************************************************
|
| 13 |
+
// ** Bertrand Lecordier : Bertrand.Lecordier@coria.fr **
|
| 14 |
+
// ** Jerry Westerweel : j.westerweel@wbmt.tudelft.nl **
|
| 15 |
+
// *************************************************************/
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
netcdf sig_conf {
|
| 19 |
+
|
| 20 |
+
dimensions:
|
| 21 |
+
d_chaine = unlimited;
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
//*********************************************
|
| 25 |
+
//************************Variables ***********
|
| 26 |
+
//*********************************************
|
| 27 |
+
|
| 28 |
+
variables:
|
| 29 |
+
|
| 30 |
+
int p_dimX;
|
| 31 |
+
p_dimX:valid_min = 1;
|
| 32 |
+
p_dimX:valid_max = 4096;
|
| 33 |
+
p_dimX:units = "pixel";
|
| 34 |
+
p_dimX:long_name = "main image width";
|
| 35 |
+
|
| 36 |
+
int p_dimY;
|
| 37 |
+
p_dimY:valid_min = 1;
|
| 38 |
+
p_dimY:valid_max = 4096;
|
| 39 |
+
p_dimY:units = "pixel";
|
| 40 |
+
p_dimY:long_name = "main image height";
|
| 41 |
+
|
| 42 |
+
int p_dimL;
|
| 43 |
+
p_dimL:valid_min = 0;
|
| 44 |
+
p_dimL:valid_max = 1024;
|
| 45 |
+
p_dimL:units = "pixel";
|
| 46 |
+
p_dimL:long_name = "left strip";
|
| 47 |
+
|
| 48 |
+
int p_dimR;
|
| 49 |
+
p_dimR:valid_min = 0;
|
| 50 |
+
p_dimR:valid_max = 1024;
|
| 51 |
+
p_dimR:units = "pixel";
|
| 52 |
+
p_dimR:long_name = "right strip";
|
| 53 |
+
|
| 54 |
+
int p_dimT;
|
| 55 |
+
p_dimT:valid_min = 0;
|
| 56 |
+
p_dimT:valid_max = 1024;
|
| 57 |
+
p_dimT:units = "pixel";
|
| 58 |
+
p_dimT:long_name = "top strip";
|
| 59 |
+
|
| 60 |
+
int p_dimB;
|
| 61 |
+
p_dimB:valid_min = 0;
|
| 62 |
+
p_dimB:valid_max = 1024;
|
| 63 |
+
p_dimB:units = "pixel";
|
| 64 |
+
p_dimB:long_name = "bottom strip";
|
| 65 |
+
|
| 66 |
+
char periodic_flag(d_chaine);
|
| 67 |
+
|
| 68 |
+
//*********************************************
|
| 69 |
+
//*********************************************
|
| 70 |
+
// Particle field dimension (real space)
|
| 71 |
+
// r_[x,y,z]min, r_[x,y,z]max defined the region of interest
|
| 72 |
+
// into the particle field - the particle field can be largeur
|
| 73 |
+
//
|
| 74 |
+
// The magnification factor is obtained from
|
| 75 |
+
// Gx = (r_xmax-r_xmin)/p_dimX (real/pixel)
|
| 76 |
+
// Gy = (r_ymax-r_ymin)/p_dimY (real/pixel)
|
| 77 |
+
// Important : Gx and Gy can be different
|
| 78 |
+
|
| 79 |
+
// ******* X axis **************************
|
| 80 |
+
double r_xmin;
|
| 81 |
+
r_xmin:units = "real";
|
| 82 |
+
r_xmin:long_name = "x minimum";
|
| 83 |
+
|
| 84 |
+
double r_xmax;
|
| 85 |
+
r_xmax:units = "real";
|
| 86 |
+
r_xmax:long_name = "x maximum";
|
| 87 |
+
|
| 88 |
+
// ******* Y axis **************************
|
| 89 |
+
double r_ymin;
|
| 90 |
+
r_ymin:units = "real";
|
| 91 |
+
r_ymin:long_name = "y minimum";
|
| 92 |
+
|
| 93 |
+
double r_ymax;
|
| 94 |
+
r_ymax:units = "real";
|
| 95 |
+
r_ymax:long_name = "y maximum";
|
| 96 |
+
|
| 97 |
+
// ******* Z axis ***************************
|
| 98 |
+
// ** for the 2D particle (x,y), used the same value for
|
| 99 |
+
// ** r_zmin, r_zmin and sheet_rpos_z
|
| 100 |
+
double r_zmin;
|
| 101 |
+
r_zmin:units = "real";
|
| 102 |
+
r_zmin:long_name = "z minimum";
|
| 103 |
+
|
| 104 |
+
double r_zmax;
|
| 105 |
+
r_zmax:units = "real";
|
| 106 |
+
r_zmax:long_name = "z maximum";
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
// ****************************************
|
| 110 |
+
// ****************************************
|
| 111 |
+
// Light sheet information
|
| 112 |
+
// ****************************************
|
| 113 |
+
// ****************************************
|
| 114 |
+
|
| 115 |
+
char lsheet_type(d_chaine);
|
| 116 |
+
lsheet_type:long_name = "type of light sheet";
|
| 117 |
+
// possible values :
|
| 118 |
+
// uniform
|
| 119 |
+
// gaussian
|
| 120 |
+
// triangle
|
| 121 |
+
// cosine
|
| 122 |
+
// squarecosine
|
| 123 |
+
|
| 124 |
+
// location in the real domain of the center
|
| 125 |
+
// of laser sheet (perpendicular to the z axis)
|
| 126 |
+
double lsheet_rpos_z;
|
| 127 |
+
lsheet_rpos_z:units = "real";
|
| 128 |
+
lsheet_rpos_z:long_name = "z location of light sheet";
|
| 129 |
+
|
| 130 |
+
double lsheet_rthickness;
|
| 131 |
+
lsheet_rthickness:valid_min = 0.0;
|
| 132 |
+
lsheet_rthickness:units = "real";
|
| 133 |
+
lsheet_rthickness:long_name = "light sheet thickness";
|
| 134 |
+
|
| 135 |
+
double lsheet_wave_length;
|
| 136 |
+
lsheet_wave_length:valid_min = 0.0;
|
| 137 |
+
lsheet_wave_length:units = "real";
|
| 138 |
+
lsheet_wave_length:long_name = "laser wave length";
|
| 139 |
+
|
| 140 |
+
// ************************************************
|
| 141 |
+
// ************* Particle distribution ************
|
| 142 |
+
// ************************************************
|
| 143 |
+
|
| 144 |
+
char part_distribution(d_chaine);
|
| 145 |
+
// Possible alternative
|
| 146 |
+
// uniform : constant diameter equal to part_mean_diam
|
| 147 |
+
//
|
| 148 |
+
// gaussian: gaussian distribution for the particle diameter
|
| 149 |
+
// mean diameter : part_mean_diam
|
| 150 |
+
// std diameter : part_std_diam
|
| 151 |
+
double part_min_diam;
|
| 152 |
+
part_min_diam:valid_min = 0.0;
|
| 153 |
+
part_min_diam:long_name = "minimum particle diameter";
|
| 154 |
+
double part_max_diam;
|
| 155 |
+
part_max_diam:valid_min = 0.0;
|
| 156 |
+
part_max_diam:valid_max = 10.0;
|
| 157 |
+
part_max_diam:long_name = "maximum particle diameter";
|
| 158 |
+
double part_mean_diam;
|
| 159 |
+
part_mean_diam:long_name= "mean particle diamete";
|
| 160 |
+
double part_std_diam;
|
| 161 |
+
part_std_diam:long_name= "std. of distribution of particle diameter";
|
| 162 |
+
|
| 163 |
+
// *****************************************************
|
| 164 |
+
// ************ image pattern information **************
|
| 165 |
+
// *****************************************************
|
| 166 |
+
|
| 167 |
+
char pattern_type(d_chaine);
|
| 168 |
+
// possible values
|
| 169 |
+
// gaussian : gaussian particle shape
|
| 170 |
+
// circle : circle particle shape
|
| 171 |
+
// rectangle: rectangle particle shape
|
| 172 |
+
double pattern_meanx;
|
| 173 |
+
pattern_meanx:valid_min = 0.0;
|
| 174 |
+
pattern_meanx:long_name = "pattern size for the part_meanx_diam";
|
| 175 |
+
double pattern_meany;
|
| 176 |
+
pattern_meany:valid_min = 0.0;
|
| 177 |
+
pattern_meany:long_name = "pattern size for the part_meany_diam";
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
// ************************************************
|
| 181 |
+
// ************ Projection information ************
|
| 182 |
+
// ************************************************
|
| 183 |
+
|
| 184 |
+
char projection_type(d_chaine);
|
| 185 |
+
// possible values
|
| 186 |
+
// normal : Normal projection without effect of particle motion along z
|
| 187 |
+
// znormal : Normal projection with effect of particule motion along z
|
| 188 |
+
// angular : Angular projection for stereo PIV
|
| 189 |
+
|
| 190 |
+
double projection_angle; // For angular projection
|
| 191 |
+
projection_angle:valid_min = 0.0;
|
| 192 |
+
projection_angle:valid_max = 360;
|
| 193 |
+
projection_angle:long_name = "Angle of view";
|
| 194 |
+
double projection_tilt_angle; // For angular projection
|
| 195 |
+
projection_tilt_angle:valid_min = 0.0;
|
| 196 |
+
projection_tilt_angle:valid_max = 360;
|
| 197 |
+
projection_tilt_angle:long_name = "Tilt angle";
|
| 198 |
+
|
| 199 |
+
// ************************************************
|
| 200 |
+
// ************* CCD information ************
|
| 201 |
+
// ************************************************
|
| 202 |
+
|
| 203 |
+
// Pixel active area size : ccd_fill_ratio_x*ccd_fill_ratio_y
|
| 204 |
+
double ccd_fill_ratio_x;
|
| 205 |
+
ccd_fill_ratio_x:valid_min = 0.0;
|
| 206 |
+
ccd_fill_ratio_x:valid_max = 1.0;
|
| 207 |
+
ccd_fill_ratio_x:long_name = "X CCD fill ration";
|
| 208 |
+
double ccd_fill_ratio_y;
|
| 209 |
+
ccd_fill_ratio_y:valid_min = 0.0;
|
| 210 |
+
ccd_fill_ratio_y:valid_max = 1.0;
|
| 211 |
+
ccd_fill_ratio_y:long_name = "Y CCD fill ration";
|
| 212 |
+
double ccd_saturation_level;
|
| 213 |
+
ccd_saturation_level:valid_min = 0.0;
|
| 214 |
+
ccd_saturation_level:valid_max = 1.0;
|
| 215 |
+
ccd_saturation_level:long_name = "saturation level";
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
//****** Initial background information *******/
|
| 220 |
+
|
| 221 |
+
char ccd_background_type(d_chaine);
|
| 222 |
+
// Possible alternative
|
| 223 |
+
// uniform : uniform background with
|
| 224 |
+
// level ccd_background_mean_level
|
| 225 |
+
// gaussian: gaussian noise with a mean value
|
| 226 |
+
// equal to ccd_background_mean_level
|
| 227 |
+
// and a std. equal to ccd_background_std_noise
|
| 228 |
+
double ccd_background_mean_level;
|
| 229 |
+
ccd_background_mean_level:valid_min = 0;
|
| 230 |
+
ccd_background_mean_level:long_name = "mean initial background level";
|
| 231 |
+
double ccd_background_std_noise;
|
| 232 |
+
ccd_background_std_noise:valid_min = 0;
|
| 233 |
+
ccd_background_std_noise:long_name = "std. noise for initial background";
|
| 234 |
+
|
| 235 |
+
double ccd_pixel_horizontal_pitch;
|
| 236 |
+
ccd_pixel_horizontal_pitch:valid_min = 0.0;
|
| 237 |
+
ccd_pixel_horizontal_pitch:units = "pixel/real";
|
| 238 |
+
ccd_pixel_horizontal_pitch:long_name = "horizontal pixel pitch";
|
| 239 |
+
|
| 240 |
+
double ccd_pixel_vertical_pitch;
|
| 241 |
+
ccd_pixel_vertical_pitch:valid_min = 0.0;
|
| 242 |
+
ccd_pixel_vertical_pitch:units = "pixel/real";
|
| 243 |
+
ccd_pixel_vertical_pitch:long_name = "vertical pixel pitch";
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
// *************************************************
|
| 247 |
+
// **********optics information ********************
|
| 248 |
+
// *************************************************
|
| 249 |
+
|
| 250 |
+
double optic_object_distance;
|
| 251 |
+
optic_object_distance:long_name = "object distance";
|
| 252 |
+
|
| 253 |
+
double optic_image_distance;
|
| 254 |
+
optic_image_distance:long_name = "image distance";
|
| 255 |
+
|
| 256 |
+
double optic_aperture;
|
| 257 |
+
optic_aperture:valid_min = 1.;
|
| 258 |
+
optic_aperture:long_name = "optic aperture";
|
| 259 |
+
|
| 260 |
+
double optic_magnification;
|
| 261 |
+
optic_magnification:valid_min = 0.0;
|
| 262 |
+
optic_magnification:long_name = "optic magnification";
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
// ************************************************
|
| 269 |
+
// ** initial seed numbers for the random generator
|
| 270 |
+
// ************************************************
|
| 271 |
+
|
| 272 |
+
int seed_number1;
|
| 273 |
+
seed_number1:valid_min = 0;
|
| 274 |
+
seed_number1:valid_max = 30000;
|
| 275 |
+
seed_number1:long_name = "seed number 1";
|
| 276 |
+
|
| 277 |
+
int seed_number2;
|
| 278 |
+
seed_number2:valid_min = 0;
|
| 279 |
+
seed_number2:valid_max = 30000;
|
| 280 |
+
seed_number2:long_name = "seed number 2";
|
| 281 |
+
|
| 282 |
+
int seed_number3;
|
| 283 |
+
seed_number3:valid_min = 0;
|
| 284 |
+
seed_number3:valid_max = 30000;
|
| 285 |
+
seed_number3:long_name = "seed number 3";
|
| 286 |
+
data:
|
| 287 |
+
|
| 288 |
+
p_dimX = 2048 ;
|
| 289 |
+
|
| 290 |
+
p_dimY = 2240 ;
|
| 291 |
+
|
| 292 |
+
p_dimL = 0 ;
|
| 293 |
+
|
| 294 |
+
p_dimR = 0 ;
|
| 295 |
+
|
| 296 |
+
p_dimT = 0 ;
|
| 297 |
+
|
| 298 |
+
p_dimB = 0 ;
|
| 299 |
+
|
| 300 |
+
periodic_flag = "no_periodic" ;
|
| 301 |
+
|
| 302 |
+
r_xmin = 0 ;
|
| 303 |
+
|
| 304 |
+
r_xmax = 150;
|
| 305 |
+
|
| 306 |
+
r_ymin = -159.0625 ;
|
| 307 |
+
|
| 308 |
+
r_ymax = 5 ;
|
| 309 |
+
|
| 310 |
+
r_zmin = -0.6 ;
|
| 311 |
+
|
| 312 |
+
r_zmax = 0.6 ;
|
| 313 |
+
|
| 314 |
+
lsheet_type = "uniform" ;
|
| 315 |
+
|
| 316 |
+
lsheet_rpos_z = 0 ;
|
| 317 |
+
|
| 318 |
+
lsheet_rthickness = 1.2 ;
|
| 319 |
+
|
| 320 |
+
lsheet_wave_length = 532e-9 ;
|
| 321 |
+
|
| 322 |
+
part_distribution = "uniform" ;
|
| 323 |
+
|
| 324 |
+
part_min_diam = 0.7 ;
|
| 325 |
+
|
| 326 |
+
part_max_diam = 0.7;
|
| 327 |
+
|
| 328 |
+
part_mean_diam = 0.7 ;
|
| 329 |
+
|
| 330 |
+
part_std_diam = 0;
|
| 331 |
+
|
| 332 |
+
pattern_type = "gaussian" ;
|
| 333 |
+
|
| 334 |
+
pattern_meanx = 1.274;
|
| 335 |
+
|
| 336 |
+
pattern_meany = 1.274 ;
|
| 337 |
+
|
| 338 |
+
projection_type = "angular" ;
|
| 339 |
+
|
| 340 |
+
projection_angle = 315 ;
|
| 341 |
+
|
| 342 |
+
projection_tilt_angle = 357.61 ;
|
| 343 |
+
|
| 344 |
+
ccd_fill_ratio_x = 1 ;
|
| 345 |
+
|
| 346 |
+
ccd_fill_ratio_y = 1 ;
|
| 347 |
+
|
| 348 |
+
ccd_saturation_level = 1 ;
|
| 349 |
+
|
| 350 |
+
ccd_background_type = "gaussian" ;
|
| 351 |
+
|
| 352 |
+
ccd_background_mean_level = 80 ;
|
| 353 |
+
|
| 354 |
+
ccd_background_std_noise = 16 ;
|
| 355 |
+
|
| 356 |
+
ccd_pixel_horizontal_pitch = 327.68 ;
|
| 357 |
+
|
| 358 |
+
ccd_pixel_vertical_pitch = 327.68 ;
|
| 359 |
+
|
| 360 |
+
optic_object_distance = 5000 ;
|
| 361 |
+
|
| 362 |
+
optic_image_distance = 208.5 ;
|
| 363 |
+
|
| 364 |
+
optic_aperture = 2 ;
|
| 365 |
+
|
| 366 |
+
optic_magnification = 0.0417;
|
| 367 |
+
|
| 368 |
+
seed_number1 = 7 ;
|
| 369 |
+
|
| 370 |
+
seed_number2 = 500 ;
|
| 371 |
+
|
| 372 |
+
seed_number3 = 20000 ;
|
| 373 |
+
}
|
scripts/sig_configs/SIGconf_Stereo_cam2.cdl
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
// **************************************************************
|
| 3 |
+
// **************************************************************
|
| 4 |
+
// *********** netcdf configuration file for SIG program *******
|
| 5 |
+
// *********** Version 1.0 *******
|
| 6 |
+
// **************************************************************
|
| 7 |
+
// **************************************************************
|
| 8 |
+
// **************************************************************
|
| 9 |
+
// ** EUROPIV II Project **
|
| 10 |
+
// ** Synthetic Image Generator **
|
| 11 |
+
// ** Feb. 2001 **
|
| 12 |
+
// **************************************************************
|
| 13 |
+
// ** Bertrand Lecordier : Bertrand.Lecordier@coria.fr **
|
| 14 |
+
// ** Jerry Westerweel : j.westerweel@wbmt.tudelft.nl **
|
| 15 |
+
// *************************************************************/
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
netcdf sig_conf {
|
| 19 |
+
|
| 20 |
+
dimensions:
|
| 21 |
+
d_chaine = unlimited;
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
//*********************************************
|
| 25 |
+
//************************Variables ***********
|
| 26 |
+
//*********************************************
|
| 27 |
+
|
| 28 |
+
variables:
|
| 29 |
+
|
| 30 |
+
int p_dimX;
|
| 31 |
+
p_dimX:valid_min = 1;
|
| 32 |
+
p_dimX:valid_max = 4096;
|
| 33 |
+
p_dimX:units = "pixel";
|
| 34 |
+
p_dimX:long_name = "main image width";
|
| 35 |
+
|
| 36 |
+
int p_dimY;
|
| 37 |
+
p_dimY:valid_min = 1;
|
| 38 |
+
p_dimY:valid_max = 4096;
|
| 39 |
+
p_dimY:units = "pixel";
|
| 40 |
+
p_dimY:long_name = "main image height";
|
| 41 |
+
|
| 42 |
+
int p_dimL;
|
| 43 |
+
p_dimL:valid_min = 0;
|
| 44 |
+
p_dimL:valid_max = 1024;
|
| 45 |
+
p_dimL:units = "pixel";
|
| 46 |
+
p_dimL:long_name = "left strip";
|
| 47 |
+
|
| 48 |
+
int p_dimR;
|
| 49 |
+
p_dimR:valid_min = 0;
|
| 50 |
+
p_dimR:valid_max = 1024;
|
| 51 |
+
p_dimR:units = "pixel";
|
| 52 |
+
p_dimR:long_name = "right strip";
|
| 53 |
+
|
| 54 |
+
int p_dimT;
|
| 55 |
+
p_dimT:valid_min = 0;
|
| 56 |
+
p_dimT:valid_max = 1024;
|
| 57 |
+
p_dimT:units = "pixel";
|
| 58 |
+
p_dimT:long_name = "top strip";
|
| 59 |
+
|
| 60 |
+
int p_dimB;
|
| 61 |
+
p_dimB:valid_min = 0;
|
| 62 |
+
p_dimB:valid_max = 1024;
|
| 63 |
+
p_dimB:units = "pixel";
|
| 64 |
+
p_dimB:long_name = "bottom strip";
|
| 65 |
+
|
| 66 |
+
char periodic_flag(d_chaine);
|
| 67 |
+
|
| 68 |
+
//*********************************************
|
| 69 |
+
//*********************************************
|
| 70 |
+
// Particle field dimension (real space)
|
| 71 |
+
// r_[x,y,z]min, r_[x,y,z]max defined the region of interest
|
| 72 |
+
// into the particle field - the particle field can be largeur
|
| 73 |
+
//
|
| 74 |
+
// The magnification factor is obtained from
|
| 75 |
+
// Gx = (r_xmax-r_xmin)/p_dimX (real/pixel)
|
| 76 |
+
// Gy = (r_ymax-r_ymin)/p_dimY (real/pixel)
|
| 77 |
+
// Important : Gx and Gy can be different
|
| 78 |
+
|
| 79 |
+
// ******* X axis **************************
|
| 80 |
+
double r_xmin;
|
| 81 |
+
r_xmin:units = "real";
|
| 82 |
+
r_xmin:long_name = "x minimum";
|
| 83 |
+
|
| 84 |
+
double r_xmax;
|
| 85 |
+
r_xmax:units = "real";
|
| 86 |
+
r_xmax:long_name = "x maximum";
|
| 87 |
+
|
| 88 |
+
// ******* Y axis **************************
|
| 89 |
+
double r_ymin;
|
| 90 |
+
r_ymin:units = "real";
|
| 91 |
+
r_ymin:long_name = "y minimum";
|
| 92 |
+
|
| 93 |
+
double r_ymax;
|
| 94 |
+
r_ymax:units = "real";
|
| 95 |
+
r_ymax:long_name = "y maximum";
|
| 96 |
+
|
| 97 |
+
// ******* Z axis ***************************
|
| 98 |
+
// ** for the 2D particle (x,y), used the same value for
|
| 99 |
+
// ** r_zmin, r_zmin and sheet_rpos_z
|
| 100 |
+
double r_zmin;
|
| 101 |
+
r_zmin:units = "real";
|
| 102 |
+
r_zmin:long_name = "z minimum";
|
| 103 |
+
|
| 104 |
+
double r_zmax;
|
| 105 |
+
r_zmax:units = "real";
|
| 106 |
+
r_zmax:long_name = "z maximum";
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
// ****************************************
|
| 110 |
+
// ****************************************
|
| 111 |
+
// Light sheet information
|
| 112 |
+
// ****************************************
|
| 113 |
+
// ****************************************
|
| 114 |
+
|
| 115 |
+
char lsheet_type(d_chaine);
|
| 116 |
+
lsheet_type:long_name = "type of light sheet";
|
| 117 |
+
// possible values :
|
| 118 |
+
// uniform
|
| 119 |
+
// gaussian
|
| 120 |
+
// triangle
|
| 121 |
+
// cosine
|
| 122 |
+
// squarecosine
|
| 123 |
+
|
| 124 |
+
// location in the real domain of the center
|
| 125 |
+
// of laser sheet (perpendicular to the z axis)
|
| 126 |
+
double lsheet_rpos_z;
|
| 127 |
+
lsheet_rpos_z:units = "real";
|
| 128 |
+
lsheet_rpos_z:long_name = "z location of light sheet";
|
| 129 |
+
|
| 130 |
+
double lsheet_rthickness;
|
| 131 |
+
lsheet_rthickness:valid_min = 0.0;
|
| 132 |
+
lsheet_rthickness:units = "real";
|
| 133 |
+
lsheet_rthickness:long_name = "light sheet thickness";
|
| 134 |
+
|
| 135 |
+
double lsheet_wave_length;
|
| 136 |
+
lsheet_wave_length:valid_min = 0.0;
|
| 137 |
+
lsheet_wave_length:units = "real";
|
| 138 |
+
lsheet_wave_length:long_name = "laser wave length";
|
| 139 |
+
|
| 140 |
+
// ************************************************
|
| 141 |
+
// ************* Particle distribution ************
|
| 142 |
+
// ************************************************
|
| 143 |
+
|
| 144 |
+
char part_distribution(d_chaine);
|
| 145 |
+
// Possible alternative
|
| 146 |
+
// uniform : constant diameter equal to part_mean_diam
|
| 147 |
+
//
|
| 148 |
+
// gaussian: gaussian distribution for the particle diameter
|
| 149 |
+
// mean diameter : part_mean_diam
|
| 150 |
+
// std diameter : part_std_diam
|
| 151 |
+
double part_min_diam;
|
| 152 |
+
part_min_diam:valid_min = 0.0;
|
| 153 |
+
part_min_diam:long_name = "minimum particle diameter";
|
| 154 |
+
double part_max_diam;
|
| 155 |
+
part_max_diam:valid_min = 0.0;
|
| 156 |
+
part_max_diam:valid_max = 10.0;
|
| 157 |
+
part_max_diam:long_name = "maximum particle diameter";
|
| 158 |
+
double part_mean_diam;
|
| 159 |
+
part_mean_diam:long_name= "mean particle diamete";
|
| 160 |
+
double part_std_diam;
|
| 161 |
+
part_std_diam:long_name= "std. of distribution of particle diameter";
|
| 162 |
+
|
| 163 |
+
// *****************************************************
|
| 164 |
+
// ************ image pattern information **************
|
| 165 |
+
// *****************************************************
|
| 166 |
+
|
| 167 |
+
char pattern_type(d_chaine);
|
| 168 |
+
// possible values
|
| 169 |
+
// gaussian : gaussian particle shape
|
| 170 |
+
// circle : circle particle shape
|
| 171 |
+
// rectangle: rectangle particle shape
|
| 172 |
+
double pattern_meanx;
|
| 173 |
+
pattern_meanx:valid_min = 0.0;
|
| 174 |
+
pattern_meanx:long_name = "pattern size for the part_meanx_diam";
|
| 175 |
+
double pattern_meany;
|
| 176 |
+
pattern_meany:valid_min = 0.0;
|
| 177 |
+
pattern_meany:long_name = "pattern size for the part_meany_diam";
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
// ************************************************
|
| 181 |
+
// ************ Projection information ************
|
| 182 |
+
// ************************************************
|
| 183 |
+
|
| 184 |
+
char projection_type(d_chaine);
|
| 185 |
+
// possible values
|
| 186 |
+
// normal : Normal projection without effect of particle motion along z
|
| 187 |
+
// znormal : Normal projection with effect of particule motion along z
|
| 188 |
+
// angular : Angular projection for stereo PIV
|
| 189 |
+
|
| 190 |
+
double projection_angle; // For angular projection
|
| 191 |
+
projection_angle:valid_min = 0.0;
|
| 192 |
+
projection_angle:valid_max = 360;
|
| 193 |
+
projection_angle:long_name = "Angle of view";
|
| 194 |
+
double projection_tilt_angle; // For angular projection
|
| 195 |
+
projection_tilt_angle:valid_min = 0.0;
|
| 196 |
+
projection_tilt_angle:valid_max = 360;
|
| 197 |
+
projection_tilt_angle:long_name = "Tilt angle";
|
| 198 |
+
|
| 199 |
+
// ************************************************
|
| 200 |
+
// ************* CCD information ************
|
| 201 |
+
// ************************************************
|
| 202 |
+
|
| 203 |
+
// Pixel active area size : ccd_fill_ratio_x*ccd_fill_ratio_y
|
| 204 |
+
double ccd_fill_ratio_x;
|
| 205 |
+
ccd_fill_ratio_x:valid_min = 0.0;
|
| 206 |
+
ccd_fill_ratio_x:valid_max = 1.0;
|
| 207 |
+
ccd_fill_ratio_x:long_name = "X CCD fill ration";
|
| 208 |
+
double ccd_fill_ratio_y;
|
| 209 |
+
ccd_fill_ratio_y:valid_min = 0.0;
|
| 210 |
+
ccd_fill_ratio_y:valid_max = 1.0;
|
| 211 |
+
ccd_fill_ratio_y:long_name = "Y CCD fill ration";
|
| 212 |
+
double ccd_saturation_level;
|
| 213 |
+
ccd_saturation_level:valid_min = 0.0;
|
| 214 |
+
ccd_saturation_level:valid_max = 1.0;
|
| 215 |
+
ccd_saturation_level:long_name = "saturation level";
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
//****** Initial background information *******/
|
| 220 |
+
|
| 221 |
+
char ccd_background_type(d_chaine);
|
| 222 |
+
// Possible alternative
|
| 223 |
+
// uniform : uniform background with
|
| 224 |
+
// level ccd_background_mean_level
|
| 225 |
+
// gaussian: gaussian noise with a mean value
|
| 226 |
+
// equal to ccd_background_mean_level
|
| 227 |
+
// and a std. equal to ccd_background_std_noise
|
| 228 |
+
double ccd_background_mean_level;
|
| 229 |
+
ccd_background_mean_level:valid_min = 0;
|
| 230 |
+
ccd_background_mean_level:long_name = "mean initial background level";
|
| 231 |
+
double ccd_background_std_noise;
|
| 232 |
+
ccd_background_std_noise:valid_min = 0;
|
| 233 |
+
ccd_background_std_noise:long_name = "std. noise for initial background";
|
| 234 |
+
|
| 235 |
+
double ccd_pixel_horizontal_pitch;
|
| 236 |
+
ccd_pixel_horizontal_pitch:valid_min = 0.0;
|
| 237 |
+
ccd_pixel_horizontal_pitch:units = "pixel/real";
|
| 238 |
+
ccd_pixel_horizontal_pitch:long_name = "horizontal pixel pitch";
|
| 239 |
+
|
| 240 |
+
double ccd_pixel_vertical_pitch;
|
| 241 |
+
ccd_pixel_vertical_pitch:valid_min = 0.0;
|
| 242 |
+
ccd_pixel_vertical_pitch:units = "pixel/real";
|
| 243 |
+
ccd_pixel_vertical_pitch:long_name = "vertical pixel pitch";
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
// *************************************************
|
| 247 |
+
// **********optics information ********************
|
| 248 |
+
// *************************************************
|
| 249 |
+
|
| 250 |
+
double optic_object_distance;
|
| 251 |
+
optic_object_distance:long_name = "object distance";
|
| 252 |
+
|
| 253 |
+
double optic_image_distance;
|
| 254 |
+
optic_image_distance:long_name = "image distance";
|
| 255 |
+
|
| 256 |
+
double optic_aperture;
|
| 257 |
+
optic_aperture:valid_min = 1.;
|
| 258 |
+
optic_aperture:long_name = "optic aperture";
|
| 259 |
+
|
| 260 |
+
double optic_magnification;
|
| 261 |
+
optic_magnification:valid_min = 0.0;
|
| 262 |
+
optic_magnification:long_name = "optic magnification";
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
// ************************************************
|
| 269 |
+
// ** initial seed numbers for the random generator
|
| 270 |
+
// ************************************************
|
| 271 |
+
|
| 272 |
+
int seed_number1;
|
| 273 |
+
seed_number1:valid_min = 0;
|
| 274 |
+
seed_number1:valid_max = 30000;
|
| 275 |
+
seed_number1:long_name = "seed number 1";
|
| 276 |
+
|
| 277 |
+
int seed_number2;
|
| 278 |
+
seed_number2:valid_min = 0;
|
| 279 |
+
seed_number2:valid_max = 30000;
|
| 280 |
+
seed_number2:long_name = "seed number 2";
|
| 281 |
+
|
| 282 |
+
int seed_number3;
|
| 283 |
+
seed_number3:valid_min = 0;
|
| 284 |
+
seed_number3:valid_max = 30000;
|
| 285 |
+
seed_number3:long_name = "seed number 3";
|
| 286 |
+
data:
|
| 287 |
+
|
| 288 |
+
p_dimX = 2048 ;
|
| 289 |
+
|
| 290 |
+
p_dimY = 2240 ;
|
| 291 |
+
|
| 292 |
+
p_dimL = 0 ;
|
| 293 |
+
|
| 294 |
+
p_dimR = 0 ;
|
| 295 |
+
|
| 296 |
+
p_dimT = 0 ;
|
| 297 |
+
|
| 298 |
+
p_dimB = 0 ;
|
| 299 |
+
|
| 300 |
+
periodic_flag = "no_periodic" ;
|
| 301 |
+
|
| 302 |
+
r_xmin = 0 ;
|
| 303 |
+
|
| 304 |
+
r_xmax = 150;
|
| 305 |
+
|
| 306 |
+
r_ymin = -159.0625 ;
|
| 307 |
+
|
| 308 |
+
r_ymax = 5 ;
|
| 309 |
+
|
| 310 |
+
r_zmin = -0.6 ;
|
| 311 |
+
|
| 312 |
+
r_zmax = 0.6 ;
|
| 313 |
+
|
| 314 |
+
lsheet_type = "uniform" ;
|
| 315 |
+
|
| 316 |
+
lsheet_rpos_z = 0 ;
|
| 317 |
+
|
| 318 |
+
lsheet_rthickness = 1.2 ;
|
| 319 |
+
|
| 320 |
+
lsheet_wave_length = 532e-9 ;
|
| 321 |
+
|
| 322 |
+
part_distribution = "uniform" ;
|
| 323 |
+
|
| 324 |
+
part_min_diam = 0.7 ;
|
| 325 |
+
|
| 326 |
+
part_max_diam = 0.7;
|
| 327 |
+
|
| 328 |
+
part_mean_diam = 0.7 ;
|
| 329 |
+
|
| 330 |
+
part_std_diam = 0;
|
| 331 |
+
|
| 332 |
+
pattern_type = "gaussian" ;
|
| 333 |
+
|
| 334 |
+
pattern_meanx = 1.274;
|
| 335 |
+
|
| 336 |
+
pattern_meany = 1.274 ;
|
| 337 |
+
|
| 338 |
+
projection_type = "angular" ;
|
| 339 |
+
|
| 340 |
+
projection_angle = 45 ;
|
| 341 |
+
|
| 342 |
+
projection_tilt_angle = 2.39 ;
|
| 343 |
+
|
| 344 |
+
ccd_fill_ratio_x = 1 ;
|
| 345 |
+
|
| 346 |
+
ccd_fill_ratio_y = 1 ;
|
| 347 |
+
|
| 348 |
+
ccd_saturation_level = 1 ;
|
| 349 |
+
|
| 350 |
+
ccd_background_type = "gaussian" ;
|
| 351 |
+
|
| 352 |
+
ccd_background_mean_level = 0 ;
|
| 353 |
+
|
| 354 |
+
ccd_background_std_noise = 0 ;
|
| 355 |
+
|
| 356 |
+
ccd_pixel_horizontal_pitch = 327.68 ;
|
| 357 |
+
|
| 358 |
+
ccd_pixel_vertical_pitch = 327.68 ;
|
| 359 |
+
|
| 360 |
+
optic_object_distance = 5000 ;
|
| 361 |
+
|
| 362 |
+
optic_image_distance = 208.5 ;
|
| 363 |
+
|
| 364 |
+
optic_aperture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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
// **************************************************************
|
| 3 |
+
// **************************************************************
|
| 4 |
+
// *********** netcdf configuration file for SIG program *******
|
| 5 |
+
// *********** Version 1.0 *******
|
| 6 |
+
// **************************************************************
|
| 7 |
+
// **************************************************************
|
| 8 |
+
// **************************************************************
|
| 9 |
+
// ** EUROPIV II Project **
|
| 10 |
+
// ** Synthetic Image Generator **
|
| 11 |
+
// ** Feb. 2001 **
|
| 12 |
+
// **************************************************************
|
| 13 |
+
// ** Bertrand Lecordier : Bertrand.Lecordier@coria.fr **
|
| 14 |
+
// ** Jerry Westerweel : j.westerweel@wbmt.tudelft.nl **
|
| 15 |
+
// *************************************************************/
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
netcdf sig_conf {
|
| 19 |
+
|
| 20 |
+
dimensions:
|
| 21 |
+
d_chaine = unlimited;
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
//*********************************************
|
| 25 |
+
//************************Variables ***********
|
| 26 |
+
//*********************************************
|
| 27 |
+
|
| 28 |
+
variables:
|
| 29 |
+
|
| 30 |
+
int p_dimX;
|
| 31 |
+
p_dimX:valid_min = 1;
|
| 32 |
+
p_dimX:valid_max = 4096;
|
| 33 |
+
p_dimX:units = "pixel";
|
| 34 |
+
p_dimX:long_name = "main image width";
|
| 35 |
+
|
| 36 |
+
int p_dimY;
|
| 37 |
+
p_dimY:valid_min = 1;
|
| 38 |
+
p_dimY:valid_max = 4096;
|
| 39 |
+
p_dimY:units = "pixel";
|
| 40 |
+
p_dimY:long_name = "main image height";
|
| 41 |
+
|
| 42 |
+
int p_dimL;
|
| 43 |
+
p_dimL:valid_min = 0;
|
| 44 |
+
p_dimL:valid_max = 1024;
|
| 45 |
+
p_dimL:units = "pixel";
|
| 46 |
+
p_dimL:long_name = "left strip";
|
| 47 |
+
|
| 48 |
+
int p_dimR;
|
| 49 |
+
p_dimR:valid_min = 0;
|
| 50 |
+
p_dimR:valid_max = 1024;
|
| 51 |
+
p_dimR:units = "pixel";
|
| 52 |
+
p_dimR:long_name = "right strip";
|
| 53 |
+
|
| 54 |
+
int p_dimT;
|
| 55 |
+
p_dimT:valid_min = 0;
|
| 56 |
+
p_dimT:valid_max = 1024;
|
| 57 |
+
p_dimT:units = "pixel";
|
| 58 |
+
p_dimT:long_name = "top strip";
|
| 59 |
+
|
| 60 |
+
int p_dimB;
|
| 61 |
+
p_dimB:valid_min = 0;
|
| 62 |
+
p_dimB:valid_max = 1024;
|
| 63 |
+
p_dimB:units = "pixel";
|
| 64 |
+
p_dimB:long_name = "bottom strip";
|
| 65 |
+
|
| 66 |
+
char periodic_flag(d_chaine);
|
| 67 |
+
|
| 68 |
+
//*********************************************
|
| 69 |
+
//*********************************************
|
| 70 |
+
// Particle field dimension (real space)
|
| 71 |
+
// r_[x,y,z]min, r_[x,y,z]max defined the region of interest
|
| 72 |
+
// into the particle field - the particle field can be largeur
|
| 73 |
+
//
|
| 74 |
+
// The magnification factor is obtained from
|
| 75 |
+
// Gx = (r_xmax-r_xmin)/p_dimX (real/pixel)
|
| 76 |
+
// Gy = (r_ymax-r_ymin)/p_dimY (real/pixel)
|
| 77 |
+
// Important : Gx and Gy can be different
|
| 78 |
+
|
| 79 |
+
// ******* X axis **************************
|
| 80 |
+
double r_xmin;
|
| 81 |
+
r_xmin:units = "real";
|
| 82 |
+
r_xmin:long_name = "x minimum";
|
| 83 |
+
|
| 84 |
+
double r_xmax;
|
| 85 |
+
r_xmax:units = "real";
|
| 86 |
+
r_xmax:long_name = "x maximum";
|
| 87 |
+
|
| 88 |
+
// ******* Y axis **************************
|
| 89 |
+
double r_ymin;
|
| 90 |
+
r_ymin:units = "real";
|
| 91 |
+
r_ymin:long_name = "y minimum";
|
| 92 |
+
|
| 93 |
+
double r_ymax;
|
| 94 |
+
r_ymax:units = "real";
|
| 95 |
+
r_ymax:long_name = "y maximum";
|
| 96 |
+
|
| 97 |
+
// ******* Z axis ***************************
|
| 98 |
+
// ** for the 2D particle (x,y), used the same value for
|
| 99 |
+
// ** r_zmin, r_zmin and sheet_rpos_z
|
| 100 |
+
double r_zmin;
|
| 101 |
+
r_zmin:units = "real";
|
| 102 |
+
r_zmin:long_name = "z minimum";
|
| 103 |
+
|
| 104 |
+
double r_zmax;
|
| 105 |
+
r_zmax:units = "real";
|
| 106 |
+
r_zmax:long_name = "z maximum";
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
// ****************************************
|
| 110 |
+
// ****************************************
|
| 111 |
+
// Light sheet information
|
| 112 |
+
// ****************************************
|
| 113 |
+
// ****************************************
|
| 114 |
+
|
| 115 |
+
char lsheet_type(d_chaine);
|
| 116 |
+
lsheet_type:long_name = "type of light sheet";
|
| 117 |
+
// possible values :
|
| 118 |
+
// uniform
|
| 119 |
+
// gaussian
|
| 120 |
+
// triangle
|
| 121 |
+
// cosine
|
| 122 |
+
// squarecosine
|
| 123 |
+
|
| 124 |
+
// location in the real domain of the center
|
| 125 |
+
// of laser sheet (perpendicular to the z axis)
|
| 126 |
+
double lsheet_rpos_z;
|
| 127 |
+
lsheet_rpos_z:units = "real";
|
| 128 |
+
lsheet_rpos_z:long_name = "z location of light sheet";
|
| 129 |
+
|
| 130 |
+
double lsheet_rthickness;
|
| 131 |
+
lsheet_rthickness:valid_min = 0.0;
|
| 132 |
+
lsheet_rthickness:units = "real";
|
| 133 |
+
lsheet_rthickness:long_name = "light sheet thickness";
|
| 134 |
+
|
| 135 |
+
double lsheet_wave_length;
|
| 136 |
+
lsheet_wave_length:valid_min = 0.0;
|
| 137 |
+
lsheet_wave_length:units = "real";
|
| 138 |
+
lsheet_wave_length:long_name = "laser wave length";
|
| 139 |
+
|
| 140 |
+
// ************************************************
|
| 141 |
+
// ************* Particle distribution ************
|
| 142 |
+
// ************************************************
|
| 143 |
+
|
| 144 |
+
char part_distribution(d_chaine);
|
| 145 |
+
// Possible alternative
|
| 146 |
+
// uniform : constant diameter equal to part_mean_diam
|
| 147 |
+
//
|
| 148 |
+
// gaussian: gaussian distribution for the particle diameter
|
| 149 |
+
// mean diameter : part_mean_diam
|
| 150 |
+
// std diameter : part_std_diam
|
| 151 |
+
double part_min_diam;
|
| 152 |
+
part_min_diam:valid_min = 0.0;
|
| 153 |
+
part_min_diam:long_name = "minimum particle diameter";
|
| 154 |
+
double part_max_diam;
|
| 155 |
+
part_max_diam:valid_min = 0.0;
|
| 156 |
+
part_max_diam:valid_max = 10.0;
|
| 157 |
+
part_max_diam:long_name = "maximum particle diameter";
|
| 158 |
+
double part_mean_diam;
|
| 159 |
+
part_mean_diam:long_name= "mean particle diamete";
|
| 160 |
+
double part_std_diam;
|
| 161 |
+
part_std_diam:long_name= "std. of distribution of particle diameter";
|
| 162 |
+
|
| 163 |
+
// *****************************************************
|
| 164 |
+
// ************ image pattern information **************
|
| 165 |
+
// *****************************************************
|
| 166 |
+
|
| 167 |
+
char pattern_type(d_chaine);
|
| 168 |
+
// possible values
|
| 169 |
+
// gaussian : gaussian particle shape
|
| 170 |
+
// circle : circle particle shape
|
| 171 |
+
// rectangle: rectangle particle shape
|
| 172 |
+
double pattern_meanx;
|
| 173 |
+
pattern_meanx:valid_min = 0.0;
|
| 174 |
+
pattern_meanx:long_name = "pattern size for the part_meanx_diam";
|
| 175 |
+
double pattern_meany;
|
| 176 |
+
pattern_meany:valid_min = 0.0;
|
| 177 |
+
pattern_meany:long_name = "pattern size for the part_meany_diam";
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
// ************************************************
|
| 181 |
+
// ************ Projection information ************
|
| 182 |
+
// ************************************************
|
| 183 |
+
|
| 184 |
+
char projection_type(d_chaine);
|
| 185 |
+
// possible values
|
| 186 |
+
// normal : Normal projection without effect of particle motion along z
|
| 187 |
+
// znormal : Normal projection with effect of particule motion along z
|
| 188 |
+
// angular : Angular projection for stereo PIV
|
| 189 |
+
|
| 190 |
+
double projection_angle; // For angular projection
|
| 191 |
+
projection_angle:valid_min = 0.0;
|
| 192 |
+
projection_angle:valid_max = 360;
|
| 193 |
+
projection_angle:long_name = "Angle of view";
|
| 194 |
+
double projection_tilt_angle; // For angular projection
|
| 195 |
+
projection_tilt_angle:valid_min = 0.0;
|
| 196 |
+
projection_tilt_angle:valid_max = 360;
|
| 197 |
+
projection_tilt_angle:long_name = "Tilt angle";
|
| 198 |
+
|
| 199 |
+
// ************************************************
|
| 200 |
+
// ************* CCD information ************
|
| 201 |
+
// ************************************************
|
| 202 |
+
|
| 203 |
+
// Pixel active area size : ccd_fill_ratio_x*ccd_fill_ratio_y
|
| 204 |
+
double ccd_fill_ratio_x;
|
| 205 |
+
ccd_fill_ratio_x:valid_min = 0.0;
|
| 206 |
+
ccd_fill_ratio_x:valid_max = 1.0;
|
| 207 |
+
ccd_fill_ratio_x:long_name = "X CCD fill ration";
|
| 208 |
+
double ccd_fill_ratio_y;
|
| 209 |
+
ccd_fill_ratio_y:valid_min = 0.0;
|
| 210 |
+
ccd_fill_ratio_y:valid_max = 1.0;
|
| 211 |
+
ccd_fill_ratio_y:long_name = "Y CCD fill ration";
|
| 212 |
+
double ccd_saturation_level;
|
| 213 |
+
ccd_saturation_level:valid_min = 0.0;
|
| 214 |
+
ccd_saturation_level:valid_max = 1.0;
|
| 215 |
+
ccd_saturation_level:long_name = "saturation level";
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
//****** Initial background information *******/
|
| 220 |
+
|
| 221 |
+
char ccd_background_type(d_chaine);
|
| 222 |
+
// Possible alternative
|
| 223 |
+
// uniform : uniform background with
|
| 224 |
+
// level ccd_background_mean_level
|
| 225 |
+
// gaussian: gaussian noise with a mean value
|
| 226 |
+
// equal to ccd_background_mean_level
|
| 227 |
+
// and a std. equal to ccd_background_std_noise
|
| 228 |
+
double ccd_background_mean_level;
|
| 229 |
+
ccd_background_mean_level:valid_min = 0;
|
| 230 |
+
ccd_background_mean_level:long_name = "mean initial background level";
|
| 231 |
+
double ccd_background_std_noise;
|
| 232 |
+
ccd_background_std_noise:valid_min = 0;
|
| 233 |
+
ccd_background_std_noise:long_name = "std. noise for initial background";
|
| 234 |
+
|
| 235 |
+
double ccd_pixel_horizontal_pitch;
|
| 236 |
+
ccd_pixel_horizontal_pitch:valid_min = 0.0;
|
| 237 |
+
ccd_pixel_horizontal_pitch:units = "pixel/real";
|
| 238 |
+
ccd_pixel_horizontal_pitch:long_name = "horizontal pixel pitch";
|
| 239 |
+
|
| 240 |
+
double ccd_pixel_vertical_pitch;
|
| 241 |
+
ccd_pixel_vertical_pitch:valid_min = 0.0;
|
| 242 |
+
ccd_pixel_vertical_pitch:units = "pixel/real";
|
| 243 |
+
ccd_pixel_vertical_pitch:long_name = "vertical pixel pitch";
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
// *************************************************
|
| 247 |
+
// **********optics information ********************
|
| 248 |
+
// *************************************************
|
| 249 |
+
|
| 250 |
+
double optic_object_distance;
|
| 251 |
+
optic_object_distance:long_name = "object distance";
|
| 252 |
+
|
| 253 |
+
double optic_image_distance;
|
| 254 |
+
optic_image_distance:long_name = "image distance";
|
| 255 |
+
|
| 256 |
+
double optic_aperture;
|
| 257 |
+
optic_aperture:valid_min = 1.;
|
| 258 |
+
optic_aperture:long_name = "optic aperture";
|
| 259 |
+
|
| 260 |
+
double optic_magnification;
|
| 261 |
+
optic_magnification:valid_min = 0.0;
|
| 262 |
+
optic_magnification:long_name = "optic magnification";
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
// ************************************************
|
| 269 |
+
// ** initial seed numbers for the random generator
|
| 270 |
+
// ************************************************
|
| 271 |
+
|
| 272 |
+
int seed_number1;
|
| 273 |
+
seed_number1:valid_min = 0;
|
| 274 |
+
seed_number1:valid_max = 30000;
|
| 275 |
+
seed_number1:long_name = "seed number 1";
|
| 276 |
+
|
| 277 |
+
int seed_number2;
|
| 278 |
+
seed_number2:valid_min = 0;
|
| 279 |
+
seed_number2:valid_max = 30000;
|
| 280 |
+
seed_number2:long_name = "seed number 2";
|
| 281 |
+
|
| 282 |
+
int seed_number3;
|
| 283 |
+
seed_number3:valid_min = 0;
|
| 284 |
+
seed_number3:valid_max = 30000;
|
| 285 |
+
seed_number3:long_name = "seed number 3";
|
| 286 |
+
data:
|
| 287 |
+
|
| 288 |
+
p_dimX = 2048 ;
|
| 289 |
+
|
| 290 |
+
p_dimY = 2240 ;
|
| 291 |
+
|
| 292 |
+
p_dimL = 0 ;
|
| 293 |
+
|
| 294 |
+
p_dimR = 0 ;
|
| 295 |
+
|
| 296 |
+
p_dimT = 0 ;
|
| 297 |
+
|
| 298 |
+
p_dimB = 0 ;
|
| 299 |
+
|
| 300 |
+
periodic_flag = "no_periodic" ;
|
| 301 |
+
|
| 302 |
+
r_xmin = 0 ;
|
| 303 |
+
|
| 304 |
+
r_xmax = 150;
|
| 305 |
+
|
| 306 |
+
r_ymin = -159.0625 ;
|
| 307 |
+
|
| 308 |
+
r_ymax = 5 ;
|
| 309 |
+
|
| 310 |
+
r_zmin = -0.6 ;
|
| 311 |
+
|
| 312 |
+
r_zmax = 0.6 ;
|
| 313 |
+
|
| 314 |
+
lsheet_type = "uniform" ;
|
| 315 |
+
|
| 316 |
+
lsheet_rpos_z = 0 ;
|
| 317 |
+
|
| 318 |
+
lsheet_rthickness = 1.2 ;
|
| 319 |
+
|
| 320 |
+
lsheet_wave_length = 532e-9 ;
|
| 321 |
+
|
| 322 |
+
part_distribution = "uniform" ;
|
| 323 |
+
|
| 324 |
+
part_min_diam = 0.7 ;
|
| 325 |
+
|
| 326 |
+
part_max_diam = 0.7;
|
| 327 |
+
|
| 328 |
+
part_mean_diam = 0.7 ;
|
| 329 |
+
|
| 330 |
+
part_std_diam = 0;
|
| 331 |
+
|
| 332 |
+
pattern_type = "gaussian" ;
|
| 333 |
+
|
| 334 |
+
pattern_meanx = 1.274;
|
| 335 |
+
|
| 336 |
+
pattern_meany = 1.274 ;
|
| 337 |
+
|
| 338 |
+
projection_type = "angular" ;
|
| 339 |
+
|
| 340 |
+
projection_angle = 45 ;
|
| 341 |
+
|
| 342 |
+
projection_tilt_angle = 2.39 ;
|
| 343 |
+
|
| 344 |
+
ccd_fill_ratio_x = 1 ;
|
| 345 |
+
|
| 346 |
+
ccd_fill_ratio_y = 1 ;
|
| 347 |
+
|
| 348 |
+
ccd_saturation_level = 1 ;
|
| 349 |
+
|
| 350 |
+
ccd_background_type = "gaussian" ;
|
| 351 |
+
|
| 352 |
+
ccd_background_mean_level = 80 ;
|
| 353 |
+
|
| 354 |
+
ccd_background_std_noise = 16 ;
|
| 355 |
+
|
| 356 |
+
ccd_pixel_horizontal_pitch = 327.68 ;
|
| 357 |
+
|
| 358 |
+
ccd_pixel_vertical_pitch = 327.68 ;
|
| 359 |
+
|
| 360 |
+
optic_object_distance = 5000 ;
|
| 361 |
+
|
| 362 |
+
optic_image_distance = 208.5 ;
|
| 363 |
+
|
| 364 |
+
optic_aperture = 2 ;
|
| 365 |
+
|
| 366 |
+
optic_magnification = 0.0417;
|
| 367 |
+
|
| 368 |
+
seed_number1 = 1 ;
|
| 369 |
+
|
| 370 |
+
seed_number2 = 100 ;
|
| 371 |
+
|
| 372 |
+
seed_number3 = 10000 ;
|
| 373 |
+
}
|
scripts/sig_configs/SIGconf_Stereo_cam2_noisy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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
// **************************************************************
|
| 3 |
+
// **************************************************************
|
| 4 |
+
// *********** netcdf configuration file for SIG program *******
|
| 5 |
+
// *********** Version 1.0 *******
|
| 6 |
+
// **************************************************************
|
| 7 |
+
// **************************************************************
|
| 8 |
+
// **************************************************************
|
| 9 |
+
// ** EUROPIV II Project **
|
| 10 |
+
// ** Synthetic Image Generator **
|
| 11 |
+
// ** Feb. 2001 **
|
| 12 |
+
// **************************************************************
|
| 13 |
+
// ** Bertrand Lecordier : Bertrand.Lecordier@coria.fr **
|
| 14 |
+
// ** Jerry Westerweel : j.westerweel@wbmt.tudelft.nl **
|
| 15 |
+
// *************************************************************/
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
netcdf sig_conf {
|
| 19 |
+
|
| 20 |
+
dimensions:
|
| 21 |
+
d_chaine = unlimited;
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
//*********************************************
|
| 25 |
+
//************************Variables ***********
|
| 26 |
+
//*********************************************
|
| 27 |
+
|
| 28 |
+
variables:
|
| 29 |
+
|
| 30 |
+
int p_dimX;
|
| 31 |
+
p_dimX:valid_min = 1;
|
| 32 |
+
p_dimX:valid_max = 4096;
|
| 33 |
+
p_dimX:units = "pixel";
|
| 34 |
+
p_dimX:long_name = "main image width";
|
| 35 |
+
|
| 36 |
+
int p_dimY;
|
| 37 |
+
p_dimY:valid_min = 1;
|
| 38 |
+
p_dimY:valid_max = 4096;
|
| 39 |
+
p_dimY:units = "pixel";
|
| 40 |
+
p_dimY:long_name = "main image height";
|
| 41 |
+
|
| 42 |
+
int p_dimL;
|
| 43 |
+
p_dimL:valid_min = 0;
|
| 44 |
+
p_dimL:valid_max = 1024;
|
| 45 |
+
p_dimL:units = "pixel";
|
| 46 |
+
p_dimL:long_name = "left strip";
|
| 47 |
+
|
| 48 |
+
int p_dimR;
|
| 49 |
+
p_dimR:valid_min = 0;
|
| 50 |
+
p_dimR:valid_max = 1024;
|
| 51 |
+
p_dimR:units = "pixel";
|
| 52 |
+
p_dimR:long_name = "right strip";
|
| 53 |
+
|
| 54 |
+
int p_dimT;
|
| 55 |
+
p_dimT:valid_min = 0;
|
| 56 |
+
p_dimT:valid_max = 1024;
|
| 57 |
+
p_dimT:units = "pixel";
|
| 58 |
+
p_dimT:long_name = "top strip";
|
| 59 |
+
|
| 60 |
+
int p_dimB;
|
| 61 |
+
p_dimB:valid_min = 0;
|
| 62 |
+
p_dimB:valid_max = 1024;
|
| 63 |
+
p_dimB:units = "pixel";
|
| 64 |
+
p_dimB:long_name = "bottom strip";
|
| 65 |
+
|
| 66 |
+
char periodic_flag(d_chaine);
|
| 67 |
+
|
| 68 |
+
//*********************************************
|
| 69 |
+
//*********************************************
|
| 70 |
+
// Particle field dimension (real space)
|
| 71 |
+
// r_[x,y,z]min, r_[x,y,z]max defined the region of interest
|
| 72 |
+
// into the particle field - the particle field can be largeur
|
| 73 |
+
//
|
| 74 |
+
// The magnification factor is obtained from
|
| 75 |
+
// Gx = (r_xmax-r_xmin)/p_dimX (real/pixel)
|
| 76 |
+
// Gy = (r_ymax-r_ymin)/p_dimY (real/pixel)
|
| 77 |
+
// Important : Gx and Gy can be different
|
| 78 |
+
|
| 79 |
+
// ******* X axis **************************
|
| 80 |
+
double r_xmin;
|
| 81 |
+
r_xmin:units = "real";
|
| 82 |
+
r_xmin:long_name = "x minimum";
|
| 83 |
+
|
| 84 |
+
double r_xmax;
|
| 85 |
+
r_xmax:units = "real";
|
| 86 |
+
r_xmax:long_name = "x maximum";
|
| 87 |
+
|
| 88 |
+
// ******* Y axis **************************
|
| 89 |
+
double r_ymin;
|
| 90 |
+
r_ymin:units = "real";
|
| 91 |
+
r_ymin:long_name = "y minimum";
|
| 92 |
+
|
| 93 |
+
double r_ymax;
|
| 94 |
+
r_ymax:units = "real";
|
| 95 |
+
r_ymax:long_name = "y maximum";
|
| 96 |
+
|
| 97 |
+
// ******* Z axis ***************************
|
| 98 |
+
// ** for the 2D particle (x,y), used the same value for
|
| 99 |
+
// ** r_zmin, r_zmin and sheet_rpos_z
|
| 100 |
+
double r_zmin;
|
| 101 |
+
r_zmin:units = "real";
|
| 102 |
+
r_zmin:long_name = "z minimum";
|
| 103 |
+
|
| 104 |
+
double r_zmax;
|
| 105 |
+
r_zmax:units = "real";
|
| 106 |
+
r_zmax:long_name = "z maximum";
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
// ****************************************
|
| 110 |
+
// ****************************************
|
| 111 |
+
// Light sheet information
|
| 112 |
+
// ****************************************
|
| 113 |
+
// ****************************************
|
| 114 |
+
|
| 115 |
+
char lsheet_type(d_chaine);
|
| 116 |
+
lsheet_type:long_name = "type of light sheet";
|
| 117 |
+
// possible values :
|
| 118 |
+
// uniform
|
| 119 |
+
// gaussian
|
| 120 |
+
// triangle
|
| 121 |
+
// cosine
|
| 122 |
+
// squarecosine
|
| 123 |
+
|
| 124 |
+
// location in the real domain of the center
|
| 125 |
+
// of laser sheet (perpendicular to the z axis)
|
| 126 |
+
double lsheet_rpos_z;
|
| 127 |
+
lsheet_rpos_z:units = "real";
|
| 128 |
+
lsheet_rpos_z:long_name = "z location of light sheet";
|
| 129 |
+
|
| 130 |
+
double lsheet_rthickness;
|
| 131 |
+
lsheet_rthickness:valid_min = 0.0;
|
| 132 |
+
lsheet_rthickness:units = "real";
|
| 133 |
+
lsheet_rthickness:long_name = "light sheet thickness";
|
| 134 |
+
|
| 135 |
+
double lsheet_wave_length;
|
| 136 |
+
lsheet_wave_length:valid_min = 0.0;
|
| 137 |
+
lsheet_wave_length:units = "real";
|
| 138 |
+
lsheet_wave_length:long_name = "laser wave length";
|
| 139 |
+
|
| 140 |
+
// ************************************************
|
| 141 |
+
// ************* Particle distribution ************
|
| 142 |
+
// ************************************************
|
| 143 |
+
|
| 144 |
+
char part_distribution(d_chaine);
|
| 145 |
+
// Possible alternative
|
| 146 |
+
// uniform : constant diameter equal to part_mean_diam
|
| 147 |
+
//
|
| 148 |
+
// gaussian: gaussian distribution for the particle diameter
|
| 149 |
+
// mean diameter : part_mean_diam
|
| 150 |
+
// std diameter : part_std_diam
|
| 151 |
+
double part_min_diam;
|
| 152 |
+
part_min_diam:valid_min = 0.0;
|
| 153 |
+
part_min_diam:long_name = "minimum particle diameter";
|
| 154 |
+
double part_max_diam;
|
| 155 |
+
part_max_diam:valid_min = 0.0;
|
| 156 |
+
part_max_diam:valid_max = 10.0;
|
| 157 |
+
part_max_diam:long_name = "maximum particle diameter";
|
| 158 |
+
double part_mean_diam;
|
| 159 |
+
part_mean_diam:long_name= "mean particle diamete";
|
| 160 |
+
double part_std_diam;
|
| 161 |
+
part_std_diam:long_name= "std. of distribution of particle diameter";
|
| 162 |
+
|
| 163 |
+
// *****************************************************
|
| 164 |
+
// ************ image pattern information **************
|
| 165 |
+
// *****************************************************
|
| 166 |
+
|
| 167 |
+
char pattern_type(d_chaine);
|
| 168 |
+
// possible values
|
| 169 |
+
// gaussian : gaussian particle shape
|
| 170 |
+
// circle : circle particle shape
|
| 171 |
+
// rectangle: rectangle particle shape
|
| 172 |
+
double pattern_meanx;
|
| 173 |
+
pattern_meanx:valid_min = 0.0;
|
| 174 |
+
pattern_meanx:long_name = "pattern size for the part_meanx_diam";
|
| 175 |
+
double pattern_meany;
|
| 176 |
+
pattern_meany:valid_min = 0.0;
|
| 177 |
+
pattern_meany:long_name = "pattern size for the part_meany_diam";
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
// ************************************************
|
| 181 |
+
// ************ Projection information ************
|
| 182 |
+
// ************************************************
|
| 183 |
+
|
| 184 |
+
char projection_type(d_chaine);
|
| 185 |
+
// possible values
|
| 186 |
+
// normal : Normal projection without effect of particle motion along z
|
| 187 |
+
// znormal : Normal projection with effect of particule motion along z
|
| 188 |
+
// angular : Angular projection for stereo PIV
|
| 189 |
+
|
| 190 |
+
double projection_angle; // For angular projection
|
| 191 |
+
projection_angle:valid_min = 0.0;
|
| 192 |
+
projection_angle:valid_max = 360;
|
| 193 |
+
projection_angle:long_name = "Angle of view";
|
| 194 |
+
double projection_tilt_angle; // For angular projection
|
| 195 |
+
projection_tilt_angle:valid_min = 0.0;
|
| 196 |
+
projection_tilt_angle:valid_max = 360;
|
| 197 |
+
projection_tilt_angle:long_name = "Tilt angle";
|
| 198 |
+
|
| 199 |
+
// ************************************************
|
| 200 |
+
// ************* CCD information ************
|
| 201 |
+
// ************************************************
|
| 202 |
+
|
| 203 |
+
// Pixel active area size : ccd_fill_ratio_x*ccd_fill_ratio_y
|
| 204 |
+
double ccd_fill_ratio_x;
|
| 205 |
+
ccd_fill_ratio_x:valid_min = 0.0;
|
| 206 |
+
ccd_fill_ratio_x:valid_max = 1.0;
|
| 207 |
+
ccd_fill_ratio_x:long_name = "X CCD fill ration";
|
| 208 |
+
double ccd_fill_ratio_y;
|
| 209 |
+
ccd_fill_ratio_y:valid_min = 0.0;
|
| 210 |
+
ccd_fill_ratio_y:valid_max = 1.0;
|
| 211 |
+
ccd_fill_ratio_y:long_name = "Y CCD fill ration";
|
| 212 |
+
double ccd_saturation_level;
|
| 213 |
+
ccd_saturation_level:valid_min = 0.0;
|
| 214 |
+
ccd_saturation_level:valid_max = 1.0;
|
| 215 |
+
ccd_saturation_level:long_name = "saturation level";
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
//****** Initial background information *******/
|
| 220 |
+
|
| 221 |
+
char ccd_background_type(d_chaine);
|
| 222 |
+
// Possible alternative
|
| 223 |
+
// uniform : uniform background with
|
| 224 |
+
// level ccd_background_mean_level
|
| 225 |
+
// gaussian: gaussian noise with a mean value
|
| 226 |
+
// equal to ccd_background_mean_level
|
| 227 |
+
// and a std. equal to ccd_background_std_noise
|
| 228 |
+
double ccd_background_mean_level;
|
| 229 |
+
ccd_background_mean_level:valid_min = 0;
|
| 230 |
+
ccd_background_mean_level:long_name = "mean initial background level";
|
| 231 |
+
double ccd_background_std_noise;
|
| 232 |
+
ccd_background_std_noise:valid_min = 0;
|
| 233 |
+
ccd_background_std_noise:long_name = "std. noise for initial background";
|
| 234 |
+
|
| 235 |
+
double ccd_pixel_horizontal_pitch;
|
| 236 |
+
ccd_pixel_horizontal_pitch:valid_min = 0.0;
|
| 237 |
+
ccd_pixel_horizontal_pitch:units = "pixel/real";
|
| 238 |
+
ccd_pixel_horizontal_pitch:long_name = "horizontal pixel pitch";
|
| 239 |
+
|
| 240 |
+
double ccd_pixel_vertical_pitch;
|
| 241 |
+
ccd_pixel_vertical_pitch:valid_min = 0.0;
|
| 242 |
+
ccd_pixel_vertical_pitch:units = "pixel/real";
|
| 243 |
+
ccd_pixel_vertical_pitch:long_name = "vertical pixel pitch";
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
// *************************************************
|
| 247 |
+
// **********optics information ********************
|
| 248 |
+
// *************************************************
|
| 249 |
+
|
| 250 |
+
double optic_object_distance;
|
| 251 |
+
optic_object_distance:long_name = "object distance";
|
| 252 |
+
|
| 253 |
+
double optic_image_distance;
|
| 254 |
+
optic_image_distance:long_name = "image distance";
|
| 255 |
+
|
| 256 |
+
double optic_aperture;
|
| 257 |
+
optic_aperture:valid_min = 1.;
|
| 258 |
+
optic_aperture:long_name = "optic aperture";
|
| 259 |
+
|
| 260 |
+
double optic_magnification;
|
| 261 |
+
optic_magnification:valid_min = 0.0;
|
| 262 |
+
optic_magnification:long_name = "optic magnification";
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
// ************************************************
|
| 269 |
+
// ** initial seed numbers for the random generator
|
| 270 |
+
// ************************************************
|
| 271 |
+
|
| 272 |
+
int seed_number1;
|
| 273 |
+
seed_number1:valid_min = 0;
|
| 274 |
+
seed_number1:valid_max = 30000;
|
| 275 |
+
seed_number1:long_name = "seed number 1";
|
| 276 |
+
|
| 277 |
+
int seed_number2;
|
| 278 |
+
seed_number2:valid_min = 0;
|
| 279 |
+
seed_number2:valid_max = 30000;
|
| 280 |
+
seed_number2:long_name = "seed number 2";
|
| 281 |
+
|
| 282 |
+
int seed_number3;
|
| 283 |
+
seed_number3:valid_min = 0;
|
| 284 |
+
seed_number3:valid_max = 30000;
|
| 285 |
+
seed_number3:long_name = "seed number 3";
|
| 286 |
+
data:
|
| 287 |
+
|
| 288 |
+
p_dimX = 2048 ;
|
| 289 |
+
|
| 290 |
+
p_dimY = 2240 ;
|
| 291 |
+
|
| 292 |
+
p_dimL = 0 ;
|
| 293 |
+
|
| 294 |
+
p_dimR = 0 ;
|
| 295 |
+
|
| 296 |
+
p_dimT = 0 ;
|
| 297 |
+
|
| 298 |
+
p_dimB = 0 ;
|
| 299 |
+
|
| 300 |
+
periodic_flag = "no_periodic" ;
|
| 301 |
+
|
| 302 |
+
r_xmin = 0 ;
|
| 303 |
+
|
| 304 |
+
r_xmax = 150;
|
| 305 |
+
|
| 306 |
+
r_ymin = -159.0625 ;
|
| 307 |
+
|
| 308 |
+
r_ymax = 5 ;
|
| 309 |
+
|
| 310 |
+
r_zmin = -0.6 ;
|
| 311 |
+
|
| 312 |
+
r_zmax = 0.6 ;
|
| 313 |
+
|
| 314 |
+
lsheet_type = "uniform" ;
|
| 315 |
+
|
| 316 |
+
lsheet_rpos_z = 0 ;
|
| 317 |
+
|
| 318 |
+
lsheet_rthickness = 1.2 ;
|
| 319 |
+
|
| 320 |
+
lsheet_wave_length = 532e-9 ;
|
| 321 |
+
|
| 322 |
+
part_distribution = "uniform" ;
|
| 323 |
+
|
| 324 |
+
part_min_diam = 0.7 ;
|
| 325 |
+
|
| 326 |
+
part_max_diam = 0.7;
|
| 327 |
+
|
| 328 |
+
part_mean_diam = 0.7 ;
|
| 329 |
+
|
| 330 |
+
part_std_diam = 0;
|
| 331 |
+
|
| 332 |
+
pattern_type = "gaussian" ;
|
| 333 |
+
|
| 334 |
+
pattern_meanx = 1.274;
|
| 335 |
+
|
| 336 |
+
pattern_meany = 1.274 ;
|
| 337 |
+
|
| 338 |
+
projection_type = "angular" ;
|
| 339 |
+
|
| 340 |
+
projection_angle = 45 ;
|
| 341 |
+
|
| 342 |
+
projection_tilt_angle = 2.39 ;
|
| 343 |
+
|
| 344 |
+
ccd_fill_ratio_x = 1 ;
|
| 345 |
+
|
| 346 |
+
ccd_fill_ratio_y = 1 ;
|
| 347 |
+
|
| 348 |
+
ccd_saturation_level = 1 ;
|
| 349 |
+
|
| 350 |
+
ccd_background_type = "gaussian" ;
|
| 351 |
+
|
| 352 |
+
ccd_background_mean_level = 80 ;
|
| 353 |
+
|
| 354 |
+
ccd_background_std_noise = 16 ;
|
| 355 |
+
|
| 356 |
+
ccd_pixel_horizontal_pitch = 327.68 ;
|
| 357 |
+
|
| 358 |
+
ccd_pixel_vertical_pitch = 327.68 ;
|
| 359 |
+
|
| 360 |
+
optic_object_distance = 5000 ;
|
| 361 |
+
|
| 362 |
+
optic_image_distance = 208.5 ;
|
| 363 |
+
|
| 364 |
+
optic_aperture = 2 ;
|
| 365 |
+
|
| 366 |
+
optic_magnification = 0.0417;
|
| 367 |
+
|
| 368 |
+
seed_number1 = 7 ;
|
| 369 |
+
|
| 370 |
+
seed_number2 = 500 ;
|
| 371 |
+
|
| 372 |
+
seed_number3 = 20000 ;
|
| 373 |
+
}
|
scripts/sig_configs/sigconf_planar.cdl
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
// **************************************************************
|
| 3 |
+
// **************************************************************
|
| 4 |
+
// *********** netcdf configuration file for SIG program *******
|
| 5 |
+
// *********** Version 1.0 *******
|
| 6 |
+
// **************************************************************
|
| 7 |
+
// **************************************************************
|
| 8 |
+
// **************************************************************
|
| 9 |
+
// ** EUROPIV II Project **
|
| 10 |
+
// ** Synthetic Image Generator **
|
| 11 |
+
// ** Feb. 2001 **
|
| 12 |
+
// **************************************************************
|
| 13 |
+
// ** Bertrand Lecordier : Bertrand.Lecordier@coria.fr **
|
| 14 |
+
// ** Jerry Westerweel : j.westerweel@wbmt.tudelft.nl **
|
| 15 |
+
// *************************************************************/
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
netcdf sig_conf {
|
| 19 |
+
|
| 20 |
+
dimensions:
|
| 21 |
+
d_chaine = unlimited;
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
//*********************************************
|
| 25 |
+
//************************Variables ***********
|
| 26 |
+
//*********************************************
|
| 27 |
+
|
| 28 |
+
variables:
|
| 29 |
+
|
| 30 |
+
int p_dimX;
|
| 31 |
+
p_dimX:valid_min = 1;
|
| 32 |
+
p_dimX:valid_max = 4096;
|
| 33 |
+
p_dimX:units = "pixel";
|
| 34 |
+
p_dimX:long_name = "main image width";
|
| 35 |
+
|
| 36 |
+
int p_dimY;
|
| 37 |
+
p_dimY:valid_min = 1;
|
| 38 |
+
p_dimY:valid_max = 4096;
|
| 39 |
+
p_dimY:units = "pixel";
|
| 40 |
+
p_dimY:long_name = "main image height";
|
| 41 |
+
|
| 42 |
+
int p_dimL;
|
| 43 |
+
p_dimL:valid_min = 0;
|
| 44 |
+
p_dimL:valid_max = 1024;
|
| 45 |
+
p_dimL:units = "pixel";
|
| 46 |
+
p_dimL:long_name = "left strip";
|
| 47 |
+
|
| 48 |
+
int p_dimR;
|
| 49 |
+
p_dimR:valid_min = 0;
|
| 50 |
+
p_dimR:valid_max = 1024;
|
| 51 |
+
p_dimR:units = "pixel";
|
| 52 |
+
p_dimR:long_name = "right strip";
|
| 53 |
+
|
| 54 |
+
int p_dimT;
|
| 55 |
+
p_dimT:valid_min = 0;
|
| 56 |
+
p_dimT:valid_max = 1024;
|
| 57 |
+
p_dimT:units = "pixel";
|
| 58 |
+
p_dimT:long_name = "top strip";
|
| 59 |
+
|
| 60 |
+
int p_dimB;
|
| 61 |
+
p_dimB:valid_min = 0;
|
| 62 |
+
p_dimB:valid_max = 1024;
|
| 63 |
+
p_dimB:units = "pixel";
|
| 64 |
+
p_dimB:long_name = "bottom strip";
|
| 65 |
+
|
| 66 |
+
char periodic_flag(d_chaine);
|
| 67 |
+
|
| 68 |
+
//*********************************************
|
| 69 |
+
//*********************************************
|
| 70 |
+
// Particle field dimension (real space)
|
| 71 |
+
// r_[x,y,z]min, r_[x,y,z]max defined the region of interest
|
| 72 |
+
// into the particle field - the particle field can be largeur
|
| 73 |
+
//
|
| 74 |
+
// The magnification factor is obtained from
|
| 75 |
+
// Gx = (r_xmax-r_xmin)/p_dimX (real/pixel)
|
| 76 |
+
// Gy = (r_ymax-r_ymin)/p_dimY (real/pixel)
|
| 77 |
+
// Important : Gx and Gy can be different
|
| 78 |
+
|
| 79 |
+
// ******* X axis **************************
|
| 80 |
+
double r_xmin;
|
| 81 |
+
r_xmin:units = "real";
|
| 82 |
+
r_xmin:long_name = "x minimum";
|
| 83 |
+
|
| 84 |
+
double r_xmax;
|
| 85 |
+
r_xmax:units = "real";
|
| 86 |
+
r_xmax:long_name = "x maximum";
|
| 87 |
+
|
| 88 |
+
// ******* Y axis **************************
|
| 89 |
+
double r_ymin;
|
| 90 |
+
r_ymin:units = "real";
|
| 91 |
+
r_ymin:long_name = "y minimum";
|
| 92 |
+
|
| 93 |
+
double r_ymax;
|
| 94 |
+
r_ymax:units = "real";
|
| 95 |
+
r_ymax:long_name = "y maximum";
|
| 96 |
+
|
| 97 |
+
// ******* Z axis ***************************
|
| 98 |
+
// ** for the 2D particle (x,y), used the same value for
|
| 99 |
+
// ** r_zmin, r_zmin and sheet_rpos_z
|
| 100 |
+
double r_zmin;
|
| 101 |
+
r_zmin:units = "real";
|
| 102 |
+
r_zmin:long_name = "z minimum";
|
| 103 |
+
|
| 104 |
+
double r_zmax;
|
| 105 |
+
r_zmax:units = "real";
|
| 106 |
+
r_zmax:long_name = "z maximum";
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
// ****************************************
|
| 110 |
+
// ****************************************
|
| 111 |
+
// Light sheet information
|
| 112 |
+
// ****************************************
|
| 113 |
+
// ****************************************
|
| 114 |
+
|
| 115 |
+
char lsheet_type(d_chaine);
|
| 116 |
+
lsheet_type:long_name = "type of light sheet";
|
| 117 |
+
// possible values :
|
| 118 |
+
// uniform
|
| 119 |
+
// gaussian
|
| 120 |
+
// triangle
|
| 121 |
+
// cosine
|
| 122 |
+
// squarecosine
|
| 123 |
+
|
| 124 |
+
// location in the real domain of the center
|
| 125 |
+
// of laser sheet (perpendicular to the z axis)
|
| 126 |
+
double lsheet_rpos_z;
|
| 127 |
+
lsheet_rpos_z:units = "real";
|
| 128 |
+
lsheet_rpos_z:long_name = "z location of light sheet";
|
| 129 |
+
|
| 130 |
+
double lsheet_rthickness;
|
| 131 |
+
lsheet_rthickness:valid_min = 0.0;
|
| 132 |
+
lsheet_rthickness:units = "real";
|
| 133 |
+
lsheet_rthickness:long_name = "light sheet thickness";
|
| 134 |
+
|
| 135 |
+
double lsheet_wave_length;
|
| 136 |
+
lsheet_wave_length:valid_min = 0.0;
|
| 137 |
+
lsheet_wave_length:units = "real";
|
| 138 |
+
lsheet_wave_length:long_name = "laser wave length";
|
| 139 |
+
|
| 140 |
+
// ************************************************
|
| 141 |
+
// ************* Particle distribution ************
|
| 142 |
+
// ************************************************
|
| 143 |
+
|
| 144 |
+
char part_distribution(d_chaine);
|
| 145 |
+
// Possible alternative
|
| 146 |
+
// uniform : constant diameter equal to part_mean_diam
|
| 147 |
+
//
|
| 148 |
+
// gaussian: gaussian distribution for the particle diameter
|
| 149 |
+
// mean diameter : part_mean_diam
|
| 150 |
+
// std diameter : part_std_diam
|
| 151 |
+
double part_min_diam;
|
| 152 |
+
part_min_diam:valid_min = 0.0;
|
| 153 |
+
part_min_diam:long_name = "minimum particle diameter";
|
| 154 |
+
double part_max_diam;
|
| 155 |
+
part_max_diam:valid_min = 0.0;
|
| 156 |
+
part_max_diam:valid_max = 10.0;
|
| 157 |
+
part_max_diam:long_name = "maximum particle diameter";
|
| 158 |
+
double part_mean_diam;
|
| 159 |
+
part_mean_diam:long_name= "mean particle diamete";
|
| 160 |
+
double part_std_diam;
|
| 161 |
+
part_std_diam:long_name= "std. of distribution of particle diameter";
|
| 162 |
+
|
| 163 |
+
// *****************************************************
|
| 164 |
+
// ************ image pattern information **************
|
| 165 |
+
// *****************************************************
|
| 166 |
+
|
| 167 |
+
char pattern_type(d_chaine);
|
| 168 |
+
// possible values
|
| 169 |
+
// gaussian : gaussian particle shape
|
| 170 |
+
// circle : circle particle shape
|
| 171 |
+
// rectangle: rectangle particle shape
|
| 172 |
+
double pattern_meanx;
|
| 173 |
+
pattern_meanx:valid_min = 0.0;
|
| 174 |
+
pattern_meanx:long_name = "pattern size for the part_meanx_diam";
|
| 175 |
+
double pattern_meany;
|
| 176 |
+
pattern_meany:valid_min = 0.0;
|
| 177 |
+
pattern_meany:long_name = "pattern size for the part_meany_diam";
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
// ************************************************
|
| 181 |
+
// ************ Projection information ************
|
| 182 |
+
// ************************************************
|
| 183 |
+
|
| 184 |
+
char projection_type(d_chaine);
|
| 185 |
+
// possible values
|
| 186 |
+
// normal : Normal projection without effect of particle motion along z
|
| 187 |
+
// znormal : Normal projection with effect of particule motion along z
|
| 188 |
+
// angular : Angular projection for stereo PIV
|
| 189 |
+
|
| 190 |
+
double projection_angle; // For angular projection
|
| 191 |
+
projection_angle:valid_min = 0.0;
|
| 192 |
+
projection_angle:valid_max = 360;
|
| 193 |
+
projection_angle:long_name = "Angle of view";
|
| 194 |
+
double projection_tilt_angle; // For angular projection
|
| 195 |
+
projection_tilt_angle:valid_min = 0.0;
|
| 196 |
+
projection_tilt_angle:valid_max = 360;
|
| 197 |
+
projection_tilt_angle:long_name = "Tilt angle";
|
| 198 |
+
|
| 199 |
+
// ************************************************
|
| 200 |
+
// ************* CCD information ************
|
| 201 |
+
// ************************************************
|
| 202 |
+
|
| 203 |
+
// Pixel active area size : ccd_fill_ratio_x*ccd_fill_ratio_y
|
| 204 |
+
double ccd_fill_ratio_x;
|
| 205 |
+
ccd_fill_ratio_x:valid_min = 0.0;
|
| 206 |
+
ccd_fill_ratio_x:valid_max = 1.0;
|
| 207 |
+
ccd_fill_ratio_x:long_name = "X CCD fill ration";
|
| 208 |
+
double ccd_fill_ratio_y;
|
| 209 |
+
ccd_fill_ratio_y:valid_min = 0.0;
|
| 210 |
+
ccd_fill_ratio_y:valid_max = 1.0;
|
| 211 |
+
ccd_fill_ratio_y:long_name = "Y CCD fill ration";
|
| 212 |
+
double ccd_saturation_level;
|
| 213 |
+
ccd_saturation_level:valid_min = 0.0;
|
| 214 |
+
ccd_saturation_level:valid_max = 1.0;
|
| 215 |
+
ccd_saturation_level:long_name = "saturation level";
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
//****** Initial background information *******/
|
| 220 |
+
|
| 221 |
+
char ccd_background_type(d_chaine);
|
| 222 |
+
// Possible alternative
|
| 223 |
+
// uniform : uniform background with
|
| 224 |
+
// level ccd_background_mean_level
|
| 225 |
+
// gaussian: gaussian noise with a mean value
|
| 226 |
+
// equal to ccd_background_mean_level
|
| 227 |
+
// and a std. equal to ccd_background_std_noise
|
| 228 |
+
double ccd_background_mean_level;
|
| 229 |
+
ccd_background_mean_level:valid_min = 0;
|
| 230 |
+
ccd_background_mean_level:long_name = "mean initial background level";
|
| 231 |
+
double ccd_background_std_noise;
|
| 232 |
+
ccd_background_std_noise:valid_min = 0;
|
| 233 |
+
ccd_background_std_noise:long_name = "std. noise for initial background";
|
| 234 |
+
|
| 235 |
+
double ccd_pixel_horizontal_pitch;
|
| 236 |
+
ccd_pixel_horizontal_pitch:valid_min = 0.0;
|
| 237 |
+
ccd_pixel_horizontal_pitch:units = "pixel/real";
|
| 238 |
+
ccd_pixel_horizontal_pitch:long_name = "horizontal pixel pitch";
|
| 239 |
+
|
| 240 |
+
double ccd_pixel_vertical_pitch;
|
| 241 |
+
ccd_pixel_vertical_pitch:valid_min = 0.0;
|
| 242 |
+
ccd_pixel_vertical_pitch:units = "pixel/real";
|
| 243 |
+
ccd_pixel_vertical_pitch:long_name = "vertical pixel pitch";
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
// *************************************************
|
| 247 |
+
// **********optics information ********************
|
| 248 |
+
// *************************************************
|
| 249 |
+
|
| 250 |
+
double optic_object_distance;
|
| 251 |
+
optic_object_distance:long_name = "object distance";
|
| 252 |
+
|
| 253 |
+
double optic_image_distance;
|
| 254 |
+
optic_image_distance:long_name = "image distance";
|
| 255 |
+
|
| 256 |
+
double optic_aperture;
|
| 257 |
+
optic_aperture:valid_min = 1.;
|
| 258 |
+
optic_aperture:long_name = "optic aperture";
|
| 259 |
+
|
| 260 |
+
double optic_magnification;
|
| 261 |
+
optic_magnification:valid_min = 0.0;
|
| 262 |
+
optic_magnification:long_name = "optic magnification";
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
// ************************************************
|
| 269 |
+
// ** initial seed numbers for the random generator
|
| 270 |
+
// ************************************************
|
| 271 |
+
|
| 272 |
+
int seed_number1;
|
| 273 |
+
seed_number1:valid_min = 0;
|
| 274 |
+
seed_number1:valid_max = 30000;
|
| 275 |
+
seed_number1:long_name = "seed number 1";
|
| 276 |
+
|
| 277 |
+
int seed_number2;
|
| 278 |
+
seed_number2:valid_min = 0;
|
| 279 |
+
seed_number2:valid_max = 30000;
|
| 280 |
+
seed_number2:long_name = "seed number 2";
|
| 281 |
+
|
| 282 |
+
int seed_number3;
|
| 283 |
+
seed_number3:valid_min = 0;
|
| 284 |
+
seed_number3:valid_max = 30000;
|
| 285 |
+
seed_number3:long_name = "seed number 3";
|
| 286 |
+
data:
|
| 287 |
+
|
| 288 |
+
p_dimX = 2048 ;
|
| 289 |
+
|
| 290 |
+
p_dimY = 2048 ;
|
| 291 |
+
|
| 292 |
+
p_dimL = 0 ;
|
| 293 |
+
|
| 294 |
+
p_dimR = 0 ;
|
| 295 |
+
|
| 296 |
+
p_dimT = 0 ;
|
| 297 |
+
|
| 298 |
+
p_dimB = 0 ;
|
| 299 |
+
|
| 300 |
+
periodic_flag = "no_periodic" ;
|
| 301 |
+
|
| 302 |
+
r_xmin = 0 ;
|
| 303 |
+
|
| 304 |
+
r_xmax = 150;
|
| 305 |
+
|
| 306 |
+
r_ymin = -150 ;
|
| 307 |
+
|
| 308 |
+
r_ymax = 0 ;
|
| 309 |
+
|
| 310 |
+
r_zmin = -0.6 ;
|
| 311 |
+
|
| 312 |
+
r_zmax = 0.6 ;
|
| 313 |
+
|
| 314 |
+
lsheet_type = "uniform" ;
|
| 315 |
+
|
| 316 |
+
lsheet_rpos_z = 0 ;
|
| 317 |
+
|
| 318 |
+
lsheet_rthickness = 1.2 ;
|
| 319 |
+
|
| 320 |
+
lsheet_wave_length = 532e-9 ;
|
| 321 |
+
|
| 322 |
+
part_distribution = "uniform" ;
|
| 323 |
+
|
| 324 |
+
part_min_diam = 0.7 ;
|
| 325 |
+
|
| 326 |
+
part_max_diam = 0.7;
|
| 327 |
+
|
| 328 |
+
part_mean_diam = 0.7 ;
|
| 329 |
+
|
| 330 |
+
part_std_diam = 0;
|
| 331 |
+
|
| 332 |
+
pattern_type = "gaussian" ;
|
| 333 |
+
|
| 334 |
+
pattern_meanx = 1.274;
|
| 335 |
+
|
| 336 |
+
pattern_meany = 1.274 ;
|
| 337 |
+
|
| 338 |
+
projection_type = "normal" ;
|
| 339 |
+
|
| 340 |
+
projection_angle = 0 ;
|
| 341 |
+
|
| 342 |
+
projection_tilt_angle = 0 ;
|
| 343 |
+
|
| 344 |
+
ccd_fill_ratio_x = 1 ;
|
| 345 |
+
|
| 346 |
+
ccd_fill_ratio_y = 1 ;
|
| 347 |
+
|
| 348 |
+
ccd_saturation_level = 1 ;
|
| 349 |
+
|
| 350 |
+
ccd_background_type = "gaussian" ;
|
| 351 |
+
|
| 352 |
+
ccd_background_mean_level = 0 ;
|
| 353 |
+
|
| 354 |
+
ccd_background_std_noise = 0 ;
|
| 355 |
+
|
| 356 |
+
ccd_pixel_horizontal_pitch = 327.68 ;
|
| 357 |
+
|
| 358 |
+
ccd_pixel_vertical_pitch = 327.68 ;
|
| 359 |
+
|
| 360 |
+
optic_object_distance = 5000 ;
|
| 361 |
+
|
| 362 |
+
optic_image_distance = 208.5 ;
|
| 363 |
+
|
| 364 |
+
optic_aperture = 2 ;
|
| 365 |
+
|
| 366 |
+
optic_magnification = 0.0417;
|
| 367 |
+
|
| 368 |
+
seed_number1 = 1 ;
|
| 369 |
+
|
| 370 |
+
seed_number2 = 100 ;
|
| 371 |
+
|
| 372 |
+
seed_number3 = 10000 ;
|
| 373 |
+
}
|
scripts/sig_configs/sigconf_planar_noisy_A.cdl
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
// **************************************************************
|
| 3 |
+
// **************************************************************
|
| 4 |
+
// *********** netcdf configuration file for SIG program *******
|
| 5 |
+
// *********** Version 1.0 *******
|
| 6 |
+
// **************************************************************
|
| 7 |
+
// **************************************************************
|
| 8 |
+
// **************************************************************
|
| 9 |
+
// ** EUROPIV II Project **
|
| 10 |
+
// ** Synthetic Image Generator **
|
| 11 |
+
// ** Feb. 2001 **
|
| 12 |
+
// **************************************************************
|
| 13 |
+
// ** Bertrand Lecordier : Bertrand.Lecordier@coria.fr **
|
| 14 |
+
// ** Jerry Westerweel : j.westerweel@wbmt.tudelft.nl **
|
| 15 |
+
// *************************************************************/
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
netcdf sig_conf {
|
| 19 |
+
|
| 20 |
+
dimensions:
|
| 21 |
+
d_chaine = unlimited;
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
//*********************************************
|
| 25 |
+
//************************Variables ***********
|
| 26 |
+
//*********************************************
|
| 27 |
+
|
| 28 |
+
variables:
|
| 29 |
+
|
| 30 |
+
int p_dimX;
|
| 31 |
+
p_dimX:valid_min = 1;
|
| 32 |
+
p_dimX:valid_max = 4096;
|
| 33 |
+
p_dimX:units = "pixel";
|
| 34 |
+
p_dimX:long_name = "main image width";
|
| 35 |
+
|
| 36 |
+
int p_dimY;
|
| 37 |
+
p_dimY:valid_min = 1;
|
| 38 |
+
p_dimY:valid_max = 4096;
|
| 39 |
+
p_dimY:units = "pixel";
|
| 40 |
+
p_dimY:long_name = "main image height";
|
| 41 |
+
|
| 42 |
+
int p_dimL;
|
| 43 |
+
p_dimL:valid_min = 0;
|
| 44 |
+
p_dimL:valid_max = 1024;
|
| 45 |
+
p_dimL:units = "pixel";
|
| 46 |
+
p_dimL:long_name = "left strip";
|
| 47 |
+
|
| 48 |
+
int p_dimR;
|
| 49 |
+
p_dimR:valid_min = 0;
|
| 50 |
+
p_dimR:valid_max = 1024;
|
| 51 |
+
p_dimR:units = "pixel";
|
| 52 |
+
p_dimR:long_name = "right strip";
|
| 53 |
+
|
| 54 |
+
int p_dimT;
|
| 55 |
+
p_dimT:valid_min = 0;
|
| 56 |
+
p_dimT:valid_max = 1024;
|
| 57 |
+
p_dimT:units = "pixel";
|
| 58 |
+
p_dimT:long_name = "top strip";
|
| 59 |
+
|
| 60 |
+
int p_dimB;
|
| 61 |
+
p_dimB:valid_min = 0;
|
| 62 |
+
p_dimB:valid_max = 1024;
|
| 63 |
+
p_dimB:units = "pixel";
|
| 64 |
+
p_dimB:long_name = "bottom strip";
|
| 65 |
+
|
| 66 |
+
char periodic_flag(d_chaine);
|
| 67 |
+
|
| 68 |
+
//*********************************************
|
| 69 |
+
//*********************************************
|
| 70 |
+
// Particle field dimension (real space)
|
| 71 |
+
// r_[x,y,z]min, r_[x,y,z]max defined the region of interest
|
| 72 |
+
// into the particle field - the particle field can be largeur
|
| 73 |
+
//
|
| 74 |
+
// The magnification factor is obtained from
|
| 75 |
+
// Gx = (r_xmax-r_xmin)/p_dimX (real/pixel)
|
| 76 |
+
// Gy = (r_ymax-r_ymin)/p_dimY (real/pixel)
|
| 77 |
+
// Important : Gx and Gy can be different
|
| 78 |
+
|
| 79 |
+
// ******* X axis **************************
|
| 80 |
+
double r_xmin;
|
| 81 |
+
r_xmin:units = "real";
|
| 82 |
+
r_xmin:long_name = "x minimum";
|
| 83 |
+
|
| 84 |
+
double r_xmax;
|
| 85 |
+
r_xmax:units = "real";
|
| 86 |
+
r_xmax:long_name = "x maximum";
|
| 87 |
+
|
| 88 |
+
// ******* Y axis **************************
|
| 89 |
+
double r_ymin;
|
| 90 |
+
r_ymin:units = "real";
|
| 91 |
+
r_ymin:long_name = "y minimum";
|
| 92 |
+
|
| 93 |
+
double r_ymax;
|
| 94 |
+
r_ymax:units = "real";
|
| 95 |
+
r_ymax:long_name = "y maximum";
|
| 96 |
+
|
| 97 |
+
// ******* Z axis ***************************
|
| 98 |
+
// ** for the 2D particle (x,y), used the same value for
|
| 99 |
+
// ** r_zmin, r_zmin and sheet_rpos_z
|
| 100 |
+
double r_zmin;
|
| 101 |
+
r_zmin:units = "real";
|
| 102 |
+
r_zmin:long_name = "z minimum";
|
| 103 |
+
|
| 104 |
+
double r_zmax;
|
| 105 |
+
r_zmax:units = "real";
|
| 106 |
+
r_zmax:long_name = "z maximum";
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
// ****************************************
|
| 110 |
+
// ****************************************
|
| 111 |
+
// Light sheet information
|
| 112 |
+
// ****************************************
|
| 113 |
+
// ****************************************
|
| 114 |
+
|
| 115 |
+
char lsheet_type(d_chaine);
|
| 116 |
+
lsheet_type:long_name = "type of light sheet";
|
| 117 |
+
// possible values :
|
| 118 |
+
// uniform
|
| 119 |
+
// gaussian
|
| 120 |
+
// triangle
|
| 121 |
+
// cosine
|
| 122 |
+
// squarecosine
|
| 123 |
+
|
| 124 |
+
// location in the real domain of the center
|
| 125 |
+
// of laser sheet (perpendicular to the z axis)
|
| 126 |
+
double lsheet_rpos_z;
|
| 127 |
+
lsheet_rpos_z:units = "real";
|
| 128 |
+
lsheet_rpos_z:long_name = "z location of light sheet";
|
| 129 |
+
|
| 130 |
+
double lsheet_rthickness;
|
| 131 |
+
lsheet_rthickness:valid_min = 0.0;
|
| 132 |
+
lsheet_rthickness:units = "real";
|
| 133 |
+
lsheet_rthickness:long_name = "light sheet thickness";
|
| 134 |
+
|
| 135 |
+
double lsheet_wave_length;
|
| 136 |
+
lsheet_wave_length:valid_min = 0.0;
|
| 137 |
+
lsheet_wave_length:units = "real";
|
| 138 |
+
lsheet_wave_length:long_name = "laser wave length";
|
| 139 |
+
|
| 140 |
+
// ************************************************
|
| 141 |
+
// ************* Particle distribution ************
|
| 142 |
+
// ************************************************
|
| 143 |
+
|
| 144 |
+
char part_distribution(d_chaine);
|
| 145 |
+
// Possible alternative
|
| 146 |
+
// uniform : constant diameter equal to part_mean_diam
|
| 147 |
+
//
|
| 148 |
+
// gaussian: gaussian distribution for the particle diameter
|
| 149 |
+
// mean diameter : part_mean_diam
|
| 150 |
+
// std diameter : part_std_diam
|
| 151 |
+
double part_min_diam;
|
| 152 |
+
part_min_diam:valid_min = 0.0;
|
| 153 |
+
part_min_diam:long_name = "minimum particle diameter";
|
| 154 |
+
double part_max_diam;
|
| 155 |
+
part_max_diam:valid_min = 0.0;
|
| 156 |
+
part_max_diam:valid_max = 10.0;
|
| 157 |
+
part_max_diam:long_name = "maximum particle diameter";
|
| 158 |
+
double part_mean_diam;
|
| 159 |
+
part_mean_diam:long_name= "mean particle diamete";
|
| 160 |
+
double part_std_diam;
|
| 161 |
+
part_std_diam:long_name= "std. of distribution of particle diameter";
|
| 162 |
+
|
| 163 |
+
// *****************************************************
|
| 164 |
+
// ************ image pattern information **************
|
| 165 |
+
// *****************************************************
|
| 166 |
+
|
| 167 |
+
char pattern_type(d_chaine);
|
| 168 |
+
// possible values
|
| 169 |
+
// gaussian : gaussian particle shape
|
| 170 |
+
// circle : circle particle shape
|
| 171 |
+
// rectangle: rectangle particle shape
|
| 172 |
+
double pattern_meanx;
|
| 173 |
+
pattern_meanx:valid_min = 0.0;
|
| 174 |
+
pattern_meanx:long_name = "pattern size for the part_meanx_diam";
|
| 175 |
+
double pattern_meany;
|
| 176 |
+
pattern_meany:valid_min = 0.0;
|
| 177 |
+
pattern_meany:long_name = "pattern size for the part_meany_diam";
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
// ************************************************
|
| 181 |
+
// ************ Projection information ************
|
| 182 |
+
// ************************************************
|
| 183 |
+
|
| 184 |
+
char projection_type(d_chaine);
|
| 185 |
+
// possible values
|
| 186 |
+
// normal : Normal projection without effect of particle motion along z
|
| 187 |
+
// znormal : Normal projection with effect of particule motion along z
|
| 188 |
+
// angular : Angular projection for stereo PIV
|
| 189 |
+
|
| 190 |
+
double projection_angle; // For angular projection
|
| 191 |
+
projection_angle:valid_min = 0.0;
|
| 192 |
+
projection_angle:valid_max = 360;
|
| 193 |
+
projection_angle:long_name = "Angle of view";
|
| 194 |
+
double projection_tilt_angle; // For angular projection
|
| 195 |
+
projection_tilt_angle:valid_min = 0.0;
|
| 196 |
+
projection_tilt_angle:valid_max = 360;
|
| 197 |
+
projection_tilt_angle:long_name = "Tilt angle";
|
| 198 |
+
|
| 199 |
+
// ************************************************
|
| 200 |
+
// ************* CCD information ************
|
| 201 |
+
// ************************************************
|
| 202 |
+
|
| 203 |
+
// Pixel active area size : ccd_fill_ratio_x*ccd_fill_ratio_y
|
| 204 |
+
double ccd_fill_ratio_x;
|
| 205 |
+
ccd_fill_ratio_x:valid_min = 0.0;
|
| 206 |
+
ccd_fill_ratio_x:valid_max = 1.0;
|
| 207 |
+
ccd_fill_ratio_x:long_name = "X CCD fill ration";
|
| 208 |
+
double ccd_fill_ratio_y;
|
| 209 |
+
ccd_fill_ratio_y:valid_min = 0.0;
|
| 210 |
+
ccd_fill_ratio_y:valid_max = 1.0;
|
| 211 |
+
ccd_fill_ratio_y:long_name = "Y CCD fill ration";
|
| 212 |
+
double ccd_saturation_level;
|
| 213 |
+
ccd_saturation_level:valid_min = 0.0;
|
| 214 |
+
ccd_saturation_level:valid_max = 1.0;
|
| 215 |
+
ccd_saturation_level:long_name = "saturation level";
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
//****** Initial background information *******/
|
| 220 |
+
|
| 221 |
+
char ccd_background_type(d_chaine);
|
| 222 |
+
// Possible alternative
|
| 223 |
+
// uniform : uniform background with
|
| 224 |
+
// level ccd_background_mean_level
|
| 225 |
+
// gaussian: gaussian noise with a mean value
|
| 226 |
+
// equal to ccd_background_mean_level
|
| 227 |
+
// and a std. equal to ccd_background_std_noise
|
| 228 |
+
double ccd_background_mean_level;
|
| 229 |
+
ccd_background_mean_level:valid_min = 0;
|
| 230 |
+
ccd_background_mean_level:long_name = "mean initial background level";
|
| 231 |
+
double ccd_background_std_noise;
|
| 232 |
+
ccd_background_std_noise:valid_min = 0;
|
| 233 |
+
ccd_background_std_noise:long_name = "std. noise for initial background";
|
| 234 |
+
|
| 235 |
+
double ccd_pixel_horizontal_pitch;
|
| 236 |
+
ccd_pixel_horizontal_pitch:valid_min = 0.0;
|
| 237 |
+
ccd_pixel_horizontal_pitch:units = "pixel/real";
|
| 238 |
+
ccd_pixel_horizontal_pitch:long_name = "horizontal pixel pitch";
|
| 239 |
+
|
| 240 |
+
double ccd_pixel_vertical_pitch;
|
| 241 |
+
ccd_pixel_vertical_pitch:valid_min = 0.0;
|
| 242 |
+
ccd_pixel_vertical_pitch:units = "pixel/real";
|
| 243 |
+
ccd_pixel_vertical_pitch:long_name = "vertical pixel pitch";
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
// *************************************************
|
| 247 |
+
// **********optics information ********************
|
| 248 |
+
// *************************************************
|
| 249 |
+
|
| 250 |
+
double optic_object_distance;
|
| 251 |
+
optic_object_distance:long_name = "object distance";
|
| 252 |
+
|
| 253 |
+
double optic_image_distance;
|
| 254 |
+
optic_image_distance:long_name = "image distance";
|
| 255 |
+
|
| 256 |
+
double optic_aperture;
|
| 257 |
+
optic_aperture:valid_min = 1.;
|
| 258 |
+
optic_aperture:long_name = "optic aperture";
|
| 259 |
+
|
| 260 |
+
double optic_magnification;
|
| 261 |
+
optic_magnification:valid_min = 0.0;
|
| 262 |
+
optic_magnification:long_name = "optic magnification";
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
// ************************************************
|
| 269 |
+
// ** initial seed numbers for the random generator
|
| 270 |
+
// ************************************************
|
| 271 |
+
|
| 272 |
+
int seed_number1;
|
| 273 |
+
seed_number1:valid_min = 0;
|
| 274 |
+
seed_number1:valid_max = 30000;
|
| 275 |
+
seed_number1:long_name = "seed number 1";
|
| 276 |
+
|
| 277 |
+
int seed_number2;
|
| 278 |
+
seed_number2:valid_min = 0;
|
| 279 |
+
seed_number2:valid_max = 30000;
|
| 280 |
+
seed_number2:long_name = "seed number 2";
|
| 281 |
+
|
| 282 |
+
int seed_number3;
|
| 283 |
+
seed_number3:valid_min = 0;
|
| 284 |
+
seed_number3:valid_max = 30000;
|
| 285 |
+
seed_number3:long_name = "seed number 3";
|
| 286 |
+
data:
|
| 287 |
+
|
| 288 |
+
p_dimX = 2048 ;
|
| 289 |
+
|
| 290 |
+
p_dimY = 2048 ;
|
| 291 |
+
|
| 292 |
+
p_dimL = 0 ;
|
| 293 |
+
|
| 294 |
+
p_dimR = 0 ;
|
| 295 |
+
|
| 296 |
+
p_dimT = 0 ;
|
| 297 |
+
|
| 298 |
+
p_dimB = 0 ;
|
| 299 |
+
|
| 300 |
+
periodic_flag = "no_periodic" ;
|
| 301 |
+
|
| 302 |
+
r_xmin = 0 ;
|
| 303 |
+
|
| 304 |
+
r_xmax = 150;
|
| 305 |
+
|
| 306 |
+
r_ymin = -150 ;
|
| 307 |
+
|
| 308 |
+
r_ymax = 0 ;
|
| 309 |
+
|
| 310 |
+
r_zmin = -0.6 ;
|
| 311 |
+
|
| 312 |
+
r_zmax = 0.6 ;
|
| 313 |
+
|
| 314 |
+
lsheet_type = "uniform" ;
|
| 315 |
+
|
| 316 |
+
lsheet_rpos_z = 0 ;
|
| 317 |
+
|
| 318 |
+
lsheet_rthickness = 1.2 ;
|
| 319 |
+
|
| 320 |
+
lsheet_wave_length = 532e-9 ;
|
| 321 |
+
|
| 322 |
+
part_distribution = "uniform" ;
|
| 323 |
+
|
| 324 |
+
part_min_diam = 0.7 ;
|
| 325 |
+
|
| 326 |
+
part_max_diam = 0.7;
|
| 327 |
+
|
| 328 |
+
part_mean_diam = 0.7 ;
|
| 329 |
+
|
| 330 |
+
part_std_diam = 0;
|
| 331 |
+
|
| 332 |
+
pattern_type = "gaussian" ;
|
| 333 |
+
|
| 334 |
+
pattern_meanx = 1.274;
|
| 335 |
+
|
| 336 |
+
pattern_meany = 1.274 ;
|
| 337 |
+
|
| 338 |
+
projection_type = "normal" ;
|
| 339 |
+
|
| 340 |
+
projection_angle = 0 ;
|
| 341 |
+
|
| 342 |
+
projection_tilt_angle = 0 ;
|
| 343 |
+
|
| 344 |
+
ccd_fill_ratio_x = 1 ;
|
| 345 |
+
|
| 346 |
+
ccd_fill_ratio_y = 1 ;
|
| 347 |
+
|
| 348 |
+
ccd_saturation_level = 1 ;
|
| 349 |
+
|
| 350 |
+
ccd_background_type = "gaussian" ;
|
| 351 |
+
|
| 352 |
+
ccd_background_mean_level = 80 ;
|
| 353 |
+
|
| 354 |
+
ccd_background_std_noise = 16 ;
|
| 355 |
+
|
| 356 |
+
ccd_pixel_horizontal_pitch = 327.68 ;
|
| 357 |
+
|
| 358 |
+
ccd_pixel_vertical_pitch = 327.68 ;
|
| 359 |
+
|
| 360 |
+
optic_object_distance = 5000 ;
|
| 361 |
+
|
| 362 |
+
optic_image_distance = 208.5 ;
|
| 363 |
+
|
| 364 |
+
optic_aperture = 2 ;
|
| 365 |
+
|
| 366 |
+
optic_magnification = 0.0417;
|
| 367 |
+
|
| 368 |
+
seed_number1 = 1 ;
|
| 369 |
+
|
| 370 |
+
seed_number2 = 100 ;
|
| 371 |
+
|
| 372 |
+
seed_number3 = 10000 ;
|
| 373 |
+
}
|
scripts/sig_configs/sigconf_planar_noisy_B.cdl
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
// **************************************************************
|
| 3 |
+
// **************************************************************
|
| 4 |
+
// *********** netcdf configuration file for SIG program *******
|
| 5 |
+
// *********** Version 1.0 *******
|
| 6 |
+
// **************************************************************
|
| 7 |
+
// **************************************************************
|
| 8 |
+
// **************************************************************
|
| 9 |
+
// ** EUROPIV II Project **
|
| 10 |
+
// ** Synthetic Image Generator **
|
| 11 |
+
// ** Feb. 2001 **
|
| 12 |
+
// **************************************************************
|
| 13 |
+
// ** Bertrand Lecordier : Bertrand.Lecordier@coria.fr **
|
| 14 |
+
// ** Jerry Westerweel : j.westerweel@wbmt.tudelft.nl **
|
| 15 |
+
// *************************************************************/
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
netcdf sig_conf {
|
| 19 |
+
|
| 20 |
+
dimensions:
|
| 21 |
+
d_chaine = unlimited;
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
//*********************************************
|
| 25 |
+
//************************Variables ***********
|
| 26 |
+
//*********************************************
|
| 27 |
+
|
| 28 |
+
variables:
|
| 29 |
+
|
| 30 |
+
int p_dimX;
|
| 31 |
+
p_dimX:valid_min = 1;
|
| 32 |
+
p_dimX:valid_max = 4096;
|
| 33 |
+
p_dimX:units = "pixel";
|
| 34 |
+
p_dimX:long_name = "main image width";
|
| 35 |
+
|
| 36 |
+
int p_dimY;
|
| 37 |
+
p_dimY:valid_min = 1;
|
| 38 |
+
p_dimY:valid_max = 4096;
|
| 39 |
+
p_dimY:units = "pixel";
|
| 40 |
+
p_dimY:long_name = "main image height";
|
| 41 |
+
|
| 42 |
+
int p_dimL;
|
| 43 |
+
p_dimL:valid_min = 0;
|
| 44 |
+
p_dimL:valid_max = 1024;
|
| 45 |
+
p_dimL:units = "pixel";
|
| 46 |
+
p_dimL:long_name = "left strip";
|
| 47 |
+
|
| 48 |
+
int p_dimR;
|
| 49 |
+
p_dimR:valid_min = 0;
|
| 50 |
+
p_dimR:valid_max = 1024;
|
| 51 |
+
p_dimR:units = "pixel";
|
| 52 |
+
p_dimR:long_name = "right strip";
|
| 53 |
+
|
| 54 |
+
int p_dimT;
|
| 55 |
+
p_dimT:valid_min = 0;
|
| 56 |
+
p_dimT:valid_max = 1024;
|
| 57 |
+
p_dimT:units = "pixel";
|
| 58 |
+
p_dimT:long_name = "top strip";
|
| 59 |
+
|
| 60 |
+
int p_dimB;
|
| 61 |
+
p_dimB:valid_min = 0;
|
| 62 |
+
p_dimB:valid_max = 1024;
|
| 63 |
+
p_dimB:units = "pixel";
|
| 64 |
+
p_dimB:long_name = "bottom strip";
|
| 65 |
+
|
| 66 |
+
char periodic_flag(d_chaine);
|
| 67 |
+
|
| 68 |
+
//*********************************************
|
| 69 |
+
//*********************************************
|
| 70 |
+
// Particle field dimension (real space)
|
| 71 |
+
// r_[x,y,z]min, r_[x,y,z]max defined the region of interest
|
| 72 |
+
// into the particle field - the particle field can be largeur
|
| 73 |
+
//
|
| 74 |
+
// The magnification factor is obtained from
|
| 75 |
+
// Gx = (r_xmax-r_xmin)/p_dimX (real/pixel)
|
| 76 |
+
// Gy = (r_ymax-r_ymin)/p_dimY (real/pixel)
|
| 77 |
+
// Important : Gx and Gy can be different
|
| 78 |
+
|
| 79 |
+
// ******* X axis **************************
|
| 80 |
+
double r_xmin;
|
| 81 |
+
r_xmin:units = "real";
|
| 82 |
+
r_xmin:long_name = "x minimum";
|
| 83 |
+
|
| 84 |
+
double r_xmax;
|
| 85 |
+
r_xmax:units = "real";
|
| 86 |
+
r_xmax:long_name = "x maximum";
|
| 87 |
+
|
| 88 |
+
// ******* Y axis **************************
|
| 89 |
+
double r_ymin;
|
| 90 |
+
r_ymin:units = "real";
|
| 91 |
+
r_ymin:long_name = "y minimum";
|
| 92 |
+
|
| 93 |
+
double r_ymax;
|
| 94 |
+
r_ymax:units = "real";
|
| 95 |
+
r_ymax:long_name = "y maximum";
|
| 96 |
+
|
| 97 |
+
// ******* Z axis ***************************
|
| 98 |
+
// ** for the 2D particle (x,y), used the same value for
|
| 99 |
+
// ** r_zmin, r_zmin and sheet_rpos_z
|
| 100 |
+
double r_zmin;
|
| 101 |
+
r_zmin:units = "real";
|
| 102 |
+
r_zmin:long_name = "z minimum";
|
| 103 |
+
|
| 104 |
+
double r_zmax;
|
| 105 |
+
r_zmax:units = "real";
|
| 106 |
+
r_zmax:long_name = "z maximum";
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
// ****************************************
|
| 110 |
+
// ****************************************
|
| 111 |
+
// Light sheet information
|
| 112 |
+
// ****************************************
|
| 113 |
+
// ****************************************
|
| 114 |
+
|
| 115 |
+
char lsheet_type(d_chaine);
|
| 116 |
+
lsheet_type:long_name = "type of light sheet";
|
| 117 |
+
// possible values :
|
| 118 |
+
// uniform
|
| 119 |
+
// gaussian
|
| 120 |
+
// triangle
|
| 121 |
+
// cosine
|
| 122 |
+
// squarecosine
|
| 123 |
+
|
| 124 |
+
// location in the real domain of the center
|
| 125 |
+
// of laser sheet (perpendicular to the z axis)
|
| 126 |
+
double lsheet_rpos_z;
|
| 127 |
+
lsheet_rpos_z:units = "real";
|
| 128 |
+
lsheet_rpos_z:long_name = "z location of light sheet";
|
| 129 |
+
|
| 130 |
+
double lsheet_rthickness;
|
| 131 |
+
lsheet_rthickness:valid_min = 0.0;
|
| 132 |
+
lsheet_rthickness:units = "real";
|
| 133 |
+
lsheet_rthickness:long_name = "light sheet thickness";
|
| 134 |
+
|
| 135 |
+
double lsheet_wave_length;
|
| 136 |
+
lsheet_wave_length:valid_min = 0.0;
|
| 137 |
+
lsheet_wave_length:units = "real";
|
| 138 |
+
lsheet_wave_length:long_name = "laser wave length";
|
| 139 |
+
|
| 140 |
+
// ************************************************
|
| 141 |
+
// ************* Particle distribution ************
|
| 142 |
+
// ************************************************
|
| 143 |
+
|
| 144 |
+
char part_distribution(d_chaine);
|
| 145 |
+
// Possible alternative
|
| 146 |
+
// uniform : constant diameter equal to part_mean_diam
|
| 147 |
+
//
|
| 148 |
+
// gaussian: gaussian distribution for the particle diameter
|
| 149 |
+
// mean diameter : part_mean_diam
|
| 150 |
+
// std diameter : part_std_diam
|
| 151 |
+
double part_min_diam;
|
| 152 |
+
part_min_diam:valid_min = 0.0;
|
| 153 |
+
part_min_diam:long_name = "minimum particle diameter";
|
| 154 |
+
double part_max_diam;
|
| 155 |
+
part_max_diam:valid_min = 0.0;
|
| 156 |
+
part_max_diam:valid_max = 10.0;
|
| 157 |
+
part_max_diam:long_name = "maximum particle diameter";
|
| 158 |
+
double part_mean_diam;
|
| 159 |
+
part_mean_diam:long_name= "mean particle diamete";
|
| 160 |
+
double part_std_diam;
|
| 161 |
+
part_std_diam:long_name= "std. of distribution of particle diameter";
|
| 162 |
+
|
| 163 |
+
// *****************************************************
|
| 164 |
+
// ************ image pattern information **************
|
| 165 |
+
// *****************************************************
|
| 166 |
+
|
| 167 |
+
char pattern_type(d_chaine);
|
| 168 |
+
// possible values
|
| 169 |
+
// gaussian : gaussian particle shape
|
| 170 |
+
// circle : circle particle shape
|
| 171 |
+
// rectangle: rectangle particle shape
|
| 172 |
+
double pattern_meanx;
|
| 173 |
+
pattern_meanx:valid_min = 0.0;
|
| 174 |
+
pattern_meanx:long_name = "pattern size for the part_meanx_diam";
|
| 175 |
+
double pattern_meany;
|
| 176 |
+
pattern_meany:valid_min = 0.0;
|
| 177 |
+
pattern_meany:long_name = "pattern size for the part_meany_diam";
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
// ************************************************
|
| 181 |
+
// ************ Projection information ************
|
| 182 |
+
// ************************************************
|
| 183 |
+
|
| 184 |
+
char projection_type(d_chaine);
|
| 185 |
+
// possible values
|
| 186 |
+
// normal : Normal projection without effect of particle motion along z
|
| 187 |
+
// znormal : Normal projection with effect of particule motion along z
|
| 188 |
+
// angular : Angular projection for stereo PIV
|
| 189 |
+
|
| 190 |
+
double projection_angle; // For angular projection
|
| 191 |
+
projection_angle:valid_min = 0.0;
|
| 192 |
+
projection_angle:valid_max = 360;
|
| 193 |
+
projection_angle:long_name = "Angle of view";
|
| 194 |
+
double projection_tilt_angle; // For angular projection
|
| 195 |
+
projection_tilt_angle:valid_min = 0.0;
|
| 196 |
+
projection_tilt_angle:valid_max = 360;
|
| 197 |
+
projection_tilt_angle:long_name = "Tilt angle";
|
| 198 |
+
|
| 199 |
+
// ************************************************
|
| 200 |
+
// ************* CCD information ************
|
| 201 |
+
// ************************************************
|
| 202 |
+
|
| 203 |
+
// Pixel active area size : ccd_fill_ratio_x*ccd_fill_ratio_y
|
| 204 |
+
double ccd_fill_ratio_x;
|
| 205 |
+
ccd_fill_ratio_x:valid_min = 0.0;
|
| 206 |
+
ccd_fill_ratio_x:valid_max = 1.0;
|
| 207 |
+
ccd_fill_ratio_x:long_name = "X CCD fill ration";
|
| 208 |
+
double ccd_fill_ratio_y;
|
| 209 |
+
ccd_fill_ratio_y:valid_min = 0.0;
|
| 210 |
+
ccd_fill_ratio_y:valid_max = 1.0;
|
| 211 |
+
ccd_fill_ratio_y:long_name = "Y CCD fill ration";
|
| 212 |
+
double ccd_saturation_level;
|
| 213 |
+
ccd_saturation_level:valid_min = 0.0;
|
| 214 |
+
ccd_saturation_level:valid_max = 1.0;
|
| 215 |
+
ccd_saturation_level:long_name = "saturation level";
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
//****** Initial background information *******/
|
| 220 |
+
|
| 221 |
+
char ccd_background_type(d_chaine);
|
| 222 |
+
// Possible alternative
|
| 223 |
+
// uniform : uniform background with
|
| 224 |
+
// level ccd_background_mean_level
|
| 225 |
+
// gaussian: gaussian noise with a mean value
|
| 226 |
+
// equal to ccd_background_mean_level
|
| 227 |
+
// and a std. equal to ccd_background_std_noise
|
| 228 |
+
double ccd_background_mean_level;
|
| 229 |
+
ccd_background_mean_level:valid_min = 0;
|
| 230 |
+
ccd_background_mean_level:long_name = "mean initial background level";
|
| 231 |
+
double ccd_background_std_noise;
|
| 232 |
+
ccd_background_std_noise:valid_min = 0;
|
| 233 |
+
ccd_background_std_noise:long_name = "std. noise for initial background";
|
| 234 |
+
|
| 235 |
+
double ccd_pixel_horizontal_pitch;
|
| 236 |
+
ccd_pixel_horizontal_pitch:valid_min = 0.0;
|
| 237 |
+
ccd_pixel_horizontal_pitch:units = "pixel/real";
|
| 238 |
+
ccd_pixel_horizontal_pitch:long_name = "horizontal pixel pitch";
|
| 239 |
+
|
| 240 |
+
double ccd_pixel_vertical_pitch;
|
| 241 |
+
ccd_pixel_vertical_pitch:valid_min = 0.0;
|
| 242 |
+
ccd_pixel_vertical_pitch:units = "pixel/real";
|
| 243 |
+
ccd_pixel_vertical_pitch:long_name = "vertical pixel pitch";
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
// *************************************************
|
| 247 |
+
// **********optics information ********************
|
| 248 |
+
// *************************************************
|
| 249 |
+
|
| 250 |
+
double optic_object_distance;
|
| 251 |
+
optic_object_distance:long_name = "object distance";
|
| 252 |
+
|
| 253 |
+
double optic_image_distance;
|
| 254 |
+
optic_image_distance:long_name = "image distance";
|
| 255 |
+
|
| 256 |
+
double optic_aperture;
|
| 257 |
+
optic_aperture:valid_min = 1.;
|
| 258 |
+
optic_aperture:long_name = "optic aperture";
|
| 259 |
+
|
| 260 |
+
double optic_magnification;
|
| 261 |
+
optic_magnification:valid_min = 0.0;
|
| 262 |
+
optic_magnification:long_name = "optic magnification";
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
// ************************************************
|
| 269 |
+
// ** initial seed numbers for the random generator
|
| 270 |
+
// ************************************************
|
| 271 |
+
|
| 272 |
+
int seed_number1;
|
| 273 |
+
seed_number1:valid_min = 0;
|
| 274 |
+
seed_number1:valid_max = 30000;
|
| 275 |
+
seed_number1:long_name = "seed number 1";
|
| 276 |
+
|
| 277 |
+
int seed_number2;
|
| 278 |
+
seed_number2:valid_min = 0;
|
| 279 |
+
seed_number2:valid_max = 30000;
|
| 280 |
+
seed_number2:long_name = "seed number 2";
|
| 281 |
+
|
| 282 |
+
int seed_number3;
|
| 283 |
+
seed_number3:valid_min = 0;
|
| 284 |
+
seed_number3:valid_max = 30000;
|
| 285 |
+
seed_number3:long_name = "seed number 3";
|
| 286 |
+
data:
|
| 287 |
+
|
| 288 |
+
p_dimX = 2048 ;
|
| 289 |
+
|
| 290 |
+
p_dimY = 2048 ;
|
| 291 |
+
|
| 292 |
+
p_dimL = 0 ;
|
| 293 |
+
|
| 294 |
+
p_dimR = 0 ;
|
| 295 |
+
|
| 296 |
+
p_dimT = 0 ;
|
| 297 |
+
|
| 298 |
+
p_dimB = 0 ;
|
| 299 |
+
|
| 300 |
+
periodic_flag = "no_periodic" ;
|
| 301 |
+
|
| 302 |
+
r_xmin = 0 ;
|
| 303 |
+
|
| 304 |
+
r_xmax = 150;
|
| 305 |
+
|
| 306 |
+
r_ymin = -150 ;
|
| 307 |
+
|
| 308 |
+
r_ymax = 0 ;
|
| 309 |
+
|
| 310 |
+
r_zmin = -0.6 ;
|
| 311 |
+
|
| 312 |
+
r_zmax = 0.6 ;
|
| 313 |
+
|
| 314 |
+
lsheet_type = "uniform" ;
|
| 315 |
+
|
| 316 |
+
lsheet_rpos_z = 0 ;
|
| 317 |
+
|
| 318 |
+
lsheet_rthickness = 1.2 ;
|
| 319 |
+
|
| 320 |
+
lsheet_wave_length = 532e-9 ;
|
| 321 |
+
|
| 322 |
+
part_distribution = "uniform" ;
|
| 323 |
+
|
| 324 |
+
part_min_diam = 0.7 ;
|
| 325 |
+
|
| 326 |
+
part_max_diam = 0.7;
|
| 327 |
+
|
| 328 |
+
part_mean_diam = 0.7 ;
|
| 329 |
+
|
| 330 |
+
part_std_diam = 0;
|
| 331 |
+
|
| 332 |
+
pattern_type = "gaussian" ;
|
| 333 |
+
|
| 334 |
+
pattern_meanx = 1.274;
|
| 335 |
+
|
| 336 |
+
pattern_meany = 1.274 ;
|
| 337 |
+
|
| 338 |
+
projection_type = "normal" ;
|
| 339 |
+
|
| 340 |
+
projection_angle = 0 ;
|
| 341 |
+
|
| 342 |
+
projection_tilt_angle = 0 ;
|
| 343 |
+
|
| 344 |
+
ccd_fill_ratio_x = 1 ;
|
| 345 |
+
|
| 346 |
+
ccd_fill_ratio_y = 1 ;
|
| 347 |
+
|
| 348 |
+
ccd_saturation_level = 1 ;
|
| 349 |
+
|
| 350 |
+
ccd_background_type = "gaussian" ;
|
| 351 |
+
|
| 352 |
+
ccd_background_mean_level = 80 ;
|
| 353 |
+
|
| 354 |
+
ccd_background_std_noise = 16 ;
|
| 355 |
+
|
| 356 |
+
ccd_pixel_horizontal_pitch = 327.68 ;
|
| 357 |
+
|
| 358 |
+
ccd_pixel_vertical_pitch = 327.68 ;
|
| 359 |
+
|
| 360 |
+
optic_object_distance = 5000 ;
|
| 361 |
+
|
| 362 |
+
optic_image_distance = 208.5 ;
|
| 363 |
+
|
| 364 |
+
optic_aperture = 2 ;
|
| 365 |
+
|
| 366 |
+
optic_magnification = 0.0417;
|
| 367 |
+
|
| 368 |
+
seed_number1 = 7 ;
|
| 369 |
+
|
| 370 |
+
seed_number2 = 500 ;
|
| 371 |
+
|
| 372 |
+
seed_number3 = 20000 ;
|
| 373 |
+
}
|
scripts/stereo_benchmark_comparison.py
ADDED
|
@@ -0,0 +1,1261 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Stereo PIV Benchmark Comparison against JHTDB DNS Ground Truth.
|
| 4 |
+
|
| 5 |
+
Compares 3-component velocity (U, V, W) and all 6 Reynolds stresses
|
| 6 |
+
(uu, vv, ww, uv, uw, vw) against DNS channel flow data.
|
| 7 |
+
|
| 8 |
+
Usage:
|
| 9 |
+
python stereo_benchmark_comparison.py [--run RUN_IDX] [--x-min X_MIN] [--x-max X_MAX]
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import numpy as np
|
| 13 |
+
import scipy.io as sio
|
| 14 |
+
from scipy.interpolate import interp1d
|
| 15 |
+
import matplotlib
|
| 16 |
+
import matplotlib.pyplot as plt
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
import argparse
|
| 19 |
+
|
| 20 |
+
# LaTeX-style fonts (no LaTeX install required)
|
| 21 |
+
matplotlib.rcParams.update({
|
| 22 |
+
'text.usetex': False,
|
| 23 |
+
'font.family': 'serif',
|
| 24 |
+
'font.serif': ['CMU Serif', 'Computer Modern Roman', 'DejaVu Serif'],
|
| 25 |
+
'mathtext.fontset': 'cm',
|
| 26 |
+
'axes.labelsize': 14,
|
| 27 |
+
'axes.titlesize': 16,
|
| 28 |
+
'legend.fontsize': 11,
|
| 29 |
+
'xtick.labelsize': 12,
|
| 30 |
+
'ytick.labelsize': 12,
|
| 31 |
+
})
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def log_smooth(y_plus, values, sigma_decades=0.06):
|
| 35 |
+
"""LOWESS-style smooth in log(y+) space, evaluated at original points.
|
| 36 |
+
|
| 37 |
+
Each output point is a locally-weighted LINEAR regression of neighbours,
|
| 38 |
+
where distance is measured in decades of y+. Using local linear fits
|
| 39 |
+
instead of local averages gives:
|
| 40 |
+
- Better peak tracking (local slope captures gradients)
|
| 41 |
+
- Better edge behaviour (linear extrapolation, not mean bias)
|
| 42 |
+
|
| 43 |
+
Parameters
|
| 44 |
+
----------
|
| 45 |
+
y_plus : array
|
| 46 |
+
y+ coordinates (positive)
|
| 47 |
+
values : array
|
| 48 |
+
Values to smooth
|
| 49 |
+
sigma_decades : float
|
| 50 |
+
Smoothing width in decades of y+ (0.06 ~ +/-15% local y+)
|
| 51 |
+
|
| 52 |
+
Returns
|
| 53 |
+
-------
|
| 54 |
+
y_out, smoothed : arrays
|
| 55 |
+
Sorted y+ and smoothed values (at original data points)
|
| 56 |
+
"""
|
| 57 |
+
valid = (y_plus > 0) & ~np.isnan(values)
|
| 58 |
+
yp = y_plus[valid]
|
| 59 |
+
vals = values[valid]
|
| 60 |
+
if len(yp) < 5:
|
| 61 |
+
return yp, vals
|
| 62 |
+
|
| 63 |
+
order = np.argsort(yp)
|
| 64 |
+
yp = yp[order]
|
| 65 |
+
vals = vals[order]
|
| 66 |
+
log_yp = np.log10(yp)
|
| 67 |
+
|
| 68 |
+
smoothed = np.empty_like(vals)
|
| 69 |
+
for i in range(len(vals)):
|
| 70 |
+
d = (log_yp - log_yp[i]) / sigma_decades
|
| 71 |
+
w = np.exp(-0.5 * d * d)
|
| 72 |
+
# Local linear regression (LOWESS) instead of weighted mean
|
| 73 |
+
wsum = np.sum(w)
|
| 74 |
+
wmean_x = np.sum(w * log_yp) / wsum
|
| 75 |
+
wmean_y = np.sum(w * vals) / wsum
|
| 76 |
+
dx = log_yp - wmean_x
|
| 77 |
+
denom = np.sum(w * dx * dx)
|
| 78 |
+
if denom > 1e-30:
|
| 79 |
+
slope = np.sum(w * dx * vals) / denom
|
| 80 |
+
smoothed[i] = wmean_y + slope * (log_yp[i] - wmean_x)
|
| 81 |
+
else:
|
| 82 |
+
smoothed[i] = wmean_y
|
| 83 |
+
|
| 84 |
+
return yp, smoothed
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def plot_ci_band(ax, y_plus, ci_lo, ci_hi, sign=1, color='k', alpha=0.3, zorder=1):
|
| 88 |
+
"""Plot a 95% CI shaded band around a reference line.
|
| 89 |
+
|
| 90 |
+
Parameters
|
| 91 |
+
----------
|
| 92 |
+
ax : matplotlib Axes
|
| 93 |
+
y_plus : array
|
| 94 |
+
x-axis values (y+ coordinates)
|
| 95 |
+
ci_lo, ci_hi : array
|
| 96 |
+
Lower/upper CI bounds (same units as the plotted variable)
|
| 97 |
+
sign : int
|
| 98 |
+
1 or -1 (for variables like -uv+ that flip sign)
|
| 99 |
+
color : str
|
| 100 |
+
Fill color
|
| 101 |
+
alpha : float
|
| 102 |
+
Fill transparency
|
| 103 |
+
zorder : int
|
| 104 |
+
Drawing order
|
| 105 |
+
"""
|
| 106 |
+
lo = sign * ci_lo if sign == 1 else sign * ci_hi # sign flip swaps lo/hi
|
| 107 |
+
hi = sign * ci_hi if sign == 1 else sign * ci_lo
|
| 108 |
+
ax.fill_between(y_plus, lo, hi, color=color, alpha=alpha, zorder=zorder,
|
| 109 |
+
linewidth=0)
|
| 110 |
+
# Add thin edge lines so the CI is visible even when narrow
|
| 111 |
+
ax.plot(y_plus, lo, color=color, linewidth=0.5, alpha=0.4, zorder=zorder)
|
| 112 |
+
ax.plot(y_plus, hi, color=color, linewidth=0.5, alpha=0.4, zorder=zorder)
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
def load_wall_units(wall_units_path):
|
| 116 |
+
"""Load wall units from .mat file (supports v5 struct, v7.3/HDF5, and direct_stats)."""
|
| 117 |
+
wall_units_path = str(wall_units_path)
|
| 118 |
+
try:
|
| 119 |
+
wall = sio.loadmat(wall_units_path, squeeze_me=True, struct_as_record=False)
|
| 120 |
+
|
| 121 |
+
# Format: direct_stats.mat (top-level scalar keys)
|
| 122 |
+
if 'u_tau' in wall and 'delta_nu' in wall and 'Re_tau' in wall:
|
| 123 |
+
u_tau = float(wall['u_tau'])
|
| 124 |
+
delta_nu = float(wall['delta_nu'])
|
| 125 |
+
Re_tau = float(wall['Re_tau'])
|
| 126 |
+
return {
|
| 127 |
+
'u_tau': u_tau,
|
| 128 |
+
'nu': u_tau * delta_nu,
|
| 129 |
+
'delta_nu': delta_nu,
|
| 130 |
+
'h_mm': float(wall['h_mm']) if 'h_mm' in wall else Re_tau * delta_nu,
|
| 131 |
+
'Re_tau': Re_tau,
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
# Format: wall_units.mat (struct)
|
| 135 |
+
wu = wall['wall_units']
|
| 136 |
+
return {
|
| 137 |
+
'u_tau': float(wu.u_tau),
|
| 138 |
+
'nu': float(wu.nu),
|
| 139 |
+
'delta_nu': float(wu.delta_nu),
|
| 140 |
+
'h_mm': float(wu.h_mm),
|
| 141 |
+
'Re_tau': float(wu.Re_tau)
|
| 142 |
+
}
|
| 143 |
+
except NotImplementedError:
|
| 144 |
+
import h5py
|
| 145 |
+
with h5py.File(wall_units_path, 'r') as f:
|
| 146 |
+
d = f['diagnostics']
|
| 147 |
+
u_tau = float(d['u_tau'][0, 0])
|
| 148 |
+
Re_tau = float(d['Re_tau'][0, 0])
|
| 149 |
+
delta_nu = float(d['delta_nu'][0, 0])
|
| 150 |
+
return {
|
| 151 |
+
'u_tau': u_tau,
|
| 152 |
+
'nu': u_tau * delta_nu,
|
| 153 |
+
'delta_nu': delta_nu,
|
| 154 |
+
'h_mm': Re_tau * delta_nu,
|
| 155 |
+
'Re_tau': Re_tau
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
def load_ground_truth_3d(profiles_path):
|
| 160 |
+
"""Load ground truth 1px profiles including W component (supports v5 struct, v7.3/HDF5, and direct_stats)."""
|
| 161 |
+
profiles_path = str(profiles_path)
|
| 162 |
+
try:
|
| 163 |
+
profiles = sio.loadmat(profiles_path, squeeze_me=True, struct_as_record=False)
|
| 164 |
+
|
| 165 |
+
# Format: direct_stats.mat (top-level arrays)
|
| 166 |
+
if 'U_plus' in profiles and 'stress_plus' in profiles and 'y_plus' in profiles:
|
| 167 |
+
y_plus_full = profiles['y_plus']
|
| 168 |
+
Re_tau = float(profiles['Re_tau'])
|
| 169 |
+
u_tau = float(profiles['u_tau'])
|
| 170 |
+
delta_nu = float(profiles['delta_nu'])
|
| 171 |
+
u_tau2 = u_tau ** 2
|
| 172 |
+
|
| 173 |
+
# Select lower half of channel (y+ <= Re_tau)
|
| 174 |
+
mask = y_plus_full <= Re_tau
|
| 175 |
+
y_plus = y_plus_full[mask]
|
| 176 |
+
y_mm = y_plus * delta_nu
|
| 177 |
+
|
| 178 |
+
# U_plus: (N, 3) -> columns [U, V, W]
|
| 179 |
+
U_plus = profiles['U_plus'][mask, 0]
|
| 180 |
+
V_plus = profiles['U_plus'][mask, 1]
|
| 181 |
+
W_plus = profiles['U_plus'][mask, 2]
|
| 182 |
+
|
| 183 |
+
# stress_plus: (N, 3, 3) -> Reynolds stress tensor
|
| 184 |
+
uu_plus = profiles['stress_plus'][mask, 0, 0]
|
| 185 |
+
vv_plus = profiles['stress_plus'][mask, 1, 1]
|
| 186 |
+
ww_plus = profiles['stress_plus'][mask, 2, 2]
|
| 187 |
+
uv_plus = profiles['stress_plus'][mask, 0, 1]
|
| 188 |
+
uw_plus = profiles['stress_plus'][mask, 0, 2]
|
| 189 |
+
vw_plus = profiles['stress_plus'][mask, 1, 2]
|
| 190 |
+
|
| 191 |
+
result = {
|
| 192 |
+
'y_mm': y_mm,
|
| 193 |
+
'y_plus': y_plus,
|
| 194 |
+
'U': U_plus * u_tau,
|
| 195 |
+
'V': V_plus * u_tau,
|
| 196 |
+
'W': W_plus * u_tau,
|
| 197 |
+
'uu': uu_plus * u_tau2,
|
| 198 |
+
'vv': vv_plus * u_tau2,
|
| 199 |
+
'ww': ww_plus * u_tau2,
|
| 200 |
+
'uv': uv_plus * u_tau2,
|
| 201 |
+
'uw': uw_plus * u_tau2,
|
| 202 |
+
'vw': vw_plus * u_tau2,
|
| 203 |
+
'U_plus': U_plus,
|
| 204 |
+
'uu_plus': uu_plus,
|
| 205 |
+
'vv_plus': vv_plus,
|
| 206 |
+
'ww_plus': ww_plus,
|
| 207 |
+
'uv_plus': uv_plus,
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
# Load 95% confidence intervals if available
|
| 211 |
+
if 'stress_ci_lo' in profiles and 'stress_ci_hi' in profiles:
|
| 212 |
+
result['uu_plus_ci_lo'] = profiles['stress_ci_lo'][mask, 0, 0]
|
| 213 |
+
result['uu_plus_ci_hi'] = profiles['stress_ci_hi'][mask, 0, 0]
|
| 214 |
+
result['vv_plus_ci_lo'] = profiles['stress_ci_lo'][mask, 1, 1]
|
| 215 |
+
result['vv_plus_ci_hi'] = profiles['stress_ci_hi'][mask, 1, 1]
|
| 216 |
+
result['ww_plus_ci_lo'] = profiles['stress_ci_lo'][mask, 2, 2]
|
| 217 |
+
result['ww_plus_ci_hi'] = profiles['stress_ci_hi'][mask, 2, 2]
|
| 218 |
+
result['uv_plus_ci_lo'] = profiles['stress_ci_lo'][mask, 0, 1]
|
| 219 |
+
result['uv_plus_ci_hi'] = profiles['stress_ci_hi'][mask, 0, 1]
|
| 220 |
+
result['uw_plus_ci_lo'] = profiles['stress_ci_lo'][mask, 0, 2]
|
| 221 |
+
result['uw_plus_ci_hi'] = profiles['stress_ci_hi'][mask, 0, 2]
|
| 222 |
+
result['vw_plus_ci_lo'] = profiles['stress_ci_lo'][mask, 1, 2]
|
| 223 |
+
result['vw_plus_ci_hi'] = profiles['stress_ci_hi'][mask, 1, 2]
|
| 224 |
+
if 'umean_ci_lo' in profiles and 'umean_ci_hi' in profiles:
|
| 225 |
+
result['U_plus_ci_lo'] = profiles['umean_ci_lo'][mask, 0]
|
| 226 |
+
result['U_plus_ci_hi'] = profiles['umean_ci_hi'][mask, 0]
|
| 227 |
+
result['V_plus_ci_lo'] = profiles['umean_ci_lo'][mask, 1]
|
| 228 |
+
result['V_plus_ci_hi'] = profiles['umean_ci_hi'][mask, 1]
|
| 229 |
+
result['W_plus_ci_lo'] = profiles['umean_ci_lo'][mask, 2]
|
| 230 |
+
result['W_plus_ci_hi'] = profiles['umean_ci_hi'][mask, 2]
|
| 231 |
+
|
| 232 |
+
return result
|
| 233 |
+
|
| 234 |
+
# Format: profiles.mat (struct)
|
| 235 |
+
win1px = profiles['profiles'].win_1px
|
| 236 |
+
return {
|
| 237 |
+
'y_mm': win1px.y_mm,
|
| 238 |
+
'y_plus': win1px.y_plus,
|
| 239 |
+
'U': win1px.U,
|
| 240 |
+
'V': win1px.V,
|
| 241 |
+
'W': win1px.W,
|
| 242 |
+
'uu': win1px.uu,
|
| 243 |
+
'vv': win1px.vv,
|
| 244 |
+
'ww': win1px.ww,
|
| 245 |
+
'uv': win1px.uv,
|
| 246 |
+
'uw': win1px.uw,
|
| 247 |
+
'vw': win1px.vw,
|
| 248 |
+
'U_plus': win1px.U_plus,
|
| 249 |
+
'uu_plus': win1px.uu_plus,
|
| 250 |
+
'vv_plus': win1px.vv_plus,
|
| 251 |
+
'ww_plus': win1px.ww_plus,
|
| 252 |
+
'uv_plus': win1px.uv_plus,
|
| 253 |
+
}
|
| 254 |
+
except NotImplementedError:
|
| 255 |
+
import h5py
|
| 256 |
+
with h5py.File(profiles_path, 'r') as f:
|
| 257 |
+
rp = f['ref_profile']
|
| 258 |
+
y_plus = rp['y_plus'][0, :]
|
| 259 |
+
U = rp['U'][0, :]
|
| 260 |
+
V = rp['V'][0, :]
|
| 261 |
+
W = rp['W'][0, :]
|
| 262 |
+
|
| 263 |
+
# Also load ensemble_stats for stress profiles (win_idx=0 = 16x16)
|
| 264 |
+
es = f['ensemble_stats']
|
| 265 |
+
|
| 266 |
+
def deref(field, idx=0):
|
| 267 |
+
ref = es[field][idx, 0]
|
| 268 |
+
return f[ref][:].flatten()
|
| 269 |
+
|
| 270 |
+
y_mm_es = deref('y_mm')
|
| 271 |
+
y_plus_es = deref('y_plus')
|
| 272 |
+
|
| 273 |
+
# Wall units from diagnostics sibling file
|
| 274 |
+
diag_path = str(Path(profiles_path).parent / 'diagnostics.mat')
|
| 275 |
+
wu = load_wall_units(diag_path)
|
| 276 |
+
u_tau = wu['u_tau']
|
| 277 |
+
u_tau2 = u_tau ** 2
|
| 278 |
+
|
| 279 |
+
uu = deref('uu_profile')
|
| 280 |
+
vv = deref('vv_profile')
|
| 281 |
+
ww = deref('ww_profile')
|
| 282 |
+
uv = deref('uv_profile')
|
| 283 |
+
uw = deref('uw_profile')
|
| 284 |
+
vw = deref('vw_profile')
|
| 285 |
+
|
| 286 |
+
return {
|
| 287 |
+
'y_mm': y_mm_es,
|
| 288 |
+
'y_plus': y_plus_es,
|
| 289 |
+
'U': deref('U_profile'),
|
| 290 |
+
'V': deref('V_profile'),
|
| 291 |
+
'W': deref('W_profile'),
|
| 292 |
+
'uu': uu,
|
| 293 |
+
'vv': vv,
|
| 294 |
+
'ww': ww,
|
| 295 |
+
'uv': uv,
|
| 296 |
+
'uw': uw,
|
| 297 |
+
'vw': vw,
|
| 298 |
+
'U_plus': deref('U_profile') / u_tau,
|
| 299 |
+
'uu_plus': uu / u_tau2,
|
| 300 |
+
'vv_plus': vv / u_tau2,
|
| 301 |
+
'ww_plus': ww / u_tau2,
|
| 302 |
+
'uv_plus': uv / u_tau2,
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
|
| 306 |
+
def load_stereo_statistics(stats_path, coords_path, run_idx=3):
|
| 307 |
+
"""
|
| 308 |
+
Load stereo PIV statistics from mean_stats.mat and coordinates from separate file.
|
| 309 |
+
|
| 310 |
+
Parameters
|
| 311 |
+
----------
|
| 312 |
+
stats_path : Path
|
| 313 |
+
Path to mean_stats.mat
|
| 314 |
+
coords_path : Path
|
| 315 |
+
Path to coordinates.mat (from stereo_calibrated folder)
|
| 316 |
+
run_idx : int
|
| 317 |
+
Run index (0-based). run_idx=3 is typically finest resolution (16x16)
|
| 318 |
+
"""
|
| 319 |
+
stats = sio.loadmat(stats_path, squeeze_me=True, struct_as_record=False)
|
| 320 |
+
coords_data = sio.loadmat(coords_path, squeeze_me=True, struct_as_record=False)
|
| 321 |
+
|
| 322 |
+
# Get piv_result for the requested run
|
| 323 |
+
piv_result = stats['piv_result']
|
| 324 |
+
if isinstance(piv_result, np.ndarray) and piv_result.ndim == 0:
|
| 325 |
+
piv = piv_result.item()
|
| 326 |
+
elif hasattr(piv_result, '__len__') and len(piv_result) > run_idx:
|
| 327 |
+
piv = piv_result[run_idx]
|
| 328 |
+
else:
|
| 329 |
+
piv = piv_result
|
| 330 |
+
|
| 331 |
+
# Get coordinates from separate file
|
| 332 |
+
coords = coords_data['coordinates']
|
| 333 |
+
if isinstance(coords, np.ndarray) and coords.ndim == 0:
|
| 334 |
+
coord = coords.item()
|
| 335 |
+
elif hasattr(coords, '__len__') and len(coords) > run_idx:
|
| 336 |
+
coord = coords[run_idx]
|
| 337 |
+
else:
|
| 338 |
+
coord = coords
|
| 339 |
+
|
| 340 |
+
return {
|
| 341 |
+
# Velocities (m/s -> mm/s)
|
| 342 |
+
'ux': piv.ux * 1000,
|
| 343 |
+
'uy': piv.uy * 1000,
|
| 344 |
+
'uz': piv.uz * 1000,
|
| 345 |
+
# Normal stresses ((m/s)^2 -> (mm/s)^2)
|
| 346 |
+
'uu': piv.uu * 1e6,
|
| 347 |
+
'vv': piv.vv * 1e6,
|
| 348 |
+
'ww': piv.ww * 1e6,
|
| 349 |
+
# Shear stresses
|
| 350 |
+
'uv': piv.uv * 1e6,
|
| 351 |
+
'uw': piv.uw * 1e6,
|
| 352 |
+
'vw': piv.vw * 1e6,
|
| 353 |
+
# Coordinates (already in mm from calibrated file)
|
| 354 |
+
'x': coord.x,
|
| 355 |
+
'y': coord.y,
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
def compute_stereo_profiles(piv_data, x_min=5.0, x_max=145.0):
|
| 360 |
+
"""
|
| 361 |
+
Compute x-averaged stereo PIV profiles.
|
| 362 |
+
|
| 363 |
+
Parameters
|
| 364 |
+
----------
|
| 365 |
+
piv_data : dict
|
| 366 |
+
Stereo PIV data dictionary
|
| 367 |
+
x_min : float
|
| 368 |
+
Minimum x to include (mm)
|
| 369 |
+
x_max : float
|
| 370 |
+
Maximum x to include (mm)
|
| 371 |
+
|
| 372 |
+
Returns
|
| 373 |
+
-------
|
| 374 |
+
dict with y_mm and all velocity/stress profiles
|
| 375 |
+
"""
|
| 376 |
+
x = piv_data['x']
|
| 377 |
+
y = piv_data['y']
|
| 378 |
+
|
| 379 |
+
# Stereo coordinates have NaN at edges (outside overlap region)
|
| 380 |
+
# Find valid region
|
| 381 |
+
valid_mask = ~np.isnan(x)
|
| 382 |
+
valid_rows = np.any(valid_mask, axis=1)
|
| 383 |
+
valid_cols = np.any(valid_mask, axis=0)
|
| 384 |
+
|
| 385 |
+
# Find first valid column to get y values from
|
| 386 |
+
first_valid_col = np.argmax(valid_cols)
|
| 387 |
+
last_valid_col = len(valid_cols) - np.argmax(valid_cols[::-1]) - 1
|
| 388 |
+
mid_col = (first_valid_col + last_valid_col) // 2
|
| 389 |
+
|
| 390 |
+
# Find first valid row to get x values from
|
| 391 |
+
first_valid_row = np.argmax(valid_rows)
|
| 392 |
+
last_valid_row = len(valid_rows) - np.argmax(valid_rows[::-1]) - 1
|
| 393 |
+
mid_row = (first_valid_row + last_valid_row) // 2
|
| 394 |
+
|
| 395 |
+
# Get unique coordinates from valid region
|
| 396 |
+
y_full = y[:, mid_col]
|
| 397 |
+
x_unique = x[mid_row, :]
|
| 398 |
+
|
| 399 |
+
print(f" Valid row range: {first_valid_row} to {last_valid_row}")
|
| 400 |
+
print(f" Valid col range: {first_valid_col} to {last_valid_col}")
|
| 401 |
+
print(f" X range: {np.nanmin(x_unique):.2f} to {np.nanmax(x_unique):.2f} mm")
|
| 402 |
+
print(f" Y range: {np.nanmin(y_full):.2f} to {np.nanmax(y_full):.2f} mm")
|
| 403 |
+
|
| 404 |
+
# Apply x range filter
|
| 405 |
+
x_mask = (x_unique >= x_min) & (x_unique <= x_max) & ~np.isnan(x_unique)
|
| 406 |
+
|
| 407 |
+
print(f" Keeping X: {x_min:.2f} to {x_max:.2f} mm")
|
| 408 |
+
print(f" X points: {x_mask.sum()} / {len(x_unique)}")
|
| 409 |
+
|
| 410 |
+
# Filter out rows with invalid y values
|
| 411 |
+
y_valid_mask = ~np.isnan(y_full)
|
| 412 |
+
|
| 413 |
+
# Compute profiles for all variables
|
| 414 |
+
profiles = {}
|
| 415 |
+
|
| 416 |
+
for var in ['ux', 'uy', 'uz', 'uu', 'vv', 'ww', 'uv', 'uw', 'vw']:
|
| 417 |
+
data = piv_data[var]
|
| 418 |
+
# Average along x for each row, then keep only valid y rows
|
| 419 |
+
row_means = np.nanmean(data[:, x_mask], axis=1)
|
| 420 |
+
profiles[var] = row_means[y_valid_mask]
|
| 421 |
+
|
| 422 |
+
# Store y for valid rows only
|
| 423 |
+
profiles['y_mm'] = y_full[y_valid_mask]
|
| 424 |
+
|
| 425 |
+
# Rename for clarity
|
| 426 |
+
profiles['U'] = profiles.pop('ux')
|
| 427 |
+
profiles['V'] = profiles.pop('uy')
|
| 428 |
+
profiles['W'] = profiles.pop('uz')
|
| 429 |
+
|
| 430 |
+
return profiles
|
| 431 |
+
|
| 432 |
+
|
| 433 |
+
def convert_to_wall_units(profiles, wall_units, y_offset_mm=0.0):
|
| 434 |
+
"""
|
| 435 |
+
Convert profiles to wall units.
|
| 436 |
+
|
| 437 |
+
Parameters
|
| 438 |
+
----------
|
| 439 |
+
profiles : dict
|
| 440 |
+
PIV profiles with y_mm, U, V, W, stresses
|
| 441 |
+
wall_units : dict
|
| 442 |
+
Wall unit parameters
|
| 443 |
+
y_offset_mm : float
|
| 444 |
+
Offset to add to y_mm for coordinate alignment
|
| 445 |
+
"""
|
| 446 |
+
u_tau = wall_units['u_tau']
|
| 447 |
+
delta_nu = wall_units['delta_nu']
|
| 448 |
+
u_tau2 = u_tau ** 2
|
| 449 |
+
|
| 450 |
+
y_mm_aligned = profiles['y_mm'] + y_offset_mm
|
| 451 |
+
|
| 452 |
+
return {
|
| 453 |
+
'y_mm': y_mm_aligned,
|
| 454 |
+
'y_plus': y_mm_aligned / delta_nu,
|
| 455 |
+
# Velocities
|
| 456 |
+
'U_plus': profiles['U'] / u_tau,
|
| 457 |
+
'V_plus': profiles['V'] / u_tau,
|
| 458 |
+
'W_plus': profiles['W'] / u_tau,
|
| 459 |
+
# Normal stresses
|
| 460 |
+
'uu_plus': profiles['uu'] / u_tau2,
|
| 461 |
+
'vv_plus': profiles['vv'] / u_tau2,
|
| 462 |
+
'ww_plus': profiles['ww'] / u_tau2,
|
| 463 |
+
# Shear stresses
|
| 464 |
+
'uv_plus': profiles['uv'] / u_tau2,
|
| 465 |
+
'uw_plus': profiles['uw'] / u_tau2,
|
| 466 |
+
'vw_plus': profiles['vw'] / u_tau2,
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
|
| 470 |
+
def compute_errors(piv_plus, gt_plus, y_plus_range=(10, 500)):
|
| 471 |
+
"""Compute error metrics between PIV and ground truth."""
|
| 472 |
+
y_piv = piv_plus['y_plus']
|
| 473 |
+
y_gt = gt_plus['y_plus']
|
| 474 |
+
|
| 475 |
+
mask_piv = (y_piv >= y_plus_range[0]) & (y_piv <= y_plus_range[1])
|
| 476 |
+
y_compare = y_piv[mask_piv]
|
| 477 |
+
|
| 478 |
+
if len(y_compare) == 0:
|
| 479 |
+
print(f" Warning: No PIV points in y+ range {y_plus_range}")
|
| 480 |
+
return {}
|
| 481 |
+
|
| 482 |
+
errors = {}
|
| 483 |
+
variables = ['U_plus', 'V_plus', 'W_plus', 'uu_plus', 'vv_plus', 'ww_plus',
|
| 484 |
+
'uv_plus', 'uw_plus', 'vw_plus']
|
| 485 |
+
|
| 486 |
+
for var in variables:
|
| 487 |
+
if var not in piv_plus or var not in gt_plus:
|
| 488 |
+
continue
|
| 489 |
+
|
| 490 |
+
piv_vals = piv_plus[var][mask_piv]
|
| 491 |
+
|
| 492 |
+
# Interpolate ground truth
|
| 493 |
+
gt_interp = interp1d(y_gt, gt_plus[var], kind='linear',
|
| 494 |
+
bounds_error=False, fill_value=np.nan)
|
| 495 |
+
gt_vals = gt_interp(y_compare)
|
| 496 |
+
|
| 497 |
+
# Remove NaN values
|
| 498 |
+
valid = ~np.isnan(piv_vals) & ~np.isnan(gt_vals)
|
| 499 |
+
if valid.sum() == 0:
|
| 500 |
+
continue
|
| 501 |
+
|
| 502 |
+
piv_valid = piv_vals[valid]
|
| 503 |
+
gt_valid = gt_vals[valid]
|
| 504 |
+
|
| 505 |
+
# Compute metrics
|
| 506 |
+
diff = piv_valid - gt_valid
|
| 507 |
+
rms_error = np.sqrt(np.mean(diff**2))
|
| 508 |
+
mean_abs_error = np.mean(np.abs(diff))
|
| 509 |
+
|
| 510 |
+
gt_range = np.ptp(gt_valid)
|
| 511 |
+
rms_rel = (rms_error / gt_range * 100) if gt_range > 0 else np.nan
|
| 512 |
+
|
| 513 |
+
corr = np.corrcoef(piv_valid, gt_valid)[0, 1] if len(piv_valid) > 1 else np.nan
|
| 514 |
+
|
| 515 |
+
ss_res = np.sum(diff**2)
|
| 516 |
+
ss_tot = np.sum((gt_valid - gt_valid.mean())**2)
|
| 517 |
+
r2 = 1 - (ss_res / ss_tot) if ss_tot > 0 else np.nan
|
| 518 |
+
|
| 519 |
+
errors[var] = {
|
| 520 |
+
'rms': rms_error,
|
| 521 |
+
'rms_rel': rms_rel,
|
| 522 |
+
'mae': mean_abs_error,
|
| 523 |
+
'corr': corr,
|
| 524 |
+
'r2': r2,
|
| 525 |
+
'n_points': valid.sum(),
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
return errors
|
| 529 |
+
|
| 530 |
+
|
| 531 |
+
def plot_velocity_comparison(piv_plus, gt_plus, wall_units, errors, output_dir):
|
| 532 |
+
"""Generate velocity comparison plots (U+, V+, W+)."""
|
| 533 |
+
output_dir = Path(output_dir)
|
| 534 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 535 |
+
|
| 536 |
+
Re_tau = wall_units['Re_tau']
|
| 537 |
+
has_ci = 'uu_plus_ci_lo' in gt_plus
|
| 538 |
+
|
| 539 |
+
# ==========================================================================
|
| 540 |
+
# Figure 1: U+ profile (semilog)
|
| 541 |
+
# ==========================================================================
|
| 542 |
+
fig, ax = plt.subplots(figsize=(10, 7))
|
| 543 |
+
|
| 544 |
+
if has_ci and 'U_plus_ci_lo' in gt_plus:
|
| 545 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['U_plus_ci_lo'],
|
| 546 |
+
gt_plus['U_plus_ci_hi'], color='k', alpha=0.15, zorder=1)
|
| 547 |
+
ax.semilogx(gt_plus['y_plus'], gt_plus['U_plus'], 'k-',
|
| 548 |
+
linewidth=2, label='DNS (1px)', zorder=3)
|
| 549 |
+
ax.semilogx(piv_plus['y_plus'], piv_plus['U_plus'], 'ro',
|
| 550 |
+
markersize=4, alpha=0.7, label='Stereo PIV', zorder=2)
|
| 551 |
+
|
| 552 |
+
# Log law reference
|
| 553 |
+
y_log = np.logspace(1, np.log10(Re_tau), 100)
|
| 554 |
+
kappa, B = 0.41, 5.2
|
| 555 |
+
U_log = (1/kappa) * np.log(y_log) + B
|
| 556 |
+
ax.semilogx(y_log, U_log, 'b--', linewidth=1, alpha=0.7,
|
| 557 |
+
label=r'Log law: $U^+ = \frac{1}{\kappa}\ln(y^+) + B$')
|
| 558 |
+
|
| 559 |
+
# Viscous sublayer
|
| 560 |
+
y_visc = np.linspace(0.1, 10, 50)
|
| 561 |
+
ax.semilogx(y_visc, y_visc, 'g--', linewidth=1, alpha=0.7,
|
| 562 |
+
label=r'Viscous sublayer: $U^+ = y^+$')
|
| 563 |
+
|
| 564 |
+
ax.set_xlabel(r'$y^+$', fontsize=14)
|
| 565 |
+
ax.set_ylabel(r'$U^+$', fontsize=14)
|
| 566 |
+
ax.set_title(f'Mean Streamwise Velocity - Stereo PIV (Re$_\\tau$ = {Re_tau:.0f})', fontsize=16)
|
| 567 |
+
ax.legend(fontsize=11)
|
| 568 |
+
ax.set_xlim(1, Re_tau)
|
| 569 |
+
ax.set_ylim(0, 25)
|
| 570 |
+
ax.grid(True, alpha=0.3)
|
| 571 |
+
|
| 572 |
+
if 'U_plus' in errors:
|
| 573 |
+
ax.text(0.02, 0.98, f"R² = {errors['U_plus']['r2']:.4f}\n"
|
| 574 |
+
f"RMS = {errors['U_plus']['rms_rel']:.1f}%",
|
| 575 |
+
transform=ax.transAxes, fontsize=11, verticalalignment='top',
|
| 576 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 577 |
+
|
| 578 |
+
fig.tight_layout()
|
| 579 |
+
fig.savefig(output_dir / 'U_plus_profile.png', dpi=150)
|
| 580 |
+
plt.close(fig)
|
| 581 |
+
|
| 582 |
+
# ==========================================================================
|
| 583 |
+
# Figure 2: V+ profile
|
| 584 |
+
# ==========================================================================
|
| 585 |
+
fig, ax = plt.subplots(figsize=(10, 7))
|
| 586 |
+
|
| 587 |
+
if has_ci and 'V_plus_ci_lo' in gt_plus:
|
| 588 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['V_plus_ci_lo'],
|
| 589 |
+
gt_plus['V_plus_ci_hi'], color='k', alpha=0.15, zorder=1)
|
| 590 |
+
ax.plot(gt_plus['y_plus'], gt_plus['V_plus'], 'k-', linewidth=2, label='DNS')
|
| 591 |
+
ax.plot(piv_plus['y_plus'], piv_plus['V_plus'], 'ro', markersize=4,
|
| 592 |
+
alpha=0.7, label='Stereo PIV')
|
| 593 |
+
ax.axhline(y=0, color='gray', linestyle='--', linewidth=0.5)
|
| 594 |
+
|
| 595 |
+
ax.set_xlabel(r'$y^+$', fontsize=14)
|
| 596 |
+
ax.set_ylabel(r'$V^+$', fontsize=14)
|
| 597 |
+
ax.set_title('Mean Wall-Normal Velocity - Stereo PIV', fontsize=16)
|
| 598 |
+
ax.legend(fontsize=11)
|
| 599 |
+
ax.set_xscale('log')
|
| 600 |
+
ax.set_xlim(1, Re_tau)
|
| 601 |
+
ax.grid(True, alpha=0.3)
|
| 602 |
+
|
| 603 |
+
if 'V_plus' in errors:
|
| 604 |
+
ax.text(0.02, 0.98, f"R² = {errors['V_plus']['r2']:.4f}",
|
| 605 |
+
transform=ax.transAxes, fontsize=11, verticalalignment='top',
|
| 606 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 607 |
+
|
| 608 |
+
fig.tight_layout()
|
| 609 |
+
fig.savefig(output_dir / 'V_plus_profile.png', dpi=150)
|
| 610 |
+
plt.close(fig)
|
| 611 |
+
|
| 612 |
+
# ==========================================================================
|
| 613 |
+
# Figure 3: W+ profile (spanwise - should be ~0 for channel flow)
|
| 614 |
+
# ==========================================================================
|
| 615 |
+
fig, ax = plt.subplots(figsize=(10, 7))
|
| 616 |
+
|
| 617 |
+
if has_ci and 'W_plus_ci_lo' in gt_plus:
|
| 618 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['W_plus_ci_lo'],
|
| 619 |
+
gt_plus['W_plus_ci_hi'], color='k', alpha=0.15, zorder=1)
|
| 620 |
+
ax.plot(gt_plus['y_plus'], gt_plus['W_plus'], 'k-', linewidth=2, label='DNS')
|
| 621 |
+
ax.plot(piv_plus['y_plus'], piv_plus['W_plus'], 'bo', markersize=4,
|
| 622 |
+
alpha=0.7, label='Stereo PIV')
|
| 623 |
+
ax.axhline(y=0, color='gray', linestyle='--', linewidth=0.5)
|
| 624 |
+
|
| 625 |
+
ax.set_xlabel(r'$y^+$', fontsize=14)
|
| 626 |
+
ax.set_ylabel(r'$W^+$', fontsize=14)
|
| 627 |
+
ax.set_title('Mean Spanwise Velocity - Stereo PIV (should be ~0)', fontsize=16)
|
| 628 |
+
ax.legend(fontsize=11)
|
| 629 |
+
ax.set_xscale('log')
|
| 630 |
+
ax.set_xlim(1, Re_tau)
|
| 631 |
+
ax.grid(True, alpha=0.3)
|
| 632 |
+
|
| 633 |
+
if 'W_plus' in errors:
|
| 634 |
+
ax.text(0.02, 0.98, f"R² = {errors['W_plus']['r2']:.4f}",
|
| 635 |
+
transform=ax.transAxes, fontsize=11, verticalalignment='top',
|
| 636 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 637 |
+
|
| 638 |
+
fig.tight_layout()
|
| 639 |
+
fig.savefig(output_dir / 'W_plus_profile.png', dpi=150)
|
| 640 |
+
plt.close(fig)
|
| 641 |
+
|
| 642 |
+
# ==========================================================================
|
| 643 |
+
# Figure 4: All velocities combined
|
| 644 |
+
# ==========================================================================
|
| 645 |
+
fig, axes = plt.subplots(1, 3, figsize=(16, 5))
|
| 646 |
+
|
| 647 |
+
# U+
|
| 648 |
+
ax = axes[0]
|
| 649 |
+
if has_ci and 'U_plus_ci_lo' in gt_plus:
|
| 650 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['U_plus_ci_lo'],
|
| 651 |
+
gt_plus['U_plus_ci_hi'], color='k', alpha=0.15, zorder=1)
|
| 652 |
+
ax.semilogx(gt_plus['y_plus'], gt_plus['U_plus'], 'k-', linewidth=2, label='DNS')
|
| 653 |
+
ax.semilogx(piv_plus['y_plus'], piv_plus['U_plus'], 'ro', markersize=3, alpha=0.7, label='Stereo')
|
| 654 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 655 |
+
ax.set_ylabel(r'$U^+$', fontsize=12)
|
| 656 |
+
ax.set_title('Streamwise Velocity', fontsize=14)
|
| 657 |
+
ax.legend()
|
| 658 |
+
ax.set_xlim(1, Re_tau)
|
| 659 |
+
ax.grid(True, alpha=0.3)
|
| 660 |
+
|
| 661 |
+
# V+
|
| 662 |
+
ax = axes[1]
|
| 663 |
+
if has_ci and 'V_plus_ci_lo' in gt_plus:
|
| 664 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['V_plus_ci_lo'],
|
| 665 |
+
gt_plus['V_plus_ci_hi'], color='k', alpha=0.15, zorder=1)
|
| 666 |
+
ax.plot(gt_plus['y_plus'], gt_plus['V_plus'], 'k-', linewidth=2, label='DNS')
|
| 667 |
+
ax.plot(piv_plus['y_plus'], piv_plus['V_plus'], 'ro', markersize=3, alpha=0.7, label='Stereo')
|
| 668 |
+
ax.axhline(y=0, color='gray', linestyle='--', linewidth=0.5)
|
| 669 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 670 |
+
ax.set_ylabel(r'$V^+$', fontsize=12)
|
| 671 |
+
ax.set_title('Wall-Normal Velocity', fontsize=14)
|
| 672 |
+
ax.legend()
|
| 673 |
+
ax.set_xscale('log')
|
| 674 |
+
ax.set_xlim(1, Re_tau)
|
| 675 |
+
ax.grid(True, alpha=0.3)
|
| 676 |
+
|
| 677 |
+
# W+
|
| 678 |
+
ax = axes[2]
|
| 679 |
+
if has_ci and 'W_plus_ci_lo' in gt_plus:
|
| 680 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['W_plus_ci_lo'],
|
| 681 |
+
gt_plus['W_plus_ci_hi'], color='k', alpha=0.15, zorder=1)
|
| 682 |
+
ax.plot(gt_plus['y_plus'], gt_plus['W_plus'], 'k-', linewidth=2, label='DNS')
|
| 683 |
+
ax.plot(piv_plus['y_plus'], piv_plus['W_plus'], 'bo', markersize=3, alpha=0.7, label='Stereo')
|
| 684 |
+
ax.axhline(y=0, color='gray', linestyle='--', linewidth=0.5)
|
| 685 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 686 |
+
ax.set_ylabel(r'$W^+$', fontsize=12)
|
| 687 |
+
ax.set_title('Spanwise Velocity', fontsize=14)
|
| 688 |
+
ax.legend()
|
| 689 |
+
ax.set_xscale('log')
|
| 690 |
+
ax.set_xlim(1, Re_tau)
|
| 691 |
+
ax.grid(True, alpha=0.3)
|
| 692 |
+
|
| 693 |
+
fig.tight_layout()
|
| 694 |
+
fig.savefig(output_dir / 'velocities_combined.png', dpi=150)
|
| 695 |
+
plt.close(fig)
|
| 696 |
+
|
| 697 |
+
|
| 698 |
+
def plot_normal_stresses(piv_plus, gt_plus, wall_units, errors, output_dir):
|
| 699 |
+
"""Generate normal stress plots (uu+, vv+, ww+)."""
|
| 700 |
+
output_dir = Path(output_dir)
|
| 701 |
+
Re_tau = wall_units['Re_tau']
|
| 702 |
+
has_ci = 'uu_plus_ci_lo' in gt_plus
|
| 703 |
+
|
| 704 |
+
fig, axes = plt.subplots(1, 3, figsize=(16, 5))
|
| 705 |
+
|
| 706 |
+
# uu+
|
| 707 |
+
ax = axes[0]
|
| 708 |
+
if has_ci:
|
| 709 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['uu_plus_ci_lo'],
|
| 710 |
+
gt_plus['uu_plus_ci_hi'], color='k', zorder=1)
|
| 711 |
+
ax.plot(gt_plus['y_plus'], gt_plus['uu_plus'], 'k-', linewidth=2, label='DNS')
|
| 712 |
+
ax.plot(piv_plus['y_plus'], piv_plus['uu_plus'], 'ro', markersize=3, alpha=0.7, label='Stereo')
|
| 713 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 714 |
+
ax.set_ylabel(r"$\overline{u'u'}^+$", fontsize=12)
|
| 715 |
+
ax.set_title('Streamwise Normal Stress', fontsize=14)
|
| 716 |
+
ax.legend()
|
| 717 |
+
ax.set_xscale('log')
|
| 718 |
+
ax.set_xlim(1, Re_tau)
|
| 719 |
+
ax.grid(True, alpha=0.3)
|
| 720 |
+
if 'uu_plus' in errors:
|
| 721 |
+
ax.text(0.98, 0.98, f"R² = {errors['uu_plus']['r2']:.4f}",
|
| 722 |
+
transform=ax.transAxes, fontsize=10, ha='right', va='top',
|
| 723 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 724 |
+
|
| 725 |
+
# vv+
|
| 726 |
+
ax = axes[1]
|
| 727 |
+
if has_ci:
|
| 728 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['vv_plus_ci_lo'],
|
| 729 |
+
gt_plus['vv_plus_ci_hi'], color='k', zorder=1)
|
| 730 |
+
ax.plot(gt_plus['y_plus'], gt_plus['vv_plus'], 'k-', linewidth=2, label='DNS')
|
| 731 |
+
ax.plot(piv_plus['y_plus'], piv_plus['vv_plus'], 'go', markersize=3, alpha=0.7, label='Stereo')
|
| 732 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 733 |
+
ax.set_ylabel(r"$\overline{v'v'}^+$", fontsize=12)
|
| 734 |
+
ax.set_title('Wall-Normal Normal Stress', fontsize=14)
|
| 735 |
+
ax.legend()
|
| 736 |
+
ax.set_xscale('log')
|
| 737 |
+
ax.set_xlim(1, Re_tau)
|
| 738 |
+
ax.grid(True, alpha=0.3)
|
| 739 |
+
if 'vv_plus' in errors:
|
| 740 |
+
ax.text(0.98, 0.98, f"R² = {errors['vv_plus']['r2']:.4f}",
|
| 741 |
+
transform=ax.transAxes, fontsize=10, ha='right', va='top',
|
| 742 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 743 |
+
|
| 744 |
+
# ww+
|
| 745 |
+
ax = axes[2]
|
| 746 |
+
if has_ci and 'ww_plus_ci_lo' in gt_plus:
|
| 747 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['ww_plus_ci_lo'],
|
| 748 |
+
gt_plus['ww_plus_ci_hi'], color='k', zorder=1)
|
| 749 |
+
ax.plot(gt_plus['y_plus'], gt_plus['ww_plus'], 'k-', linewidth=2, label='DNS')
|
| 750 |
+
ax.plot(piv_plus['y_plus'], piv_plus['ww_plus'], 'bo', markersize=3, alpha=0.7, label='Stereo')
|
| 751 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 752 |
+
ax.set_ylabel(r"$\overline{w'w'}^+$", fontsize=12)
|
| 753 |
+
ax.set_title('Spanwise Normal Stress', fontsize=14)
|
| 754 |
+
ax.legend()
|
| 755 |
+
ax.set_xscale('log')
|
| 756 |
+
ax.set_xlim(1, Re_tau)
|
| 757 |
+
ax.grid(True, alpha=0.3)
|
| 758 |
+
if 'ww_plus' in errors:
|
| 759 |
+
ax.text(0.98, 0.98, f"R² = {errors['ww_plus']['r2']:.4f}",
|
| 760 |
+
transform=ax.transAxes, fontsize=10, ha='right', va='top',
|
| 761 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 762 |
+
|
| 763 |
+
fig.suptitle('Normal Reynolds Stresses - Stereo PIV', fontsize=16, y=1.02)
|
| 764 |
+
fig.tight_layout()
|
| 765 |
+
fig.savefig(output_dir / 'normal_stresses.png', dpi=150)
|
| 766 |
+
plt.close(fig)
|
| 767 |
+
|
| 768 |
+
|
| 769 |
+
def plot_shear_stresses(piv_plus, gt_plus, wall_units, errors, output_dir):
|
| 770 |
+
"""Generate shear stress plots (-uv+, -uw+, -vw+)."""
|
| 771 |
+
output_dir = Path(output_dir)
|
| 772 |
+
Re_tau = wall_units['Re_tau']
|
| 773 |
+
has_ci = 'uv_plus_ci_lo' in gt_plus
|
| 774 |
+
|
| 775 |
+
fig, axes = plt.subplots(1, 3, figsize=(16, 5))
|
| 776 |
+
|
| 777 |
+
# -uv+
|
| 778 |
+
ax = axes[0]
|
| 779 |
+
if has_ci:
|
| 780 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['uv_plus_ci_lo'],
|
| 781 |
+
gt_plus['uv_plus_ci_hi'], sign=-1, color='k', zorder=1)
|
| 782 |
+
ax.plot(gt_plus['y_plus'], -gt_plus['uv_plus'], 'k-', linewidth=2, label='DNS')
|
| 783 |
+
ax.plot(piv_plus['y_plus'], -piv_plus['uv_plus'], 'ro', markersize=3, alpha=0.7, label='Stereo')
|
| 784 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 785 |
+
ax.set_ylabel(r"$-\overline{u'v'}^+$", fontsize=12)
|
| 786 |
+
ax.set_title('Reynolds Shear Stress (u-v)', fontsize=14)
|
| 787 |
+
ax.legend()
|
| 788 |
+
ax.set_xscale('log')
|
| 789 |
+
ax.set_xlim(1, Re_tau)
|
| 790 |
+
ax.grid(True, alpha=0.3)
|
| 791 |
+
if 'uv_plus' in errors:
|
| 792 |
+
ax.text(0.98, 0.98, f"R² = {errors['uv_plus']['r2']:.4f}",
|
| 793 |
+
transform=ax.transAxes, fontsize=10, ha='right', va='top',
|
| 794 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 795 |
+
|
| 796 |
+
# -uw+
|
| 797 |
+
ax = axes[1]
|
| 798 |
+
if has_ci and 'uw_plus_ci_lo' in gt_plus:
|
| 799 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['uw_plus_ci_lo'],
|
| 800 |
+
gt_plus['uw_plus_ci_hi'], sign=-1, color='k', zorder=1)
|
| 801 |
+
ax.plot(gt_plus['y_plus'], -gt_plus['uw_plus'], 'k-', linewidth=2, label='DNS')
|
| 802 |
+
ax.plot(piv_plus['y_plus'], -piv_plus['uw_plus'], 'go', markersize=3, alpha=0.7, label='Stereo')
|
| 803 |
+
ax.axhline(y=0, color='gray', linestyle='--', linewidth=0.5)
|
| 804 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 805 |
+
ax.set_ylabel(r"$-\overline{u'w'}^+$", fontsize=12)
|
| 806 |
+
ax.set_title('Reynolds Shear Stress (u-w)', fontsize=14)
|
| 807 |
+
ax.legend()
|
| 808 |
+
ax.set_xscale('log')
|
| 809 |
+
ax.set_xlim(1, Re_tau)
|
| 810 |
+
ax.grid(True, alpha=0.3)
|
| 811 |
+
if 'uw_plus' in errors:
|
| 812 |
+
ax.text(0.98, 0.98, f"R² = {errors['uw_plus']['r2']:.4f}",
|
| 813 |
+
transform=ax.transAxes, fontsize=10, ha='right', va='top',
|
| 814 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 815 |
+
|
| 816 |
+
# -vw+
|
| 817 |
+
ax = axes[2]
|
| 818 |
+
if has_ci and 'vw_plus_ci_lo' in gt_plus:
|
| 819 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['vw_plus_ci_lo'],
|
| 820 |
+
gt_plus['vw_plus_ci_hi'], sign=-1, color='k', zorder=1)
|
| 821 |
+
ax.plot(gt_plus['y_plus'], -gt_plus['vw_plus'], 'k-', linewidth=2, label='DNS')
|
| 822 |
+
ax.plot(piv_plus['y_plus'], -piv_plus['vw_plus'], 'bo', markersize=3, alpha=0.7, label='Stereo')
|
| 823 |
+
ax.axhline(y=0, color='gray', linestyle='--', linewidth=0.5)
|
| 824 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 825 |
+
ax.set_ylabel(r"$-\overline{v'w'}^+$", fontsize=12)
|
| 826 |
+
ax.set_title('Reynolds Shear Stress (v-w)', fontsize=14)
|
| 827 |
+
ax.legend()
|
| 828 |
+
ax.set_xscale('log')
|
| 829 |
+
ax.set_xlim(1, Re_tau)
|
| 830 |
+
ax.grid(True, alpha=0.3)
|
| 831 |
+
if 'vw_plus' in errors:
|
| 832 |
+
ax.text(0.98, 0.98, f"R² = {errors['vw_plus']['r2']:.4f}",
|
| 833 |
+
transform=ax.transAxes, fontsize=10, ha='right', va='top',
|
| 834 |
+
bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
|
| 835 |
+
|
| 836 |
+
fig.suptitle('Reynolds Shear Stresses - Stereo PIV', fontsize=16, y=1.02)
|
| 837 |
+
fig.tight_layout()
|
| 838 |
+
fig.savefig(output_dir / 'shear_stresses.png', dpi=150)
|
| 839 |
+
plt.close(fig)
|
| 840 |
+
|
| 841 |
+
|
| 842 |
+
def plot_combined_stresses(piv_plus, gt_plus, wall_units, errors, output_dir):
|
| 843 |
+
"""Plot uu+, vv+, ww+, -uv+ all on a single axis."""
|
| 844 |
+
output_dir = Path(output_dir)
|
| 845 |
+
Re_tau = wall_units['Re_tau']
|
| 846 |
+
has_ci = 'uu_plus_ci_lo' in gt_plus
|
| 847 |
+
|
| 848 |
+
fig, ax = plt.subplots(figsize=(12, 8))
|
| 849 |
+
|
| 850 |
+
# CI bands (behind everything)
|
| 851 |
+
if has_ci:
|
| 852 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['uu_plus_ci_lo'],
|
| 853 |
+
gt_plus['uu_plus_ci_hi'], color='k', alpha=0.12, zorder=1)
|
| 854 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['vv_plus_ci_lo'],
|
| 855 |
+
gt_plus['vv_plus_ci_hi'], color='k', alpha=0.12, zorder=1)
|
| 856 |
+
if 'ww_plus_ci_lo' in gt_plus:
|
| 857 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['ww_plus_ci_lo'],
|
| 858 |
+
gt_plus['ww_plus_ci_hi'], color='k', alpha=0.12, zorder=1)
|
| 859 |
+
plot_ci_band(ax, gt_plus['y_plus'], gt_plus['uv_plus_ci_lo'],
|
| 860 |
+
gt_plus['uv_plus_ci_hi'], sign=-1, color='k', alpha=0.12, zorder=1)
|
| 861 |
+
|
| 862 |
+
# Ground truth / reference
|
| 863 |
+
ax.plot(gt_plus['y_plus'], gt_plus['uu_plus'], 'k-', linewidth=2, label=r"Ref $\overline{u'u'}^+$")
|
| 864 |
+
ax.plot(gt_plus['y_plus'], gt_plus['vv_plus'], 'k--', linewidth=2, label=r"Ref $\overline{v'v'}^+$")
|
| 865 |
+
ax.plot(gt_plus['y_plus'], gt_plus['ww_plus'], 'k-.', linewidth=2, label=r"Ref $\overline{w'w'}^+$")
|
| 866 |
+
ax.plot(gt_plus['y_plus'], -gt_plus['uv_plus'], 'k:', linewidth=2, label=r"Ref $-\overline{u'v'}^+$")
|
| 867 |
+
|
| 868 |
+
# Stereo PIV — markers only (no smoothed lines)
|
| 869 |
+
piv_configs = [
|
| 870 |
+
('uu_plus', 1, 'r', 'o', r"Stereo $\overline{u'u'}^+$"),
|
| 871 |
+
('vv_plus', 1, 'g', 's', r"Stereo $\overline{v'v'}^+$"),
|
| 872 |
+
('ww_plus', 1, 'b', '^', r"Stereo $\overline{w'w'}^+$"),
|
| 873 |
+
('uv_plus', -1, 'm', 'D', r"Stereo $-\overline{u'v'}^+$"),
|
| 874 |
+
]
|
| 875 |
+
for var, sign, col, mkr, label in piv_configs:
|
| 876 |
+
piv_vals = sign * piv_plus[var]
|
| 877 |
+
ax.plot(piv_plus['y_plus'], piv_vals, color=col, marker=mkr,
|
| 878 |
+
markersize=4, alpha=0.7, linestyle='none', label=label, zorder=5)
|
| 879 |
+
|
| 880 |
+
ax.set_xlabel(r'$y^+$')
|
| 881 |
+
ax.set_ylabel(r'Stress$^+$')
|
| 882 |
+
ax.set_title(r'Reynolds Stresses -- Stereo PIV vs Reference ($\mathrm{Re}_\tau$ = ' + f'{Re_tau:.0f})')
|
| 883 |
+
ax.legend(ncol=2, loc='upper right')
|
| 884 |
+
ax.set_xscale('log')
|
| 885 |
+
ax.set_xlim(1, Re_tau)
|
| 886 |
+
ax.grid(True, alpha=0.3)
|
| 887 |
+
|
| 888 |
+
fig.tight_layout()
|
| 889 |
+
fig.savefig(output_dir / 'combined_stresses.png', dpi=150)
|
| 890 |
+
plt.close(fig)
|
| 891 |
+
|
| 892 |
+
|
| 893 |
+
def plot_residuals(piv_plus, gt_plus, wall_units, output_dir):
|
| 894 |
+
"""Plot residuals (PIV - Ref) for velocities and stresses."""
|
| 895 |
+
output_dir = Path(output_dir)
|
| 896 |
+
Re_tau = wall_units['Re_tau']
|
| 897 |
+
|
| 898 |
+
fig, axes = plt.subplots(2, 3, figsize=(16, 10))
|
| 899 |
+
|
| 900 |
+
# Interpolate ground truth onto PIV y+ grid
|
| 901 |
+
gt_interp_fn = {}
|
| 902 |
+
for var in ['U_plus', 'V_plus', 'W_plus', 'uu_plus', 'vv_plus', 'ww_plus',
|
| 903 |
+
'uv_plus', 'uw_plus', 'vw_plus']:
|
| 904 |
+
if var in gt_plus:
|
| 905 |
+
gt_interp_fn[var] = interp1d(gt_plus['y_plus'], gt_plus[var], kind='linear',
|
| 906 |
+
bounds_error=False, fill_value=np.nan)
|
| 907 |
+
|
| 908 |
+
# Top row: velocity residuals (U+, V+, W+)
|
| 909 |
+
vel_configs = [
|
| 910 |
+
('U_plus', r"$U^+_{\mathrm{PIV}} - U^+_{\mathrm{Ref}}$",
|
| 911 |
+
'Streamwise Velocity Residual', 1),
|
| 912 |
+
('V_plus', r"$V^+_{\mathrm{PIV}} - V^+_{\mathrm{Ref}}$",
|
| 913 |
+
'Wall-Normal Velocity Residual', 1),
|
| 914 |
+
('W_plus', r"$W^+_{\mathrm{PIV}} - W^+_{\mathrm{Ref}}$",
|
| 915 |
+
'Spanwise Velocity Residual', 1),
|
| 916 |
+
]
|
| 917 |
+
for ax, (var, ylabel, title, sign) in zip(axes[0, :], vel_configs):
|
| 918 |
+
gt_at_piv = gt_interp_fn[var](piv_plus['y_plus'])
|
| 919 |
+
residual = sign * piv_plus[var] - sign * gt_at_piv
|
| 920 |
+
|
| 921 |
+
ax.semilogx(piv_plus['y_plus'], residual, 'ro', markersize=3, alpha=0.5)
|
| 922 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], residual)
|
| 923 |
+
ax.semilogx(yp_s, r_s, 'r-', linewidth=2, label='Stereo PIV')
|
| 924 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 925 |
+
|
| 926 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 927 |
+
ax.set_ylabel(ylabel, fontsize=12)
|
| 928 |
+
ax.set_title(title, fontsize=14)
|
| 929 |
+
ax.legend()
|
| 930 |
+
ax.set_xlim(1, Re_tau)
|
| 931 |
+
ax.grid(True, alpha=0.3)
|
| 932 |
+
|
| 933 |
+
# Bottom row: normal stress residuals (uu+, vv+, ww+)
|
| 934 |
+
stress_configs = [
|
| 935 |
+
('uu_plus', r"$\overline{u'u'}^+_{\mathrm{PIV}} - \overline{u'u'}^+_{\mathrm{Ref}}$",
|
| 936 |
+
'Streamwise Normal Stress Residual', 1),
|
| 937 |
+
('vv_plus', r"$\overline{v'v'}^+_{\mathrm{PIV}} - \overline{v'v'}^+_{\mathrm{Ref}}$",
|
| 938 |
+
'Wall-Normal Normal Stress Residual', 1),
|
| 939 |
+
('ww_plus', r"$\overline{w'w'}^+_{\mathrm{PIV}} - \overline{w'w'}^+_{\mathrm{Ref}}$",
|
| 940 |
+
'Spanwise Normal Stress Residual', 1),
|
| 941 |
+
]
|
| 942 |
+
for ax, (var, ylabel, title, sign) in zip(axes[1, :], stress_configs):
|
| 943 |
+
gt_at_piv = gt_interp_fn[var](piv_plus['y_plus'])
|
| 944 |
+
residual = sign * piv_plus[var] - sign * gt_at_piv
|
| 945 |
+
|
| 946 |
+
ax.semilogx(piv_plus['y_plus'], residual, 'ro', markersize=3, alpha=0.5)
|
| 947 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], residual)
|
| 948 |
+
ax.semilogx(yp_s, r_s, 'r-', linewidth=2, label='Stereo PIV')
|
| 949 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 950 |
+
|
| 951 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 952 |
+
ax.set_ylabel(ylabel, fontsize=12)
|
| 953 |
+
ax.set_title(title, fontsize=14)
|
| 954 |
+
ax.legend()
|
| 955 |
+
ax.set_xlim(1, Re_tau)
|
| 956 |
+
ax.grid(True, alpha=0.3)
|
| 957 |
+
|
| 958 |
+
fig.tight_layout()
|
| 959 |
+
fig.savefig(output_dir / 'residuals.png', dpi=150)
|
| 960 |
+
plt.close(fig)
|
| 961 |
+
|
| 962 |
+
# Additional figure: shear stress residuals (uv+, uw+, vw+)
|
| 963 |
+
fig, axes = plt.subplots(1, 3, figsize=(16, 5))
|
| 964 |
+
|
| 965 |
+
shear_configs = [
|
| 966 |
+
('uv_plus', r"$-\overline{u'v'}^+_{\mathrm{PIV}} - (-\overline{u'v'}^+_{\mathrm{Ref}})$",
|
| 967 |
+
'Shear Stress Residual (u-v)', -1),
|
| 968 |
+
('uw_plus', r"$-\overline{u'w'}^+_{\mathrm{PIV}} - (-\overline{u'w'}^+_{\mathrm{Ref}})$",
|
| 969 |
+
'Shear Stress Residual (u-w)', -1),
|
| 970 |
+
('vw_plus', r"$-\overline{v'w'}^+_{\mathrm{PIV}} - (-\overline{v'w'}^+_{\mathrm{Ref}})$",
|
| 971 |
+
'Shear Stress Residual (v-w)', -1),
|
| 972 |
+
]
|
| 973 |
+
for ax, (var, ylabel, title, sign) in zip(axes, shear_configs):
|
| 974 |
+
gt_at_piv = gt_interp_fn[var](piv_plus['y_plus'])
|
| 975 |
+
residual = sign * piv_plus[var] - sign * gt_at_piv
|
| 976 |
+
|
| 977 |
+
ax.semilogx(piv_plus['y_plus'], residual, 'ro', markersize=3, alpha=0.5)
|
| 978 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], residual)
|
| 979 |
+
ax.semilogx(yp_s, r_s, 'r-', linewidth=2, label='Stereo PIV')
|
| 980 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 981 |
+
|
| 982 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 983 |
+
ax.set_ylabel(ylabel, fontsize=12)
|
| 984 |
+
ax.set_title(title, fontsize=14)
|
| 985 |
+
ax.legend()
|
| 986 |
+
ax.set_xlim(1, Re_tau)
|
| 987 |
+
ax.grid(True, alpha=0.3)
|
| 988 |
+
|
| 989 |
+
fig.suptitle('Shear Stress Residuals - Stereo PIV', fontsize=14, y=1.02)
|
| 990 |
+
fig.tight_layout()
|
| 991 |
+
fig.savefig(output_dir / 'residuals_shear.png', dpi=150)
|
| 992 |
+
plt.close(fig)
|
| 993 |
+
|
| 994 |
+
|
| 995 |
+
def plot_noise_gradient_decomposition(piv_plus, gt_plus, wall_units, output_dir):
|
| 996 |
+
"""Plot noise floor vs gradient correction decomposition.
|
| 997 |
+
|
| 998 |
+
Uses the fact that PIV measurement noise is approximately isotropic
|
| 999 |
+
(vv+ residual ~ noise floor), while velocity gradient bias is
|
| 1000 |
+
anisotropic (uu+ - vv+ removes the isotropic noise contribution).
|
| 1001 |
+
Extended for stereo: ww+ residual provides an independent noise floor check.
|
| 1002 |
+
"""
|
| 1003 |
+
output_dir = Path(output_dir)
|
| 1004 |
+
Re_tau = wall_units['Re_tau']
|
| 1005 |
+
|
| 1006 |
+
# Interpolate ground truth onto PIV y+ grid
|
| 1007 |
+
gt_interp = {}
|
| 1008 |
+
for var in ['uu_plus', 'vv_plus', 'ww_plus']:
|
| 1009 |
+
gt_interp[var] = interp1d(gt_plus['y_plus'], gt_plus[var], kind='linear',
|
| 1010 |
+
bounds_error=False, fill_value=np.nan)
|
| 1011 |
+
|
| 1012 |
+
uu_residual = piv_plus['uu_plus'] - gt_interp['uu_plus'](piv_plus['y_plus'])
|
| 1013 |
+
vv_residual = piv_plus['vv_plus'] - gt_interp['vv_plus'](piv_plus['y_plus'])
|
| 1014 |
+
ww_residual = piv_plus['ww_plus'] - gt_interp['ww_plus'](piv_plus['y_plus'])
|
| 1015 |
+
gradient_only = uu_residual - vv_residual
|
| 1016 |
+
|
| 1017 |
+
fig, axes = plt.subplots(1, 3, figsize=(16, 5))
|
| 1018 |
+
|
| 1019 |
+
# Left: Noise floor (vv+ residual — isotropic)
|
| 1020 |
+
ax = axes[0]
|
| 1021 |
+
ax.semilogx(piv_plus['y_plus'], vv_residual, 'bo', markersize=2, alpha=0.3)
|
| 1022 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], vv_residual)
|
| 1023 |
+
ax.semilogx(yp_s, r_s, 'b-', linewidth=2.5, label=r"$v'v'$ residual (noise floor)")
|
| 1024 |
+
# Overlay ww+ as independent noise check
|
| 1025 |
+
ax.semilogx(piv_plus['y_plus'], ww_residual, 'co', markersize=2, alpha=0.2)
|
| 1026 |
+
yp_s_ww, r_s_ww = log_smooth(piv_plus['y_plus'], ww_residual)
|
| 1027 |
+
ax.semilogx(yp_s_ww, r_s_ww, 'c--', linewidth=2, label=r"$w'w'$ residual (check)")
|
| 1028 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 1029 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 1030 |
+
ax.set_ylabel(r"Noise floor residual$^+$", fontsize=12)
|
| 1031 |
+
ax.set_title('Noise Floor (isotropic)', fontsize=14)
|
| 1032 |
+
ax.legend(fontsize=10)
|
| 1033 |
+
ax.set_xlim(1, Re_tau)
|
| 1034 |
+
ax.grid(True, alpha=0.3)
|
| 1035 |
+
|
| 1036 |
+
# Middle: Gradient-only residual (uu+ - vv+ removes isotropic noise)
|
| 1037 |
+
ax = axes[1]
|
| 1038 |
+
ax.semilogx(piv_plus['y_plus'], gradient_only, 'ro', markersize=2, alpha=0.3)
|
| 1039 |
+
yp_s, r_s = log_smooth(piv_plus['y_plus'], gradient_only)
|
| 1040 |
+
ax.semilogx(yp_s, r_s, 'r-', linewidth=2.5,
|
| 1041 |
+
label=r"$(\overline{u'u'} - \overline{v'v'})_{\mathrm{PIV}} - (\overline{u'u'} - \overline{v'v'})_{\mathrm{Ref}}$")
|
| 1042 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 1043 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 1044 |
+
ax.set_ylabel(r"Gradient-only residual$^+$", fontsize=12)
|
| 1045 |
+
ax.set_title(r"Gradient Correction Residual ($u'u' - v'v'$ removes noise)", fontsize=14)
|
| 1046 |
+
ax.legend(fontsize=9)
|
| 1047 |
+
ax.set_xlim(1, Re_tau)
|
| 1048 |
+
ax.grid(True, alpha=0.3)
|
| 1049 |
+
|
| 1050 |
+
# Right: All overlaid
|
| 1051 |
+
ax = axes[2]
|
| 1052 |
+
ax.semilogx(piv_plus['y_plus'], uu_residual, 'ro', markersize=2, alpha=0.15)
|
| 1053 |
+
yp_s_uu, r_s_uu = log_smooth(piv_plus['y_plus'], uu_residual)
|
| 1054 |
+
ax.semilogx(yp_s_uu, r_s_uu, 'r-', linewidth=2, label=r"$u'u'$ residual (total)")
|
| 1055 |
+
|
| 1056 |
+
ax.semilogx(piv_plus['y_plus'], vv_residual, 'bo', markersize=2, alpha=0.15)
|
| 1057 |
+
yp_s_vv, r_s_vv = log_smooth(piv_plus['y_plus'], vv_residual)
|
| 1058 |
+
ax.semilogx(yp_s_vv, r_s_vv, 'b-', linewidth=2, label=r"$v'v'$ residual (noise floor)")
|
| 1059 |
+
|
| 1060 |
+
yp_s_g, r_s_g = log_smooth(piv_plus['y_plus'], gradient_only)
|
| 1061 |
+
ax.semilogx(yp_s_g, r_s_g, 'g--', linewidth=2, label=r"$u'u' - v'v'$ residual (gradient only)")
|
| 1062 |
+
|
| 1063 |
+
ax.axhline(y=0, color='k', linestyle='-', linewidth=1, alpha=0.5)
|
| 1064 |
+
ax.set_xlabel(r'$y^+$', fontsize=12)
|
| 1065 |
+
ax.set_ylabel(r"Residual$^+$", fontsize=12)
|
| 1066 |
+
ax.set_title('Decomposition: Total = Noise + Gradient', fontsize=14)
|
| 1067 |
+
ax.legend(fontsize=9)
|
| 1068 |
+
ax.set_xlim(1, Re_tau)
|
| 1069 |
+
ax.grid(True, alpha=0.3)
|
| 1070 |
+
|
| 1071 |
+
fig.suptitle('Noise Floor vs Gradient Correction - Stereo PIV', fontsize=14, y=1.02)
|
| 1072 |
+
fig.tight_layout()
|
| 1073 |
+
fig.savefig(output_dir / 'noise_gradient_decomposition.png', dpi=150)
|
| 1074 |
+
plt.close(fig)
|
| 1075 |
+
|
| 1076 |
+
|
| 1077 |
+
def main(run_idx=2, x_min=5.0, x_max=145.0, gt_dir=None, stereo_base=None, num_frames=1000, output_dir_override=None, trim_top=0):
|
| 1078 |
+
"""Main stereo benchmark comparison function."""
|
| 1079 |
+
|
| 1080 |
+
# Paths
|
| 1081 |
+
script_dir = Path(__file__).parent
|
| 1082 |
+
|
| 1083 |
+
if gt_dir is None:
|
| 1084 |
+
raise ValueError("gt_dir is required. Provide the ground truth directory path.")
|
| 1085 |
+
gt_dir = Path(gt_dir)
|
| 1086 |
+
|
| 1087 |
+
if stereo_base is None:
|
| 1088 |
+
raise ValueError("stereo_base is required. Provide the stereo PIV results directory path.")
|
| 1089 |
+
stereo_base = Path(stereo_base)
|
| 1090 |
+
|
| 1091 |
+
stats_path = stereo_base / f'statistics/{num_frames}/stereo/Cam1_Cam2/instantaneous/mean_stats/mean_stats.mat'
|
| 1092 |
+
coords_path = stereo_base / f'stereo_calibrated/{num_frames}/Cam1_Cam2/instantaneous/coordinates.mat'
|
| 1093 |
+
|
| 1094 |
+
output_dir = output_dir_override or (script_dir / 'benchmark_results_stereo')
|
| 1095 |
+
|
| 1096 |
+
print("=" * 70)
|
| 1097 |
+
print("STEREO PIV BENCHMARK COMPARISON")
|
| 1098 |
+
print("=" * 70)
|
| 1099 |
+
print(f"Run index: {run_idx}")
|
| 1100 |
+
print(f"X range: {x_min} to {x_max} mm")
|
| 1101 |
+
|
| 1102 |
+
# Load data - detect file format
|
| 1103 |
+
wall_units_file = gt_dir / 'wall_units.mat'
|
| 1104 |
+
if not wall_units_file.exists():
|
| 1105 |
+
wall_units_file = gt_dir / 'diagnostics.mat'
|
| 1106 |
+
if not wall_units_file.exists():
|
| 1107 |
+
wall_units_file = gt_dir / 'direct_stats.mat'
|
| 1108 |
+
|
| 1109 |
+
profiles_file = gt_dir / 'profiles.mat'
|
| 1110 |
+
if not profiles_file.exists():
|
| 1111 |
+
profiles_file = gt_dir / 'ensemble_statistics_full.mat'
|
| 1112 |
+
if not profiles_file.exists():
|
| 1113 |
+
profiles_file = gt_dir / 'direct_stats.mat'
|
| 1114 |
+
|
| 1115 |
+
print("\n[1] Loading wall units...")
|
| 1116 |
+
print(f" Source: {wall_units_file.name}")
|
| 1117 |
+
wall_units = load_wall_units(wall_units_file)
|
| 1118 |
+
print(f" u_tau = {wall_units['u_tau']:.4f} mm/s")
|
| 1119 |
+
print(f" delta_nu = {wall_units['delta_nu']:.4f} mm")
|
| 1120 |
+
print(f" Re_tau = {wall_units['Re_tau']:.0f}")
|
| 1121 |
+
|
| 1122 |
+
print("\n[2] Loading ground truth (3-component)...")
|
| 1123 |
+
print(f" Source: {profiles_file.name}")
|
| 1124 |
+
gt = load_ground_truth_3d(profiles_file)
|
| 1125 |
+
print(f" y+ range: {gt['y_plus'].min():.1f} to {gt['y_plus'].max():.1f}")
|
| 1126 |
+
print(f" U range: {gt['U'].min():.2f} to {gt['U'].max():.2f} mm/s")
|
| 1127 |
+
print(f" W range: {gt['W'].min():.2f} to {gt['W'].max():.2f} mm/s")
|
| 1128 |
+
|
| 1129 |
+
print(f"\n[3] Loading stereo PIV statistics (run {run_idx})...")
|
| 1130 |
+
piv = load_stereo_statistics(stats_path, coords_path, run_idx=run_idx)
|
| 1131 |
+
print(f" Grid size: {piv['ux'].shape}")
|
| 1132 |
+
print(f" ux range: {np.nanmin(piv['ux']):.2f} to {np.nanmax(piv['ux']):.2f} mm/s")
|
| 1133 |
+
print(f" uz (W) range: {np.nanmin(piv['uz']):.2f} to {np.nanmax(piv['uz']):.2f} mm/s")
|
| 1134 |
+
|
| 1135 |
+
print("\n[4] Computing x-averaged profiles...")
|
| 1136 |
+
piv_profiles = compute_stereo_profiles(piv, x_min=x_min, x_max=x_max)
|
| 1137 |
+
print(f" y range: {piv_profiles['y_mm'].min():.2f} to {piv_profiles['y_mm'].max():.2f} mm")
|
| 1138 |
+
|
| 1139 |
+
print("\n[5] Converting to wall units...")
|
| 1140 |
+
y_offset_mm = -piv_profiles['y_mm'].min()
|
| 1141 |
+
print(f" Applying y-offset: {y_offset_mm:.2f} mm")
|
| 1142 |
+
|
| 1143 |
+
piv_plus = convert_to_wall_units(piv_profiles, wall_units, y_offset_mm=y_offset_mm)
|
| 1144 |
+
piv_plus['y_plus'] = piv_plus['y_plus'] + 1.0 # shift y+ by +1
|
| 1145 |
+
print(f" y+ range: {piv_plus['y_plus'].min():.1f} to {piv_plus['y_plus'].max():.1f} (after +1 shift)")
|
| 1146 |
+
|
| 1147 |
+
if trim_top > 0:
|
| 1148 |
+
# Sort by y+ to ensure we trim from the correct end
|
| 1149 |
+
sort_idx = np.argsort(piv_plus['y_plus'])
|
| 1150 |
+
for key in piv_plus:
|
| 1151 |
+
piv_plus[key] = piv_plus[key][sort_idx]
|
| 1152 |
+
# Now trim the last N points (highest y+)
|
| 1153 |
+
keep = slice(None, len(piv_plus['y_plus']) - trim_top)
|
| 1154 |
+
for key in piv_plus:
|
| 1155 |
+
piv_plus[key] = piv_plus[key][keep]
|
| 1156 |
+
print(f" Trimmed top {trim_top} highest-y+ points -> {len(piv_plus['y_plus'])} remaining")
|
| 1157 |
+
print(f" y+ range after trim: {piv_plus['y_plus'].min():.1f} to {piv_plus['y_plus'].max():.1f}")
|
| 1158 |
+
|
| 1159 |
+
# Ground truth in wall units
|
| 1160 |
+
u_tau = wall_units['u_tau']
|
| 1161 |
+
u_tau2 = u_tau ** 2
|
| 1162 |
+
gt_plus = {
|
| 1163 |
+
'y_plus': gt['y_plus'],
|
| 1164 |
+
'U_plus': gt['U_plus'],
|
| 1165 |
+
'V_plus': gt['V'] / u_tau,
|
| 1166 |
+
'W_plus': gt['W'] / u_tau,
|
| 1167 |
+
'uu_plus': gt['uu_plus'],
|
| 1168 |
+
'vv_plus': gt['vv_plus'],
|
| 1169 |
+
'ww_plus': gt['ww_plus'],
|
| 1170 |
+
'uv_plus': gt['uv_plus'],
|
| 1171 |
+
'uw_plus': gt['uw'] / u_tau2,
|
| 1172 |
+
'vw_plus': gt['vw'] / u_tau2,
|
| 1173 |
+
}
|
| 1174 |
+
# Thread CI bounds through if available
|
| 1175 |
+
for ci_key in ['U_plus_ci_lo', 'U_plus_ci_hi', 'V_plus_ci_lo', 'V_plus_ci_hi',
|
| 1176 |
+
'W_plus_ci_lo', 'W_plus_ci_hi',
|
| 1177 |
+
'uu_plus_ci_lo', 'uu_plus_ci_hi', 'vv_plus_ci_lo', 'vv_plus_ci_hi',
|
| 1178 |
+
'ww_plus_ci_lo', 'ww_plus_ci_hi',
|
| 1179 |
+
'uv_plus_ci_lo', 'uv_plus_ci_hi', 'uw_plus_ci_lo', 'uw_plus_ci_hi',
|
| 1180 |
+
'vw_plus_ci_lo', 'vw_plus_ci_hi']:
|
| 1181 |
+
if ci_key in gt:
|
| 1182 |
+
gt_plus[ci_key] = gt[ci_key]
|
| 1183 |
+
|
| 1184 |
+
print("\n[6] Computing error metrics (y+ = 10-500)...")
|
| 1185 |
+
errors = compute_errors(piv_plus, gt_plus, y_plus_range=(10, 500))
|
| 1186 |
+
|
| 1187 |
+
# Print results
|
| 1188 |
+
print("\n" + "=" * 70)
|
| 1189 |
+
print("STEREO BENCHMARK RESULTS")
|
| 1190 |
+
print("=" * 70)
|
| 1191 |
+
|
| 1192 |
+
var_names = {
|
| 1193 |
+
'U_plus': 'Streamwise Velocity (U+)',
|
| 1194 |
+
'V_plus': 'Wall-normal Velocity (V+)',
|
| 1195 |
+
'W_plus': 'Spanwise Velocity (W+)',
|
| 1196 |
+
'uu_plus': 'Streamwise Stress (uu+)',
|
| 1197 |
+
'vv_plus': 'Wall-normal Stress (vv+)',
|
| 1198 |
+
'ww_plus': 'Spanwise Stress (ww+)',
|
| 1199 |
+
'uv_plus': 'Shear Stress (uv+)',
|
| 1200 |
+
'uw_plus': 'Shear Stress (uw+)',
|
| 1201 |
+
'vw_plus': 'Shear Stress (vw+)',
|
| 1202 |
+
}
|
| 1203 |
+
|
| 1204 |
+
for var, err in errors.items():
|
| 1205 |
+
name = var_names.get(var, var)
|
| 1206 |
+
print(f"\n{name}:")
|
| 1207 |
+
print(f" RMS Error: {err['rms']:.4f} ({err['rms_rel']:.1f}% of range)")
|
| 1208 |
+
print(f" R²: {err['r2']:.4f}")
|
| 1209 |
+
print(f" Correlation: {err['corr']:.4f}")
|
| 1210 |
+
|
| 1211 |
+
print("\n[7] Generating plots...")
|
| 1212 |
+
plot_velocity_comparison(piv_plus, gt_plus, wall_units, errors, output_dir)
|
| 1213 |
+
plot_normal_stresses(piv_plus, gt_plus, wall_units, errors, output_dir)
|
| 1214 |
+
plot_shear_stresses(piv_plus, gt_plus, wall_units, errors, output_dir)
|
| 1215 |
+
plot_combined_stresses(piv_plus, gt_plus, wall_units, errors, output_dir)
|
| 1216 |
+
plot_residuals(piv_plus, gt_plus, wall_units, output_dir)
|
| 1217 |
+
plot_noise_gradient_decomposition(piv_plus, gt_plus, wall_units, output_dir)
|
| 1218 |
+
|
| 1219 |
+
print(f"\nPlots saved to: {output_dir}")
|
| 1220 |
+
|
| 1221 |
+
# Summary table
|
| 1222 |
+
print("\n" + "=" * 70)
|
| 1223 |
+
print("SUMMARY TABLE")
|
| 1224 |
+
print("=" * 70)
|
| 1225 |
+
print(f"\n{'Variable':<20} {'R²':<10} {'RMS%':<10} {'Corr':<10}")
|
| 1226 |
+
print("-" * 50)
|
| 1227 |
+
for var in ['U_plus', 'V_plus', 'W_plus', 'uu_plus', 'vv_plus', 'ww_plus', 'uv_plus', 'uw_plus', 'vw_plus']:
|
| 1228 |
+
if var in errors:
|
| 1229 |
+
e = errors[var]
|
| 1230 |
+
print(f"{var:<20} {e['r2']:<10.4f} {e['rms_rel']:<10.1f} {e['corr']:<10.4f}")
|
| 1231 |
+
|
| 1232 |
+
print("\n" + "=" * 70)
|
| 1233 |
+
print("STEREO BENCHMARK COMPLETE")
|
| 1234 |
+
print("=" * 70)
|
| 1235 |
+
|
| 1236 |
+
|
| 1237 |
+
if __name__ == '__main__':
|
| 1238 |
+
parser = argparse.ArgumentParser(description='Stereo PIV Benchmark Comparison')
|
| 1239 |
+
parser.add_argument('--run', '-r', type=int, default=2,
|
| 1240 |
+
help='Run index (0-based), default=2 (finest available)')
|
| 1241 |
+
parser.add_argument('--x-min', type=float, default=5.0,
|
| 1242 |
+
help='Minimum x to include (mm), default=5.0')
|
| 1243 |
+
parser.add_argument('--x-max', type=float, default=145.0,
|
| 1244 |
+
help='Maximum x to include (mm), default=145.0')
|
| 1245 |
+
parser.add_argument('--gt-dir', '-g', type=str, default=None,
|
| 1246 |
+
help='Ground truth directory path')
|
| 1247 |
+
parser.add_argument('--stereo-base', '-s', type=str, default=None,
|
| 1248 |
+
help='Base directory containing stereo PIV results')
|
| 1249 |
+
parser.add_argument('--num-frames', '-n', type=int, default=1000,
|
| 1250 |
+
help='Frame count subdirectory in paths (default: 1000)')
|
| 1251 |
+
parser.add_argument('--output-dir', '-o', type=str, default=None,
|
| 1252 |
+
help='Custom output directory for results')
|
| 1253 |
+
parser.add_argument('--trim-top', '-t', type=int, default=0,
|
| 1254 |
+
help='Number of highest-y+ vectors to exclude (default: 0)')
|
| 1255 |
+
args = parser.parse_args()
|
| 1256 |
+
|
| 1257 |
+
output_dir = Path(args.output_dir) if args.output_dir else None
|
| 1258 |
+
main(run_idx=args.run, x_min=args.x_min, x_max=args.x_max,
|
| 1259 |
+
gt_dir=args.gt_dir, stereo_base=args.stereo_base,
|
| 1260 |
+
num_frames=args.num_frames, output_dir_override=output_dir,
|
| 1261 |
+
trim_top=args.trim_top)
|
scripts/tcf_direct_stats.py
ADDED
|
@@ -0,0 +1,614 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
tcf_direct_stats.py — Direct binning statistics for JHTDB channel flow data.
|
| 4 |
+
|
| 5 |
+
Reimplements the tcf_mean.m direct binning approach in Python:
|
| 6 |
+
- Cosine-stretched (Chebyshev) y-bins for wall-normal resolution
|
| 7 |
+
- Single-pass accumulation of velocity moments
|
| 8 |
+
- Self-consistent variance: Var = <uu> - <u><u>
|
| 9 |
+
- No spatial smoothing bias from convolution
|
| 10 |
+
- 2D uniform grid for spatial mean/stress fields
|
| 11 |
+
|
| 12 |
+
Reads particle position pairs (B#####_A.data, B#####_B.data) and computes
|
| 13 |
+
turbulence statistics (mean velocity, Reynolds stress tensor) in wall units.
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
import numpy as np
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
import time
|
| 19 |
+
|
| 20 |
+
from scipy.io import loadmat, savemat
|
| 21 |
+
|
| 22 |
+
# ============================================================================
|
| 23 |
+
# CONFIGURATION
|
| 24 |
+
# ============================================================================
|
| 25 |
+
|
| 26 |
+
import argparse as _argparse
|
| 27 |
+
_parser = _argparse.ArgumentParser(description='Compute ground truth statistics from JHTDB particle data')
|
| 28 |
+
_parser.add_argument('--data-dir', '-d', type=str, required=True,
|
| 29 |
+
help='Directory containing B#####_A.data / B#####_B.data particle files')
|
| 30 |
+
_parser.add_argument('--params-file', '-p', type=str, default=None,
|
| 31 |
+
help='Path to download_parameters.mat (default: <data-dir>/../download_parameters.mat)')
|
| 32 |
+
_parser.add_argument('--output-dir', '-o', type=str, required=True,
|
| 33 |
+
help='Output directory for direct_stats.mat')
|
| 34 |
+
_args = _parser.parse_args()
|
| 35 |
+
|
| 36 |
+
data_folder = Path(_args.data_dir)
|
| 37 |
+
params_file = Path(_args.params_file) if _args.params_file else data_folder.parent / "download_parameters.mat"
|
| 38 |
+
output_folder = Path(_args.output_dir)
|
| 39 |
+
|
| 40 |
+
n_y = 90 # Number of y-bins (was 64; ~2x near-wall resolution since dy_wall ~ 1/n_y²)
|
| 41 |
+
|
| 42 |
+
# 2D grid bin size (mm) — uniform grid for spatial fields
|
| 43 |
+
dx_2d = 1.0
|
| 44 |
+
dy_2d = 1.0
|
| 45 |
+
|
| 46 |
+
# DNS Re_tau=1000 fallback constants (used if params file missing fields)
|
| 47 |
+
u_tau_nondim = 0.0499 # Friction velocity (non-dimensional)
|
| 48 |
+
nu_nondim = 5e-5 # Kinematic viscosity (non-dimensional)
|
| 49 |
+
|
| 50 |
+
# ============================================================================
|
| 51 |
+
# STEP 1: Load parameters from download_parameters.mat
|
| 52 |
+
# ============================================================================
|
| 53 |
+
|
| 54 |
+
print("=" * 60)
|
| 55 |
+
print(" Direct Binning Statistics — JHTDB Channel Flow")
|
| 56 |
+
print("=" * 60)
|
| 57 |
+
print()
|
| 58 |
+
|
| 59 |
+
print(f"Loading parameters from:\n {params_file}")
|
| 60 |
+
mat_data = loadmat(str(params_file))
|
| 61 |
+
p = mat_data["params"].flat[0]
|
| 62 |
+
|
| 63 |
+
n_frames = int(p["n_frames"].flat[0])
|
| 64 |
+
dt = float(p["dt"].flat[0])
|
| 65 |
+
h_mm = float(p["h_mm"].flat[0])
|
| 66 |
+
Nx = int(p["Nx"].flat[0])
|
| 67 |
+
Ny = int(p["Ny"].flat[0])
|
| 68 |
+
mm_per_pixel = float(p["mm_per_pixel"].flat[0])
|
| 69 |
+
velocity_conv = float(p["velocity_conv"].flat[0])
|
| 70 |
+
length_conv = float(p["length_conv"].flat[0])
|
| 71 |
+
|
| 72 |
+
# Compute wall units
|
| 73 |
+
u_tau = u_tau_nondim * velocity_conv # mm/s
|
| 74 |
+
nu = nu_nondim * length_conv * velocity_conv # mm^2/s
|
| 75 |
+
delta_nu = nu / u_tau # viscous length scale (mm)
|
| 76 |
+
Re_tau = h_mm / delta_nu # friction Reynolds number
|
| 77 |
+
|
| 78 |
+
print(f"\n--- Physical Parameters ---")
|
| 79 |
+
print(f" Channel half-height h = {h_mm:.1f} mm")
|
| 80 |
+
print(f" Time step dt = {dt:.6e}")
|
| 81 |
+
print(f" Friction velocity u_tau = {u_tau:.4f} mm/s")
|
| 82 |
+
print(f" Kinematic viscosity nu = {nu:.2e} mm^2/s")
|
| 83 |
+
print(f" Viscous length delta_nu = {delta_nu:.4f} mm")
|
| 84 |
+
print(f" Friction Reynolds Re_tau = {Re_tau:.0f}")
|
| 85 |
+
print()
|
| 86 |
+
|
| 87 |
+
# ============================================================================
|
| 88 |
+
# STEP 2: Scan for frame pairs
|
| 89 |
+
# ============================================================================
|
| 90 |
+
|
| 91 |
+
print("Scanning for frame pairs...")
|
| 92 |
+
a_files = sorted(data_folder.glob("B*_A.data"))
|
| 93 |
+
|
| 94 |
+
frame_pairs = []
|
| 95 |
+
for af in a_files:
|
| 96 |
+
stem = af.stem # e.g. "B00001_A"
|
| 97 |
+
frame_str = stem.split("_")[0][1:] # e.g. "00001"
|
| 98 |
+
bf = af.parent / f"B{frame_str}_B.data"
|
| 99 |
+
if bf.exists():
|
| 100 |
+
frame_pairs.append((af, bf, int(frame_str)))
|
| 101 |
+
|
| 102 |
+
frame_pairs.sort(key=lambda x: x[2])
|
| 103 |
+
n_available = len(frame_pairs)
|
| 104 |
+
|
| 105 |
+
if n_available == 0:
|
| 106 |
+
raise RuntimeError(f"No frame pairs found in {data_folder}")
|
| 107 |
+
|
| 108 |
+
print(f" Found {n_available} complete frame pairs.")
|
| 109 |
+
print(f" Frame range: {frame_pairs[0][2]} to {frame_pairs[-1][2]}")
|
| 110 |
+
print()
|
| 111 |
+
|
| 112 |
+
# ============================================================================
|
| 113 |
+
# STEP 3: Create cosine-stretched (Chebyshev) y-bins
|
| 114 |
+
# ============================================================================
|
| 115 |
+
# Based on tcf_mean.m but restricted to the bottom channel [-h, 0].
|
| 116 |
+
# phi from pi to pi/2 maps cos(phi) from -1 to 0, giving y in [-h, 0].
|
| 117 |
+
# All n_y bins cover the data range — no wasted bins in the empty top channel.
|
| 118 |
+
|
| 119 |
+
phi = np.linspace(np.pi, np.pi / 2, n_y + 1)
|
| 120 |
+
y_edges = h_mm * np.cos(phi) # -h … 0
|
| 121 |
+
y_centers = 0.5 * (y_edges[:-1] + y_edges[1:])
|
| 122 |
+
|
| 123 |
+
print(f"Chebyshev y-bins: {n_y} bins spanning [{y_edges[0]:.1f}, {y_edges[-1]:.1f}] mm")
|
| 124 |
+
print(f" First bin width (near wall): {y_edges[1] - y_edges[0]:.3f} mm")
|
| 125 |
+
print(f" Mid bin width (near centre): {y_edges[n_y // 2 + 1] - y_edges[n_y // 2]:.3f} mm")
|
| 126 |
+
print()
|
| 127 |
+
|
| 128 |
+
# ============================================================================
|
| 129 |
+
# STEP 3b: Create uniform 2D grid for spatial fields
|
| 130 |
+
# ============================================================================
|
| 131 |
+
# x in [0, Lx], y in [-h, 0]. Lx determined from params grid.
|
| 132 |
+
|
| 133 |
+
Lx = Nx * mm_per_pixel
|
| 134 |
+
x2d_edges = np.arange(0, Lx + dx_2d, dx_2d)
|
| 135 |
+
y2d_edges = np.arange(-h_mm, 0 + dy_2d, dy_2d)
|
| 136 |
+
nx_2d = len(x2d_edges) - 1
|
| 137 |
+
ny_2d = len(y2d_edges) - 1
|
| 138 |
+
x2d_centers = 0.5 * (x2d_edges[:-1] + x2d_edges[1:])
|
| 139 |
+
y2d_centers = 0.5 * (y2d_edges[:-1] + y2d_edges[1:])
|
| 140 |
+
|
| 141 |
+
print(f"2D uniform grid: {nx_2d} x {ny_2d} bins ({dx_2d} x {dy_2d} mm)")
|
| 142 |
+
print(f" x range: [0, {Lx:.1f}] mm y range: [{-h_mm:.1f}, 0] mm")
|
| 143 |
+
print(f" Resolution: {dx_2d} x {dy_2d} mm = "
|
| 144 |
+
f"{dx_2d / mm_per_pixel:.2f} x {dy_2d / mm_per_pixel:.2f} px")
|
| 145 |
+
print()
|
| 146 |
+
|
| 147 |
+
# Pixel-space coordinate arrays
|
| 148 |
+
x2d_centers_px = x2d_centers / mm_per_pixel
|
| 149 |
+
y2d_centers_px = (y2d_centers + h_mm) / mm_per_pixel # wall at 0 px, centreline at Ny px
|
| 150 |
+
x2d_edges_px = x2d_edges / mm_per_pixel
|
| 151 |
+
y2d_edges_px = (y2d_edges + h_mm) / mm_per_pixel
|
| 152 |
+
|
| 153 |
+
# ============================================================================
|
| 154 |
+
# STEP 4: Single-pass accumulation (1D Chebyshev + 2D uniform)
|
| 155 |
+
# ============================================================================
|
| 156 |
+
|
| 157 |
+
print("Accumulating statistics (single pass)...")
|
| 158 |
+
|
| 159 |
+
# --- 1D Chebyshev accumulators ---
|
| 160 |
+
n_sum = np.zeros(n_y, dtype=np.float64)
|
| 161 |
+
u_sum = np.zeros((n_y, 3), dtype=np.float64)
|
| 162 |
+
uu_sum = np.zeros((n_y, 3, 3), dtype=np.float64)
|
| 163 |
+
|
| 164 |
+
# --- Per-frame accumulators for bootstrap CI ---
|
| 165 |
+
n_per_frame = np.zeros((n_available, n_y), dtype=np.float64)
|
| 166 |
+
u_sum_per_frame = np.zeros((n_available, n_y, 3), dtype=np.float64)
|
| 167 |
+
uu_sum_per_frame = np.zeros((n_available, n_y, 3, 3), dtype=np.float64)
|
| 168 |
+
|
| 169 |
+
# --- 2D uniform grid accumulators (individual components) ---
|
| 170 |
+
n_sum_2d = np.zeros((nx_2d, ny_2d), dtype=np.float64)
|
| 171 |
+
# Means
|
| 172 |
+
u_sum_2d = np.zeros((nx_2d, ny_2d), dtype=np.float64)
|
| 173 |
+
v_sum_2d = np.zeros((nx_2d, ny_2d), dtype=np.float64)
|
| 174 |
+
w_sum_2d = np.zeros((nx_2d, ny_2d), dtype=np.float64)
|
| 175 |
+
# Second moments (6 unique components of symmetric tensor)
|
| 176 |
+
uu_sum_2d = np.zeros((nx_2d, ny_2d), dtype=np.float64)
|
| 177 |
+
vv_sum_2d = np.zeros((nx_2d, ny_2d), dtype=np.float64)
|
| 178 |
+
ww_sum_2d = np.zeros((nx_2d, ny_2d), dtype=np.float64)
|
| 179 |
+
uv_sum_2d = np.zeros((nx_2d, ny_2d), dtype=np.float64)
|
| 180 |
+
uw_sum_2d = np.zeros((nx_2d, ny_2d), dtype=np.float64)
|
| 181 |
+
vw_sum_2d = np.zeros((nx_2d, ny_2d), dtype=np.float64)
|
| 182 |
+
|
| 183 |
+
t_start = time.time()
|
| 184 |
+
total_particles = 0
|
| 185 |
+
progress_interval = max(1, n_available // 20)
|
| 186 |
+
|
| 187 |
+
for idx, (file_a, file_b, frame_num) in enumerate(frame_pairs):
|
| 188 |
+
# Load positions — 3 columns: x, y, z in mm
|
| 189 |
+
pos_A = np.loadtxt(str(file_a))
|
| 190 |
+
pos_B = np.loadtxt(str(file_b))
|
| 191 |
+
|
| 192 |
+
if pos_A.shape[0] != pos_B.shape[0]:
|
| 193 |
+
print(f" Warning: frame {frame_num} particle count mismatch, skipping.")
|
| 194 |
+
continue
|
| 195 |
+
|
| 196 |
+
# Velocity = displacement / dt (mm/s)
|
| 197 |
+
vel = (pos_B - pos_A) / dt
|
| 198 |
+
u, v, w = vel[:, 0], vel[:, 1], vel[:, 2]
|
| 199 |
+
|
| 200 |
+
# Midpoint positions for bin assignment
|
| 201 |
+
x_mid = 0.5 * (pos_A[:, 0] + pos_B[:, 0])
|
| 202 |
+
y_mid = 0.5 * (pos_A[:, 1] + pos_B[:, 1])
|
| 203 |
+
|
| 204 |
+
# --- 1D Chebyshev accumulation ---
|
| 205 |
+
bin_idx = np.digitize(y_mid, y_edges) - 1 # 0-based bin index
|
| 206 |
+
valid = (bin_idx >= 0) & (bin_idx < n_y)
|
| 207 |
+
bi = bin_idx[valid]
|
| 208 |
+
vel_v = vel[valid]
|
| 209 |
+
|
| 210 |
+
n_particles = int(valid.sum())
|
| 211 |
+
total_particles += n_particles
|
| 212 |
+
|
| 213 |
+
n_frame = np.bincount(bi, minlength=n_y).astype(np.float64)
|
| 214 |
+
n_per_frame[idx] = n_frame
|
| 215 |
+
n_sum += n_frame
|
| 216 |
+
for i in range(3):
|
| 217 |
+
u_frame_i = np.bincount(bi, weights=vel_v[:, i], minlength=n_y)
|
| 218 |
+
u_sum_per_frame[idx, :, i] = u_frame_i
|
| 219 |
+
u_sum[:, i] += u_frame_i
|
| 220 |
+
for j in range(3):
|
| 221 |
+
uu_frame_ij = np.bincount(
|
| 222 |
+
bi, weights=vel_v[:, i] * vel_v[:, j], minlength=n_y
|
| 223 |
+
)
|
| 224 |
+
uu_sum_per_frame[idx, :, i, j] = uu_frame_ij
|
| 225 |
+
uu_sum[:, i, j] += uu_frame_ij
|
| 226 |
+
|
| 227 |
+
# --- 2D uniform grid accumulation ---
|
| 228 |
+
ix = np.floor(x_mid / dx_2d).astype(int)
|
| 229 |
+
iy = np.floor((y_mid - y2d_edges[0]) / dy_2d).astype(int)
|
| 230 |
+
ok = (ix >= 0) & (ix < nx_2d) & (iy >= 0) & (iy < ny_2d)
|
| 231 |
+
lin = ix[ok] * ny_2d + iy[ok]
|
| 232 |
+
u_ok, v_ok, w_ok = u[ok], v[ok], w[ok]
|
| 233 |
+
flat_sz = nx_2d * ny_2d
|
| 234 |
+
|
| 235 |
+
n_sum_2d += np.bincount(lin, minlength=flat_sz).reshape(nx_2d, ny_2d)
|
| 236 |
+
u_sum_2d += np.bincount(lin, weights=u_ok, minlength=flat_sz).reshape(nx_2d, ny_2d)
|
| 237 |
+
v_sum_2d += np.bincount(lin, weights=v_ok, minlength=flat_sz).reshape(nx_2d, ny_2d)
|
| 238 |
+
w_sum_2d += np.bincount(lin, weights=w_ok, minlength=flat_sz).reshape(nx_2d, ny_2d)
|
| 239 |
+
uu_sum_2d += np.bincount(lin, weights=u_ok * u_ok, minlength=flat_sz).reshape(nx_2d, ny_2d)
|
| 240 |
+
vv_sum_2d += np.bincount(lin, weights=v_ok * v_ok, minlength=flat_sz).reshape(nx_2d, ny_2d)
|
| 241 |
+
ww_sum_2d += np.bincount(lin, weights=w_ok * w_ok, minlength=flat_sz).reshape(nx_2d, ny_2d)
|
| 242 |
+
uv_sum_2d += np.bincount(lin, weights=u_ok * v_ok, minlength=flat_sz).reshape(nx_2d, ny_2d)
|
| 243 |
+
uw_sum_2d += np.bincount(lin, weights=u_ok * w_ok, minlength=flat_sz).reshape(nx_2d, ny_2d)
|
| 244 |
+
vw_sum_2d += np.bincount(lin, weights=v_ok * w_ok, minlength=flat_sz).reshape(nx_2d, ny_2d)
|
| 245 |
+
|
| 246 |
+
if (idx + 1) % progress_interval == 0 or idx == n_available - 1:
|
| 247 |
+
elapsed = time.time() - t_start
|
| 248 |
+
print(
|
| 249 |
+
f" {idx + 1:>5d}/{n_available} frames "
|
| 250 |
+
f"({100 * (idx + 1) / n_available:5.1f}%) — "
|
| 251 |
+
f"{total_particles / 1e6:.2f}M particles — {elapsed:.1f}s"
|
| 252 |
+
)
|
| 253 |
+
|
| 254 |
+
elapsed = time.time() - t_start
|
| 255 |
+
print(f"\n Finished: {n_available} frames, "
|
| 256 |
+
f"{total_particles / 1e6:.3f}M particles in {elapsed:.1f}s")
|
| 257 |
+
print()
|
| 258 |
+
|
| 259 |
+
# ============================================================================
|
| 260 |
+
# STEP 5: Compute statistics
|
| 261 |
+
# ============================================================================
|
| 262 |
+
|
| 263 |
+
print("Computing statistics...")
|
| 264 |
+
|
| 265 |
+
# --- 1D Chebyshev profiles ---
|
| 266 |
+
valid_bins = n_sum > 0
|
| 267 |
+
|
| 268 |
+
u_mean = np.full((n_y, 3), np.nan)
|
| 269 |
+
uu_mean = np.full((n_y, 3, 3), np.nan)
|
| 270 |
+
u_var = np.full((n_y, 3, 3), np.nan)
|
| 271 |
+
|
| 272 |
+
u_mean[valid_bins] = u_sum[valid_bins] / n_sum[valid_bins, None]
|
| 273 |
+
uu_mean[valid_bins] = uu_sum[valid_bins] / n_sum[valid_bins, None, None]
|
| 274 |
+
|
| 275 |
+
# Reynolds stress tensor: <u_i' u_j'> = <u_i u_j> - <u_i><u_j>
|
| 276 |
+
u_var[valid_bins] = (
|
| 277 |
+
uu_mean[valid_bins]
|
| 278 |
+
- u_mean[valid_bins, :, None] * u_mean[valid_bins, None, :]
|
| 279 |
+
)
|
| 280 |
+
|
| 281 |
+
print(f" 1D bins with data: {int(valid_bins.sum())} / {n_y}")
|
| 282 |
+
|
| 283 |
+
# --- 2D fields: individual named variables ---
|
| 284 |
+
min_count_2d = 10
|
| 285 |
+
ok2d = n_sum_2d >= min_count_2d
|
| 286 |
+
N = np.where(ok2d, n_sum_2d, np.nan)
|
| 287 |
+
|
| 288 |
+
# Mean velocities (nx_2d x ny_2d each)
|
| 289 |
+
U_mean_2d = np.where(ok2d, u_sum_2d / N, np.nan)
|
| 290 |
+
V_mean_2d = np.where(ok2d, v_sum_2d / N, np.nan)
|
| 291 |
+
W_mean_2d = np.where(ok2d, w_sum_2d / N, np.nan)
|
| 292 |
+
|
| 293 |
+
# Mean second moments
|
| 294 |
+
UU_mom_2d = np.where(ok2d, uu_sum_2d / N, np.nan)
|
| 295 |
+
VV_mom_2d = np.where(ok2d, vv_sum_2d / N, np.nan)
|
| 296 |
+
WW_mom_2d = np.where(ok2d, ww_sum_2d / N, np.nan)
|
| 297 |
+
UV_mom_2d = np.where(ok2d, uv_sum_2d / N, np.nan)
|
| 298 |
+
UW_mom_2d = np.where(ok2d, uw_sum_2d / N, np.nan)
|
| 299 |
+
VW_mom_2d = np.where(ok2d, vw_sum_2d / N, np.nan)
|
| 300 |
+
|
| 301 |
+
# Reynolds stresses: <u'v'> = <uv> - <u><v>
|
| 302 |
+
uu_stress_2d = UU_mom_2d - U_mean_2d * U_mean_2d
|
| 303 |
+
vv_stress_2d = VV_mom_2d - V_mean_2d * V_mean_2d
|
| 304 |
+
ww_stress_2d = WW_mom_2d - W_mean_2d * W_mean_2d
|
| 305 |
+
uv_stress_2d = UV_mom_2d - U_mean_2d * V_mean_2d
|
| 306 |
+
uw_stress_2d = UW_mom_2d - U_mean_2d * W_mean_2d
|
| 307 |
+
vw_stress_2d = VW_mom_2d - V_mean_2d * W_mean_2d
|
| 308 |
+
|
| 309 |
+
print(f" 2D grid cells with data: {int(ok2d.sum())} / {nx_2d * ny_2d}")
|
| 310 |
+
print()
|
| 311 |
+
|
| 312 |
+
# ============================================================================
|
| 313 |
+
# STEP 5b: Bootstrap 95% confidence intervals (1D profiles)
|
| 314 |
+
# ============================================================================
|
| 315 |
+
|
| 316 |
+
N_boot = 2000
|
| 317 |
+
print(f"Bootstrap CI: {N_boot} resamples over {n_available} frames...")
|
| 318 |
+
t_boot = time.time()
|
| 319 |
+
|
| 320 |
+
rng_boot = np.random.default_rng(42)
|
| 321 |
+
stress_boot = np.full((N_boot, n_y, 3, 3), np.nan, dtype=np.float64)
|
| 322 |
+
umean_boot = np.full((N_boot, n_y, 3), np.nan, dtype=np.float64)
|
| 323 |
+
|
| 324 |
+
for b in range(N_boot):
|
| 325 |
+
idx_b = rng_boot.integers(0, n_available, size=n_available)
|
| 326 |
+
n_b = n_per_frame[idx_b].sum(axis=0)
|
| 327 |
+
u_b = u_sum_per_frame[idx_b].sum(axis=0)
|
| 328 |
+
uu_b = uu_sum_per_frame[idx_b].sum(axis=0)
|
| 329 |
+
|
| 330 |
+
ok_b = n_b > 0
|
| 331 |
+
mean_b = np.full((n_y, 3), np.nan)
|
| 332 |
+
mean_b[ok_b] = u_b[ok_b] / n_b[ok_b, None]
|
| 333 |
+
|
| 334 |
+
mom2_b = np.full((n_y, 3, 3), np.nan)
|
| 335 |
+
mom2_b[ok_b] = uu_b[ok_b] / n_b[ok_b, None, None]
|
| 336 |
+
|
| 337 |
+
var_b = np.full((n_y, 3, 3), np.nan)
|
| 338 |
+
var_b[ok_b] = mom2_b[ok_b] - mean_b[ok_b, :, None] * mean_b[ok_b, None, :]
|
| 339 |
+
|
| 340 |
+
stress_boot[b] = var_b / u_tau**2
|
| 341 |
+
umean_boot[b] = mean_b / u_tau
|
| 342 |
+
|
| 343 |
+
# 95% CI (2.5th and 97.5th percentiles)
|
| 344 |
+
stress_ci_lo = np.nanpercentile(stress_boot, 2.5, axis=0)
|
| 345 |
+
stress_ci_hi = np.nanpercentile(stress_boot, 97.5, axis=0)
|
| 346 |
+
umean_ci_lo = np.nanpercentile(umean_boot, 2.5, axis=0)
|
| 347 |
+
umean_ci_hi = np.nanpercentile(umean_boot, 97.5, axis=0)
|
| 348 |
+
|
| 349 |
+
print(f" Done in {time.time() - t_boot:.1f}s")
|
| 350 |
+
if valid_bins.any():
|
| 351 |
+
mid_bin = n_y // 2
|
| 352 |
+
ci_width = stress_ci_hi[mid_bin, 0, 0] - stress_ci_lo[mid_bin, 0, 0]
|
| 353 |
+
print(f" Example u'u'+ CI width at bin {mid_bin}: {ci_width:.4f} wall units")
|
| 354 |
+
print()
|
| 355 |
+
|
| 356 |
+
# ============================================================================
|
| 357 |
+
# STEP 6: Wall-unit normalization
|
| 358 |
+
# ============================================================================
|
| 359 |
+
|
| 360 |
+
y_plus = (h_mm + y_centers) / delta_nu # wall distance in wall units
|
| 361 |
+
U_plus = u_mean / u_tau # mean velocity in wall units
|
| 362 |
+
stress_plus = u_var / u_tau**2 # Reynolds stresses in wall units
|
| 363 |
+
|
| 364 |
+
rng = valid_bins # all bins are in [-h, 0]
|
| 365 |
+
|
| 366 |
+
print("Wall-unit normalization:")
|
| 367 |
+
print(f" y+ range (with data): "
|
| 368 |
+
f"[{np.nanmin(y_plus[rng]):.1f}, {np.nanmax(y_plus[rng]):.1f}]")
|
| 369 |
+
print(f" U+ max (streamwise): {np.nanmax(U_plus[rng, 0]):.2f}")
|
| 370 |
+
if rng.any():
|
| 371 |
+
peak_uu = np.nanmax(stress_plus[rng, 0, 0])
|
| 372 |
+
peak_yp = y_plus[rng][np.nanargmax(stress_plus[rng, 0, 0])]
|
| 373 |
+
print(f" <u'u'>+ peak: {peak_uu:.2f} at y+ ~ {peak_yp:.0f}")
|
| 374 |
+
print()
|
| 375 |
+
|
| 376 |
+
# ============================================================================
|
| 377 |
+
# STEP 7: Save outputs
|
| 378 |
+
# ============================================================================
|
| 379 |
+
|
| 380 |
+
output_folder.mkdir(parents=True, exist_ok=True)
|
| 381 |
+
|
| 382 |
+
# Collect all 2D fields in a dict for easy saving
|
| 383 |
+
fields_2d = {
|
| 384 |
+
# Coordinates in mm
|
| 385 |
+
"x2d_centers": x2d_centers,
|
| 386 |
+
"y2d_centers": y2d_centers,
|
| 387 |
+
"x2d_edges": x2d_edges,
|
| 388 |
+
"y2d_edges": y2d_edges,
|
| 389 |
+
# Coordinates in pixels
|
| 390 |
+
"x2d_centers_px": x2d_centers_px,
|
| 391 |
+
"y2d_centers_px": y2d_centers_px,
|
| 392 |
+
"x2d_edges_px": x2d_edges_px,
|
| 393 |
+
"y2d_edges_px": y2d_edges_px,
|
| 394 |
+
# Counts
|
| 395 |
+
"n_sum_2d": n_sum_2d,
|
| 396 |
+
# Mean velocities
|
| 397 |
+
"U_mean_2d": U_mean_2d,
|
| 398 |
+
"V_mean_2d": V_mean_2d,
|
| 399 |
+
"W_mean_2d": W_mean_2d,
|
| 400 |
+
# Reynolds stresses
|
| 401 |
+
"uu_stress_2d": uu_stress_2d,
|
| 402 |
+
"vv_stress_2d": vv_stress_2d,
|
| 403 |
+
"ww_stress_2d": ww_stress_2d,
|
| 404 |
+
"uv_stress_2d": uv_stress_2d,
|
| 405 |
+
"uw_stress_2d": uw_stress_2d,
|
| 406 |
+
"vw_stress_2d": vw_stress_2d,
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
fields_1d = {
|
| 410 |
+
"y_centers": y_centers,
|
| 411 |
+
"y_edges": y_edges,
|
| 412 |
+
"y_plus": y_plus,
|
| 413 |
+
"n_sum": n_sum,
|
| 414 |
+
"u_mean": u_mean,
|
| 415 |
+
"uu_mean": uu_mean,
|
| 416 |
+
"u_var": u_var,
|
| 417 |
+
"U_plus": U_plus,
|
| 418 |
+
"stress_plus": stress_plus,
|
| 419 |
+
# Bootstrap 95% CI
|
| 420 |
+
"stress_ci_lo": stress_ci_lo,
|
| 421 |
+
"stress_ci_hi": stress_ci_hi,
|
| 422 |
+
"umean_ci_lo": umean_ci_lo,
|
| 423 |
+
"umean_ci_hi": umean_ci_hi,
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
scalars = {
|
| 427 |
+
"h_mm": h_mm,
|
| 428 |
+
"u_tau": u_tau,
|
| 429 |
+
"delta_nu": delta_nu,
|
| 430 |
+
"Re_tau": Re_tau,
|
| 431 |
+
"dt": dt,
|
| 432 |
+
"n_frames": np.array(n_available),
|
| 433 |
+
"mm_per_pixel": mm_per_pixel,
|
| 434 |
+
"dx_2d_mm": dx_2d,
|
| 435 |
+
"dy_2d_mm": dy_2d,
|
| 436 |
+
"dx_2d_px": dx_2d / mm_per_pixel,
|
| 437 |
+
"dy_2d_px": dy_2d / mm_per_pixel,
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
# --- .npz file ---
|
| 441 |
+
npz_file = output_folder / "direct_stats.npz"
|
| 442 |
+
np.savez(str(npz_file), **fields_1d, **fields_2d, **scalars)
|
| 443 |
+
print(f"Saved: {npz_file}")
|
| 444 |
+
|
| 445 |
+
# --- .mat file ---
|
| 446 |
+
mat_file = output_folder / "direct_stats.mat"
|
| 447 |
+
mat_dict = {}
|
| 448 |
+
mat_dict.update(fields_1d)
|
| 449 |
+
mat_dict.update(fields_2d)
|
| 450 |
+
mat_dict.update(scalars)
|
| 451 |
+
mat_dict["n_frames"] = n_available # savemat prefers plain int
|
| 452 |
+
savemat(str(mat_file), mat_dict)
|
| 453 |
+
print(f"Saved: {mat_file}")
|
| 454 |
+
print()
|
| 455 |
+
|
| 456 |
+
# ============================================================================
|
| 457 |
+
# STEP 8: Validation plots
|
| 458 |
+
# ============================================================================
|
| 459 |
+
|
| 460 |
+
import matplotlib
|
| 461 |
+
matplotlib.use("Agg")
|
| 462 |
+
import matplotlib.pyplot as plt
|
| 463 |
+
|
| 464 |
+
print("Generating validation plots...")
|
| 465 |
+
|
| 466 |
+
kappa = 0.41
|
| 467 |
+
B_const = 5.2
|
| 468 |
+
|
| 469 |
+
# ---- Figure 1: Mean velocity profile (semilog U+ vs y+) ----
|
| 470 |
+
fig1, ax1 = plt.subplots(figsize=(8, 5))
|
| 471 |
+
|
| 472 |
+
yp_visc = np.linspace(0.1, 5, 100)
|
| 473 |
+
ax1.semilogx(yp_visc, yp_visc, "r-", lw=2, label=r"$U^+ = y^+$")
|
| 474 |
+
|
| 475 |
+
yp_log = np.logspace(1, 3, 100)
|
| 476 |
+
up_log = (1.0 / kappa) * np.log(yp_log) + B_const
|
| 477 |
+
ax1.semilogx(
|
| 478 |
+
yp_log, up_log, "k--", lw=2,
|
| 479 |
+
label=rf"Log law ($\kappa={kappa}$, $B={B_const}$)",
|
| 480 |
+
)
|
| 481 |
+
|
| 482 |
+
comp_names = [r"$\langle U_1 \rangle^+$",
|
| 483 |
+
r"$\langle U_2 \rangle^+$",
|
| 484 |
+
r"$\langle U_3 \rangle^+$"]
|
| 485 |
+
for ic in range(3):
|
| 486 |
+
ax1.semilogx(y_plus[rng], U_plus[rng, ic], ".-", ms=4, label=comp_names[ic])
|
| 487 |
+
|
| 488 |
+
ax1.set_xlabel(r"$y^+$")
|
| 489 |
+
ax1.set_ylabel(r"$U^+$")
|
| 490 |
+
ax1.set_title(rf"Mean Velocity Profile ($Re_{{\tau}} = {Re_tau:.0f}$)")
|
| 491 |
+
ax1.legend(loc="upper left")
|
| 492 |
+
ax1.set_xlim(0.1, Re_tau)
|
| 493 |
+
ax1.set_ylim(-0.5, 25)
|
| 494 |
+
ax1.grid(True, which="both", alpha=0.3)
|
| 495 |
+
fig1.tight_layout()
|
| 496 |
+
fig1.savefig(str(output_folder / "fig1_mean_velocity_semilog.png"), dpi=200)
|
| 497 |
+
plt.close(fig1)
|
| 498 |
+
print(" Fig 1: Mean velocity (semilog U+ vs y+)")
|
| 499 |
+
|
| 500 |
+
# ---- Figure 2: Reynolds normal stresses vs y/h ----
|
| 501 |
+
fig2, ax2 = plt.subplots(figsize=(8, 5))
|
| 502 |
+
|
| 503 |
+
diag_labels = [r"$\langle u'_1 u'_1 \rangle^+$",
|
| 504 |
+
r"$\langle u'_2 u'_2 \rangle^+$",
|
| 505 |
+
r"$\langle u'_3 u'_3 \rangle^+$"]
|
| 506 |
+
for i in range(3):
|
| 507 |
+
ax2.plot(
|
| 508 |
+
stress_plus[rng, i, i], y_centers[rng] / h_mm, ".-", ms=4,
|
| 509 |
+
label=diag_labels[i],
|
| 510 |
+
)
|
| 511 |
+
|
| 512 |
+
ax2.set_xlabel(r"$\langle u'_i u'_i \rangle^+$")
|
| 513 |
+
ax2.set_ylabel(r"$y / h$")
|
| 514 |
+
ax2.set_title("Reynolds Normal Stresses")
|
| 515 |
+
ax2.legend(loc="best")
|
| 516 |
+
ax2.set_xlim(0, 10)
|
| 517 |
+
ax2.grid(True, alpha=0.3)
|
| 518 |
+
fig2.tight_layout()
|
| 519 |
+
fig2.savefig(str(output_folder / "fig2_normal_stresses_yh.png"), dpi=200)
|
| 520 |
+
plt.close(fig2)
|
| 521 |
+
print(" Fig 2: Reynolds normal stresses vs y/h")
|
| 522 |
+
|
| 523 |
+
# ---- Figure 3: Reynolds shear stresses vs y/h ----
|
| 524 |
+
fig3, ax3 = plt.subplots(figsize=(8, 5))
|
| 525 |
+
|
| 526 |
+
shear_pairs = [(0, 1), (0, 2), (1, 2)]
|
| 527 |
+
for i, j in shear_pairs:
|
| 528 |
+
label = rf"$\langle u'_{i+1} u'_{j+1} \rangle^+$"
|
| 529 |
+
ax3.plot(
|
| 530 |
+
stress_plus[rng, i, j], y_centers[rng] / h_mm, ".-", ms=4,
|
| 531 |
+
label=label,
|
| 532 |
+
)
|
| 533 |
+
|
| 534 |
+
yh_theory = np.linspace(-1, 0, 100)
|
| 535 |
+
ax3.plot(-(1 + yh_theory), yh_theory, "k-", lw=2, label=r"$-(1+y/h)$")
|
| 536 |
+
|
| 537 |
+
ax3.set_xlabel(r"$\langle u'_i u'_j \rangle^+$")
|
| 538 |
+
ax3.set_ylabel(r"$y / h$")
|
| 539 |
+
ax3.set_title("Reynolds Shear Stresses")
|
| 540 |
+
ax3.legend(loc="best")
|
| 541 |
+
ax3.set_xlim(-1, 1)
|
| 542 |
+
ax3.grid(True, alpha=0.3)
|
| 543 |
+
fig3.tight_layout()
|
| 544 |
+
fig3.savefig(str(output_folder / "fig3_shear_stresses_yh.png"), dpi=200)
|
| 545 |
+
plt.close(fig3)
|
| 546 |
+
print(" Fig 3: Reynolds shear stresses vs y/h")
|
| 547 |
+
|
| 548 |
+
# ---- Figure 4: Normal stresses vs y+ (semilog x-axis) with 95% CI ----
|
| 549 |
+
fig4, ax4 = plt.subplots(figsize=(8, 5))
|
| 550 |
+
|
| 551 |
+
ci_colors = ["C0", "C1", "C2"]
|
| 552 |
+
for i in range(3):
|
| 553 |
+
ax4.semilogx(
|
| 554 |
+
y_plus[rng], stress_plus[rng, i, i], ".-", ms=4,
|
| 555 |
+
color=ci_colors[i], label=diag_labels[i],
|
| 556 |
+
)
|
| 557 |
+
ax4.fill_between(
|
| 558 |
+
y_plus[rng],
|
| 559 |
+
stress_ci_lo[rng, i, i],
|
| 560 |
+
stress_ci_hi[rng, i, i],
|
| 561 |
+
color=ci_colors[i], alpha=0.2,
|
| 562 |
+
label=f"95% CI" if i == 0 else None,
|
| 563 |
+
)
|
| 564 |
+
|
| 565 |
+
ax4.set_xlabel(r"$y^+$")
|
| 566 |
+
ax4.set_ylabel(r"$\langle u'_i u'_i \rangle^+$")
|
| 567 |
+
ax4.set_title("Reynolds Normal Stresses (wall units) — 95% bootstrap CI")
|
| 568 |
+
ax4.legend(loc="best")
|
| 569 |
+
ax4.set_xlim(0.1, Re_tau)
|
| 570 |
+
ax4.set_ylim(0, 10)
|
| 571 |
+
ax4.grid(True, which="both", alpha=0.3)
|
| 572 |
+
fig4.tight_layout()
|
| 573 |
+
fig4.savefig(str(output_folder / "fig4_normal_stresses_yplus.png"), dpi=200)
|
| 574 |
+
plt.close(fig4)
|
| 575 |
+
print(" Fig 4: Normal stresses vs y+ with 95% CI (semilog)")
|
| 576 |
+
|
| 577 |
+
# ---- Figure 5: 2D mean streamwise velocity field ----
|
| 578 |
+
# x horizontal (streamwise), y vertical (wall-normal, wall at bottom)
|
| 579 |
+
fig5, ax5 = plt.subplots(figsize=(12, 5))
|
| 580 |
+
im = ax5.pcolormesh(
|
| 581 |
+
x2d_centers, y2d_centers + h_mm, U_mean_2d.T,
|
| 582 |
+
cmap="viridis", shading="auto", rasterized=True,
|
| 583 |
+
)
|
| 584 |
+
fig5.colorbar(im, ax=ax5, label=r"$\langle u_x \rangle$ (mm/s)")
|
| 585 |
+
ax5.set_xlabel("x (mm)")
|
| 586 |
+
ax5.set_ylabel("y (mm, wall at 0)")
|
| 587 |
+
ax5.set_title(r"2D mean streamwise velocity $\langle u_x \rangle$")
|
| 588 |
+
ax5.set_aspect("equal")
|
| 589 |
+
fig5.tight_layout()
|
| 590 |
+
fig5.savefig(str(output_folder / "fig5_mean_ux_2d.png"), dpi=250)
|
| 591 |
+
plt.close(fig5)
|
| 592 |
+
print(" Fig 5: 2D mean streamwise velocity (mm)")
|
| 593 |
+
|
| 594 |
+
# ---- Figure 6: 2D mean streamwise velocity in pixel space ----
|
| 595 |
+
fig6, ax6 = plt.subplots(figsize=(12, 5))
|
| 596 |
+
im6 = ax6.pcolormesh(
|
| 597 |
+
x2d_centers_px, y2d_centers_px, U_mean_2d.T,
|
| 598 |
+
cmap="viridis", shading="auto", rasterized=True,
|
| 599 |
+
)
|
| 600 |
+
fig6.colorbar(im6, ax=ax6, label=r"$\langle u_x \rangle$ (mm/s)")
|
| 601 |
+
ax6.set_xlabel("x (px)")
|
| 602 |
+
ax6.set_ylabel("y (px, wall at 0)")
|
| 603 |
+
ax6.set_title(r"2D mean streamwise velocity $\langle u_x \rangle$ (pixel coords)")
|
| 604 |
+
ax6.set_aspect("equal")
|
| 605 |
+
fig6.tight_layout()
|
| 606 |
+
fig6.savefig(str(output_folder / "fig6_mean_ux_2d_px.png"), dpi=250)
|
| 607 |
+
plt.close(fig6)
|
| 608 |
+
print(" Fig 6: 2D mean streamwise velocity (px)")
|
| 609 |
+
|
| 610 |
+
print()
|
| 611 |
+
print("=" * 60)
|
| 612 |
+
print(" All done.")
|
| 613 |
+
print(f" Outputs in: {output_folder}")
|
| 614 |
+
print("=" * 60)
|
stereo_noisy/calibration/cam1/planar_calibration_plate_01.tif
ADDED
|
|
stereo_noisy/calibration/cam1/planar_calibration_plate_02.tif
ADDED
|
|
stereo_noisy/calibration/cam1/planar_calibration_plate_03.tif
ADDED
|
|
stereo_noisy/calibration/cam1/planar_calibration_plate_04.tif
ADDED
|
|
stereo_noisy/calibration/cam1/planar_calibration_plate_05.tif
ADDED
|
|
stereo_noisy/calibration/cam1/planar_calibration_plate_06.tif
ADDED
|
|
stereo_noisy/calibration/cam1/planar_calibration_plate_07.tif
ADDED
|
|
stereo_noisy/calibration/cam1/planar_calibration_plate_08.tif
ADDED
|
|
stereo_noisy/calibration/cam1/planar_calibration_plate_09.tif
ADDED
|
|
stereo_noisy/calibration/cam1/planar_calibration_plate_10.tif
ADDED
|
|
stereo_noisy/calibration/cam1/planar_calibration_plate_11.tif
ADDED
|
|
stereo_noisy/calibration/cam1/planar_calibration_plate_12.tif
ADDED
|
|