Learning Incompressible 3D Flows from Sparse Samples: A Set Transformer Approach to Divergence-Free Kernel Fitting
Organizations: King Abdullah University of Science and Technology (KAUST), Thuwal, Saudi Arabia · Mohammed VI Polytechnic University (UM6P), Benguerir, Morocco
Abstract
Recovering divergence-free velocity fields from sparse and corrupted observations requires reconciling physical consistency, expressive representations, and robustness to missing data. We introduce DFK-Former, a set-to-field transformer that reconstructs divergence-free velocity fields from sparse, noisy, and irregularly sampled 3D observations. The model is inherently invariant to the number and ordering of input samples and predicts the parameters of a divergence-free kernel representation, producing continuous, mesh-free velocity fields that satisfy incompressibility exactly by construction rather than approximately through soft constraints or projection operators. Unlike existing divergence-free kernel approaches, which estimate kernel coefficients via a separate optimization for each field, DFK-Former predicts these coefficients directly in a single forward pass. This eliminates costly iterative fitting while providing a learned prior that enables accurate reconstruction even when observations are insufficient to uniquely determine the field. To enhance representational power, we introduce adaptive and anisotropic divergence-free kernels that preserve exact incompressibility guarantees while capturing more complex flow structures. Extensive experiments across varying levels of sparsity, noise, and occlusion, including transfer to real Direct Numerical Simulation (DNS) turbulence data, demonstrate substantial gains in both accuracy and efficiency. DFK-Former reduces endpoint error by up to 4.6x compared to per-field divergence-free-kernel optimization, while reconstructing each field in 7.5 ms instead of 9.8 s, yielding a speedup of more than three orders of magnitude. These results establish direct, feed-forward prediction of divergence-free kernel parameters as a practical and effective paradigm for physically consistent velocity-field reconstruction from sparse observations.
Figures & tables
| Method | RMSE/ | rel. | MAE | cosine | angle ( ∘ ) | ms/field | div-free? | |
|---|---|---|---|---|---|---|---|---|
| Wendland RBF (scalar) | 0.598 | 0.736 | 0.280 | 0.663 | 37.9 | 26 | no | |
| SIREN ( soft penalty) | 0.392 | 0.519 | 0.195 | 0.805 | 26.7 | 53600 | no (soft) | |
| Curl-SIREN | 0.950 | 1.352 | 0.475 | 0.629 | 42.0 | 52700 | by construction | |
| Vector-potential INR | 0.778 | 1.092 | 0.388 | 0.661 | 39.1 | 48000 | by construction | |
| DFK fitting (fixed kernels) | 0.689 | 0.924 | 0.335 | 0.482 | 52.9 | 22 | by construction | |
| DFK fitting (adaptive kernels) | 0.546 | 0.719 | 0.264 | 0.568 | 45.5 | 9821 | by construction |
| Regime | Temporal DFK-Former (ours) | Per-frame DFK | Shared-kernel DFK | ST-SIREN | ST-Curl-SIREN |
|---|---|---|---|---|---|
| clean&dense | 0.114 | 0.100 | 0.083 | 0.442 | 0.781 |
| sparse | 0.109 | 0.847 | 1.093 | 0.388 | 0.590 |
| occluded | 0.098 | 0.951 | 1.511 | 0.413 | 0.766 |
| Overall (median ) | 0.114 | 0.767 | 0.626 | 0.428 | 0.842 |
| Overall (mean ) | 0.124 | 20.29 † | 0.762 | 0.466 | 0.821 |
| Overall (mean angular error) | 4.8 ∘ | 40.0 ∘ | 25.4 ∘ | 21.3 ∘ | 37.1 ∘ |
| Target structure | Isotropic | Anisotropic | improvement |
|---|---|---|---|
| Vortex tube (Lamb–Oseen) | 0.0763 | 0.0656 | |
| Shear layer | 0.0719 | 0.0592 | |
| Vortex ring | 0.0835 | 0.0623 |
Appendix figures & tables26 assets
Supplementary material from the paper’s appendix.
Appendix
| Component | Setting |
|---|---|
| Static model: backbone, heads and kernel geometry | |
| Token width | |
| Backbone blocks | ; each block one masked cross-attention sublayer one self-attention sublayer |
| Attention heads / head dimension | / |
| Feed-forward hidden width | , GELU |
| Dropout | |
| Setting | Value |
|---|---|
| Optimization and schedule | |
| Optimizer | AdamW, library-default and ; weight decay |
| Peak learning rate | |
| Schedule | constant to step , cosine decay to step , held at thereafter; no warm-up |
| Gradient clipping | global norm |
| Batch size | fields per rank ranks fields per step |
| Symbol | Meaning | Value / range |
| Domain and precision | ||
| periodic domain size, | ||
| FFT generation grid | ||
| — | generation / training precision | float64 / float32 |
| Spectral generator (Eq. 10 ) | ||
| energy-containing wavenumber (cycles/domain) | ||
| Stage | Steps | Sources (spectral / coherent) | ||||
|---|---|---|---|---|---|---|
| Core | / | |||||
| Hard | / | |||||
| Cooldown | / |
| Set | Generator | Fields | Role |
| in-dist | spectral, training band-limit | matched-distribution accuracy | |
| CAF | coherent-structure mixture | coherent structure (in training) | |
| Taylor–Green | single analytic family | per-family accuracy | |
| Lamb–Oseen | single analytic family | per-family accuracy | |
| vortex ring | single analytic family | per-family accuracy | |
| shear layer | single analytic family | per-family accuracy |
| Radius / spacing | channel | transitional b.l. | isotropic turb. | forced MHD |
|---|---|---|---|---|
| 0.106 | 0.165 | 0.483 | 0.739 | |
| 0.037 | 0.056 | 0.173 | 0.261 | |
| 0.012 | 0.019 | 0.050 | 0.075 | |
| 0.010 | 0.016 | 0.040 | 0.058 | |
| 0.009 | 0.014 | 0.035 | 0.051 |
| same- | same-memory | |||
|---|---|---|---|---|
| isotropic | aniso, equal-volume | aniso, extend-only | aniso, extend-only | |
| 0.173 | 0.251 | 0.139 | 0.173 | |
| 0.137 | 0.247 | 0.092 | 0.122 | |
| 0.128 | 0.282 | 0.055 | 0.076 | |
| 0.124 | 0.356 | 0.038 | 0.045 | |
| 0.215 | 0.592 | 0.049 | 0.038 | |
| Factor | Change | EPE | Budget |
|---|---|---|---|
| Set encoder | attention DeepSets pooling | k steps | |
| Kernel count | (no point) | k steps | |
| Adaptive placement | fixed predicted centers/radii | k steps | |
| Width | k steps | ||
| Fourier position enc. | off on | k steps | |
| Orthogonality loss | k steps |
| Method | noise | occl. | |||
| DFK-Former (ours) | 0.714 | 0.477 | 0.713 | 0.687 | |
| FNO | 0.742 | 0.501 | 0.749 | 0.760 | |
| DeepONet | 0.816 | 0.723 | 0.856 | 0.862 | |
| DFK fitting (fixed kernels) ‡ | 0.804 | 0.636 | 0.805 | 0.842 | |
| DFK fitting (adaptive kernels) | 1.628 | 2.167 | 2.425 | 2.361 | |
| Wendland RBF (scalar) | 0.795 | 0.657 | 0.803 | 0.756 |
| Axis | Range (easy hard) | model EPE | margin vs fit | margin vs aniso. fit |
|---|---|---|---|---|
| Sample count | ||||
| Noise | ||||
| Occluded fraction | ||||
| Target – |
| Synthetic (band-limited) | Real DNS (zero-shot) | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Method | GRF | CAF | Taylor–Gr. | Lamb–Os. | vtx. ring | shear | ABC | iso. | MHD | chan. | tr. BL |
| Wendland RBF (scalar) | 0.634 | 0.615 | 0.607 | 0.627 | 0.560 | 0.622 | 0.618 | 0.566 | 0.553 | 0.601 | 0.572 |
| SIREN ( soft penalty) | 0.550 | 0.537 | 0.560 | 0.435 | 0.444 | 0.438 | 0.418 | 0.256 | 0.310 | 0.183 | 0.180 |
| Curl-SIREN | 0.998 | 1.177 | 1.167 | 1.102 | 1.028 | 1.108 | 1.005 | 0.673 | 0.729 | 0.769 | 0.699 |
| Vector-potential INR | 0.819 | 1.029 | 0.969 | 0.943 | 0.942 | 0.989 | 0.821 | 0.469 | 0.470 | 0.623 | 0.485 |
| DFK fitting (fixed kernels) | 0.545 | 0.643 | 0.482 | 0.715 | 0.692 | 0.743 | 0.548 | 0.752 | 0.732 | 0.889 | 0.842 |
| Method | \lVert\nabla\!\cdot\!{\color[rgb]{0.1211,0.6055,0.3516}{\bm{v}}_{\Theta}}\rVert_{\infty} | div-free |
|---|---|---|
| Wendland RBF (scalar) | no | |
| SIREN ( soft penalty) | no (soft) | |
| Curl-SIREN | by construction | |
| Vector-potential INR | by construction | |
| DFK fitting (fixed kernels) | by construction | |
| DFK fitting (adaptive kernels) | by construction |
| Three turbulence sets | Ten-family battery | ||||
|---|---|---|---|---|---|
| Method | rel. KE | rel. | band | rel. | band |
| SIREN ( soft penalty) | 0.077 | 0.296 | 0.175 | – | – |
| Curl-SIREN | 1.388 | 4.962 | 1.576 | – | – |
| DFK fitting (fixed kernels) | 0.148 | 0.486 | 0.230 | – | – |
| FNO | 0.202 | 0.696 | 0.258 | 2.660 | 0.211 |
| DeepONet | 0.388 | 0.875 | 0.435 | – | – |
| Method | ms/field | scenes/s | peak mem (MB) | GFLOPs | # params (M) |
|---|---|---|---|---|---|
| SIREN / Curl-SIREN (per-field fit) | 53000 | 0.019 | 204 | 9500 | 0.20 |
| DFK fitting (fixed kernels) | 22 | 45 | 1285 | 81 | 0 |
| DFK fitting (adaptive kernels) | 9821 | 0.10 | 623 | 786 | 0 |
| DFK-Former (ours) | 7.5 | 134 | 68 | 41 | 10.2 |
| Sparsity axis | Noise axis ( ) | ||||||||
| Method | ( ) † | ( ) † | |||||||
| Restricted training — sparsity arm , noise arm , every stage, retrained from step | |||||||||
| FNO | 0.753 | 0.665 | 0.580 | 0.407 | 0.362 | 0.495 | 0.496 | 0.497 | 0.501 |
| DeepONet | 0.812 | 0.782 | 0.766 | 0.756 | 0.750 | 0.757 | 0.755 | 0.748 | 0.724 |
| DFK-Former (ours) | 0.718 | 0.637 | 0.551 | 0.380 | 0.323 | 0.461 | 0.464 | 0.471 | 0.492 |
| Full-range training ( , ) — unrestricted reference | |||||||||
| Set | restricted | full library | ratio | |
|---|---|---|---|---|
| Excluded families | Shear layer | 0.425 | 0.054 | 7.95 |
| Taylor–Green | 0.301 | 0.053 | 5.71 | |
| Vortex ring | 0.277 | 0.062 | 4.50 | |
| Lamb–Oseen | 0.249 | 0.056 | 4.48 | |
| Included families | ABC (the one kept family) | 0.074 | 0.036 | 2.04 |
| Gaussian Random Fields | 0.369 | 0.343 | 1.08 |
| Corruption regime | Temporal DFK-Former | Per-frame DFK | Shared-kernel DFK | ST-SIREN | ST-Curl-SIREN |
|---|---|---|---|---|---|
| clean&dense | 0.114 (0.114) | 0.100 (0.102) | 0.083 (0.093) | 0.442 (0.432) | 0.781 (0.727) |
| contaminated | 0.085 (0.122) | 0.217 (0.291) | 0.165 (0.191) | 0.365 (0.448) | 0.712 (0.781) |
| noisy | 0.088 (0.097) | 0.398 (1.874) | 0.268 (0.281) | 0.440 (0.482) | 0.939 (0.926) |
| sparse | 0.109 (0.129) | 0.847 (0.828) | 1.093 (1.067) | 0.388 (0.453) | 0.590 (0.617) |
| occluded | 0.098 (0.110) | 0.951 (107.1) | 1.511 (1.519) | 0.413 (0.451) | 0.766 (0.819) |
| hard combo | 0.138 (0.173) | 0.916 (11.52) | 1.420 (1.419) | 0.497 (0.528) | 1.029 (1.057) |
| Dataset | angle ( ∘ ) | \lVert\nabla\!\cdot\!{\color[rgb]{0.1211,0.6055,0.3516}{\bm{v}}_{\Theta}}\rVert_{\mathrm{rms}} | Per-frame DFK | ratio | ||
|---|---|---|---|---|---|---|
| JHTDB isotropic | 48 | 0.141 | 6.8 | 0.752 | 5.3 | |
| JHTDB MHD | 48 | 0.196 | 9.5 | 0.790 | 4.0 | |
| JHTDB channel | 42 | 0.057 | 2.7 | 0.805 | 14.2 | |
| JHTDB transitional BL | 42 | 0.073 | 3.4 | 0.753 | 10.4 |
| Corruption regime | Per-frame DFK | moving iso. | moving iso. | shared aniso. | shared aniso. | adaptive placement |
|---|---|---|---|---|---|---|
| clean&dense | 0.100 | 0.115 | 0.174 | 0.133 | 0.114 | 0.117 |
| contaminated | 0.217 | 0.092 | 0.172 | 0.105 | 0.085 | 0.100 |
| noisy | 0.398 | 0.093 | 0.173 | 0.102 | 0.089 | 0.098 |
| hard combo | 0.916 | 0.146 | 0.222 | 0.152 | 0.138 | 0.152 |
| sparse | 0.847 | 0.118 | 0.194 | 0.125 | 0.109 | 0.117 |
| occluded | 0.951 | 0.103 | 0.186 | 0.117 | 0.098 | 0.108 |