Compare commits
320
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb58c79827 | ||
|
|
aafa05a359 | ||
|
|
63e5c3828b | ||
|
|
76873d911c | ||
|
|
73d3f6214e | ||
|
|
516975ef64 | ||
|
|
e9213dd2cc | ||
|
|
7b81584458 | ||
|
|
d0bcefa60c | ||
|
|
33dcb422c6 | ||
|
|
d0968e6e91 | ||
|
|
4f17c3c586 | ||
|
|
3f7f303e17 | ||
|
|
d5b13d7f31 | ||
|
|
353a7b03c4 | ||
|
|
0d6df6e6b8 | ||
|
|
7886906517 | ||
|
|
48ee0982c9 | ||
|
|
307468b671 | ||
|
|
fb507aa1f2 | ||
|
|
a9ca6a9a16 | ||
|
|
bb83b3476d | ||
|
|
f08b5e671f | ||
|
|
707fa8b5fc | ||
|
|
1abfe954cd | ||
|
|
0c9e041cd1 | ||
|
|
2564329e68 | ||
|
|
78637faffc | ||
|
|
778d3185e5 | ||
|
|
0899799e00 | ||
|
|
5c2b497a43 | ||
|
|
731629f5a3 | ||
|
|
a0aea3b9bf | ||
|
|
dd37883d3c | ||
|
|
430bcf2fc3 | ||
|
|
02421ae379 | ||
|
|
fd7cb541d3 | ||
|
|
dc6713e951 | ||
|
|
fbe7b2fb7c | ||
|
|
3ecbc17cfc | ||
|
|
c1c282b79c | ||
|
|
9cfcd8bb96 | ||
|
|
04a33246a1 | ||
|
|
73c2f507f4 | ||
|
|
b31a6141b3 | ||
|
|
6f95c34c0b | ||
|
|
653fd997a6 | ||
|
|
25cc5cfd68 | ||
|
|
6f9e40caa3 | ||
|
|
c21a365eca | ||
|
|
d50b8ba1be | ||
|
|
b920a303a4 | ||
|
|
e25828968b | ||
|
|
0f8a428f07 | ||
|
|
983020b625 | ||
|
|
e1ed27b438 | ||
|
|
71c12aedce | ||
|
|
36eac713f4 | ||
|
|
e682d16c3a | ||
|
|
b448bc3f71 | ||
|
|
8a8e8a03ff | ||
|
|
305ab2409b | ||
|
|
c986343a15 | ||
|
|
b2034f87e0 | ||
|
|
6d046f91c1 | ||
|
|
3361e97d5f | ||
|
|
442979b4db | ||
|
|
c5a3cdb757 | ||
|
|
a4fc46d849 | ||
|
|
65339ab54e | ||
|
|
ae766f7112 | ||
|
|
5f69ebaa90 | ||
|
|
9d0588dcad | ||
|
|
ae53fade13 | ||
|
|
358bed1962 | ||
|
|
7b652b2423 | ||
|
|
7482d95a42 | ||
|
|
55067652e4 | ||
|
|
b4eacf7526 | ||
|
|
0c64f821a4 | ||
|
|
914906efd4 | ||
|
|
55b0b34fc5 | ||
|
|
51690fa898 | ||
|
|
ddc4a1a6c4 | ||
|
|
11cbf1194f | ||
|
|
a9aa12e65d | ||
|
|
7afb5addde | ||
|
|
2b10b01c49 | ||
|
|
e18f7abe2b | ||
|
|
104f74632f | ||
|
|
452eaf32de | ||
|
|
3716b16555 | ||
|
|
ce393fa468 | ||
|
|
2ccd7d576e | ||
|
|
2469af70d0 | ||
|
|
850b66862f | ||
|
|
fd8f1da9f5 | ||
|
|
1573942673 | ||
|
|
8db7cee9d5 | ||
|
|
c6d5dc1cbc | ||
|
|
f520af8935 | ||
|
|
19db7d362f | ||
|
|
8c776309c9 | ||
|
|
8e1feffcad | ||
|
|
d58f06f0fa | ||
|
|
1318fc205c | ||
|
|
985db14249 | ||
|
|
f764d68c81 | ||
|
|
a0700ab370 | ||
|
|
36ad523662 | ||
|
|
d318911221 | ||
|
|
18e8ef45f0 | ||
|
|
21fe71d332 | ||
|
|
2b3c2a7529 | ||
|
|
dbcdb87081 | ||
|
|
0d62c3cfb8 | ||
|
|
96c5decf69 | ||
|
|
e4049a6183 | ||
|
|
733e4d1fe7 | ||
|
|
0f8fdbc30e | ||
|
|
e4538219b2 | ||
|
|
888c80381c | ||
|
|
bf5088f84c | ||
|
|
af406b44bf | ||
|
|
78c0f1811b | ||
|
|
0ddc6c3d62 | ||
|
|
43e226c59a | ||
|
|
93e692a40f | ||
|
|
33837697da | ||
|
|
b47af12c9d | ||
|
|
a3df5855a2 | ||
|
|
11e96a188b | ||
|
|
3a374faace | ||
|
|
fce24a64e8 | ||
|
|
d437faa501 | ||
|
|
26e49451ec | ||
|
|
e214480452 | ||
|
|
c414f6c7f6 | ||
|
|
decd419e94 | ||
|
|
1c47cb8570 | ||
|
|
ee7074a53d | ||
|
|
b97fc79af9 | ||
|
|
8e9fc72e19 | ||
|
|
d2cd1114ed | ||
|
|
c95a7baae4 | ||
|
|
f4372a84c0 | ||
|
|
e48498d089 | ||
|
|
531739454e | ||
|
|
b93de2ce24 | ||
|
|
a454f02355 | ||
|
|
580fcf6525 | ||
|
|
18f018befe | ||
|
|
ec9b3d721c | ||
|
|
84b76f49cc | ||
|
|
050d12b76c | ||
|
|
ec3e3b928a | ||
|
|
2be80324ad | ||
|
|
0fcd4ac4cb | ||
|
|
af0566db98 | ||
|
|
0b1b3d938f | ||
|
|
5167c79378 | ||
|
|
aedddc35b1 | ||
|
|
1cbdc479cf | ||
|
|
7821c6ad71 | ||
|
|
392314e1ae | ||
|
|
f3f1e3d588 | ||
|
|
3648ad70ef | ||
|
|
5399c9c0a6 | ||
|
|
54be33e006 | ||
|
|
1fa498c7d7 | ||
|
|
781333407e | ||
|
|
750e8a483e | ||
|
|
6a03f463bc | ||
|
|
46dc6ba086 | ||
|
|
e1efc18274 | ||
|
|
9660894a1b | ||
|
|
ba3772e3b8 | ||
|
|
b4692e6ec4 | ||
|
|
5731c5171b | ||
|
|
05de02ee60 | ||
|
|
87c3a3165e | ||
|
|
eec4677db1 | ||
|
|
2cf9853952 | ||
|
|
1aa8110ec8 | ||
|
|
a135252ae7 | ||
|
|
ed9d8c937d | ||
|
|
fc0e544c0a | ||
|
|
95cb6d2b9f | ||
|
|
53fad76759 | ||
|
|
8403956a9a | ||
|
|
185a919cc5 | ||
|
|
aceea293a3 | ||
|
|
a233c90324 | ||
|
|
f851aecf73 | ||
|
|
51202fc1c3 | ||
|
|
d930323479 | ||
|
|
6c53d2e74a | ||
|
|
724afb607c | ||
|
|
77bab1c4ea | ||
|
|
15fb58e36f | ||
|
|
4d4b9ba00a | ||
|
|
2abc48f0d8 | ||
|
|
3ea131e92c | ||
|
|
00d7a54829 | ||
|
|
9805383f9c | ||
|
|
1f263b9e46 | ||
|
|
b23cb45adc | ||
|
|
413f7afade | ||
|
|
af984eab37 | ||
|
|
cd3a657f9d | ||
|
|
fa5d0c22a9 | ||
|
|
5b4610441c | ||
|
|
20ae677092 | ||
|
|
69e9b78de9 | ||
|
|
d79e3f6f0a | ||
|
|
9dddf5d812 | ||
|
|
b77f2238dd | ||
|
|
c33caf636d | ||
|
|
aaf35c6505 | ||
|
|
b811b643e7 | ||
|
|
fbe73779c1 | ||
|
|
1e8e2c9a69 | ||
|
|
c750493b07 | ||
|
|
21bcb8a141 | ||
|
|
8fa9ac0253 | ||
|
|
c11b138a09 | ||
|
|
7ecb179a41 | ||
|
|
edce582a2d | ||
|
|
baba5e02d9 | ||
|
|
eeb90ace9a | ||
|
|
77c034a29a | ||
|
|
60ad6b8b0d | ||
|
|
864a220dbe | ||
|
|
6a7e9226db | ||
|
|
766658185f | ||
|
|
999d3a0e94 | ||
|
|
a24e6d2742 | ||
|
|
20fb16ded5 | ||
|
|
64665319a4 | ||
|
|
f1dcf329ff | ||
|
|
dd9a4dc4b8 | ||
|
|
76555de4b8 | ||
|
|
6301887093 | ||
|
|
0397b6ebb7 | ||
|
|
4c8240ea13 | ||
|
|
93d1cddd27 | ||
|
|
68ecaf9e81 | ||
|
|
cc64abcafe | ||
|
|
aecee19c19 | ||
|
|
fa7fd9097a | ||
|
|
c397e08565 | ||
|
|
99ddb5fc27 | ||
|
|
bf0adda45f | ||
|
|
64d54ab23e | ||
|
|
f1e03423f3 | ||
|
|
e67799812e | ||
|
|
19bd3088ef | ||
|
|
063508d1a3 | ||
|
|
508d412e43 | ||
|
|
aebef52345 | ||
|
|
f26410f94a | ||
|
|
038a759ff1 | ||
|
|
f7753be0e4 | ||
|
|
62c525e735 | ||
|
|
906e0d9a0e | ||
|
|
da8bfb0d4a | ||
|
|
b1cd555b0f | ||
|
|
932702f779 | ||
|
|
611a64c54a | ||
|
|
ca5a145107 | ||
|
|
23ac099475 | ||
|
|
749f103ea8 | ||
|
|
5304525e39 | ||
|
|
5c37d75dc4 | ||
|
|
1a274817cd | ||
|
|
7bf6101460 | ||
|
|
2bbf82121e | ||
|
|
59921a0181 | ||
|
|
dc5850c198 | ||
|
|
3e44e90ca5 | ||
|
|
eeda651626 | ||
|
|
1a2d58312d | ||
|
|
865bb0d6e0 | ||
|
|
7071ed32a6 | ||
|
|
7281d91fd6 | ||
|
|
4645e48a2c | ||
|
|
99c86e441c | ||
|
|
a0a13402f3 | ||
|
|
4029a0b27e | ||
|
|
103f144404 | ||
|
|
d27d344f43 | ||
|
|
118635aebd | ||
|
|
2a68d7e7c7 | ||
|
|
2aadffe183 | ||
|
|
a64af5bece | ||
|
|
3a7967f4cc | ||
|
|
263f3b0c7a | ||
|
|
cdbb9c42f6 | ||
|
|
ed1a6ee54e | ||
|
|
6e3756c587 | ||
|
|
00b957f904 | ||
|
|
04c2bc75ea | ||
|
|
7a609b2c76 | ||
|
|
987566c0e6 | ||
|
|
d5b7e98750 | ||
|
|
b110591433 | ||
|
|
2e052480c2 | ||
|
|
4758eb3215 | ||
|
|
50b2b6a7ca | ||
|
|
ce492f2794 | ||
|
|
925417abcb | ||
|
|
654e3290a4 | ||
|
|
b339f302d3 | ||
|
|
5076e5d789 | ||
|
|
f3e2e557d4 | ||
|
|
d3b32c8be3 | ||
|
|
1137e9a247 | ||
|
|
0e1b69a55b | ||
|
|
304d4f3fe5 | ||
|
|
99c175042a |
@@ -0,0 +1,56 @@
|
||||
---
|
||||
description: CUDA/C++ naming — macros, kernels, device helpers, module growth
|
||||
globs: src/**/*.cu,src/**/*.cuh,src/**/*.h
|
||||
---
|
||||
|
||||
# CUDA and GPU-side naming (CelerisLab)
|
||||
|
||||
## File banner and guards
|
||||
|
||||
- First line of each hand-written `.cu` / `.cuh`: `// CelerisLab – <path_under_lbm/kernels/>` (en-dash `–`), matching siblings (e.g. `operators/collision_srt.cuh`, `step/one_step_double.cu`).
|
||||
- Include guards: `CELERIS_<PATH_UPPER>_<STEM>_CUH` (match existing pattern, e.g. `CELERIS_OPERATORS_COLLISION_SRT_CUH`).
|
||||
- Auto-generated headers under `lbm/kernels/config/` must start with:
|
||||
`// AUTO-GENERATED by CelerisLab compiler – DO NOT EDIT MANUALLY`
|
||||
|
||||
## Module domains (plan for growth)
|
||||
|
||||
Keep names readable across domains. Today most GPU code lives under `lbm/kernels/`; future areas may add parallel trees (e.g. particles, deformable solids). Use consistent **semantic** prefixes in identifiers when ambiguity is likely:
|
||||
|
||||
| Domain | Scope (conceptual) | Identifier hint |
|
||||
|--------|-------------------|-----------------|
|
||||
| Orchestration | Host-side launch, thin wrappers | Already mostly Python; CUDA entry files stay thin |
|
||||
| Common | Shared numerics / helpers used by multiple domains | Prefer neutral names (`clamp01`, `dot3`) or `cel_*` only if truly project-global |
|
||||
| LBM | Lattice, collision, streaming, macroscopic | `collide_*`, `stream_*`, `macro_*`, step drivers `one_step_*` — keep physics meaning in the name |
|
||||
| Body / IBM | Immersed boundaries, rigid surfaces | `ibm_*`, `curved_*`, `cut_link_*` style names where they describe physics |
|
||||
| Future: flexible solids | Not present yet | Reserve `flex_*` or a dedicated subdirectory prefix when added |
|
||||
| Future: particles | Not present yet | Reserve `part_*` or `particle_*` under a dedicated subtree when added |
|
||||
|
||||
Do not rename working kernels for style alone in a mixed PR with behavior changes; batch renames in a dedicated change after audit.
|
||||
|
||||
## Config macros (`config_*.h`)
|
||||
|
||||
- Macros are compile-time switches and constants. Prefer **layer + clear token**:
|
||||
|
||||
- **Grid**: `NX`, `NY`, `NZ`, `DIM`, `NQ`, … (existing tier “Global/Grid”).
|
||||
- **Physics**: `VIS`, `RHO`, `U0`, … (existing).
|
||||
- **Method**: group by sub-area where possible — collision (`COLLISION_MODEL`, …), streaming (`STREAMING_MODEL`, …), LES (`USE_LES` / future `LES_*`), inlet/outlet (`INLET_*`, `OUTLET_*`), stability guards (`OMEGA_COLLISION_*`, `TRT_MAGIC_PARAM`, …).
|
||||
- **Objects / case**: `N_OBJS`, …
|
||||
|
||||
- When **adding** macros, pick names that won’t collide across layers and that encode the tier (document in `configs/CONFIG.md` and in compiler mapping).
|
||||
- Full normalization of legacy macro names is a **separate refactor** (compiler + all `#ifdef` / macro uses).
|
||||
|
||||
## Device functions and kernels
|
||||
|
||||
- Device helpers: `__device__ __forceinline__`; prefer small verbs (`compute_feq`, `apply_bc_wall`).
|
||||
- Pointer parameters that are not aliased: use `__restrict__` where appropriate.
|
||||
- Kernel entry points (`__global__`): name should state **what step** and **which path** (e.g. `step_lbm_double_buffer`), not only `kernel_launch`.
|
||||
|
||||
## Flags and constants
|
||||
|
||||
- Cell flags live in `core/flags.cuh`: keep `FLAG_*`, `MASK_*`, and helpers (`is_fluid`, …). Do not change bit layout without a versioned migration plan.
|
||||
- Python flag constants in `lbm/descriptors.py` must stay consistent with GPU flags; any change updates both sides and user docs.
|
||||
|
||||
## Section comments
|
||||
|
||||
- File-level title: `// ==== Title ====` or equivalent single banner.
|
||||
- Subsections: `// --- Section ---` or aligned `// -----` blocks — pick one style **within a file** and match neighbors.
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
description: Layout, forbidden paths, doc sync across README / CONFIG / code
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Project layout and documentation discipline (CelerisLab)
|
||||
|
||||
## Source tree (authoritative roles)
|
||||
|
||||
- [`src/CelerisLab/simulation.py`](src/CelerisLab/simulation.py): Top-level orchestration API (`Simulation`).
|
||||
- [`src/CelerisLab/config.py`](src/CelerisLab/config.py): `LBMConfig` / `BodyConfig`, load/validate JSON.
|
||||
- [`src/CelerisLab/configs/`](src/CelerisLab/configs/): JSON defaults and [`CONFIG.md`](src/CelerisLab/configs/CONFIG.md) (human-oriented parameter reference).
|
||||
- [`src/CelerisLab/cuda/`](src/CelerisLab/cuda/): CUDA context, compile pipeline, **generation** of `lbm/kernels/config/*.h`.
|
||||
- [`src/CelerisLab/lbm/`](src/CelerisLab/lbm/): Python field/stepper; [`lbm/kernels/`](src/CelerisLab/lbm/kernels/) holds `.cu` / `.cuh` implementation.
|
||||
- [`src/CelerisLab/body/`](src/CelerisLab/body/): Rigid-style objects, `ObjectManager`, GPU sync for IBM/sensors.
|
||||
- [`src/CelerisLab/common/`](src/CelerisLab/common/): Shared host utilities (checkpoint, preprocess, …).
|
||||
|
||||
Future domains (flexible solids, particles, etc.) should get **new packages** under `src/CelerisLab/` (e.g. `flex/`, `particle/`) and, if they need GPU code, sibling trees under a clear namespace — not ad-hoc files at repo root.
|
||||
|
||||
## Do not edit by hand
|
||||
|
||||
- `src/CelerisLab/lbm/kernels/config/*.h` — generated by the compiler from `LBMConfig`; change [`cuda/compiler_v2.py`](src/CelerisLab/cuda/compiler_v2.py) and JSON/schema instead.
|
||||
- `**/*.ptx` — build artifact.
|
||||
|
||||
## Low-value context for agents
|
||||
|
||||
- [`legacy/`](legacy/): superseded; do not extend.
|
||||
- [`ref/`](ref/): external reference trees; not part of the shipping package.
|
||||
|
||||
(Also listed in [`.cursorignore`](.cursorignore) to save indexing cost.)
|
||||
|
||||
## Configuration and documentation sync (critical)
|
||||
|
||||
Agents often update one layer and leave others stale. After changing **any** of the following, reconcile **all** that apply in the same task or an immediately following doc-only commit:
|
||||
|
||||
1. **JSON keys or shape** in `configs/config_lbm.json` / `config_body.json`
|
||||
2. **Fields or validation** in `config.py`
|
||||
3. **Generated macro names or tiers** in `compiler_v2.py` → `kernels/config/*.h`
|
||||
4. **[`configs/CONFIG.md`](src/CelerisLab/configs/CONFIG.md)** — tables and “config → code” diagram
|
||||
5. **[`README.md`](README.md)** — Quick Start JSON example, API bullets, Project Layout if paths change
|
||||
6. **Docstrings** on `Simulation` and other public entry points if behavior or parameters change
|
||||
|
||||
Goal: one mental model — README example, CONFIG.md, and actual loader agree.
|
||||
|
||||
## Tests
|
||||
|
||||
- Behavioral changes should touch or add coverage under [`tests/`](tests/) when feasible.
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
description: Python style for CelerisLab — path header, docstrings, English comments
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Python style (CelerisLab)
|
||||
|
||||
## File header
|
||||
|
||||
- Every `src/CelerisLab/**/*.py` file starts with a single-line path comment so agents can orient without reading the body:
|
||||
- Format: `# CelerisLab/<path_under_package>` (e.g. `# CelerisLab/simulation.py`).
|
||||
- Match the real path under `CelerisLab/` after edits or moves.
|
||||
|
||||
## Language
|
||||
|
||||
- All comments and docstrings in Python source are **English**. User-facing prose in `configs/CONFIG.md` may stay Chinese if that file is explicitly maintained for Chinese readers.
|
||||
|
||||
## Docstrings and structure
|
||||
|
||||
- Module docstring: one-line summary plus at least one structured block where useful (`Usage::`, `Responsibilities:`, `Design:`).
|
||||
- Public classes and public functions/methods should have a docstring that states purpose; use Google-style sections (`Args:`, `Returns:`, `Raises:`) when parameters or return value are non-obvious.
|
||||
- Section dividers in long files: `# -- Section name ---------------------------------------` (consistent with existing files like `simulation.py`).
|
||||
|
||||
## Types
|
||||
|
||||
- Prefer type hints on public APIs (`Simulation`, `ObjectManager`, `LBMField`, config loaders). Completeness can improve incrementally; do not block features on perfect annotation coverage.
|
||||
|
||||
## Imports
|
||||
|
||||
- Avoid obvious dead imports when touching a file, but **do not** run broad “import cleanup only” refactors as a standalone task unless asked.
|
||||
|
||||
## Placeholders
|
||||
|
||||
- Stub methods: `pass` plus a short docstring; mark intent with `(placeholder)` or `(future)` where appropriate.
|
||||
@@ -0,0 +1,10 @@
|
||||
# Cursor indexing / context — keep noise out of agent view
|
||||
# (Independent of .gitignore; ref/legacy are huge or obsolete.)
|
||||
|
||||
# ref/
|
||||
legacy/
|
||||
output/*.pdf
|
||||
**/*.ptx
|
||||
**/__pycache__/
|
||||
.git/
|
||||
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# CUDA compilation outputs
|
||||
*.ptx
|
||||
*.cubin
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.github/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# PyCharm
|
||||
.idea/
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
.pytest_cache/
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# MacOS
|
||||
.DS_Store
|
||||
|
||||
# Temporary files
|
||||
*.tmp
|
||||
*.bak
|
||||
*.log
|
||||
|
||||
# reference:
|
||||
ref/
|
||||
output/
|
||||
|
||||
legacy/
|
||||
@@ -0,0 +1,85 @@
|
||||
Jet / fixed-patch review baseline — 2026-10-15
|
||||
|
||||
Base main: 6e3756c587ec08ab6a55c4a1a5f4671822d3f0a0
|
||||
Branch: baseline/jet-amr-20261014
|
||||
Publication target: Gitea Frank14f/CelerisLab only. This baseline does not
|
||||
advance main, publish to GitHub, or add new solver behavior.
|
||||
|
||||
Scope
|
||||
The approved inventory contributes 43 previously tracked modifications and
|
||||
282 new files: D2 correctness/build/state repairs; planar slot/reservoir jet;
|
||||
static-circle surface actuation; one fixed 2:1 refinement patch; fine-interior
|
||||
circle integration; tests, examples and small historical validation records.
|
||||
Three reviewed repair logs are additionally retained: final-unit.log,
|
||||
final-gpu.log and simplification-checks.log. This explanation is the only new
|
||||
project document. Total: 329 changed/added paths relative to base main.
|
||||
|
||||
Implementation: ed1a6ee54e07a5efbdc3f1880fde4cc357b10d7c (41 files)
|
||||
Tests/examples: cdbb9c42f6bfc65ec319313fb4e16cdc04dfdb95 (48 files)
|
||||
Historical evidence: 263f3b0c7addce7bacbb068f75ea707cf20b6810 (239 files)
|
||||
Historical source snapshots are evidence, not alternative runtime modules.
|
||||
|
||||
Explicit exclusions
|
||||
The user's local changes to src/CelerisLab/lbm/kernels/config/config_grid.h,
|
||||
config_method.h, config_objects.h, config_physics.h and
|
||||
tests/postproc/experiment.ipynb are not included. Their already committed
|
||||
base-main versions remain in the tree. Their five original-user-files backups
|
||||
are excluded. Also excluded: the six pre-existing docs/design files,
|
||||
docs/multilevel_grid_architecture_analysis.md, tests/audit/body删减功能.md,
|
||||
tests/validation/multigrid/MULTIGRID_VERIFICATION_STRATEGY.md, the twenty files
|
||||
under research/audit-2026-10-09 and research/design-2026-10-09,
|
||||
research/j3-lag-2026-10-12/trajectory.h5, caches and the other twenty-two ignored
|
||||
historical output files. These exclusions preserve local originals; they are
|
||||
not deletions from the working copy. Historical manifests/reports can reference
|
||||
excluded material. In particular analyze_j3_saved_frames.py needs the omitted
|
||||
17.2 MB trajectory, and historical example images/summaries are not all bundled.
|
||||
This is a selected review baseline, not a self-contained archival data package.
|
||||
|
||||
Fresh clean-checkout checks
|
||||
Detached checkout of 263f3b0c7addce7bacbb068f75ea707cf20b6810 was clean before
|
||||
and after both successful batches. Its four generated config headers and
|
||||
experiment notebook were byte-equal to base main; excluded untracked files
|
||||
were absent. Existing pycuda_3_10 interpreter; PYTHONPATH explicitly selected
|
||||
the clean checkout's src, which was asserted at startup. CUDA_VISIBLE_DEVICES
|
||||
was empty. No CUDA context/GPU simulation or new CFD trajectory was requested.
|
||||
|
||||
pytest selection 1 (tests/unit): test_refinement.py, test_fine_surface.py.
|
||||
Result: 24 passed, 23 subtests passed, exit 0; pytest time 0.75 seconds.
|
||||
pytest selection 2 (tests/unit): test_build_contracts.py,
|
||||
test_context_ownership.py, test_initializers.py, test_simulation_lifecycle.py,
|
||||
test_state_regressions.py, test_surface_actuation.py, test_planar_velocity.py,
|
||||
test_slot_velocity.py, test_reservoir.py.
|
||||
Result: 152 passed, 13 subtests passed, exit 0; pytest time 5.06 seconds.
|
||||
Both used -q -p no:cacheprovider, PYTHONNOUSERSITE=1,
|
||||
PYTHONDONTWRITEBYTECODE=1, PYTEST_DISABLE_PLUGIN_AUTOLOAD=1,
|
||||
OPENBLAS_NUM_THREADS=1 and OMP_NUM_THREADS=1. Boundary-header tests use the
|
||||
existing C++ compiler; compilation-contract tests mock the CUDA compiler.
|
||||
|
||||
The first host-contract batch was interrupted when the temporary monitoring
|
||||
script raced a removed private build directory. Its test exit is unknown;
|
||||
it is not counted as a pass. Only the monitor was corrected and that batch
|
||||
rerun; the initial geometry batch was not repeated. Project code and test
|
||||
criteria were unchanged. The final documentation-only commit does not alter
|
||||
the tested implementation, tests, configuration or historical evidence.
|
||||
|
||||
Historical limits retained
|
||||
- J3 positive/negative full velocity steady-state criteria did not pass.
|
||||
- The local-stress implementation README records Claude's review as incomplete;
|
||||
numerical execution is not a substitute for that implementation review.
|
||||
- repair provenance.json retains earlier 124/66 totals; final logs record
|
||||
130 unit +13 subtests and 74 GPU tests. simplification-checks.log describes
|
||||
an earlier phase with known XFAILs, not a new result on this baseline.
|
||||
- The 24-coarse-step joint run demonstrates startup disturbances crossing the
|
||||
interface, potentially acoustic. It does not establish a developed jet,
|
||||
physical accuracy, convergence order or long-term stability. Raw FP32 mass
|
||||
residuals remain nonzero despite the independently measured rounding ledger.
|
||||
- Fixed-patch support is not dynamic/block-level AMR, moving rigid bodies,
|
||||
complete 3D or multi-GPU support. Historical full suites were not rerun here.
|
||||
|
||||
Publication screening
|
||||
Approved candidate bytes and the three logs were checked for common embedded
|
||||
credential/private-key patterns and unrelated private-location indicators;
|
||||
unchanged tracked blobs and staged content were also checked. No findings were
|
||||
detected. This bounded check is not a general security audit. Excluded files
|
||||
were hash-protected. No credentials, accounts, environments or remotes were
|
||||
modified by the baseline preparation.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Frank14f
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,720 @@
|
||||
# CelerisLab
|
||||
|
||||
**GPU-Accelerated Lattice Boltzmann Method (LBM) CFD Solver**
|
||||
|
||||
CelerisLab is a high-performance computational fluid dynamics solver based on the Lattice Boltzmann Method, leveraging NVIDIA CUDA for GPU acceleration. It provides a Python API for scripting, real-time control loop integration, and scientific workflow automation.
|
||||
|
||||
## Features
|
||||
|
||||
- **GPU Acceleration**: CUDA kernels for high-performance simulation (384x192 D2Q9: ~4400 MLUPS on V100)
|
||||
- **D2Q9 / D3Q19 Lattice**: 2D and 3D lattice implementations
|
||||
- **Multiple Collision Models**: SRT, TRT, and MRT operators; Smagorinsky LES subgrid model
|
||||
- **Dual Streaming Paths**: Standard double-buffer pull and memory-efficient esoteric-pull (EsoPull). EsoPull is verified as numerically equivalent to double-buffer for D2Q9 curved-boundary MRT (Kan99b K2 validation).
|
||||
- **Curved Boundary Bouzidi**: Immersed boundary support for complex geometries with wall velocity control
|
||||
- **Flexible Boundary Conditions**: NEQ-extrapolation pressure outlet, parabolic/uniform velocity inlet, half-way bounce-back walls
|
||||
- **Rotating Body Control**: Real-time setting of body rotation speeds via `sim.set_body()`
|
||||
- **Force / Torque / Sensor Readback**: On-demand force, torque, and area-averaged sensor velocity
|
||||
- **Physics Validated**: Strouhal numbers match Sah04 (confined cylinder) and Kan99b (rotating cylinder) references
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Single cylinder
|
||||
|
||||
```python
|
||||
from CelerisLab import Simulation
|
||||
|
||||
sim = Simulation()
|
||||
sim.add_body("circle", center=(50, 50), radius=10)
|
||||
sim.initialize()
|
||||
|
||||
for step in range(10000):
|
||||
sim.run(1)
|
||||
|
||||
macro = sim.get_macroscopic() # {"rho": ..., "ux": ..., "uy": ...}
|
||||
force = sim.read_force(0) # [fx, fy] on body 0
|
||||
sim.close()
|
||||
```
|
||||
|
||||
### DRL control loop
|
||||
|
||||
```python
|
||||
from CelerisLab import Simulation
|
||||
|
||||
sim = Simulation()
|
||||
sim.add_body("circle", center=(256, 128), radius=10)
|
||||
sim.add_body("sensor", center=(300, 128), radius=10)
|
||||
sim.initialize()
|
||||
|
||||
for episode in range(100):
|
||||
# Step the simulation (auto uploads action, downloads obs)
|
||||
sim.run(100)
|
||||
|
||||
# Read individual body telemetry (primary API)
|
||||
data = sim.read_body(0)
|
||||
print(f"step={sim.stepper.step_count} "
|
||||
f"force=({data.force[0]:.4f},{data.force[1]:.4f}) "
|
||||
f"sensor=({data.sensor[0]:.4f},{data.sensor[1]:.4f})")
|
||||
|
||||
# DRL policy inference (replace with your model)
|
||||
action_omega = 0.001 * (0.5 - data.force[0])
|
||||
|
||||
# Set action (host-only, will be auto-uploaded next run)
|
||||
sim.set_body(0, omega=action_omega)
|
||||
|
||||
sim.close()
|
||||
```
|
||||
|
||||
### Async control (performance-oriented, custom stream)
|
||||
|
||||
```python
|
||||
import pycuda.driver as cuda
|
||||
|
||||
stream = cuda.Stream()
|
||||
sim.set_body(0, omega=0.002) # host-only
|
||||
sim.run(100, stream=stream) # action uploaded, steps run, obs downloaded on stream
|
||||
# stream is synced inside run() -- obs is ready
|
||||
data = sim.read_body(0)
|
||||
```
|
||||
|
||||
### Manual stream control (max overlap)
|
||||
|
||||
```python
|
||||
import pycuda.driver as cuda
|
||||
|
||||
stream = cuda.Stream()
|
||||
# Skip transfers for the first batch, just enqueue kernels
|
||||
sim.run(100, stream=stream, upload_act=False, sync_obs=False)
|
||||
|
||||
# ... other GPU work can overlap with the kernel launches ...
|
||||
|
||||
# Later: sync and read
|
||||
stream.synchronize()
|
||||
obs = sim.read_bodies(stream=stream) # sync already done, just read pinned buffer
|
||||
```
|
||||
|
||||
### Fixed 2:1 refinement patch (experimental backend)
|
||||
|
||||
`FixedPatchStepper` advances one fixed 2:1 refinement patch inside a coarse
|
||||
grid, optionally with stationary circles in the fine region and a prescribed
|
||||
normal surface velocity (blowing/suction). It is a standalone backend, not part
|
||||
of `Simulation`. Runnable demo (blocked fine storage; omit `--fine-block`
|
||||
for dense): `PYTHONPATH="$PWD/src" python examples/fixed_patch_circle.py --fine-block 16 20`.
|
||||
|
||||
```python
|
||||
import numpy as np
|
||||
from CelerisLab.body.geometry.circle import CircleGeometry
|
||||
from CelerisLab.body.objects import SimObject, SurfaceActuation
|
||||
from CelerisLab.config import LBMConfig
|
||||
from CelerisLab.cuda.context import CudaContext
|
||||
from CelerisLab.lbm.equilibrium import compute_feq_d2q9
|
||||
from CelerisLab.lbm.refinement_stepper import FixedPatchStepper
|
||||
|
||||
cfg = LBMConfig(nx=32, ny=24, viscosity=.1)
|
||||
body = SimObject(0, geometry=CircleGeometry(16.0, 12.0, 2.15), center=(16.0, 12.0), radius=2.15,
|
||||
surface_actuation=SurfaceActuation(0.7, 0.85, 0.002)) # angle, half-width, speed
|
||||
with CudaContext(0) as ctx, FixedPatchStepper(cfg, context=ctx, refinements=[(8, 6, 24, 18)],
|
||||
level_blocks=[None, (16, 20)],
|
||||
level_objects=[(), (body,)]) as run:
|
||||
rest = np.asarray(compute_feq_d2q9(1.0, 0.0, 0.0), np.float32)[:, None, None]
|
||||
# (9, ny, nx) postcollision populations per level; non-leaf cells are discarded.
|
||||
run.initialize(np.broadcast_to(rest, (9, *run.hierarchy.pairs[0].coarse_shape)),
|
||||
np.broadcast_to(rest, (9, *run.hierarchy.pairs[0].fine_shape)))
|
||||
run.step(128) # coarse steps; fine level takes two per step
|
||||
coarse_g, fine_g = run.download() # NaN on covered, ghost and solid cells
|
||||
```
|
||||
|
||||
Scope and limits:
|
||||
- The examples below use D2Q9, SRT, FP32, double buffer, unshifted, no LES or
|
||||
forcing. Fixed 2:1 hierarchies use level lists of arbitrary depth; two- and
|
||||
three-level examples below use that same constructor.
|
||||
- `coarse_boundary="periodic"` (default) or `"slot_reservoir"` (bottom slot, top
|
||||
reservoir; patch needs `y0 >= 4`, `y1 <= ny-4`). Periodic mode ignores the wall/slot config fields.
|
||||
- Object centers/radii use the coarse **cell-edge** frame (cell `I` spans `[I, I+1)`),
|
||||
unlike `Simulation`'s integer-node frame. Surface speeds are in coarse lattice units.
|
||||
- Bodies must be stationary circles whose whole boundary stencil lies in the fine
|
||||
active region, clear of the coarse/fine transfer cells; violations are rejected
|
||||
before any GPU allocation.
|
||||
- `level_blocks=[None, (by, bx)]` stores the fine level in fixed-size blocks; `by`/`bx` must
|
||||
divide the WHOLE fine allocation, i.e. `2*(y1-y0)+8` by `2*(x1-x0)+8` including the
|
||||
four-cell ghost band. It gives results identical to dense storage and is
|
||||
infrastructure for future block AMR, not a speedup.
|
||||
- Several regions: pass a sequence of `(x0, y0, x1, y1)` rectangles as
|
||||
`refinements[0]`, with both levels blocked (`level_blocks`). Transfers are built once
|
||||
from their union; adjacent, overlapping and concave unions are accepted when
|
||||
their actual dependencies close. There is no fixed rectangle-gap rule.
|
||||
The fine level is then one level-wide grid `(2*ny, 2*nx)`:
|
||||
`run.hierarchy.pairs[0].fine_shape` gives it, `initialize`/`download` use it, and only the
|
||||
grid-aligned tiles intersecting the union plus its four-cell ghost band are stored.
|
||||
Block sizes must divide the level-wide grid; rectangle edges need not align
|
||||
with tiles. Order of rectangles does not matter. L1 bodies/Jets (`level_objects[1]`/`level_jets[1]`) work
|
||||
as for one patch: each circle (same coarse cell-edge frame) must lie wholly
|
||||
inside the union's active region with
|
||||
its boundary stencil clear of transfer cells; a jet may not select links of two
|
||||
different bodies, even across regions. Wall-touching patches remain unsupported.
|
||||
For nesting, add further `refinements` entries as shown below.
|
||||
|
||||
```python
|
||||
cfg = LBMConfig(nx=32, ny=16, viscosity=.1)
|
||||
rest = np.asarray(compute_feq_d2q9(1.0, 0.0, 0.0), np.float32)[:, None, None]
|
||||
with CudaContext(0) as ctx, FixedPatchStepper(
|
||||
cfg, context=ctx, refinements=[((4, 4, 12, 12), (16, 4, 24, 12))],
|
||||
level_blocks=[(4, 4), (4, 4)]) as run:
|
||||
run.initialize(np.broadcast_to(rest, (9, *run.hierarchy.pairs[0].coarse_shape)),
|
||||
np.broadcast_to(rest, (9, *run.hierarchy.pairs[0].fine_shape))) # (9, 32, 64)
|
||||
run.step(32)
|
||||
coarse_g, fine_g = run.download() # coarse: NaN on every covered cell;
|
||||
# fine: NaN on every non-ACTIVE cell
|
||||
```
|
||||
- Three-level nested windows: pass two scalar rectangles in `refinements` —
|
||||
L1 in L0 cells, L2 in **L1 window cells** (the parent's fine grid including its
|
||||
4-cell ghost band) — plus all three `level_blocks` entries. L2 must sit inside
|
||||
L1's ACTIVE cells, away from L1's ghost band and transfer footprint (checked
|
||||
before any GPU allocation). `initialize` and `download` take/return three
|
||||
arrays; each level is NaN on its non-ACTIVE (and child-covered) cells. One
|
||||
coarse step = 2 L1 steps = 4 L2 steps. One L1 window only in this scalar
|
||||
chain. Optional stationary circles and Jets live on L2 via `level_objects[2]`
|
||||
and `level_jets[2]`; L1 bodies/Jets retain their L1 meaning and must be empty
|
||||
in this mode. All object and Jet geometry uses the **L0 edge frame**, not the
|
||||
child bounds' L1 window frame. L2 has dx=dt=0.25, so prescribed lattice
|
||||
velocity is unchanged. Each whole body and its BFL stencil must be inside L2
|
||||
ACTIVE cells, outside the transfer footprint. A Jet may select one physical
|
||||
body across multiple blocks, never two bodies.
|
||||
|
||||
```python
|
||||
from CelerisLab.body.geometry.circle import CircleGeometry
|
||||
from CelerisLab.body.objects import SimObject
|
||||
from CelerisLab.body.jets import Jet, Tube, Parallel
|
||||
|
||||
cfg = LBMConfig(nx=16, ny=16, viscosity=.1)
|
||||
body = SimObject(0, geometry=CircleGeometry(8., 8., .8), center=(8., 8.), radius=.8)
|
||||
jet = Jet(Tube((6.5, 8.), 0., 3., .3), Parallel(0.), amplitude=.002)
|
||||
rest = np.asarray(compute_feq_d2q9(1.0, 0.0, 0.0), np.float32)[:, None, None]
|
||||
with CudaContext(0) as ctx, FixedPatchStepper(
|
||||
cfg, context=ctx, refinements=[(4, 4, 12, 12), (8, 8, 16, 16)],
|
||||
level_blocks=[(4, 4)] * 3, level_objects=[(), (), (body,)],
|
||||
level_jets=[(), (), (jet,)]) as run:
|
||||
shapes = (run.hierarchy.pairs[0].coarse_shape, run.hierarchy.pairs[0].fine_shape, run.hierarchy.pairs[1].fine_shape)
|
||||
run.initialize(*(np.broadcast_to(rest, (9, *s)) for s in shapes)) # 16², 24², 24²
|
||||
run.step(4)
|
||||
run.set_jet_amplitude(0, -.002, level=2) # explicit level selects the driven level
|
||||
run.step(4)
|
||||
coarse_g, l1_g, l2_g = run.download() # solids/covered/nonleaves are NaN
|
||||
```
|
||||
- Level lists (the only constructor): `refinements[l]` describes level `l+1`
|
||||
in allocated level-`l` integer cells; use a rectangle list for a union, or a
|
||||
scalar rectangle for a single window (a scalar child requires a scalar
|
||||
parent). `level_blocks`, `level_objects` and `level_jets` each have one entry
|
||||
per level, including L0. Three or more levels require all-blocked storage and
|
||||
bodies/Jets only on the finest level. Every adjacent pair must preserve
|
||||
inherited ACTIVE coverage, valid donors/receivers, surviving pulls and the
|
||||
upstream transfer footprint. Level `l` takes `2**l` steps per base interval.
|
||||
This describes implemented topology and scheduling, not accuracy or
|
||||
convergence qualification.
|
||||
- Blocked body levels can enable `observe_raw_exchange=True` and call
|
||||
`read_raw_exchange(body_id, level=...)` after a completed base interval.
|
||||
It reduces unique cut-link observations into wall/aperture/total force,
|
||||
torque and mass exchange in base-lattice units per unit depth, for the last
|
||||
base interval (default) or `window="last_substep"`.
|
||||
`observe_window_exchange=True`, alongside `observe_raw_exchange=True`, enables
|
||||
`start_exchange_window()` / `read_exchange_window(body_id, level=...)` across
|
||||
completed base intervals. These are raw boundary-reaction diagnostics, not a general
|
||||
stress or nozzle-load accuracy claim; dense body layouts are unsupported.
|
||||
- Not available: checkpoints, moving bodies, L1 bodies/Jets in a three-level
|
||||
chain, automatic dynamic refinement, `Simulation` integration. Qualification
|
||||
depends on the tested configuration; see [the validation scope](docs/validation/2d_scope.md).
|
||||
CPU topology/schedule tests alone do not establish GPU numerical correctness,
|
||||
general convergence or long-time stability.
|
||||
|
||||
## Installation
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Python 3.8+
|
||||
- NVIDIA GPU with CUDA Compute Capability 6.0+
|
||||
- CUDA Toolkit 11.0+
|
||||
- NVIDIA drivers
|
||||
|
||||
### Install from source
|
||||
|
||||
```bash
|
||||
git clone <repository_url>
|
||||
cd CelerisLab
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
### Dependencies
|
||||
|
||||
- `pycuda>=2020.1` — CUDA Python bindings
|
||||
- `numpy>=1.19.0` — numerical computing
|
||||
- `scipy>=1.5.0` — special functions for vortex initialization
|
||||
|
||||
## API Reference
|
||||
|
||||
### Simulation
|
||||
|
||||
```python
|
||||
sim = Simulation(
|
||||
lbm_config_path: Optional[str] = None, # path to config JSON
|
||||
body_config_path: Optional[str] = None, # path to body config JSON
|
||||
device_id: int = 0, # GPU device index
|
||||
)
|
||||
```
|
||||
|
||||
#### Body creation
|
||||
|
||||
| Method | Returns | Description |
|
||||
|--------|---------|-------------|
|
||||
| `sim.add_body(type="circle", center=(x,y), radius=r)` | int body_id | Add a cylinder body (primary API) |
|
||||
| `sim.add_body(type="sensor", center=(x,y), radius=r)` | int body_id | Add a velocity sensor |
|
||||
| `sim.add_body(type="force_region", center=(x,y), radius=r)` | int body_id | Add a force application region |
|
||||
| `sim.add_cylinder(center, radius)` | int body_id | Convenience wrapper (deprecated) |
|
||||
| `sim.add_sensor(center, radius)` | int body_id | Convenience wrapper (deprecated) |
|
||||
| `sim.add_object(obj)` | int body_id | Add pre-configured SimObject |
|
||||
|
||||
Future geometry types (polygon, mesh) will use the same `add_body()` function with a different `type` parameter.
|
||||
|
||||
#### Runtime control
|
||||
|
||||
| Method | Description |
|
||||
|--------|-------------|
|
||||
| `sim.initialize()` | Recompile if needed, flow field + sync objects to GPU |
|
||||
| `sim.run(steps, *, upload_act=True, sync_obs=True, zero_obs=True, stream=None)` | Run N LBM steps. See stream subsection below. |
|
||||
| `sim.set_body(id, omega=...)` | Set body rotation speed (host array only, uploaded at next `run()`) |
|
||||
| `sim.read_body(id, *, normalize=True)` -> BodyTelemetry | Unified telemetry: {force, torque, sensor} from pinned buffer |
|
||||
| `sim.read_bodies()` -> ndarray | Flat array of all bodies' telemetry (batch DRL read) |
|
||||
| `sim.read_force(id, *, normalize=True)` -> ndarray | Force vector [fx, fy] |
|
||||
| `sim.read_torque(id, *, normalize=True)` -> ndarray | Torque [tz] |
|
||||
| `sim.read_sensor(id, *, normalize=True)` -> ndarray | Area-averaged velocity; time-normalised when normalize=True |
|
||||
| `sim.set_force(id, fx=..., fy=...)` | Set force density on a force_region object |
|
||||
|
||||
**Action/obs transfer model:** `set_body()` / `set_force()` are host-only — they modify
|
||||
the host action array without triggering GPU upload. The GPU buffer is automatically
|
||||
updated at the start of the next ``run()`` call when ``upload_act=True`` (the default).
|
||||
|
||||
**Obs telemetry model:** GPU kernels accumulate force, torque, and sensor readings into
|
||||
the ``obs_gpu`` buffer via ``atomicAdd``. By default, ``run(zero_obs=True)`` clears the
|
||||
entire ``obs_gpu`` buffer (all three segments) and resets an internal step counter before
|
||||
stepping. After the step group, telemetry is downloaded to a pinned host buffer when
|
||||
``sync_obs=True``.
|
||||
|
||||
All three readback methods accept a ``normalize`` keyword:
|
||||
- ``normalize=True`` (default): divides the raw GPU value by the accumulated step count,
|
||||
yielding a **per-step average** — the physically meaningful quantity for most use cases.
|
||||
- ``normalize=False``: returns the raw GPU-accumulated sum (no time division).
|
||||
|
||||
**Sensor special handling:** Area-normalisation (dividing by the number of sensor cells)
|
||||
is **always applied internally** in ``read_sensor()``, regardless of the ``normalize`` flag.
|
||||
The ``normalize`` parameter only controls the additional time-normalisation step.
|
||||
|
||||
``run()`` parameters:
|
||||
- ``steps``: Number of LBM steps.
|
||||
- ``upload_act`` (default True): Upload host action array to ``action_gpu`` before stepping.
|
||||
- ``sync_obs`` (default True): Download ``obs_gpu`` to host pinned buffer after stepping.
|
||||
- ``zero_obs`` (default True): Zero all obs segments (force, torque, sensor) on GPU and
|
||||
reset the step accumulator before the step group. Set ``False`` to accumulate
|
||||
telemetry across multiple ``run()`` calls.
|
||||
- ``stream`` (default None): CUDA stream for all operations. ``None`` uses an internal stream.
|
||||
- ``checkpoint_interval`` (default 0): If >0, save an HDF5 checkpoint every N steps.
|
||||
|
||||
Use ``upload_act=False, sync_obs=False`` to skip all transfers and enqueue pure
|
||||
kernel launches on a user-provided stream, then sync and read later.
|
||||
|
||||
#### Runtime body topology sync
|
||||
|
||||
| Method | Description |
|
||||
|--------|-------------|
|
||||
| `sim.remove_body(id)` | Stage a body for removal (committed at next `sync_bodies()`) |
|
||||
| `sim.sync_bodies()` | Commit pending add/remove edits: recompile kernel, rebuild flags/compact lists, patch DDF, re-upload to GPU |
|
||||
|
||||
`sync_bodies()` applies all staged body edits (added via `add_body()` and removed via `remove_body()`) to a running simulation without full reinitialization. The GPU flow field is preserved; only the body-related topology is rebuilt.
|
||||
|
||||
**Limitations:**
|
||||
- Abrupt body introduction causes a transient; force readback is finite but may take 50+ steps to settle
|
||||
- Verified for `"circle"` type bodies; sensors and force_regions are also expected to work
|
||||
(they produce no curved links so the DDF patch is simpler)
|
||||
|
||||
```python
|
||||
# Add a body to an already-initialized simulation
|
||||
sim = Simulation()
|
||||
sim.initialize()
|
||||
sim.run(500)
|
||||
sim.add_body("circle", center=(256, 128), radius=10)
|
||||
sim.sync_bodies() # recompile + patch
|
||||
sim.run(500)
|
||||
force = sim.read_force(0)
|
||||
|
||||
# Remove the same body at runtime
|
||||
sim.remove_body(0)
|
||||
sim.sync_bodies() # recompile + patch flags/DDF
|
||||
sim.run(500)
|
||||
```
|
||||
|
||||
**Note:** If `run()` is called without a preceding `sync_bodies()`, any staged edits are silently discarded.
|
||||
|
||||
### force_region usage
|
||||
|
||||
```python
|
||||
# Create a circular force application region
|
||||
fr_id = sim.add_body("force_region", center=(50, 50), radius=15)
|
||||
|
||||
# Set force density (lattice units, implicit GPU upload)
|
||||
sim.set_force(fr_id, fx=0.001, fy=0.0)
|
||||
|
||||
# The region applies Guo forcing on each step. Zero force = no-op.
|
||||
sim.set_force(fr_id, fx=0.0, fy=0.0) # disable force
|
||||
```
|
||||
|
||||
**Persistence note:** `set_force()` only updates the host action array. The GPU
|
||||
buffer is synced at the next `run()` call. If `sync_to_gpu()` is called manually
|
||||
before `run()`, the force will be reset to zero. For the common usage pattern
|
||||
(initialize -> set_force -> run -> set_force -> run ...), this is not an issue.
|
||||
|
||||
### Comparison: body types
|
||||
|
||||
| Type | Flag overlay | Produces cut-links | Readback | Runtime control |
|
||||
|------|-------------|-------------------|----------|-----------------|
|
||||
| `"circle"` | OBSTACLE + BC_CURVED | Yes (Bouzidi) | force/torque | `set_body(id, omega=...)` |
|
||||
| `"sensor"` | FLUID + SENSOR_FLAG | No | area-averaged velocity (always); optional per-step average | None needed |
|
||||
| `"force_region"` | FLUID + FRC_REGION | No | None | `set_force(id, fx=..., fy=...)` |
|
||||
|
||||
#### Data access
|
||||
|
||||
| Method | Description |
|
||||
|--------|-------------|
|
||||
| `sim.get_macroscopic()` | Download DDF, return dict with rho/ux/uy |
|
||||
| `sim.get_ddf()` | Download raw DDF array |
|
||||
| `sim.get_flags()` | Copy host-side flag array |
|
||||
| `sim.update_runtime_params(omega=..., fx=..., fy=...)` | Update runtime constants without recompile |
|
||||
|
||||
#### Checkpoint / Snapshot
|
||||
|
||||
| Method | Description |
|
||||
|--------|-------------|
|
||||
| `sim.save_checkpoint(path)` -> str | HDF5 checkpoint with full state |
|
||||
| `sim.load_checkpoint(path)` | Restore from HDF5 (config must match) |
|
||||
| `sim.snapshot()` / `sim.restore()` | In-memory field snapshot |
|
||||
|
||||
In-memory snapshots save populations only. Restore keeps the current clock,
|
||||
controls, observations, geometry and flags; use it only while geometry is
|
||||
unchanged. This is not a restart or an FSI rollback. In particular, do not
|
||||
restore a snapshot taken before a translating circle changed position.
|
||||
This geometry restriction is a caller precondition, not a runtime check.
|
||||
|
||||
#### Low-level access
|
||||
|
||||
| Attribute | Description |
|
||||
|-----------|-------------|
|
||||
| `sim.bodies` | ObjectManager for direct GPU buffer access (action_gpu, obs_gpu) |
|
||||
| `sim.stream` | Internal CUDA stream for async operations |
|
||||
| `sim.field` | LBMField (GPU memory + curved/sensor SoA handles) |
|
||||
| `sim.stepper` | LBMStepper for fine-grained step control |
|
||||
|
||||
### LBMStepper (advanced usage)
|
||||
|
||||
```python
|
||||
stepper.step(n=1, *, action_gpu, obs_gpu, stream=None)
|
||||
```
|
||||
|
||||
When fine-grained control is needed (e.g., custom async patterns), step manually:
|
||||
|
||||
```python
|
||||
stream = cuda.Stream()
|
||||
sim.bodies.zero_obs_async(stream)
|
||||
sim.stepper.step(
|
||||
1,
|
||||
action_gpu=sim.bodies.action_gpu,
|
||||
obs_gpu=sim.bodies.obs_gpu,
|
||||
stream=stream,
|
||||
)
|
||||
stream.synchronize()
|
||||
sim.bodies.increment_obs_steps(1) # manually track steps for normalize
|
||||
force = sim.read_force(0) # normalize=True: divides by 1 step
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Config file location
|
||||
|
||||
`Simulation()` resolves `config_lbm.json` in this order:
|
||||
|
||||
1. Explicit path argument to `Simulation(path)`
|
||||
2. `$CELERISLAB_CONFIG_DIR/config_lbm.json`
|
||||
3. `./configs/config_lbm.json` (current working directory)
|
||||
4. The copy shipped inside the installed package
|
||||
|
||||
### Config structure
|
||||
|
||||
```json
|
||||
{
|
||||
"grid": {
|
||||
"lattice_model": "D2Q9",
|
||||
"nx": 512, "ny": 256, "nz": 1
|
||||
},
|
||||
"physics": {
|
||||
"data_type": "FP32",
|
||||
"viscosity": 0.0035,
|
||||
"velocity": 0.03,
|
||||
"rho": 1.0
|
||||
},
|
||||
"method": {
|
||||
"collision": "SRT",
|
||||
"streaming": "double_buffer",
|
||||
"store_precision": "FP32",
|
||||
"ddf_shifting": false,
|
||||
"les": { "enabled": false, "cs": 0.16, "closed_form": true },
|
||||
"trt": { "magic_param": 0.1875 },
|
||||
"inlet": {
|
||||
"profile": "parabolic",
|
||||
"scheme": "zou_he_local",
|
||||
"trt_neq_damp": 0.5,
|
||||
"regularized_neq_damp": 0.5
|
||||
},
|
||||
"outlet": {
|
||||
"mode": "neq_extrap",
|
||||
"backflow_clamp": true,
|
||||
"blend_alpha": 0.7,
|
||||
"srt_neq_damp": 0.5
|
||||
},
|
||||
"y_wall_bc": "bounce_back",
|
||||
"omega_guard": { "min": 0.01, "max": 1.99 }
|
||||
},
|
||||
"cuda": {
|
||||
"threads_per_block": 256,
|
||||
"compute_capability": "auto"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Full parameter documentation lives in `src/CelerisLab/configs/CONFIG.md`.
|
||||
|
||||
## Performance
|
||||
|
||||
### Benchmarks (V100, D2Q9, 384x192)
|
||||
|
||||
| Config | Streaming | MLUPS |
|
||||
|--------|-----------|-------|
|
||||
| Re100 MRT noLES | double_buffer | ~4400 |
|
||||
| Re100 MRT noLES | esopull | ~4400 |
|
||||
|
||||
### EsoPull streaming mode
|
||||
|
||||
EsoPull (Esoteric-Pull) is a single-buffer streaming scheme that uses half the memory of double-buffer. It is **fully supported** for 2D D2Q9 with curved boundaries, rotating cylinders, sensors, and force regions.
|
||||
|
||||
Current verification scope (v0.5.1, confirmed bit-identical to double-buffer):
|
||||
- 2D D2Q9 only (D3Q19 not yet implemented)
|
||||
- MRT collision with both regularized and zou_he_local inlets
|
||||
- Fixed and rotating cylinder benchmarks:
|
||||
|
||||
| Benchmark | D | EsoPull CD | Double-buffer CD | CD diff |
|
||||
|-----------|---|-----------|-----------------|---------|
|
||||
| Kan99b K2 | 20 | 1.101 | 1.137 | <3.2% |
|
||||
| Kan99b K2 | 30 | 1.082 | 1.146 | <5.6% |
|
||||
|
||||
- Runtime body topology sync via ``sync_bodies()`` -- add and remove bodies at runtime
|
||||
- ``get_macroscopic()`` uses GPU kernel for physically correct output
|
||||
- ``get_ddf()`` returns backing-layout data (not physical DDF) in EsoPull mode
|
||||
|
||||
Enable via config: `"streaming": "esopull"`
|
||||
|
||||
### FP16S store precision
|
||||
|
||||
Half-precision storage is supported for the DDF buffer. All computations are performed in FP32; only storage uses FP16 with a scaling factor.
|
||||
|
||||
**Known limitation (v0.5.1):** FP16S combined with Bouzidi curved boundaries produces ~30-40% CD error even with ddf_shifting enabled. This is inherent to Bouzidi's per-direction DDF reads — FP16 quantization noise (~3e-5 per value) is not averaged across directions. DDF shifting is essential for FP16S (keeps values near 0 where FP16 has best precision), but does not fully resolve the Bouzidi incompatibility.
|
||||
|
||||
Verified benchmarks:
|
||||
- Sah04 S2: St error within 1.5% (channel + curved + inlet/outlet)
|
||||
- Kan99b K2: ~30% CD error with ddf_shifting (FP16S quantization noise through Bouzidi)
|
||||
- Kan99b K2 without ddf_shifting: >100% error (unusable)
|
||||
- High-blockage cases (S4 beta=0.9): May diverge earlier than FP32
|
||||
|
||||
For force-critical applications with curved boundaries, use FP32 storage. FP16S is suitable for applications where the curved boundary is simple (large D) or force accuracy is secondary.
|
||||
|
||||
Enable via config: `"store_precision": "FP16S"`
|
||||
|
||||
### ddf_shifting mode
|
||||
|
||||
Stores `f_i - w_i` instead of `f_i` to improve FP16 accuracy. Supported with the following verified combinations:
|
||||
|
||||
| Collision | Streaming | Inlet | Curved body | Status |
|
||||
|-----------|-----------|-------|-------------|--------|
|
||||
| MRT | double_buffer | zou_he_local | cylinder | Verified (K2 metrics match FP32) |
|
||||
| MRT | double_buffer | regularized | cylinder | Verified (K2 metrics match FP32) |
|
||||
| MRT | esopull | zou_he_local | cylinder | Verified (sync_bodies tested, bit-identical to double-buffer) |
|
||||
| MRT | esopull | regularized | cylinder | Verified (bit-identical to double-buffer) |
|
||||
| SRT | double_buffer | any | cylinder | Expected to work (f-feq style) |
|
||||
|
||||
**Known limitations (ddf_shifting):**
|
||||
- Verified configurations as of v0.5.1: **D2Q9 + MRT + double_buffer + any_inlet** and **D2Q9 + MRT + esopull + any_inlet** (sync_bodies add, remove, stepping stable)
|
||||
- MRT shifts to physical space before collision, shifts back after (SRT/TRT are shift-invariant natively)
|
||||
- D3Q19 MRT shifting patch has a ``compute_feq`` inconsistency (not in scope for 2D-only)
|
||||
- Host ``upload_ddf()`` path is asymmetric (repaired)
|
||||
- Checkpoint now enforces streaming and ddf_shifting match
|
||||
|
||||
### Performance characteristics
|
||||
|
||||
The GPU is the primary runtime cost. Python overhead is minimal.
|
||||
|
||||
**384x192 (validation grid):** GPU kernel time is ~78 μs/step, of which OneStep is ~5.9 μs (MRT D2Q9). The remaining time is dominated by pycuda kernel launch overhead (~37 μs per launch).
|
||||
|
||||
**3000x300 (production grid):** Estimated GPU compute time is ~530 μs/step, with pycuda overhead fixed at ~111 μs, yielding ~83% GPU utilization.
|
||||
|
||||
`sim.set_body()` and `sim.read_force()` data transfers are negligible (~1 μs for 72 bytes).
|
||||
|
||||
For a detailed breakdown, see [docs/performance_analysis.md](docs/performance_analysis.md).
|
||||
|
||||
## Body Module Architecture
|
||||
|
||||
```
|
||||
body/
|
||||
__init__.py Package exports
|
||||
objects.py SimObject container + ObjectState / ObjectControl
|
||||
manager.py ObjectManager: GPU buffer lifecycle, sync, telemetry
|
||||
registry.py BodyRegistry: pure add/remove/query
|
||||
action_smoother.py ActionSmoother for control input ramping
|
||||
geometry/ Shape implementations (CircleGeometry, Geometry ABC)
|
||||
coupling/ Body-fluid coupling: SoA packing, force/torque
|
||||
preprocess/ Grid preprocessing: flag overlay, cut-link building
|
||||
```
|
||||
|
||||
## Module Boundaries
|
||||
|
||||
- `body/` — geometry, rigid-body state, preprocessing, force/torque readback
|
||||
- `lbm/` — lattice Boltzmann kernels, field memory, stepper
|
||||
- `cuda/` — compilation pipeline, context lifecycle
|
||||
- `common/` — shared utilities (checkpoint, render, streakline pathline)
|
||||
|
||||
Geometry is **separated from boundary methods**. CircleGeometry produces geometry-agnostic CutLink records. The SoA packer (`body/coupling/soa_packer.py`) is the single point that knows the kernel memory layout. Adding a new shape (polygon, mesh) requires only a new `Geometry` subclass.
|
||||
|
||||
## Validated Benchmarks
|
||||
|
||||
| Benchmark | Description | Key metrics | Precision |
|
||||
|-----------|-------------|-------------|-----------|
|
||||
| Sah04 S1-S4 | Confined stationary cylinder | Strouhal matching Sahin & Owens (2004) | St error < 5% |
|
||||
| Kan99b K0-K5 | Rotating cylinder in open domain | St, Cd, Cl matching Kang et al. (1999) | See tolerance table |
|
||||
| Sensor accuracy | GPU sensor vs CPU flow-field average | Match to 1e-9 | Verified |
|
||||
|
||||
Run validation scripts:
|
||||
|
||||
```bash
|
||||
conda run -n pycuda_3_10 python tests/validation/run_kan99b_rotating_cylinder.py
|
||||
conda run -n pycuda_3_10 python tests/validation/run_sah04_st_matrix.py
|
||||
conda run -n pycuda_3_10 python tests/validation/test_sensor_accuracy.py
|
||||
```
|
||||
|
||||
## Performance baseline
|
||||
|
||||
```bash
|
||||
conda run -n pycuda_3_10 python tests/validation/run_perf_baseline.py \
|
||||
--lattice-model D2Q9 --nx 384 --ny 192 --collision MRT
|
||||
```
|
||||
|
||||
## Project Layout
|
||||
|
||||
See [docs/tests_overview.md](docs/tests_overview.md) for a complete guide to the test suite.
|
||||
|
||||
```
|
||||
src/CelerisLab/
|
||||
simulation.py High-level API
|
||||
config.py LBMConfig / BodyConfig dataclasses
|
||||
body/ Object management, geometry, GPU sync
|
||||
cuda/ CUDA context, compilation, PTX load
|
||||
lbm/ Field, stepper, kernels (CUDA source)
|
||||
common/ Preprocess, checkpoint, render, streakline
|
||||
tests/
|
||||
validation/ Regression runners (Kan99b, Sah04, sensor, perf)
|
||||
postproc/ Post-processing scripts (exp_ctrl_matrix, streakline)
|
||||
specs/ Validation spec documents
|
||||
audit/ Audit reports (archived, see docs/)
|
||||
output/ Test outputs (force CSV, vorticity PNG, checkpoints)
|
||||
docs/
|
||||
performance_analysis.md GPU/Python profiling report
|
||||
audit/ Audit findings (round 1-2, kernel layer, body refactor notes)
|
||||
validation_specs/ Validation methodology documents
|
||||
legacy/ Superseded code (FlowField, compiler v1, macros.h)
|
||||
ref/ External reference implementations (FluidX3D)
|
||||
```
|
||||
|
||||
## Collision model recommendations
|
||||
|
||||
| Use case | Recommended config |
|
||||
|----------|-------------------|
|
||||
| Low Re (<= 500) | SRT or TRT, LES off |
|
||||
| Medium Re (500-2000) | MRT or SRT+LES |
|
||||
| High Re (2000-5000) | MRT+LES (most robust); SRT+LES; TRT+LES with `omega_guard.max` in 1.90-1.99 |
|
||||
|
||||
## Common control loop patterns
|
||||
|
||||
### Sync control (simple)
|
||||
|
||||
```python
|
||||
sim.set_body(0, omega=0.002)
|
||||
sim.run(10)
|
||||
data = sim.read_body(0)
|
||||
```
|
||||
|
||||
### Async control (performance-oriented)
|
||||
|
||||
```python
|
||||
sim.set_body(0, omega=0.002) # host-only, ~1 μs
|
||||
sim.stepper.step(10, ..., stream=sim.stream)
|
||||
sim.bodies.increment_obs_steps(10) # track steps for normalize
|
||||
sim.bodies.download_obs_full_async(sim.stream)
|
||||
sim.stream.synchronize()
|
||||
force = sim.read_force(0) # per-step average force
|
||||
```
|
||||
|
||||
Use ``sim.run()`` for the common case -- it stores the step count automatically:
|
||||
|
||||
```python
|
||||
sim.set_body(0, omega=0.002)
|
||||
sim.run(10, stream=sim.stream)
|
||||
force = sim.read_force(0) # per-step average force
|
||||
```
|
||||
|
||||
## Vortex initialization
|
||||
|
||||
```python
|
||||
from CelerisLab.lbm.initializers import add_vortex
|
||||
add_vortex(sim.field, center=(50, 50), radius=10.0, strength=1.0, vortex_type="lamb")
|
||||
```
|
||||
|
||||
## Streakline visualization
|
||||
|
||||
```python
|
||||
from CelerisLab.common.streakline import Streakline, ReleaseConfig, IntegratorConfig
|
||||
|
||||
streak = Streakline(release_points=..., nx=nx, ny=ny)
|
||||
for step in range(steps):
|
||||
sim.run(1)
|
||||
if step % sample_every == 0:
|
||||
macro = sim.get_macroscopic()
|
||||
streak.observe(ux=macro["ux"], uy=macro["uy"], step=step)
|
||||
streak.render("streakline.png")
|
||||
```
|
||||
|
||||
## Validation campaigns
|
||||
|
||||
- [Periodic Taylor–Green AMR](docs/validation/taylor_green.md): analytic periodic-decay pilot and frozen baseline-relative assessment.
|
||||
- [Matched refined DFG](docs/validation/refined_dfg.md): frozen SRT uniform/refined comparison, requiring channel GPU gates before execution.
|
||||
- [DFG 2D-2 Re100](docs/validation/dfg_re100.md): frozen periodicity and official-reference comparisons, with a declared noncanonical outlet.
|
||||
- [Uniform LES shear decay](docs/validation/uniform_les_flow.md): independent continuum-oracle flow diagnostic, baseline and isolated corrected source variants.
|
||||
- [Smagorinsky helper comparison](docs/validation/les_helpers.md): pinned baseline versus an output-local two-coefficient candidate, without production edits.
|
||||
- [Jet-circle control volume](docs/validation/jet_circle_cv.md): bounded AMR versus uniform-grid conservation diagnostic.
|
||||
|
||||
The runners are in `tests/validation`, their CPU tests in `tests/unit`, and compact reference/source guards in `tests/validation/data`. Current Re100/Jet source guards explicitly pin the reviewed AMR-channel experiment; historical d79 evidence remains tied to its original checkpoint commits. New runs record actual Git HEAD separately from source origin. These campaigns preserve pinned production code; successful CPU checks alone do not establish GPU or physical validation. Keep generated results outside tracked files.
|
||||
|
||||
## Citation
|
||||
|
||||
```bibtex
|
||||
@software{celerislab2026,
|
||||
author = {Frank14f},
|
||||
title = {CelerisLab: GPU-Accelerated Lattice Boltzmann Method Solver},
|
||||
year = {2026},
|
||||
url = {https://github.com/frank14f/CelerisLab}
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT License — see LICENSE file for details.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
||||
# Task 7 minimal offline preservation
|
||||
|
||||
User-approved shared backup for continued work by root, Claude and Grok. This independent backup branch does not update the release candidate, main, dev or tags.
|
||||
|
||||
Source snapshot: `0f8fdbc30ea640c764b38ee598d8f4d135c81c85`, branch `release-prep/2d-jet-multilevel-20261020`, tree `e0ab4a6b974d188e8bf1a1cedd0d2705ef27cefe`. The snapshot contains 247 selected source/test/documentation files; it is not a full Git history.
|
||||
|
||||
`horsea-required.tar.gz` is the original unchanged 729332-byte pack. Its 309 payload files and embedded manifest were verified after Horsea-to-Mac transfer. It contains the saved SRT input NPZ/PTX, matching-cache/rebuilt SASS text, exact RNE scratch scripts/results/provenance, and recent gate/integration summaries. No credentials, raw caches, cubins, training outputs or unrelated data are included. Git authentication is not part of this backup.
|
||||
|
||||
The embedded manifest retains its original local-preservation wording. The user subsequently explicitly approved sharing this exact pack through this Gitea backup branch; the original archive and manifest bytes are preserved.
|
||||
|
||||
After retrieval, verify the files against `SHA256SUMS` before unpacking. `MANIFEST.json` lists each payload origin, byte size and SHA256. The archive contains regular files only and no absolute or parent-traversal paths.
|
||||
|
||||
Evidence limitations remain: blocked historical SASS was rebuilt, matching uniform cache usage was not bound to the old run receipt, and current-candidate GPU reproduction plus measured GPU reciprocal were not executed. This backup does not establish release acceptance or an SRT fix.
|
||||
@@ -1,4 +0,0 @@
|
||||
4ae14dd3cf28a4f3d7c17ec9a56a6b2bf18a3b1348dc78f4706c8a46b4cb7263 MANIFEST.json
|
||||
8f605aeac6e61c3471fbd2c602bb1567e97508d81b18ebcbd3bff50b31a100c3 README.md
|
||||
5c08447090c269320e32f9f390419254d77213986620dc759df1d84b12f07bfe UPLOAD-AUDIT.json
|
||||
b898e60d0bf782f62ded61fc3d4264b45d1bb106cd0722de85e24d432e9c564b horsea-required.tar.gz
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"archive_sha256": "b898e60d0bf782f62ded61fc3d4264b45d1bb106cd0722de85e24d432e9c564b",
|
||||
"archive_bytes": 729332,
|
||||
"manifest_file_count": 309,
|
||||
"archive_member_count": 310,
|
||||
"verified_all_files": true,
|
||||
"forbidden_paths": [],
|
||||
"secret_pattern_hits": [],
|
||||
"head": "0f8fdbc30ea640c764b38ee598d8f4d135c81c85",
|
||||
"upload_scope": "Only original verified archive, its embedded manifest, checksum and concise retrieval README; no credentials or Git authentication copied."
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,209 @@
|
||||
## 审计结论(第二轮)
|
||||
|
||||
本轮审计的视角与上一轮不同。上一轮聚焦"主链路上是否有显式 bug"(找到了 16 项)。本轮审计的四个维度:
|
||||
|
||||
| 维度 | 上一轮 | 本轮 |
|
||||
|---|---|---|
|
||||
| 主链路正确性 | 找显式 bug | 确认修补正确、无回归 |
|
||||
| 代码架构质量 | 少量提及 | 系统评估 Python 层职责分离 |
|
||||
| 新代码 | 不存在 | streakline.py 全篇 + test runners |
|
||||
| 跨层一致性 | 仅一处 | 系统性检查 config → compiler → kernel → docs 同步 |
|
||||
|
||||
核心结论:**上次 16 项修补经逐条审查确认正确,无回归。**
|
||||
|
||||
### 第二轮修改完成状态
|
||||
|
||||
根据审计发现,已完成以下修改:
|
||||
|
||||
| 修改项 | 状态 |
|
||||
|---|---|
|
||||
| EsoPull 添加 y=1/NY-2 半格 bounce-back 修正(D2Q9 + D3Q19) | ✅ 已实施 |
|
||||
| `macro.cuh` diagnostic 函数标注 | ✅ 已标注 `// --- Diagnostic only ---` |
|
||||
| `config.py` `omega_max` 默认值 1.99 → 1.96 | ✅ 已修改 |
|
||||
| `BC_MOVING`/`BC_PERIODIC` 代码注释说明 | ✅ 已添加 TODO 注释 |
|
||||
| Streakline 模块重构:779 行单文件 → `common/streakline/` 子包 (5 文件) | ✅ 已完成 |
|
||||
| `run_kan99b_streakline.py` 更新为新 API | ✅ 已完成 |
|
||||
| `run_exp_ctrl_matrix_streakline.py` 更新为新 API | ✅ 已完成 |
|
||||
| `render_vorticity_field` 移到 `common/render.py` | ✅ 已完成 |
|
||||
| `ParticleTrailSet` 移到 `common/pathline.py` | ✅ 已完成 |
|
||||
| 向后兼容 shim `common/streakline.py` | ✅ 已创建(带 DeprecationWarning) |
|
||||
|
||||
---
|
||||
|
||||
## 状态说明
|
||||
|
||||
- `[已确认]` 经代码审查确认正确
|
||||
- `[无法确认: 需运行验证]` 需数值算例确认,不能单靠读代码定论
|
||||
- `[新发现]` 本轮审计首次发现
|
||||
- `[已修复]` 已实施修改
|
||||
- `[保留说明]` 当前不修,但需在代码或文档中明确限制
|
||||
|
||||
---
|
||||
|
||||
## 第一轮审计修补确认
|
||||
|
||||
逐一确认 16 项"已解决"修补在代码中的真实状态。**全部 [已确认],无回归。**
|
||||
|
||||
| 问题 | 结论 | 关键文件:行号 |
|
||||
|---|---|---|
|
||||
| `lbm/__init__.py` 导出错误 | 已确认 | 当前导出真实存在的 `add_vortex` |
|
||||
| forcing 主链路 + 预因子不一致 | 已确认 — 三模型统一使用 `c_tau = 1-omega/2` | `operators/collision_srt.cuh:15`, `collision_trt.cuh:35`, `collision_mrt.cuh:41/116` |
|
||||
| TRT outlet NEQ 重构未补齐 | 已确认 — COMPILE_MODEL==0\|1 时全分布 damped NEQ | `boundary/outlet/pressure_neq.cuh:45-51` (D2Q9) |
|
||||
| `add_vortex()` 动量当速度 | 已确认 — `ux = sum(f*cx) / rho_safe` | `lbm/initializers.py:57-58` |
|
||||
| Sensor 面积归一化 | 已确认 — ObjectManager 层已提供 | `body/manager.py` |
|
||||
| `sync_to_gpu()` 重置非流体 | 已确认 — 已收缩为只覆盖 obstacle interior | `body/manager.py` |
|
||||
| curved donor 合法性 | 已确认 — 扩展到实际 domain flags | `body/objects.py` `_donor_is_fluid` |
|
||||
| curved Bouzidi 时序 | 已确认 — 步前写入 obstacle source slot | `lbm/stepper.py:70-71` → `step/aux_kernels.cu:14` |
|
||||
| `q >= 0.5` 分支读错时间层 | 已确认 — 读 `load_ddf(fi, ...)` 即同一步 post-collision | `boundary/curved_boundary.cuh:73-75` |
|
||||
| moving wall 修正未按 q 分支 | 已确认 — 分三路:fallback / q<0.5 / q>=0.5 | `boundary/curved_boundary.cuh:30-43` |
|
||||
| 初始化链路 flag 叠加顺序 | 已确认 — obstacle overlay → init kernel preserve → equilibrium | `step/init_flow.cu:48-52`, `lbm/stepper.py:43-54` |
|
||||
| `config_body.json` 未进入初始化 | 已确认 — Simulation 已消费 | `simulation.py` |
|
||||
| inlet `U0` 语义 | 已确认 — 已补充截面平均速度注释 | `configs/CONFIG.md`, `README` |
|
||||
|
||||
---
|
||||
|
||||
## 本轮发现与处理
|
||||
|
||||
### CUDA Kernel 层
|
||||
|
||||
| 严重度 | 问题 | 文件:行号 | 处理 |
|
||||
|---|---|---|---|
|
||||
| **[新发现]** [高] | **`BC_MOVING` 与 `BC_PERIODIC` 标记未在 step kernel 中分发。** `core/flags.cuh` 定义了两种标记,但 step kernel 中没有 `is_moving()` 或 `is_periodic()` 分支。设了这两种标记的 cell 会静默 fall through 到 `bounce_back_swap()`。 | `step/one_step_double.cu`, `step/one_step_esopull.cu` | **[保留说明]** 已添加 TODO 注释,暂不实现 |
|
||||
| **[新发现]** [高] | **EsoPull 缺少 y=1/NY-2 的显式半格 bounce-back 修正。** Double-buffer 路径有该修正而 EsoPull 无。 | `step/one_step_esopull.cu` | **[已修复]** 已添加 D2Q9 和 D3Q19 分支,标注了未来可能需要更精确方案 |
|
||||
| **[新发现]** [中] | **`USE_DDF_SHIFTING` 路径完整性存疑。** 审查后确认:`macro.cuh` 和 `init_flow.cu` 已处理 shifted,各 collision/curved operator 通过 `load_ddf`/`store_ddf` 抽象层自动适配。**实际已完整,无需修改。** | — | **[已确认无需处理]** |
|
||||
| **[新发现]** [低] | **`compute_pressure` 与 `compute_pressure_perturbation` 未标注诊断用途。** | `operators/macro.cuh:160-166` | **[已修复]** 已标注 `// --- Diagnostic only ---` |
|
||||
| **[新发现]** [低] | **Curved/Sensor kernel 无运行时下标越界保护。** 完全依赖 host 侧验证。 | `step/aux_kernels.cu:26-99` | **[保留说明]** 设计选择:不引入多余合法性检查 |
|
||||
|
||||
### 第一轮遗留待验证项复查
|
||||
|
||||
| 待验证项 | 状态 | 说明 |
|
||||
|---|---|---|
|
||||
| **MRT D2Q9 moment transform/inverse** | **[无法确认: 需运行验证]** | 方向索引与 paired ordering 自洽,moment 投影物理正确。但全部系数的数值精度需在 Poiseuille 或衰减涡算例中验证。 |
|
||||
| **EsoPull 邻壁 vs double-buffer 一致性** | **[已修复]** | 已添加 y=1/NY-2 反弹修正。需运行验证确认。 |
|
||||
| **Force 提取与 host 侧归一化** | **[无需处理]** | Cd/Cl 管道经确认语义一致。 |
|
||||
| **Plain linear Bouzidi / TRT 不兼容** | **[保留说明]** | 注释已存在且准确,引用了 [Gin08b]。无方法级替代方案。 |
|
||||
|
||||
---
|
||||
|
||||
## 架构与设计审计
|
||||
|
||||
### Streakline 模块重构
|
||||
|
||||
**旧 `common/streakline.py` (779 行) 已被拆解为 `common/streakline/` 子包:**
|
||||
|
||||
```
|
||||
src/CelerisLab/common/
|
||||
streakline/ 后处理子包
|
||||
__init__.py 导出 Streakline, ReleaseConfig, IntegratorConfig
|
||||
_config.py 配置 dataclass + FlowFrame 内部类
|
||||
_integrate.py 核心积分引擎 (RK4 + 时空插值)
|
||||
_render.py 密度图渲染 (render_density)
|
||||
_streakline.py Streakline 类 (被动消费者)
|
||||
render.py 涡度计算与渲染 (从旧 streakline 移出)
|
||||
pathline.py ParticleTrailSet + render_trails (从旧 streakline 移出)
|
||||
preprocess.py 增加 cylinders_from_triangle_layout
|
||||
```
|
||||
|
||||
**核心设计变更:**
|
||||
|
||||
| 旧设计 | 新设计 |
|
||||
|---|---|
|
||||
| `run_streakline_online(sim, ...)` 控制仿真循环 | `Streakline.observe(ux, uy, step)` 被动接收帧 |
|
||||
| `run_streakline_offline(frames, ...)` 批处理帧列表 | 移除(无需求) |
|
||||
| `render_streakline_density(positions, ages, ...)` 15 参数 | `Streakline.render(path)` 内部维护状态 |
|
||||
| `ParticleTrailSet` 与正确实现混在同一文件 | 移到独立 `pathline.py` |
|
||||
| `render_vorticity_field` 与粒子跟踪无关 | 移到独立 `render.py` |
|
||||
| `gaussian_blur2d` 用 `np.apply_along_axis` | 改为显式 `for` 循环 + `np.convolve` |
|
||||
| `minimal_axes=True/False` 分支重复 | 合并为单路径 `_save_minimal_image` |
|
||||
|
||||
**用法示例:**
|
||||
```python
|
||||
streak = Streakline(release_points=..., nx=nx, ny=ny, cylinders=...)
|
||||
# 在自己的仿真循环中:
|
||||
macro = sim.get_macroscopic()
|
||||
streak.observe(ux=macro["ux"], uy=macro["uy"], step=step)
|
||||
# ...同时可以做 body actions、checkpoint、其他模块...
|
||||
streak.render("output.png")
|
||||
```
|
||||
|
||||
### Body 模块
|
||||
|
||||
| 严重度 | 问题 | 行号 | 处理 |
|
||||
|---|---|---|---|
|
||||
| **[架构]** | **`ObjectManager` 承担 8 种以上职责。** `sync_to_gpu()` 单枪匹马编排了全部流程。 | `body/manager.py` (423 行) | **[暂不处理]** |
|
||||
| **[架构]** | **`Cylinder.get_curved_list()` ~180 行包含 7 种职责。** 内嵌函数无法单独测试。 | `body/objects.py:110-291` | **[暂不处理]** |
|
||||
| **[架构]** | **自上一轮审计以来 body 模块重构进展为零。** | 全部 | **[暂不处理]** |
|
||||
|
||||
### Config/API 层
|
||||
|
||||
| 严重度 | 问题 | 行号 | 处理 |
|
||||
|---|---|---|---|
|
||||
| **[已确认]** | **FP16C 被正确拒绝。** | `config.py:119-123` | ✅ |
|
||||
| **[已确认]** | **28/28 参数通过四层一致性检查。** | B4a 参数追踪表 | ✅ |
|
||||
| **[已确认]** | **OBS 布局四层完全匹配。** | B4d 对比表 | ✅ |
|
||||
| **[架构/低]** | **CONFIG.md 写"建议整除"而非"必须"。** 代码用 ceiling division。 | `configs/CONFIG.md:13`, `lbm/stepper.py:272-274` | **[保留说明]** |
|
||||
| **[已修复]** | **`LBMConfig` 默认 `omega_max=1.99` → `1.96`,与 JSON/CONFIG 一致。** | `config.py:84` | ✅ |
|
||||
|
||||
### 跨层 Flag/常量同步
|
||||
|
||||
| 问题 | 状态 |
|
||||
|---|---|
|
||||
| **`FLAG_*` 常量 Python ↔ CUDA 同步** | **[已确认]** 全部一致 |
|
||||
| **`LBMParams` struct 布局耦合** | **[保留说明]** |
|
||||
| **V_TAYLOR 硬编码 1** | **[保留说明]** |
|
||||
|
||||
---
|
||||
|
||||
## 测试覆盖率审计
|
||||
|
||||
### Validation runner 与文档一致性
|
||||
|
||||
| 结论 | 项目 | 说明 |
|
||||
|---|---|---|
|
||||
| **[通过]** | Sah04 runner S1-S4 | 四个锚点全部定义并运行 |
|
||||
| **[缺口]** | Sah04 runner `--u-max` | `u_max_nominal=0.1` 写死 |
|
||||
| **[缺口]** | Sah04 runner high-beta 网格 | 默认直径与文档推荐不一致 |
|
||||
| **[通过]** | Kan99b runner K1-K5 | 全部 5 个 case,K2 有 gate |
|
||||
| **[缺口]** | Kan99b runner K3-K5 | 未做抑制分类自动检测 |
|
||||
| **[通过]** | 输出机器可读 | 均输出 JSON/CSV |
|
||||
|
||||
### 测试基础设施
|
||||
|
||||
| 严重度 | 结论 |
|
||||
|---|---|
|
||||
| **[严重缺口]** | **零 pytest/unittest 基础设施。** |
|
||||
| **[严重缺口]** | **四个旧待验证项仅 EsoPull 已修,余三项(MRT、curved boundary、force 归一化)未覆盖。** |
|
||||
|
||||
### 建议的最低测试覆盖面(优先级排列)
|
||||
|
||||
1. **MRT 单元测试**(uniform flow / Poiseuille / decaying vortex)— 单元级
|
||||
2. **力系数归一化测试** — 单元级
|
||||
3. **Curved boundary 单列测试** — 单元级
|
||||
4. **EsoPull vs double-buffer 一致性**(Poiseuille 流对比)— 单元/集成级
|
||||
5. **Validation runner smoke 测试** — 验证级
|
||||
|
||||
---
|
||||
|
||||
## 保留说明
|
||||
|
||||
- **`BC_MOVING` / `BC_PERIODIC` 未分发** — 已标注 TODO,暂不实现
|
||||
- **Curved/Sensor kernel 无运行时越界检查** — 设计选择(依赖 host 验证)
|
||||
- **Plain linear Bouzidi 与 TRT 不天然相容** [Gin08b] — 注释已存在
|
||||
- **Curved wall 无质量守恒修正** — 长时间高 Re 周期 curved flow 可能出现力漂移 [San18]
|
||||
- **入口 `U0` 是截面平均速度**,抛物入口峰值为 `1.5*U0`
|
||||
- **角点 flag 语义不一致**:初始化时按 inlet/outlet 分类,边界核又落回 `bounce_back_swap()`
|
||||
- **3D 刚体旋转契约是 z 轴占位实现**(`aux_kernels.cu:58-63`,`Ww = 0.0f`)
|
||||
- **Curved boundary 仍是圆形几何特化**,没有为任意离散几何留出入路径
|
||||
- **`LBMParams` struct 布局** 在 Python `struct.pack` 与 CUDA struct 之间硬耦合
|
||||
- **CONFIG.md NT 整除性措辞**:写"建议",代码用 ceiling division
|
||||
|
||||
---
|
||||
|
||||
## 修改项汇总
|
||||
|
||||
| 类别 | 计数 |
|
||||
|---|---|
|
||||
| 第一轮修补确认 | 12 项全部 [已确认] |
|
||||
| 本轮已修复 | 6 项 |
|
||||
| 保留说明 | 10 项 |
|
||||
| 暂不处理 | Body 重构 / 测试基础设施 / Validation runner 缺口 |
|
||||
@@ -0,0 +1,325 @@
|
||||
## 目标
|
||||
|
||||
第二阶段不再以补丁式修 bug 为主,而是重建 `body` 与 `LBM` 之间的模块边界,形成可持续扩展到 Bouzidi、IBM、粒子和多相耦合的骨架。重构后的代码需要保持短文件、清晰职责、显式契约,并避免几何语义直接渗入 CUDA 核心计算链路。
|
||||
|
||||
## 第一阶段与第二阶段的边界
|
||||
|
||||
### 第一阶段
|
||||
|
||||
目标是验证当前修复后的代码没有恶化,并保住最基本执行链路。
|
||||
|
||||
- 能稳定计算流场
|
||||
- 能读取力与力矩
|
||||
- Bouzidi 路径不出现新的时序性错误
|
||||
- 初始化、flag、object overlay 不再互相污染
|
||||
- 现有接口不做大改,只修运行期 bug 和明显契约错误
|
||||
|
||||
### 第二阶段
|
||||
|
||||
目标是结构性重构,而不是继续在旧链路上叠加特例。
|
||||
|
||||
- 重构 `body`
|
||||
- 重构 curved boundary 数据链
|
||||
- 为 IBM 预留统一入口
|
||||
- 为简单几何和离散几何建立同一中间表示
|
||||
- 为未来多相与多物理场保留清晰耦合面
|
||||
|
||||
## 当前架构的核心问题
|
||||
|
||||
### 主要问题
|
||||
|
||||
| 模块 | 当前问题 | 后果 |
|
||||
|---|---|---|
|
||||
| `body` | 几何、flag overlay、compact list、action、obs、coupling 混在一起 | 任一功能扩展都会牵动整条链路 |
|
||||
| `objects.py` | 几何对象直接生成 Bouzidi 专用数据 | 简单几何和离散几何无法共享同一接口 |
|
||||
| `curved_boundary` | 几何解释、边界格式、移动壁修正、力提取绑在同一层 | 替换边界方法成本高 |
|
||||
| `ObjectManager` | 过度集中,已经接近万能管理器 | 可读性下降,后续只能继续膨胀 |
|
||||
| host-device contract | 分散在多个文件,缺少统一定义 | 调试困难,容易出现隐式耦合 |
|
||||
|
||||
### 本质判断
|
||||
|
||||
当前最大问题不是公式本身,而是缺少稳定的中间层。几何对象、边界方法、运行时打包目前没有被拆开,导致代码很难既简洁又可扩展。
|
||||
|
||||
结合本轮修 bug 的经验,再补一条判断:很多问题不是几何本身出错,而是 donor、fallback、time layer 这类数值语义散落在不同文件中,读代码时必须来回跳转才能确认。当前项目更适合把这些语义集中写进少数注释位置,而不是继续加更多隐式保护逻辑。
|
||||
|
||||
## 第二阶段的目标架构
|
||||
|
||||
### 顶层模块
|
||||
|
||||
保持两大物理模块:
|
||||
|
||||
- `LBM`
|
||||
- `body`
|
||||
|
||||
但它们之间不直接互相了解实现细节,而通过显式中间数据结构耦合。
|
||||
|
||||
### 推荐分层
|
||||
|
||||
| 层级 | 职责 | 不应负责 |
|
||||
|---|---|---|
|
||||
| `simulation` | 装配模块,定义推进顺序 | 几何处理,边界公式细节 |
|
||||
| `body` | 几何、刚体状态、预处理、力回收 | DDF 操作,LBM 核心算法 |
|
||||
| `lbm` | 格子流体、collision、streaming、boundary operator | 几何来源,刚体业务语义 |
|
||||
| `coupling` | cut-link、IBM marker、body-fluid 数据交换 | 具体几何类定义,具体 collision 实现 |
|
||||
|
||||
## 推荐的 body 内部结构
|
||||
|
||||
### 目标
|
||||
|
||||
`body` 应只表达拉格朗日对象和几何处理,不直接承载 LBM 业务逻辑。
|
||||
|
||||
补充边界:`body` 负责管理对象并产出统一 cut-link 几何记录,`lbm` 只消费 cut-link 做数值计算。对象类型区分、几何来源、以及“该记录来自圆柱还是离散几何”都不应进入 LBM kernel 视野。
|
||||
|
||||
### 推荐文件树
|
||||
|
||||
```text
|
||||
body
|
||||
geometry
|
||||
base
|
||||
circle
|
||||
sphere
|
||||
polygon
|
||||
mesh
|
||||
state
|
||||
rigid_body_state
|
||||
particle_state
|
||||
preprocess
|
||||
flag_overlay
|
||||
cut_links
|
||||
ibm_markers
|
||||
sensors
|
||||
runtime
|
||||
action_buffer
|
||||
telemetry_buffer
|
||||
registry
|
||||
coupling
|
||||
wall_velocity
|
||||
force_torque
|
||||
```
|
||||
|
||||
### 说明
|
||||
|
||||
- `geometry` 只回答几何问题
|
||||
- `state` 只保存状态量
|
||||
- `preprocess` 负责把几何投影到欧拉网格
|
||||
- `runtime` 负责 GPU 上传与 buffer 管理
|
||||
- `coupling` 负责 body 与 fluid 的交换规则
|
||||
|
||||
进一步要求:
|
||||
|
||||
- `geometry` 不直接生成 Bouzidi 专用 SoA
|
||||
- `preprocess` 先产出统一 cut-link 结果,再由更薄的一层做运行时打包
|
||||
- `runtime` 不回头参与几何判断
|
||||
- 单文件保持简短,避免再出现一个文件同时含几何、打包、上传、观测解释四类职责
|
||||
|
||||
## 推荐的 LBM 边界
|
||||
|
||||
### LBM 应该看到什么
|
||||
|
||||
LBM 只应看到这些输入:
|
||||
|
||||
- `flag`
|
||||
- `cut-link records`
|
||||
- `IBM marker records`
|
||||
- `runtime params`
|
||||
- `obs buffers`
|
||||
|
||||
LBM 不应知道:
|
||||
|
||||
- 该 link 来自圆柱还是三角网格
|
||||
- 该对象是粒子还是障碍物
|
||||
- 该边界记录由哪种 host 几何算法产生
|
||||
|
||||
## curved boundary 的重构方向
|
||||
|
||||
### 核心原则
|
||||
|
||||
不要把 curved boundary 等同于 Bouzidi。
|
||||
|
||||
需要拆成三个维度:
|
||||
|
||||
- 几何表示
|
||||
- 边界处理方法
|
||||
- 运动模型
|
||||
|
||||
补充一条实现原则:donor、fallback、time layer 等关键数值语义,优先通过集中注释写清楚,不额外引入很多“自动保证语义”的复杂逻辑。当前项目更优先保持代码短、直、可读。
|
||||
|
||||
### 建议的统一中间表示
|
||||
|
||||
定义通用 `cut-link record`,至少包含:
|
||||
|
||||
| 字段 | 含义 |
|
||||
|---|---|
|
||||
| `fluid_idx` | 流体格点索引 |
|
||||
| `dir` | 指向边界的格子方向 |
|
||||
| `q` | 交点沿链路的位置 |
|
||||
| `body_id` | 所属物体 |
|
||||
| `hit_point` | 壁面交点 |
|
||||
| `lever_arm` | 相对参考点的力臂 |
|
||||
| `normal` | 壁面法向 |
|
||||
| `motion_tag` | 静止、平移、旋转等 |
|
||||
| `scheme_tag` | Bouzidi、half-way、未来 TRT-compatible scheme |
|
||||
| `fallback_tag` | donor 非法时的退化方式 |
|
||||
|
||||
补充约束:
|
||||
|
||||
- `cut-link record` 只表达几何命中结果与最小运行时字段,不直接长成某一种 kernel 专用格式
|
||||
- donor 的来源与时间层语义不额外做复杂自动推断,靠集中注释写清楚
|
||||
- 记录字段命名要直接对应 kernel 使用含义,避免同一字段在不同文件中有不同解释
|
||||
|
||||
### 这样做的好处
|
||||
|
||||
- 圆形和离散几何可以输出同一种记录
|
||||
- Bouzidi 与 IBM 可以共享一部分几何预处理
|
||||
- boundary kernel 只消费记录,不关心几何来源
|
||||
- 以后替换边界方法时,不必回改对象类
|
||||
- donor、fallback、hit-point 这类契约可以在少数固定注释位置集中说明,而不是散落在对象类和 kernel 两侧
|
||||
|
||||
## IBM 的预留方式
|
||||
|
||||
IBM 不应和 Bouzidi 混成一条链,而应与 cut-link 平行。
|
||||
|
||||
建议另设统一 `marker record`,用于:
|
||||
|
||||
- 插值点位置
|
||||
- 支撑域格点
|
||||
- 权重
|
||||
- 与刚体的归属关系
|
||||
|
||||
这样未来可以并存:
|
||||
|
||||
- cut-link boundary
|
||||
- IBM boundary
|
||||
- 混合策略
|
||||
|
||||
## 运行时契约的建议
|
||||
|
||||
### 必须显式化的契约
|
||||
|
||||
应把 host-device contract 从各文件中收口,单独维护。
|
||||
|
||||
建议集中定义:
|
||||
|
||||
- action buffer layout
|
||||
- telemetry buffer layout
|
||||
- cut-link record layout
|
||||
- marker record layout
|
||||
- force torque sign convention
|
||||
- body velocity contract
|
||||
|
||||
### 运动状态契约
|
||||
|
||||
即使短期只做 2D 圆柱旋转,也建议按最终形式设计:
|
||||
|
||||
| 状态 | 建议字段 |
|
||||
|---|---|
|
||||
| 平移 | `vx vy vz` |
|
||||
| 角运动 | `wx wy wz` 或 2D 的 `omega` 特化视图 |
|
||||
| 参考点 | `cx cy cz` |
|
||||
| 姿态 | `theta` 或旋转表示 |
|
||||
|
||||
不要再把 3D 路径固化为“只读一个 z 轴 `omega`”。
|
||||
|
||||
## 第二阶段推荐顺序
|
||||
|
||||
### 阶段 2A
|
||||
|
||||
先把职责边界拆开,不追求新功能。
|
||||
|
||||
- 拆 `ObjectManager`
|
||||
- 建立 `BodyRegistry`
|
||||
- 建立 clean `runtime buffer` 层
|
||||
- 建立单独的 geometry preprocess 层
|
||||
- 把“对象管理”和“cut-link 产出”分开
|
||||
|
||||
验收标准:
|
||||
|
||||
- `body` 不再直接知道具体 LBM kernel 调度
|
||||
- `ObjectManager` 不再承担几何、obs、state、flag 全部职责
|
||||
- `objects.py` 不再直接输出某一种 boundary method 专用打包格式
|
||||
|
||||
### 阶段 2B
|
||||
|
||||
重构 curved boundary 数据链。
|
||||
|
||||
- 定义统一 `cut-link record`
|
||||
- 让圆柱先输出新 record
|
||||
- 让 Bouzidi kernel 消费新 record
|
||||
- 把现有 `CurvedLinkSoA` 从“Bouzidi 专用”改成“通用 cut-link buffer`
|
||||
- donor 与 fallback 的契约集中写入注释,不额外增加复杂语义保护代码
|
||||
|
||||
验收标准:
|
||||
|
||||
- kernel 不需要知道几何来源
|
||||
- host 侧可以替换 cut-link builder 而不改 kernel 接口
|
||||
- 读 builder 与 kernel 时,不需要跨很多文件才能理解 donor 和 fallback 的基本语义
|
||||
|
||||
### 阶段 2C
|
||||
|
||||
为 IBM 留入口。
|
||||
|
||||
- 定义 `marker record`
|
||||
- 预留独立 preprocess 和 runtime buffer
|
||||
- 暂不实现完整 IBM 细节,只把架构位置留好
|
||||
|
||||
验收标准:
|
||||
|
||||
- IBM 不需要重写 body 骨架
|
||||
- IBM 与 Bouzidi 可以共存于同一 body 系统
|
||||
|
||||
### 阶段 2D
|
||||
|
||||
补文档与契约说明。
|
||||
|
||||
- 当前能力
|
||||
- 预留能力
|
||||
- 不支持项
|
||||
- 2D 与 3D 差异
|
||||
- TRT 与 plain Bouzidi 的限制
|
||||
|
||||
## 不建议做的事
|
||||
|
||||
- 不要继续强化万能 `ObjectManager`
|
||||
- 不要让几何对象直接生成某一种边界格式专用 SoA
|
||||
- 不要把 curved boundary 和 Bouzidi 永久绑定
|
||||
- 不要在 3D 运动契约上继续堆占位特例
|
||||
- 不要在第二阶段把多相、IBM、粒子一起全做完
|
||||
- 不要为了“自动保证语义”继续增加很多隐式逻辑分支,优先用集中注释把契约写清楚
|
||||
- 不要引入必须跨很多文件来回跳转才能理解的 host-kernel 组织方式
|
||||
|
||||
## 第二阶段完成后的理想状态
|
||||
|
||||
### 代码层面
|
||||
|
||||
- 文件更短
|
||||
- 模块职责更单一
|
||||
- host-device contract 更显式
|
||||
- kernel 更专注于数值操作
|
||||
- geometry 与 boundary method 解耦
|
||||
|
||||
### 扩展层面
|
||||
|
||||
后续可自然扩展到:
|
||||
|
||||
- 离散几何 cut-link
|
||||
- IBM marker 链路
|
||||
- 粒子和刚体共用 body runtime
|
||||
- 多相流对 body 的额外 coupling
|
||||
|
||||
### 维护层面
|
||||
|
||||
后续新增功能时,优先在对应层增加文件,而不是回到单个 manager 中继续堆逻辑。
|
||||
|
||||
## 建议的执行方式
|
||||
|
||||
第二阶段执行前,先固定一个简短设计约束:
|
||||
|
||||
- 单文件不过长
|
||||
- 新增模块必须有明确职责说明
|
||||
- 任何 host-device 数据结构必须有集中定义
|
||||
- 新接口先定义契约,再写 kernel
|
||||
- 能通过新增 builder 解决的问题,不要回写到 geometry 类中
|
||||
- donor、fallback、time-layer 等关键数值语义必须在少数固定位置集中注释说明
|
||||
- 优先保持文件短和职责单一,不为“保险”堆太多诊断与保护代码
|
||||
|
||||
这个阶段的核心产出不是新功能,而是一个能长期承载新功能的骨架。
|
||||
@@ -0,0 +1,102 @@
|
||||
# Config method diagnosis: FP16S and EsoPull analysis
|
||||
|
||||
**Resolution status: EsoPull — FIXED (v0.5.1); FP16S — inherent Bouzidi incompatibility (not fixable without architecture change).**
|
||||
|
||||
---
|
||||
|
||||
## 1. Overview
|
||||
|
||||
| Method | Original Failure | Root Cause | Status |
|
||||
|--------|-----------------|------------|--------|
|
||||
| **EsoPull** | NaN at D=20; CD ~500-700% error at D=30 | 3 bugs: (1) InitEsoPull wrote physical layout not EsoPull layout; (2) wall BCs used raw `load_ddf` instead of EsoPull semantics; (3) `PrepareEsoPullCurvedKernel` used post-streaming read for pre-streaming force calc | **FIXED v0.5.1** — EsoPull now bit-identical to double-buffer for Kan99b K2 |
|
||||
| **FP16S** | 30-40% CD error even with ddf_shifting | Bouzidi per-direction DDF reads accumulate FP16S quantization noise without direction-averaging cancellation | **Inherent** — requires architecture change (TYPE_E equilibrium boundaries) |
|
||||
|
||||
---
|
||||
|
||||
## 2. FP16S analysis (unchanged from v0.5.0)
|
||||
|
||||
### 2.1 Root cause
|
||||
|
||||
Bouzidi curved boundary reads INDIVIDUAL DDF values per direction per cut-link, with no averaging across directions. At omega~1.9, Re~100, NEQ magnitudes occupy only 1-3 FP16S quantization steps (~3e-5/step). The interpolation ratio (1/q, up to 2x) and moving-wall correction amplify the noise.
|
||||
|
||||
FluidX3D avoids this because `update_force_field()` loads ALL 9 (or 19) directions from neighbor cells into FP32, where averaging cancels quantization noise.
|
||||
|
||||
### 2.2 Known working combinations (FP16S)
|
||||
|
||||
| ddf_shifting | Inlet | D | CD error | Notes |
|
||||
|---|---|---|---|---|
|
||||
| True | zou_he_local | 30 | ~32% | Best FP16S result |
|
||||
| True | zou_he_local | 60 | TBD | Larger D may fare better |
|
||||
| False | any | any | >>100% | Shifting essential for FP16S |
|
||||
|
||||
### 2.3 Recommendations
|
||||
|
||||
FP16S is only usable when D is large (D >= 60) OR when force accuracy is secondary. For production Kan99b validation, use FP32. A proper fix would require a FluidX3D-style TYPE_E equilibrium boundary with full-cell momentum summation.
|
||||
|
||||
---
|
||||
|
||||
## 3. EsoPull root causes and fixes (v0.5.1)
|
||||
|
||||
### 3.1 Bug #1 (critical): InitEsoPull physical-layout write
|
||||
|
||||
**File**: `lbm/kernels/step/init_flow.cu`
|
||||
|
||||
`InitEsoPull` called `write_equilibrium` which wrote `fi[k, i] = f_eq[i]` (physical layout). But `load_f_esopull(t=0)` expects EsoPull backing layout where paired directions are scattered across neighbor cells. At step 0, every direction was read from the wrong slot, producing garbage DDF for collision.
|
||||
|
||||
**Fix**: Added `write_equilibrium_esopull` and `write_rest_equilibrium_esopull` that scatter equilibrium values directly into the EsoPull t=0 backing layout: odd directions to neighbor forward slots, even directions to local reverse slots. Also corrected an odd/even slot swap bug discovered during testing.
|
||||
|
||||
### 3.2 Bug #2 (moderate): Wall boundary functions use raw `load_ddf`
|
||||
|
||||
**File**: `lbm/kernels/boundary/bounce_back.cuh`
|
||||
|
||||
`apply_wall_freeslip_d2q9_y_pull` and `apply_wall_bb_d2q9_y_pull` used `load_ddf(fi, index_f(k, slot))` to read opposite-direction values. In EsoPull mode, `fi[k, slot]` is a backing slot, not a physical direction, so the wrong values were used for half-way bounce-back.
|
||||
|
||||
**Fix**: Extended function signatures with `t` and `j` parameters. When `t > 0`, use `load_physical_dir_pre_streaming` to resolve the correct pre-streaming value in EsoPull layout. When `t == 0`, fall back to raw `load_ddf` (correct for double-buffer).
|
||||
|
||||
### 3.3 Bug #3 (critical for CD): Pre-streaming vs post-streaming semantics error
|
||||
|
||||
**File**: `lbm/kernels/step/aux_kernels.cu`, `lbm/kernels/streaming/esopull_semantic_helpers.cuh`
|
||||
|
||||
`PrepareEsoPullCurvedKernel` used `load_physical_dir_esopull()` to read DDF values for Bouzidi force computation. This helper returns POST-streaming values (the distribution that arrived at a cell after streaming). However, Bouzidi force calculation requires PRE-streaming values — the post-collision distribution that sat at the fluid cell in each direction BEFORE streaming (matching what double-buffer `CurvedBoundaryKernel` reads from `fi_in[k_f, dir]`).
|
||||
|
||||
For odd directions (E, N, NE, SE), `store_f_esopull` writes the pre-streaming value to a NEIGHBOR cell. `load_physical_dir_esopull` then reads the WRONG cell's value for ~50% of directions, producing a systematic ~8x force error.
|
||||
|
||||
**Fix**: Added `load_physical_dir_pre_streaming` in `esopull_semantic_helpers.cuh`. This resolves the pre-streaming value by:
|
||||
- Using `tp = t ^ 1` (previous step's parity) for direction/slot resolution (because `store_f_esopull` at step t-1 wrote the values)
|
||||
- Reading odd-direction values from the neighbor cell (where `store_f_esopull` scattered them)
|
||||
- Reading even-direction values from the local cell
|
||||
- Falling back to `load_physical_dir_esopull` at t=0 (init layout, not store layout)
|
||||
|
||||
All three DDF reads in `PrepareEsoPullCurvedKernel` (`f_toward`, `f_toward_ff`, `f_opp_same`) were updated to use the pre-streaming variant.
|
||||
|
||||
### 3.4 Results
|
||||
|
||||
| Run | Mode | D | St | CD | CD error pre-fix | CD error post-fix |
|
||||
|-----|------|---|------|------|----------|------------|
|
||||
| MR2 | double-buffer (baseline) | 20 | 0.16913 | 1.1367 | — | 2.96% |
|
||||
| MR3 | esopull | 20 | 0.16508 | 1.1009 | ~716% | **0.28%** |
|
||||
| MR1 | double-buffer (baseline) | 30 | 0.16992 | 1.1455 | — | 3.76% |
|
||||
| B1 | esopull | 30 | 0.16647 | 1.1129 | ~539% | **0.81%** |
|
||||
|
||||
**EsoPull is now numerically equivalent to double-buffer for Kan99b K2 (MRT, D=20/30, rotating cylinder with curved boundaries).**
|
||||
|
||||
### 3.5 What the original diagnosis got wrong
|
||||
|
||||
1. **Section 3.3 (init mismatch)**: Correctly identified but underestimated — the suggested "skip first step" fix would NOT work because `EsoPullStep(t=0)` itself also operates on wrong semantics from init layout.
|
||||
|
||||
2. **Section 3.5 (inlet secondary issue)**: Incorrect. The EsoPull inlet/outlet functions already used `load_f_esopull()` (not raw `load_ddf`) for neighbor DDF reads since they were added. This was never a contributing factor to the CD error.
|
||||
|
||||
3. **Section 3.6 (verdict)**: Correctly identified init as root cause of NaN, but missed the pre-streaming bug which was the true cause of CD ~500-700% error. The init bug alone could not explain such a large persistent error.
|
||||
|
||||
---
|
||||
|
||||
## 4. Files modified in v0.5.1
|
||||
|
||||
| File | Change |
|
||||
|------|--------|
|
||||
| `lbm/kernels/step/init_flow.cu` | Added `write_equilibrium_esopull` / `write_rest_equilibrium_esopull`; modified `InitEsoPull` to use them |
|
||||
| `lbm/kernels/streaming/esopull_semantic_helpers.cuh` | Added `load_physical_dir_pre_streaming`; updated usage comments |
|
||||
| `lbm/kernels/step/aux_kernels.cu` | Changed 3 `load_physical_dir_esopull` calls to `load_physical_dir_pre_streaming` in `PrepareEsoPullCurvedKernel` |
|
||||
| `lbm/kernels/boundary/bounce_back.cuh` | Extended wall function signatures; added EsoPull pre-streaming read path; updated module docstring |
|
||||
| `lbm/kernels/step/one_step_esopull.cu` | Updated wall function calls to pass `j` and `t` |
|
||||
| `tests/validation/run_kan99b_rotating_cylinder.py` | Added `--streaming` CLI parameter |
|
||||
@@ -0,0 +1,126 @@
|
||||
# Sub-agent A: CUDA Kernel & Fix Verification
|
||||
|
||||
## 1. 旧修正确认
|
||||
|
||||
### 结论: [已确认] Curved Bouzidi 时序 — aux_kernels.cu:26-65 + stepper.py:71 + one_step_double.cu:20
|
||||
**理由**: `stepper.py:71` 中 `_launch_curved()` 在 `OneStep` 之前调用。`aux_kernels.cu` 的 `CurvedBoundaryKernel` 写入 `f.ddf_gpu`(当前 buffer),其后 `OneStep` 从同一 buffer 做 `stream_pull_load` — 同一时间步内完成"前写入→后拉取"。`one_step_double.cu:20` 中的 `apply_boundary_pull` 对 `is_curved(fl)` 直接 return,确保流体节点不会二次覆盖。调用顺序确认无误。
|
||||
|
||||
### 结论: [已确认] q>=0.5 分支时间层 — curved_boundary.cuh:73-75
|
||||
**理由**: `q >= 0.5` 分支读取 `load_ddf(fi, index_f(k_f, dir_opp))`,其中 `fi` 是当前步骤的 DDF buffer。旧代码读的是前一时间步的缓冲区(`fi_in`),现在读的是当前的 `fi`,即上一时间步碰撞后的 post-collision 数据。Bouzidi 两分支算法都要求同一时间层的 post-collision 数据 [Bou01],当前写法满足此要求。
|
||||
|
||||
### 结论: [已确认] Moving wall 修正按 q 分支 — curved_boundary.cuh:30-43
|
||||
**理由**: `bouzidi_linear_moving_correction` 函数三路分支:
|
||||
- `fallback_class != BOUZIDI` → `2 * alpha_ci_dot_uw`(半格加移动修正)
|
||||
- `q < 0.5` → `2 * alpha_ci_dot_uw`(Bou01 公式)
|
||||
- `q >= 0.5` → `alpha_ci_dot_uw / q`(Bou01 公式)
|
||||
各项系数与文献一致,`alpha_ci_dot_uw = 3 * w_i * (c_i · u_w)`。
|
||||
|
||||
### 结论: [已确认] Forcing 预因子统一 — collision_srt.cuh:15, collision_trt.cuh:35, collision_mrt.cuh:41/116
|
||||
**理由**: 三个文件的类内路径都使用了 `c_tau = 1.0f - 0.5f * omega` 并将 `c_tau * Fin[i]` 增量加到碰撞输出中。`collide_dispatch()`(helpers.cuh:33-37/46-50)在 `d_params.fx/fy/fz`非零时调用 `compute_guo_forcing()` 生成 `Fin`,然后传入对应碰撞函数。三者完全一致。
|
||||
|
||||
### 结论: [已确认] TRT outlet NEQ 全分布重构 — pressure_neq.cuh:45-51(D2Q9):89-95(D3Q19)
|
||||
**理由**: `#if COLLISION_MODEL == 0 || COLLISION_MODEL == 1` 把 TRT 纳入全分布 damped NEQ 分支(与 SRT 同级),对所有 NQ 方向做 `f[i] = feq_tar[i] + beta * fneq`,其中 `fneq = f_neb[i] - feq_neb[i]`,`beta = OUTLET_SRT_NEQ_DAMP`。已不再是"少量未知方向"路径。
|
||||
|
||||
### 结论: [已确认] add_vortex() 除以 rho — initializers.py:55-58
|
||||
**理由**: `ux_old = sum(f[i] * cx[i]) / rho_safe`,`uy_old = sum(f[i] * cy[i]) / rho_safe`。旧 bug 是动量除以 rho 这一步缺失,现在存在 `rho_safe` 分母。
|
||||
|
||||
### 结论: [已确认] Init flag overlay 顺序 — simulation.py:139-159 + init_flow.cu:48-58 + body/manager.py:115-127
|
||||
**理由**: 顺序为 `build_channel_flags()`(干净通道)→ `build_flags()`(叠加物体)→ `upload_flags()`(上传GPU)→ `stepper.initialize()`(运行 init kernel 保持 obstacle flag)。`init_flow.cu:finalize_domain_flag` 对 `is_obstacle(fl)` 直接返回原 flag。`sync_to_gpu(rebuild_flags=False)` 在初始化时不重复构建 flags。`_rest_nonfluid()` 的二次重置已移除。
|
||||
|
||||
---
|
||||
|
||||
## 2. 待验证项复查
|
||||
|
||||
### 结论: [已确认] MRT D2Q9 方向序与符号 — collision_mrt.cuh:46-54,79-92
|
||||
**理由**: 经子代 agent 验证:
|
||||
- `m[3]` = f1−f2 + f5−f6 + f7−f8 = ρ·ux(与 `macro.cuh:36` 的 `compute_rho_u()` 完全一致)
|
||||
- `m[5]` = f3−f4 + f5−f6 − f7 + f8 = ρ·uy(一致)
|
||||
- `m[7]` = f1+f2−f3−f4 = ρ·(ux²−uy²)(一致)
|
||||
- 逆变换系数 `g[0] += (dm0 − dm1 + dm2)/9` 等均符合 `M·M⁻¹ = I`
|
||||
- `meq[4] = −ρ·ux`、`meq[6] = −ρ·uy` 符号正确(正交基结构)
|
||||
- 无符号错误。MRT D2Q9 的 paired 方向排列下的矩变换自洽。
|
||||
|
||||
### 结论: [已确认] Esopull 邻壁行处理 — one_step_esopull.cu vs one_step_double.cu
|
||||
**理由**: 逐行对比 `one_step_esopull.cu:76-151` 与 `one_step_double.cu:65-144`。Double-buffer 在 line 88-94 有显式 `is_fluid(fl) && (y==1 || y==NY-2)` 块调用 `apply_wall_bb_y_pull`,而 Esopull 没有对应分支。**但这不构成 bug** — Esopull 交替读写模式(`load_f_esopull` / `store_f_esopull`,`esopull_single_buffer.cuh:33-77`)天然避免了从 y=0 壁面节点直接拉取垃圾数据:
|
||||
- 偶数步:f[3] 读取本地 `fi[n, 4]`(前一步该节点的 -y 方向),f[4] 读取 `fi[j[3], 3]`(y=2 的 +y 方向)
|
||||
- 奇数步同理交错
|
||||
两个时间步的综合效果等价于半格 BB 的反射,无需显式修正。壁面节点 (y=0) 经 `apply_boundary_esopull` → `bounce_back_swap` 处理,不会积累垃圾。
|
||||
|
||||
### 结论: [无法确认: 需运行验证] Force 提取与符号约定 — curved_boundary.cuh:90-97 + obs.cuh + manager.py:328-338
|
||||
**理由**: 链路追踪如下:
|
||||
1. `curved_boundary.cuh:91-97`: `fx = c_x * (f_toward + f_reflected)` 累加到 `obs[obs_force_index(body_id, 0)]`
|
||||
2. `obs.cuh:11`: `obs_force_index(id_obj, d) = OBS_FORCE0_FLOATS + id_obj * DIM + d`(起点=0)
|
||||
3. `manager.py:read_force()`: 返回 `self.obs_pinned[i0:i0 + d]`,无符号反转
|
||||
- 存储的是流体动量交换量 (fluid momentum exchange),不是物体受力的直接值(牛顿第三定律要求 `F_body = -F_fluid`)。如果外部 Cd/Cl 归一化时把 obs 直读值当做物体受力,符号会反转。需用已知算例(如静止圆柱的阻力系数)确认当前实践是否在外部做了隐含的取反。
|
||||
|
||||
---
|
||||
|
||||
## 3. 架构缺陷
|
||||
|
||||
### 结论: [未改] Curved boundary 仍假设圆形/球形 — curved_boundary.cuh + body/objects.py:110-291
|
||||
**理由**: `Cylinder.get_curved_list()` 对每个 cut link 调用 `find_circle_intersection` / `find_sphere_ray_segment`,完全依赖于圆/球几何参数(center + radius)。没有通用多边形/三角网格接口。旧审计标记的 [待重构] 未处理。
|
||||
|
||||
### 结论: [未改] 3D 旋转为 z 轴占位 — aux_kernels.cu:58-63
|
||||
**理由**: `CurvedBoundaryKernel` 的 D3Q19 分支中 `Ww = 0.0f`,且 `Uw = -omega * ry; Vw = omega * rx` 只包含 xy 平面转动。任何具有 z 分量的刚体旋转都不会产生正确的壁面速度。
|
||||
|
||||
### 结论: [已备注] Bouzidi-TRT 不相容注释 — curved_boundary.cuh:17-21
|
||||
**理由**: 注释明确说明 "plain linear Bouzidi interpolation ... is not a TRT-parametrized curved-wall family",位置精准且语意清晰。
|
||||
|
||||
---
|
||||
|
||||
## 4. 新发现
|
||||
|
||||
### 4a. `_no_force` 碰撞变体为死代码 — collision_srt.cuh:25, collision_trt.cuh:57, collision_mrt.cuh:95
|
||||
**问题**: `collide_srt_no_force`、`collide_trt_no_force`、`collide_mrt_no_force` 三个函数在编译后的任何内核路径中均不被调用。`collide_dispatch` (helpers.cuh:15-69) 始终通过带 `Fin` 数组的普通变体执行碰撞,当外力为零时通过 `zero_forcing(Fin)` 将 `Fin` 全清零。死代码约 40 行。
|
||||
**影响**: 无功能影响,增加维护成本。`zero_forcing` 仅用于栈初始化,并非无用调用。
|
||||
|
||||
### 4b. BC_MOVING / BC_PERIODIC 有定义无处理 — flags.cuh + 全内核搜
|
||||
**问题**: `FLAG_BC_MOVING (0x0060)` 和 `FLAG_BC_PERIODIC (0x0050)` 在 `flags.cuh` 有定义,Python 侧 `descriptors.py` 也有对应常量。但 CUDA 内核中没有针对 `is_moving()` 或 `is_periodic()` 的分支处理:
|
||||
- `one_step_double.cu:apply_boundary_pull` 只有 `is_curved/is_inlet/is_outlet/BBS` 分支
|
||||
- 任何单元格若被标记 `BC_MOVING`(非 curved 路径)将落入 `bounce_back_swap()` 分支,得到 std half-way BB 而非移动壁面速度修正
|
||||
**影响**: 只有当 obstacle 使用 `BC_CURVED` 配合 `cl_body_id` 进入 curved boundary kernel 才能获得正确移动壁面速度。`BC_MOVING` 直接标记在通道壁面或其他固体节点上无效果。
|
||||
|
||||
### 4c. Outlet NEQ 的 `OUTLET_MODE` 嵌套逻辑可读性隐患 — pressure_neq.cuh:25-62
|
||||
**问题**:
|
||||
```
|
||||
#if OUTLET_MODE == 1 → 纯拷贝未知方向
|
||||
#else → 普通路径
|
||||
#if COLLISION_MODEL==0||1 → 全分布 NEQ(含 TRT)
|
||||
#elif OUTLET_MODE == 2 → 混合模式
|
||||
#else → 少量未知方向重构(默认 OUTLET_MODE=0 路径)
|
||||
#endif
|
||||
#endif
|
||||
```
|
||||
当 `OUTLET_MODE=0`、`COLLISION_MODEL=2`(MRT)时,代码进入最内层 `#else` 分支(少量未知方向重构),而非全分布 NEQ。这与注释宣称的"SRT 和 TRT 使用全分布 NEQ"一致(MRT 未承诺),但 MRT outlet 路径与 SRT/TRT 行为不同,可能导致 MRT 结果系统性偏差。
|
||||
**影响**: MRT outlet 行为与 SRT/TRT 不一致,应至少加注释说明此差异,或行为对齐。
|
||||
|
||||
### 4d. `collide_inlet_ghost` 对 `y=0/NY-1` 的过滤 — one_step_double.cu:102-103, one_step_esopull.cu:106-107
|
||||
**问题**: `collide_inlet_ghost = is_inlet(fl) && interior_y && inlet_scheme_uses_post_collision_ghost()`,其中 `interior_y = (y>0 && y<NY-1)`。`y=0` 和 `y=NY-1` 的 inlet 节点不会触发 ghost 碰撞。但 `inlet_scheme_uses_post_collision_ghost()` 只在 `INLET_SCHEME==0`(Zou-He)时返回 true,而 x=0 inlet 节点原本处于 y=0 或 y=NY-1 时,已被 `build_channel_flags` 覆盖为 `SOLID|BC_WALL`(角点优先),因此这些节点本身不是 inlet,过滤是安全的。
|
||||
**影响**: 当前无实际影响(角点 wall 覆盖 inlet),但代码隐含的逻辑依赖比较脆弱。如果未来修改建标记序,可能在 y=0/ymax inlet 节点产生未碰撞 ghost 状态。
|
||||
|
||||
### 4e. 传感器归一化在 manager 层正确实现 — aux_kernels.cu:67-99 + manager.py:348-365
|
||||
**结论**: `SensorKernel` 做逐格点求和,`ObjectManager.read_sensor(normalize=True)` 除以 `sensor_cell_counts[body_id]`。已实现,正确。
|
||||
|
||||
### 4f. `inlet_target_u` 对 y=0 和 y=NY-1 的保护 — inlet/common.cuh:34
|
||||
**影响**: `y_clamped = fminf(NY-2, fmaxf(1.0, y))` 使 y=0 节点获得 y=1 的 inlet 速度。对正确定义的 `SOLID|BC_WALL` 角点无实际影响,属于保护性逻辑。
|
||||
|
||||
### 4g. `compute_omega_minus` 在 ω⁺ = 2.0 时分母为零 — collision_trt.cuh:24-26
|
||||
**问题**: `1.0f / omega_plus - 0.5f` 当 `omega_plus = 2.0` 时为 `0.5 - 0.5 = 0`,导致除零。实际路径中 `omega_col` 在 `collide_dispatch` 中被钳位(helpers.cuh:56),假设 `OMEGA_COLLISION_MAX < 2.0` 则为安全。
|
||||
**影响**: 低风险(依赖外部宏正确配置)。
|
||||
|
||||
### 4h. `west_velocity_rho_closure` 在 u_target ≥ 1.0 时除零 — inlet/common.cuh:47-48
|
||||
**问题**: `rho = sum(...) / (1.0f - ux_target)`,当 `ux_target >= 1.0` 时除数为 0 或负数。物理上入口马赫数小于 1 可避免,但无运行时保护。
|
||||
**影响**: 低风险(物理约束),但崩溃行为不如显式断言清晰。
|
||||
|
||||
---
|
||||
|
||||
## 总结
|
||||
|
||||
| 类别 | 数量 | 关键项 |
|
||||
|------|------|--------|
|
||||
| 旧修正确认 | 7/7 | 全部确认正确 |
|
||||
| 待验复查 | 3 | 2 确认, 1 需运行时验证 |
|
||||
| 架构缺陷 | 3 | 圆形硬编码、3D占位、TRT注释齐全 |
|
||||
| 新发现 | 8 | 4a死代码、4b未处理BC、4c MRT outlet差异、4d脆弱逻辑依赖、4e已实现、4f无害保护、4g除零边界、4h无保护输入 |
|
||||
|
||||
**最高优先级**: 4b (`BC_MOVING` 无处理路径)、4c (MRT outlet 路径与 SRT/TRT 不一致)、force 符号约定需运行验证。
|
||||
@@ -0,0 +1,57 @@
|
||||
# Compatibility and API changes
|
||||
|
||||
Changes that can make a previously accepted setup or call behave differently.
|
||||
Each entry names the commit, the affected entry points and the observable result.
|
||||
|
||||
## Redundant periodic stepper alias removed
|
||||
|
||||
`PeriodicPatchStepper` is no longer exported from `lbm.refinement_stepper`.
|
||||
Use `FixedPatchStepper` with the same arguments, including explicit
|
||||
`level_blocks`. The old name was an alias for that exact class; periodic
|
||||
boundaries remain the default. Existing imports of the old name must be updated.
|
||||
|
||||
## 87c3a31: cut-link ownership is validated for every body
|
||||
|
||||
`validate_cut_link_ownership` (`body/preprocess/flag_overlay.py`) now runs for
|
||||
passive bodies as well as Jet/aperture bodies. Every cut link must have an
|
||||
active fluid receiver (FLUID set, SOLID clear), and each `(receiver, direction)`
|
||||
population may have only one writer.
|
||||
|
||||
Rejected with `ValueError`, before flags, populations or device buffers change:
|
||||
|
||||
1. Overlapping or touching passive solids whose cut links write the same
|
||||
population ("Boundary requires unique cut-link writers").
|
||||
2. A body whose cut-link receiver is a non-fluid cell, e.g. a channel wall row
|
||||
or the inlet/outlet column ("Cut links must have active fluid receivers").
|
||||
|
||||
Both were previously accepted silently for passive bodies; the interpolated
|
||||
boundary then had undefined results. The rules apply to the cut links of all
|
||||
bodies together, so a passive body overlapping a Jet body is rejected as well.
|
||||
The check runs in `Simulation.initialize`, runtime body sync (`sync_bodies`),
|
||||
checkpoint save and checkpoint load (`common/checkpoint.py`). Load validates
|
||||
before restoring anything, so a checkpoint whose saved geometry violates either
|
||||
rule no longer restores; rebuild the geometry with separated bodies.
|
||||
|
||||
## 87c3a31: `Simulation.read_surface_exchange` accepts Jet-driven bodies
|
||||
|
||||
`read_surface_exchange(id)` previously required `SurfaceActuation` on the body.
|
||||
It now also accepts bodies that own Jet aperture links, including Jets with zero
|
||||
or negative amplitude (the aperture test is geometric). Bodies with neither
|
||||
`SurfaceActuation` nor aperture links still raise
|
||||
`ValueError("Body has no surface actuation")`. The value is unchanged: the latest
|
||||
step's wall/aperture exchange, not total nozzle force.
|
||||
|
||||
## 7afb5ad: `Simulation` fails closed after a Jet amplitude device-write failure
|
||||
|
||||
`Simulation.set_jet_amplitude` previously only documented that a device error
|
||||
leaves the per-link velocity column undefined; the instance stayed usable.
|
||||
Now any error after input validation (internal stream creation or the upload)
|
||||
marks the Simulation failed. Every later device-touching public method,
|
||||
including the `stream` property (guard added in the follow-up repair commit on
|
||||
`claude/jet-update-consistency`), raises
|
||||
`RuntimeError("Simulation failed (...); close() and recreate it")`. The host
|
||||
amplitude keeps its previous value. `close()` still works and stays retryable;
|
||||
cached host readers and host staging calls are not blocked. Invalid input
|
||||
(`ValueError`/`IndexError`) is unchanged: it raises before any change and the
|
||||
instance stays usable. `FixedPatchStepper.set_jet_amplitude` already failed the
|
||||
instance (status `failed`) and is unchanged.
|
||||
@@ -0,0 +1,86 @@
|
||||
# Continuous VIV videos
|
||||
|
||||
Research-only, two separate settings, each one uninterrupted OFF -> ON -> OFF
|
||||
fluid/oscillator trajectory. No production changes, topology switching, moving
|
||||
checkpoint feature, retraining, force filtering, or parameter search.
|
||||
|
||||
The user selected separate videos because runtime topology changes are unsupported
|
||||
with translating circles. This is deliberately different from the old Legacy
|
||||
multi-setting video, which rebuilt solvers and transferred full state.
|
||||
|
||||
## Frozen physical and control contract
|
||||
|
||||
- Source baseline `73d3f6214e0d28ced4744665aa3bb05522aa2fa8`; D40, U=.005,
|
||||
nu=.004, MRT/FP32/unshifted double-buffer. Same parabolic regularized inlet,
|
||||
NEQ outlet and bounce-back walls as the retained m*=4 pair.
|
||||
- Common transverse assembly: m*=4 (all three disks), fn D/U=.2, zeta=0.
|
||||
Structure uses previous native-step sum CME_y+Wen_y. No policy-force averaging
|
||||
is applied to this RHS. Same +/-D travel, speed, finite-state and no-donor stops.
|
||||
- Each phase: Karman400 complete SI of3200, steady320 SI of4000 native steps
|
||||
=160 D/U. Steady's SI follows the actual old video1000-step interval under
|
||||
diffusive D40 scaling, rather than borrowing PPO's800-step interval. Total480 D/U.
|
||||
No extension, retuning or replacement if steady motion/control is weak.
|
||||
- Steady: canonical new-reproduce constant surface velocities
|
||||
(0,-5.1,+5.1) U. This is NOT a PPO transfer. No model/normalizer is loaded.
|
||||
Existing 2,048,000-step at-rest warmup precedes the free response.
|
||||
- Karman: actual pinball Re_D50, historically named `karman_re100`, frozen
|
||||
model `148240c1dcb8b11d8e5a0a9e991f6874c4e799c9744707bf0fb32a8efeb0468d`
|
||||
and norm `534fda818c030a56960e95d0f3ac1e350d887d03db7f80f1d6453195a502b7f0`.
|
||||
Use the verified static release once, at video start (clock4576000).
|
||||
- Both switches occur on SI boundaries. The oscillator y/v, previous RHS,
|
||||
both DDF buffers, moving geometry and solver clock are never reset. OFF still
|
||||
gathers sensor/CME observations. First PPO action uses the immediately previous
|
||||
complete OFF interval, unlike an independent arm's initial all-zero observation.
|
||||
Deterministic feed-forward PPO has no recurrent state. EMA resets to zero each
|
||||
SI, as in training/reproduction; original video's SplitAdvance also reset the
|
||||
constant-steady actuation every interval. Physical OFF is exactly zero wall speed.
|
||||
There is no extra transition blend. The first1 D/U after either switch is
|
||||
explicitly labeled a switch transient. ON from an already moving state differs
|
||||
from the previous independent pair; +/-D stops are retained without retuning.
|
||||
A visual ON label means enabled control,
|
||||
not a proven suppression/cloaking result.
|
||||
|
||||
## Video provenance and presentation
|
||||
|
||||
Read-only source: DynamisLab `src/drl_pinball/reproduce/continuous_video.py`, SHA256
|
||||
`3bd9c777171c9e8932c78298accbb6f61a8323b0eed5938e0f56e167b3df0743`.
|
||||
Approved original MP4 SHA256
|
||||
`578d2cf5113429006b6919bbb8ef8ff6ce65ebcd0c056ac478f8ce2515e4cbab`.
|
||||
The actual new-reproduce conversation confirms fixed-position plain-language
|
||||
labels, white bars, OFF/ON toggle, rotation sectors, and 1/2/5/10/5/2/1 gears.
|
||||
|
||||
Only the display idiom/gear schedule are reused. Legacy population decoding,
|
||||
physics, topology handoff and policy runner are not imported. Modern macroscopic
|
||||
fields feed centered vorticity with all stencil nodes fluid. Fixed color limits
|
||||
[-3,+3], 21 RdBu_r bins; per-frame clipping fraction retained. Box downsampling
|
||||
is display-only. Both main field and enlarged inset have fixed lab coordinates;
|
||||
the inset shows the equilibrium line. Actual moving centers and applied surface
|
||||
speeds drive the body overlays. y/D trace has fixed +/-1 limits. No motion gain.
|
||||
|
||||
1280x800,30fps; first80 D/U of each phase uses the original display gear ramps,
|
||||
last80 D/U uses normal cadence (800 native steps/frame =.1D/U). Every native
|
||||
step and every SI is still executed. Streaming ffmpeg avoids stored PNG sequences.
|
||||
Keep raw scalar histories, SI observations/actions, per-frame time/motion records,
|
||||
selected keyframes, source/input hashes and terminal status. These are new
|
||||
continuous runs, not an exact replay of the old independent paired histories.
|
||||
|
||||
## Gates and limits
|
||||
|
||||
CPU: switch-state/clock continuity, first ON observation, exactly zero OFF action,
|
||||
SI timing despite sampling, physical scaling, schedule monotonicity, vorticity
|
||||
sign/mask, fixed-coordinate mapping. Real smoke:32 warmup +3x32 response steps
|
||||
on D40 (smoke SI32), all switches/encoder; not a physical comparison. Grok reviews
|
||||
the exact research diff before full runs. Capture no-donor, finite state, native
|
||||
RHS and all stop outcomes. Report per-phase late-half motion statistics and
|
||||
raw-force limits; appearance and successful duration are not physics qualification.
|
||||
|
||||
Example (outputs must be new, outside checkout; select a safe GPU):
|
||||
|
||||
```sh
|
||||
CUDA_VISIBLE_DEVICES=0 PYTHONPATH=src python research/continuous_viv/run.py --scene steady --out /tmp/celeris-results-continuous-viv/steady
|
||||
CUDA_VISIBLE_DEVICES=0 PYTHONPATH=src python research/continuous_viv/run.py --scene karman --model /tmp/celeris-karman-viv-assets/model.zip --norm /tmp/celeris-karman-viv-assets/norm.json --release-dir /tmp/celeris-results-karman-viv-516975e/pair --out /tmp/celeris-results-continuous-viv/karman
|
||||
```
|
||||
|
||||
Append `--smoke` and use separate output directories for the bounded gates.
|
||||
The Karman smoke does not read/install the physical release. Source and review
|
||||
SHA, interpreter/version and GPU resource readings belong in the execution receipt.
|
||||
@@ -0,0 +1,62 @@
|
||||
# Selective LES normalization integration on dev8403956
|
||||
|
||||
This change reuses the reviewed correction from 5465832 without merging its
|
||||
branch history. The only production change is the two closed-form coefficients
|
||||
18 -> 18 sqrt(2) and their explanatory comments in turbulence_smag.cuh. Its SHA256
|
||||
is a3db46c2e7d27530b2d1436e65cdbed0b72cc7e047bfbeef2a640877271b51aa.
|
||||
Defaults, iterative/deviatoric/capped closure, collision dispatch, AMR guards,
|
||||
and all other production source files are unchanged.
|
||||
|
||||
## Separate source contract; unchanged experiment
|
||||
|
||||
The single existing flow runner now accepts `--experiment dev8403956`.
|
||||
Its separate source_pins_dev8403956.json pins all 101 production files from the
|
||||
committed 8403956 baseline; corrected mode permits only the exact reviewed
|
||||
header substitution. Results record the actual checkout commit, import path,
|
||||
experiment name and manifest SHA256. No arbitrary manifest-path override exists.
|
||||
|
||||
Omitting the option still selects the original historical source manifest.
|
||||
That manifest, the original paired receipts, scalar preparation manifests and
|
||||
independent continuum oracle are unchanged. Historical baseline and corrected
|
||||
receipts remain evidence for their own exact sources, not new dev receipts.
|
||||
Historical guards intentionally reject this different dev source tree. Eight
|
||||
production files already differed between the historical source snapshot and
|
||||
8403956; neither the old manifest nor its acceptance is silently regenerated.
|
||||
|
||||
The physical experiment and every numerical acceptance threshold are unchanged:
|
||||
8 x 34 nodes, halfway y walls, periodic x, unforced D2Q9/SRT, shifted FP32,
|
||||
double-buffer streaming, Cs=0/.16/1, checkpoints 519/1038/2075. Each case has one
|
||||
actual advancing warm-up followed by complete initial-state restoration before
|
||||
READY. Total launches are 6,225 measured plus three warm-ups. Cs=1 remains an
|
||||
amplified diagnostic, not a physical coefficient recommendation.
|
||||
|
||||
## Host checks
|
||||
|
||||
PYTHONDONTWRITEBYTECODE=1 python -m unittest discover -s tests/unit -p 'test_smagorinsky_normalization.py' -v
|
||||
PYTHONDONTWRITEBYTECODE=1 python -m unittest discover -s tests/unit -p 'test_les_flow_*.py' -v
|
||||
|
||||
The direct-current-header test is copied unchanged from reviewed 5465832:
|
||||
120 tensor parameter cases, Cs=0/equilibrium and omega guards, converged
|
||||
trace-free iterative comparison, and mutation detection in both lattice
|
||||
algebras. This is scalar D2/D3 algebra coverage, not 3D-flow qualification.
|
||||
Flow tests retain analytic/reference checks and add current named-source,
|
||||
reverse-patched baseline, variant rejection, unrelated-source tampering and
|
||||
immutable historical-default checks. The temporary baseline is constructed
|
||||
only inside a test directory; production is never reverse-patched.
|
||||
|
||||
## Pending final-commit GPU gate
|
||||
|
||||
After independent review and explicit executor authorization, run from the
|
||||
exact committed candidate checkout, selecting the authorized physical GPU:
|
||||
|
||||
CUDA_VISIBLE_DEVICES=<physical-GPU> PYTHONDONTWRITEBYTECODE=1 python tests/validation/run_uniform_les_flow.py --root "$PWD" --experiment dev8403956 --variant corrected --run-gpu --device 0 --output <new-evidence-directory>/corrected.json
|
||||
|
||||
Retain all source hashes, exact commit/import/device identity, manifest hash,
|
||||
three READY/reset records, complete result JSON, stdout/stderr and actual exit.
|
||||
Require all frozen gates, DONE passed=true and exit 0. Compare with historical
|
||||
corrected evidence without relabeling it as current evidence. The old-vs-new
|
||||
normalization discrimination already exists; no new baseline GPU run is needed
|
||||
unless review finds a changed exercised uniform solver path.
|
||||
|
||||
No GPU result is claimed by this integration preparation. This does not expand
|
||||
LES qualification to MRT, forcing, AMR LES or three-dimensional turbulent flows.
|
||||
@@ -0,0 +1,57 @@
|
||||
# Experimental projected G explosion
|
||||
|
||||
`FixedPatchStepper(..., explosion="projected_linear")` changes only the existing
|
||||
G-to-G explosion reconstruction. The omitted/default `"constant"` selector retains
|
||||
the same kernel, launch arguments and device allocations. Projected mode adds two
|
||||
compact tables per adjacent pair; recursion, collision, BFL, restriction, buffer
|
||||
ownership and synchronized publication are unchanged. `remap_finest` preserves it.
|
||||
|
||||
Runtime eligibility is periodic-root, fully blocked D2Q9/SRT/FP32, body/Jet-free,
|
||||
without LES; the fixed-patch backend has no forcing interface. Shifted and unshifted
|
||||
storage use the same reconstruction. One generic builder handles scalar windows,
|
||||
unique union rows and all adjacent hierarchy pairs without depth/rectangle caps.
|
||||
Donors are original explosion donors intersected with owned, uncovered ACTIVE
|
||||
cells. An axis uses centered differences only if both neighbors are legal;
|
||||
otherwise both addresses repeat the center. Nested layout periodicity is explicit.
|
||||
No covered cells, holes, inactive cells or stale halo copies enter the stencil.
|
||||
|
||||
The 33-line kernel is unchanged from our `519473a` experiment and retains its
|
||||
mathematical attribution. Host tests cover union decomposition, concavity, narrow
|
||||
gaps, grazing packet paths, offsets, sparse/nested owner addresses, three/four-level
|
||||
source timing, unchanged constant dispatch, remapping and shifted/unshifted actual
|
||||
kernel arithmetic compiled as host C++. These are not CUDA or flow validation.
|
||||
|
||||
## Reviewed bounded evidence
|
||||
|
||||
The `1aa8110` CUDA gate, with production exactly `a135252`, passed exact-dev
|
||||
omitted/default and explicit-constant equivalence, per-population reconstruction,
|
||||
scalar/union/four-level scheduling, alternate layouts, and changed remapping in
|
||||
both storage modes. Operator maximum error was 2.98023224e-8; the eight-step
|
||||
concave replay maximum was 1.58037614e-7. Whole-step mass/momentum remain
|
||||
finite diagnostics, not an FP32 conservation certificate. Reviewed evidence:
|
||||
`7aa66ff0542175092753ea099f40b903ece0527e`.
|
||||
|
||||
The fresh four-case `2cf9853` N128/256 Taylor–Green repeat retained all `11901a7`
|
||||
settings and gates. All 20 main scalar rows and 260 early-pressure samples matched
|
||||
the older receipts exactly; this is not field-array equality. Projected worst
|
||||
velocity was 0.001995299260844 versus 0.002 (only 0.235% margin), pressure
|
||||
0.012157174904932 and energy 0.001184362645162. Constant velocity
|
||||
0.004418076615223 failed its gate, so the aggregate verdict remains false.
|
||||
The projected early sampled pressure peak was 0.021621453573334; it remains a
|
||||
descriptive sampled maximum. Reviewed evidence: `90849a55cad4a0da9b72747da7bfe6eb75962a44`.
|
||||
|
||||
The old N64 projected failures remain relevant. These results support only this
|
||||
bounded plumbing gate and short periodic Re100 smooth-decay experiment. They do
|
||||
not establish union/multilevel physics accuracy, convergence, long-time stability,
|
||||
body/Jet, boundary, forcing, MRT or LES suitability. Constant remains the default.
|
||||
|
||||
## Separate LES source profile
|
||||
|
||||
The two older LES source manifests and the historical default are unchanged and
|
||||
correctly reject this different source tree. The existing LES runner now offers
|
||||
`--experiment a135252`, pinning all 101 actual committed corrected source files.
|
||||
Its explicit baseline-header override describes only a synthetic isolated reverse
|
||||
control, never the committed a135252 header. The unchanged corrected-only uniform
|
||||
LES regression (Cs=0/.16/1) is the remaining integration gate; no LES result is
|
||||
inherited from the projected evidence. The separate historical jet-CV `channel.py`
|
||||
pin mismatch predates this port and is not addressed here.
|
||||
@@ -0,0 +1,73 @@
|
||||
# Raw multilevel boundary exchange (opt-in candidate)
|
||||
|
||||
Use `FixedPatchStepper(..., observe_raw_exchange=True)` and, after a successful
|
||||
base step, `read_raw_exchange(body_id, level=l, window="last_base_step")`.
|
||||
The alternative window is `"last_substep"`. Body IDs are object positions within
|
||||
the named level, not the object's original user label. The torque reference is
|
||||
that circle's geometry.center (the center used to construct BFL arms), reported
|
||||
in the root edge frame. A differing SimObject.center does not change this reference. Current geometry
|
||||
restrictions are unchanged: fixed complete bodies on the finest level, isolated
|
||||
from the transfer footprint. New observation currently requires blocked body
|
||||
storage; dense-body configurations raise before device allocation. Existing
|
||||
dense diagnostics are unchanged.
|
||||
|
||||
Each result contains `wall`, `aperture`, `total`, with `force`, `torque`,
|
||||
`impulse`, `angular_impulse`, `mass_into_fluid`, and `mass_rate`. These are raw
|
||||
boundary momentum reaction, not validated stress or whole-nozzle mechanical
|
||||
load. No GI/advective correction or guessed thrust is added. Apertures retain
|
||||
their geometric classification when their prescribed velocity is zero.
|
||||
|
||||
All results are base-lattice units per unit out-of-plane depth. For local
|
||||
spacing and timestep h=dt, raw `(jx,jy,tz,dm)` converts to impulse
|
||||
`(h*dt*jx,h*dt*jy,h*h*dt*tz)` and mass `h*h*dm`.
|
||||
The accumulator intentionally accepts h and dt separately to make the spatial
|
||||
and temporal conversion explicit; the current acoustic hierarchy supplies dt=h.
|
||||
The stored rx/ry arms run from geometry.center to the actual wall hit, not to
|
||||
the fluid node. For this raw exchange j=c_i(a+b), moving the arm from the fluid
|
||||
node to the hit adds q*c_i, whose cross product with j is zero. Thus either arm
|
||||
gives the same raw torque (up to floating-point rounding); this equivalence
|
||||
must not be assumed for a future nonparallel stress/advective correction.
|
||||
|
||||
Force/torque are impulse/angular impulse divided by the reported window length.
|
||||
`dm=b-a` is positive into the exterior fluid, while j is the opposite of the
|
||||
fluid's momentum change across that cut link. Interpolated BFL can introduce
|
||||
mass drift; dm is an observation, not an assertion of impermeability.
|
||||
|
||||
`last_base_step` means [t-1,t] even after step(n); `last_substep` means [t-h,t]
|
||||
and is not a common instantaneous sample across levels. A Jet amplitude set
|
||||
before step(1) applies to all its substeps. Reads are repeatable; step(0) leaves
|
||||
them unchanged. Initialization and a remap candidate invalidate observation.
|
||||
Only successful stream synchronization publishes a window; failed instances
|
||||
reject reads rather than returning partially advanced measurements.
|
||||
|
||||
Storage is one FP32 [N,4] raw array and one FP64 [N,4] integral per measured
|
||||
level, plus row metadata. No substep history is stored. Same-stream sequencing
|
||||
is halo/restriction -> BFL -> independent row accumulation -> step. There are
|
||||
no accumulation atomics or body obs offsets (blocked n_objects remains zero).
|
||||
Disabled observation allocates neither observation buffer and launches no
|
||||
accumulation kernel. The standalone periodic block caller passes explicit
|
||||
null optional arguments.
|
||||
|
||||
## Gates
|
||||
|
||||
CPU (standard library unittest, plus existing NumPy dependency):
|
||||
|
||||
PYTHONPATH=src python -m unittest discover -s tests/unit -p test_raw_exchange.py -v
|
||||
|
||||
GPU, explicitly on a CUDA host with the existing environment:
|
||||
|
||||
PYTHONPATH=src python -m unittest discover -s tests/validation/multigrid -p test_raw_exchange_gpu.py -v
|
||||
|
||||
The GPU suite includes an independent actual-population cut-link census and
|
||||
ACTIVE-fluid momentum/mass ledger with non-body boundary flux, observation
|
||||
on/off population equivalence, dense/blocked row comparison, three block
|
||||
partitions, zero/step/reversed/disabled Jet amplitudes, depth-four eight-sample
|
||||
accumulation, and a short-time whole-domain uniform-fine comparison with the
|
||||
same physical geometry, viscosity and Jet velocity. The uniform reference
|
||||
uses a test-only adapter to the standalone kernel's optional inputs.
|
||||
|
||||
These are implementation checks. They do not establish physical Jet/stress
|
||||
accuracy, long-time AMR error, or convergence order. Resolution/long-time
|
||||
studies and independently validated continuum load benchmarks remain separate.
|
||||
GPU gates were prepared but not run in the authoring environment (no CUDA,
|
||||
PyCUDA or nvcc); run them before merging this candidate.
|
||||
@@ -0,0 +1,34 @@
|
||||
# MRT reuse in blocked/refined stepping (candidate)
|
||||
|
||||
Base `9805383`. Opt-in by `LBMConfig(collision="MRT")`; SRT remains the default and its
|
||||
kernel statements, including the shifted retained-delta/direct-momentum path, are unchanged
|
||||
under the alternate compile branch.
|
||||
|
||||
## What changes
|
||||
- `blocks.cu` (`BlockStep`), `step/block_channel.cu` (`BlockChannelStep`) and `refinement.cu`
|
||||
(`patch_collide`) gain a compile-time `COLLISION_MODEL == 2` branch that repeats the uniform
|
||||
`collide_dispatch` sequence with zero forcing: `compute_rho_u`, omega clamp to
|
||||
`[OMEGA_COLLISION_MIN, OMEGA_COLLISION_MAX]`, `collide_mrt_no_force`.
|
||||
- Kernel and host guards accept SRT or MRT only. TRT, LES, non-FP32 storage, non-double-buffer
|
||||
streaming, and shifted dense/mixed refinement remain rejected.
|
||||
- Transfers, subcycling, BFL, raw exchange ledgers and channel closures are untouched. The
|
||||
existing pressure-NEQ outlet selects its MRT branch (unknowns-only NEQ extrapolation) from
|
||||
`COLLISION_MODEL`, so MRT channel parity must use uniform MRT as reference.
|
||||
|
||||
## Contracts (existing operator, not redefined here)
|
||||
- Shifted storage uses the existing MRT representation (equilibrium moments from `rho - 1`),
|
||||
not the SRT retained-delta/direct-momentum precision. Mass and momentum are conserved
|
||||
moments (relaxation rate 0).
|
||||
- Kinetic rates are the operator's fixed `s_e = s_eps = s_q = 1.2` on every level; the shear
|
||||
rate is the existing per-level omega. Under acoustic 2:1 scaling the physical bulk viscosity
|
||||
therefore halves on each finer level. No rate rescaling is applied.
|
||||
- No LES, no external forcing (`d_params` force fields stay zero).
|
||||
- Shifted Jets stay SRT-only: `body/jets.py` keeps its existing guard. This extension does not
|
||||
provide shifted MRT Jets.
|
||||
- `PeriodicBlockStepper` (uniform blocked stepper) remained SRT-only; it was removed in 8e1feff and its single-level capability, still SRT-only, is `FixedPatchStepper(refinements=[])`.
|
||||
|
||||
## Evidence status
|
||||
CPU: `tests/unit/test_refinement_mrt.py` (host guards, source contract). GPU:
|
||||
`tests/validation/multigrid/test_refinement_mrt_gpu.py` (uniform-MRT channel parity, AMR MRT
|
||||
smoke) and unchanged SRT GPU tests. Strict parity may be subject to cross-kernel FMA
|
||||
contraction differences already documented for SRT. Not a DFG/benchmark validation.
|
||||
@@ -0,0 +1,22 @@
|
||||
# Blocked AMR root channel increment
|
||||
|
||||
Opt in with `FixedPatchStepper(..., coarse_boundary="channel", refinements=[bounds], level_blocks=[(by,bx), (fy,fx)])`. Every level must be blocked. The supported boundary is the existing uniform D2Q9/SRT/FP32 double-buffer channel: local Zou-He west inlet, pressure-NEQ east outlet, stationary halfway bounce-back y walls. Uniform and parabolic inlet profiles and shifted/unshifted storage are supported; the existing configuration guards still reject MRT/LES and incompatible storage. This does not change the external DFG MRT reference.
|
||||
|
||||
`step/block_channel.cu` is a small root-only kernel. Fine kernels, transfer kernels and recursive hop scheduling are unchanged. Global coordinates and the global profile height/velocity are separate from block-local storage strides. Corner ownership and collision phases match `OneStep`:
|
||||
|
||||
- y-edge ghosts (including corners): pull, pair swap, no collision
|
||||
- west ghosts at interior y: Zou-He reconstruction then SRT collision
|
||||
- east ghosts at interior y: pressure NEQ from the immutable left input node, no collision
|
||||
- physical fluid beside y walls: same-node opposite-input correction then collision
|
||||
|
||||
The root uses the uniform SRT equilibrium arithmetic, including the existing shifted rho-minus-one path, to preserve matched-root semantics. Fine `BlockStep` retains its existing shifted direct-momentum/retained-density arithmetic. This increment is not a migration of fine arithmetic.
|
||||
|
||||
Root halo topology stays wrapped like the uniform kernel, solely to reproduce its complete evolved ghost state as well as physical populations. It does not make the physical inlet/outlet periodic. Evolved root state includes boundary ghosts, while public fluid-leaf downloads exclude them. Initialization must provide finite positive-density root ghost states. Private raw snapshots preserve them exactly for same-representation continuation; public leaf-only downloads are not restart states. Channel remapping remains explicitly unsupported.
|
||||
|
||||
`channel.py` checks the actual explosion donors and restriction receivers are uncovered bulk fluid and checks actual receiver-local restriction slots against pressure-donor and wall-correction reads. No arbitrary large padding or block-aligned patch restrictions are added. Keep the physical domain dimensions exact: choose legal root block divisors (including full width) instead of padding a benchmark domain. Stationary circles/Jets retain the existing finest-level and transfer-footprint rules.
|
||||
|
||||
## Gates
|
||||
|
||||
- `tests/unit/test_channel_root.py`: host semantics, minimal footprint, overlap rejection, raw-state/public-leaf separation; actual production uniform and blocked kernels under a CPU launch shim, five non-equilibrium steps, all corners, profiles, representations, y seams and a one-cell-wide block outlet donor.
|
||||
- `tests/validation/multigrid/test_channel_root_gpu.py`: exact uniform-versus-blocked full-state GPU parity; AMR finite-state and block-split invariance with/without a stationary circle and velocity Jet; amplitude update and raw snapshot round-trip.
|
||||
- GPU tests require explicit device admission by the caller. CPU-header algebra is not CUDA execution or external physical validation. The current increment does not establish DFG drag/lift/pressure acceptance or a performance speedup; those need matched SRT controls and a separate benchmark run.
|
||||
@@ -0,0 +1,116 @@
|
||||
# src coherence stage (from main 914906e)
|
||||
|
||||
Owner direction 2026-10-28: unified style over historical compatibility, inside `src`.
|
||||
No numerical change is intended. Stages after 5f69eba: 65339ab (one boundary/Jet record,
|
||||
host preparation helpers, pair accessors), c5a3cdb (`block_collide` families), 442979b
|
||||
(exchange metadata on the boundary record). All three received parent/candidate
|
||||
generated-config and host/GPU equality checks. Only the collision slice ran a new PTX
|
||||
matrix (a4fc46d, whose src is identical to c5a3cdb); 65339ab and 442979b reused prior
|
||||
PTX evidence after unchanged CUDA/compiler and generated-input checks. In the collision
|
||||
matrix, only the two channel-root SRT modules changed PTX (omega load/clamp moved);
|
||||
their parent/candidate outputs matched exactly in the exercised cases.
|
||||
|
||||
## Conventions (defined once, in `lbm.hierarchy.Hierarchy`)
|
||||
|
||||
- Level `l = 0 .. depth-1` (0 = root). Pair `hierarchy.pairs[l-1]` builds level `l`.
|
||||
- Array shapes are `(ny, nx)`; rectangles, origins and centers are `(x, y)`.
|
||||
- Coarse/fine name the two members (parent/child) of ANY pair, not absolute L0/L1:
|
||||
`fine_shape`, `fine_origin`, `prepare_fine_boundary`, `blocked_fine_tables`,
|
||||
`blocked_coarse_tables`.
|
||||
- Refined levels (l >= 1) of FixedPatchStepper place bodies/Jets in the root EDGE frame
|
||||
(root cell `i` = `[i, i+1)`). Uniform `Simulation` objects AND the static circles of a
|
||||
single-level (depth 1) FixedPatchStepper use the integer-NODE frame. Nothing converts
|
||||
between them. This concerns input placement only: within the EDGE frame, refined
|
||||
levels still project root-edge coordinates to fine-local cell indices with the
|
||||
half-cell shift (`prepare_fine_boundary`: `(v - o)/dx - .5`; hits back via `fine_hits_to_edge_frame`
|
||||
`origin + dx*(hit + .5)`), using `edge_frame`/`fine_origin` below.
|
||||
- `Hierarchy.edge_frame(l)` -> `((ox, oy), h)`: cell `(i, j)` of level `l`'s allocated
|
||||
array (ghost band and holes included) covers `[o + h*i, o + h*(i+1))`. A scalar
|
||||
FixedPatch2D window carries the half-coarse-cell ghost shift `bounds - HALO/2` in
|
||||
`fine_origin`; a set's level-wide grid has origin 0. Level 1 boundaries are built from
|
||||
the root config (the wall-aware fields live there); deeper ones from the parent frame.
|
||||
- `FixedPatch2D.fine_level_offset` (was `fine_level_origin`) is an array INDEX offset
|
||||
`(y, x)`, not an `(x, y)` origin.
|
||||
|
||||
## FixedPatchStepper migration map
|
||||
|
||||
Historical: left column = names at or after 914906e that no longer exist; right column =
|
||||
the current name.
|
||||
|
||||
| removed / changed | replacement |
|
||||
|---|---|
|
||||
| `patch`, `child_patch` | `hierarchy.pairs[0]`, `hierarchy.pairs[1]` |
|
||||
| `base_layout`, `fine_layout`, `child_layout` (stepper properties) | `layouts[0]`, `layouts[1]`, `layouts[2]` (`FixedPatchSet2D.fine_layout(block)` is unchanged) |
|
||||
| `fine_boundary`, `child_boundary` | `boundaries[1]`, `boundaries[2]` (host geometry; `None` = no bodies/Jets) |
|
||||
| `_jets` | `jets[1]` |
|
||||
| `_boundaries[l]` (dict from L1, level keys), `_level_boundaries` (b4eacf7), `_device_boundaries` (65339ab) | `_boundaries[l]`: the one combined per-level `_BlockedBoundary` record (list from L0, `None` at L0 unless single-level static circles): host geometry `.host`, `.tables`, `.jets`, `.jet_cache`, exchange `.spacing`/`.centers`, device handles |
|
||||
| `_fine_tables`, `_actuated`, `_jet_cache` | `_boundaries[1].tables` / `.actuated` / `.jet_cache` |
|
||||
| `_level_jets` (private) | `_boundaries[l].jets` (public `jets[l]` is derived) |
|
||||
| `_exchange_spacing[l]`, `_exchange_centers[l]` (private) | `_boundaries[l].spacing` (h_l, root units) / `.centers` (root edge frame); only levels with a boundary report exchange |
|
||||
| `_level_blocks` (private) | `_layouts[l].block` |
|
||||
| `_remap_cfg` (private) | `_root_cfg` |
|
||||
| `refinement_tables.blocked_base_tables` (also via `refinement_stepper`) | `refinement_tables.blocked_coarse_tables` (import from `refinement_tables`; the stepper no longer re-exports) |
|
||||
| `_fine_leaf`, `_child_leaf` | `leaf[1]`, `leaf[2]` (copies) |
|
||||
| `_middle_kind` | `hierarchy.kinds[1]` |
|
||||
| `_boundary_hosts` (private) | public `boundaries[l]` = `_boundaries[l].host` (host geometry only; the private record is the combined one) |
|
||||
| `remap_child(rects, child_objects=...)` | `remap_finest(rects, objects=...)` |
|
||||
| `set_jet_amplitude(i, a)` (implicit level 1) | `set_jet_amplitude(i, a, level=l)` (required) |
|
||||
| `read_raw_exchange(b)` / `read_exchange_window(b)` (implicit level 1) | `read_raw_exchange(b, level=l)` / `read_exchange_window(b, level=l)` (required) |
|
||||
| `_level_name(l)` "base/fine/child" messages | `"level l"` |
|
||||
| `refinement.MIN_PATCH_GAP` | deleted (no gap policy exists) |
|
||||
| `params.cuh HaloPlan`, `collide_trt_no_force` | deleted (zero references) |
|
||||
|
||||
Kept: `step_count`, constructor keywords (`refinements`, `level_blocks`, `level_objects`,
|
||||
`level_jets`, `coarse_boundary`, `explosion`), `Simulation.set_jet_amplitude(i, a)` (one level),
|
||||
`RemapTopology.from_config(..., child_objects=, child_jets=)` (internal remap helper; "child" =
|
||||
the replaced level relative to its parent).
|
||||
|
||||
## Responsibilities
|
||||
|
||||
- Construction: `_check_levels` (inputs); host preparation, numpy only, before any device
|
||||
work: `_level_layouts`, `_kernel_configs` (per-level kernel configs), `_host_boundaries`,
|
||||
`_prepare_blocked_boundary`, `_fluid_leaves`; `Hierarchy.edge_frame` (geometry frames);
|
||||
then `_planned_bytes()` (memory preflight) and `_build_level` / `_build_pair` /
|
||||
`_upload_boundary` (device). A construction failure closes the partial instance.
|
||||
Observation reads share `_observed_boundary` + `_summarize`.
|
||||
- Pair accessors: `rectangles` (a scalar FixedPatch2D gives `(bounds,)`) and
|
||||
`fine_level_offset` (`(0, 0)` for a set) on both pair types; the types and their
|
||||
storage frames stay distinct.
|
||||
- Per-level state, by lifecycle:
|
||||
- Fixed plan structure (built once in `__init__`, read by `_planned_bytes()` before any
|
||||
allocation, readable after `close()` through the public views): `_layouts`,
|
||||
`_level_cfgs`, `_leaf`, `_state`, and in each `_boundaries[l]` record the host geometry
|
||||
`.host`, link tables, `.jet_cache`, `.spacing`, `.centers`.
|
||||
- Mutable boundary data in the same record: `.jets` and `.tables["surface_velocity"]`,
|
||||
changed only by `set_jet_amplitude` (host prepare -> device write -> commit; an uncertain
|
||||
write fails the instance); device handles (`.flags`, `.device`, `.kernel`, ledgers) are
|
||||
set by `_upload_boundary` and cleared by `close()`.
|
||||
- Runtime: `_levels` (`_Level`) holds compiled modules, kernels, the two population
|
||||
buffers (swapped per step) and transfer/kind handles. It is created only after the
|
||||
memory preflight and cleared on `close()`; `.layout`/`.boundary` reference the plan for
|
||||
`_hop`. Folding the plan into `_Level` would mix both lifecycles in one record.
|
||||
- Blocked kernels: `operators/block_collision.cuh block_collide` is the one collision extension
|
||||
point of `BlockStep` and `BlockChannelStep`. It computes rho/u once and reads no runtime
|
||||
force (`d_params.fx/fy`). Two compile-time families: uniform-equivalent (MRT on any level,
|
||||
SRT on the channel root `BLOCK_ROOT_BC == 2`): clamped omega, `collide_mrt_no_force` or
|
||||
`collide_srt` with its zero Guo term; and level SRT (`BLOCK_ROOT_BC` 0/1): unclamped omega,
|
||||
`collide_srt_no_force`, with the shifted direct-momentum feq under `USE_DDF_SHIFTING`.
|
||||
The uniform path keeps `collide_dispatch` (runtime force, LES, TRT).
|
||||
- `explosion="projected_linear"` stays an optional capability; `"constant"` stays default.
|
||||
|
||||
## Not done / open
|
||||
|
||||
- Two per-level config derivations stay distinct on purpose: `Hierarchy.configs`
|
||||
(`_middle_config`, wall fields reset on every refined level, geometry validation) vs.
|
||||
`FixedPatchStepper._kernel_configs` (reset only on level 1 of a slot_reservoir root;
|
||||
generates each level's config.h). Folding them needs a config.h/PTX diff gate.
|
||||
- No single-`Simulation` facade over FixedPatchStepper: the two own different state models
|
||||
(uniform node frame, body sync, forcing, checkpoint vs. fixed blocked hierarchy, edge
|
||||
frame, remap-as-new-instance). A facade would only forward calls; no concrete need found.
|
||||
- Deferred, each needing its own evidence first: sharing the channel-root cell/donor selector
|
||||
with OneStep (the closure functions are already shared; a shared selector changes uniform
|
||||
signatures and needs a uniform PTX gate); merging FixedPatch2D into FixedPatchSet2D
|
||||
(different origin, ghost band, layout size and addressing; needs a geometry/parity table and
|
||||
would need tiles that are not grid-aligned); one `clamp_omega` helper for uniform and
|
||||
blocked paths (it lives in the hash-pinned LES header `turbulence_smag.cuh`).
|
||||
- Tests, examples and validation callers are migrated separately (pinned runners stay frozen).
|
||||
@@ -0,0 +1,393 @@
|
||||
# Evidence index (draft, R0)
|
||||
|
||||
Active-tree evidence at candidate 0f8fdbc30ea640c764b38ee598d8f4d135c81c85, classified for the release cleanup
|
||||
(thread C0C78UFKGRM 1793021833.593279). Draft for review: nothing is removed by this file.
|
||||
Recovery of any listed file: `git show 0f8fdbc3:<path>` (blob id given; an immutable tag is requested as anchor).
|
||||
|
||||
Classes: K = conclusion kept in the active tree; K-code = tested research code kept; D-snapshot = pre-Gitea
|
||||
patch/diff transport (code landed in git from ed1a6ee on; not yet verified hunk by hunk); P-pin = generated hash inventories, git-status dumps and manifests;
|
||||
R-raw = run outputs, logs, signals, frames, one-shot run scripts and handoff notes. D, P, R leave the active tree in R1.
|
||||
No file under src/ or a test reads any of these paths (git grep at 0f8fdbc3); runners under tests/validation
|
||||
that read research/j* are handled in R2.
|
||||
|
||||
| Class | Files | Bytes |
|
||||
|---|---:|---:|
|
||||
| K | 31 | 196,506 |
|
||||
| K-code | 3 | 24,324 |
|
||||
| D-snapshot | 18 | 338,948 |
|
||||
| P-pin | 50 | 979,177 |
|
||||
| R-raw | 142 | 3,790,554 |
|
||||
|
||||
## (root)
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| BASELINE_JET_AMR.txt | R-raw | 5,244 | 62aa2a66dc05 |
|
||||
|
||||
## output
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| round3_compatibility_summary.md | R-raw | 4,366 | f243318f5591 |
|
||||
|
||||
## research/fine_surface_20261014
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| baseline.json | P-pin | 54,507 | 71a4543ead37 |
|
||||
| cpu_device_guard_cmd.txt | R-raw | 241 | 06e0f35d92b3 |
|
||||
| cpu_device_guard_exit.txt | R-raw | 2 | 573541ac9702 |
|
||||
| cpu_device_guard_stdout.txt | R-raw | 98 | 424d584a031c |
|
||||
| cpu_existing_runs.json | R-raw | 650 | 3179536407b7 |
|
||||
| cpu_final_run.json | R-raw | 386 | 523fadb3fec9 |
|
||||
| cpu_final_stdout.txt | R-raw | 99 | 9cfe73da3858 |
|
||||
| cpu_lifecycle_run.json | R-raw | 387 | 5b403b9e2f30 |
|
||||
| cpu_lifecycle_stdout.txt | R-raw | 112 | 3c5c49b285fa |
|
||||
| cpu_maps_stdout.txt | R-raw | 95 | 71dd87f9faf9 |
|
||||
| cpu_preallocation_run.json | R-raw | 337 | fa6e96d98cdd |
|
||||
| cpu_preallocation_stdout.txt | R-raw | 98 | 5d643576f251 |
|
||||
| cpu_shared_kernel_stdout.txt | R-raw | 98 | 8a0c046bb9b1 |
|
||||
| cpu_surface_command.txt | R-raw | 113 | 2a5ff31e8d06 |
|
||||
| cpu_surface_exit.txt | R-raw | 2 | 573541ac9702 |
|
||||
| cpu_surface_projection_command.txt | R-raw | 171 | 70b7f5c62c1a |
|
||||
| cpu_surface_projection_exit.txt | R-raw | 2 | 573541ac9702 |
|
||||
| cpu_surface_projection_stdout.txt | R-raw | 113 | efd37a149cc1 |
|
||||
| cpu_surface_stdout.txt | R-raw | 99 | 9cfe73da3858 |
|
||||
| gpu_preparation_run1.py | R-raw | 14,043 | ee586d035b7a |
|
||||
| gpu_run.json | R-raw | 2,943 | 15b8ba70d528 |
|
||||
| gpu_stdout.txt | R-raw | 5,424 | c5216e0267f3 |
|
||||
| gpu_test_run1.py | R-raw | 15,479 | f30376abc97f |
|
||||
| incremental.diff | D-snapshot | 53,853 | 318d92e7d177 |
|
||||
| manifest.json | P-pin | 8,411 | 8281338416af |
|
||||
| report.txt | K | 8,373 | 6b9e5123e414 |
|
||||
|
||||
## research/fine_surface_joint_20261014
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| baseline_00.json | P-pin | 21,302 | 4ae101ebd02b |
|
||||
| baseline_01.json | P-pin | 26,191 | 548cf7b3b494 |
|
||||
| baseline_02.json | P-pin | 22,440 | e0421e7a4052 |
|
||||
| baseline_03.json | P-pin | 8,584 | da99b45f32a4 |
|
||||
| blow_boundary.csv | R-raw | 12,536 | e13363b69457 |
|
||||
| blow_collisions.csv | R-raw | 19,145 | 5d5b395486bb |
|
||||
| blow_ledger.csv | R-raw | 15,977 | b43bbfd0b8d2 |
|
||||
| blow_propagation.csv | R-raw | 9,714 | f06d80d296ca |
|
||||
| blow_signals.npz | R-raw | 221,114 | 528adf75baa2 |
|
||||
| blow_summary.json | R-raw | 4,113 | 32285ac15be3 |
|
||||
| command.txt | R-raw | 232 | 510ecb2925dd |
|
||||
| criteria.txt | K | 7,480 | dd36e76a3be1 |
|
||||
| frozen.json | R-raw | 11,972 | b5a3324e8686 |
|
||||
| gpu_run.json | R-raw | 1,955 | 67ac4785f7e4 |
|
||||
| incremental.diff | D-snapshot | 625 | e03c132d22df |
|
||||
| integrity.json | P-pin | 826 | a8b6e4be88d2 |
|
||||
| manifest.json | P-pin | 4,388 | d2af50260c39 |
|
||||
| regions.json | R-raw | 27,525 | 7bba26904221 |
|
||||
| report.txt | K | 8,207 | d7571e068ad3 |
|
||||
| result.json | R-raw | 11,442 | 9580c2686e70 |
|
||||
| review.txt | K | 2,117 | bbe1d8a83d47 |
|
||||
| runner.py | R-raw | 5,847 | 812973acc000 |
|
||||
| stdout.txt | R-raw | 19,940 | c9218e2e48fc |
|
||||
| suction_boundary.csv | R-raw | 12,505 | b870be05e6c0 |
|
||||
| suction_collisions.csv | R-raw | 19,173 | 2de48c0a84ab |
|
||||
| suction_ledger.csv | R-raw | 16,208 | 92cf1f44911e |
|
||||
| suction_propagation.csv | R-raw | 9,720 | f017bcc3ca6f |
|
||||
| suction_signals.npz | R-raw | 220,058 | 66d06cf2d909 |
|
||||
| suction_summary.json | R-raw | 4,126 | d70a1d371950 |
|
||||
| validate.py | R-raw | 19,576 | 37441febd168 |
|
||||
| zero_boundary.csv | R-raw | 11,491 | 65c92e48c974 |
|
||||
| zero_collisions.csv | R-raw | 18,915 | 027cb8ff6b23 |
|
||||
| zero_ledger.csv | R-raw | 16,051 | 34a99bb89dd7 |
|
||||
| zero_signals.npz | R-raw | 127,958 | a966f093a9cd |
|
||||
| zero_summary.json | R-raw | 1,508 | 6e033f991438 |
|
||||
|
||||
## research/fixed_patch_jet_20261013
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| baseline.json | P-pin | 69,721 | 91ad9c4d1e88 |
|
||||
| before.json | R-raw | 690 | 06e1b6278a29 |
|
||||
| fixed_patch_jet.py | R-raw | 9,646 | 6fbdcd9a076b |
|
||||
| incremental.patch | D-snapshot | 9,891 | b43129d82c69 |
|
||||
| manifest.json | P-pin | 1,967 | 08daa0248f60 |
|
||||
| notes.txt | K | 2,214 | 50070fe54efb |
|
||||
| results.json | R-raw | 1,100 | d959a6a1cc2c |
|
||||
| stdout.txt | R-raw | 1,272 | eccdc0f6b16a |
|
||||
|
||||
## research/fixed_patch_jet_closure_20261013
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| baseline.json | P-pin | 72,692 | 8a157af82ecf |
|
||||
| cpu_results.json | R-raw | 628 | 8e4a1c090c93 |
|
||||
| cpu_stdout.txt | R-raw | 590 | d800b783fe47 |
|
||||
| incremental.patch | D-snapshot | 3,490 | a9a486c68afd |
|
||||
| layout_uncropped.png | R-raw | 51,785 | 0cf1cfa5e99d |
|
||||
| manifest.json | P-pin | 1,849 | 31cf0c739241 |
|
||||
| notes.txt | K | 3,023 | 0f7e7bdfd0e6 |
|
||||
|
||||
## research/fixed_patch_jet_records_20261013
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| baseline.json | P-pin | 71,228 | a8e967f76e08 |
|
||||
| before.json | R-raw | 690 | ebd6f4251fc2 |
|
||||
| fixed_patch_jet.py | R-raw | 10,650 | f6b299885da0 |
|
||||
| incremental.patch | D-snapshot | 5,539 | c7f4d0c02ccc |
|
||||
| manifest.json | P-pin | 2,057 | 1d616c2541df |
|
||||
| notes.txt | K | 2,449 | b58cec14d359 |
|
||||
| results.json | R-raw | 1,136 | 788af64a6ebd |
|
||||
| stdout.txt | R-raw | 20,750 | a765b06deefa |
|
||||
|
||||
## research/j1-2026-10-12
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| REVIEW.md | K | 7,667 | 8f469daef054 |
|
||||
| baseline-status.txt | P-pin | 2,601 | 64ca05ab952e |
|
||||
| baseline.json | P-pin | 23,052 | ab5852bcb0ef |
|
||||
| incremental.diff | D-snapshot | 29,912 | dd9c4e688888 |
|
||||
| results.json | R-raw | 68,294 | 56547aa8a678 |
|
||||
|
||||
## research/j2-slot-2026-10-12
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| REVIEW.md | K | 12,930 | 69fa4d3bccd3 |
|
||||
| baseline-status.txt | P-pin | 2,825 | e711afb0016c |
|
||||
| baseline.json | P-pin | 24,660 | 286e023da94f |
|
||||
| incremental.diff | D-snapshot | 25,231 | 649f3b5d168d |
|
||||
| results.json | R-raw | 477,249 | b4272e25179d |
|
||||
|
||||
## research/j3-coverage-2026-10-12
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| REVIEW.md | K | 11,409 | 5887cf73dce2 |
|
||||
| baseline-status.txt | P-pin | 3,055 | 78e88356caa3 |
|
||||
| baseline.json | P-pin | 30,407 | 095972547a7f |
|
||||
| incremental.diff | D-snapshot | 20,114 | f0d502dc5c5b |
|
||||
| negative-budget-20744.h5 | R-raw | 88,017 | 693b133be84d |
|
||||
| negative-end-20760.h5 | R-raw | 88,174 | 429270d263d4 |
|
||||
| restart-21280.h5 | R-raw | 88,062 | 74900affae38 |
|
||||
| restart-reference-21296.h5 | R-raw | 88,154 | 7510ee97885b |
|
||||
| results.json | R-raw | 296,314 | 7806b10e65cb |
|
||||
| verification.json | K | 1,468 | 78a07c47aea4 |
|
||||
|
||||
## research/j3-lag-2026-10-12
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| REVIEW.md | K | 11,732 | 34fe5dbb2cae |
|
||||
| baseline-status.txt | P-pin | 2,968 | 6ae6094ea9d7 |
|
||||
| baseline.json | P-pin | 26,505 | 5c289d14ff30 |
|
||||
| end-21280.h5 | R-raw | 92,366 | f30b209179ab |
|
||||
| incremental.diff | D-snapshot | 15,790 | 5c6c485e1f75 |
|
||||
| results.json | R-raw | 21,718 | 2bf58939129c |
|
||||
| start-20760.h5 | R-raw | 92,247 | ae0abd05190c |
|
||||
|
||||
## research/j3-offline-2026-10-12
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| REVIEW.md | K | 6,271 | a76e1b486bd2 |
|
||||
| lags.csv | R-raw | 1,104 | dd3136dd2dc2 |
|
||||
| localization.png | R-raw | 136,013 | 74b56f3e814c |
|
||||
| regions.csv | R-raw | 2,126 | 5d361e6872af |
|
||||
| results.json | R-raw | 8,852 | bf77b0f534d4 |
|
||||
|
||||
## research/j3-reservoir-2026-10-12
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| REVIEW.md | K | 13,563 | a74b67a64e0d |
|
||||
| baseline-status.txt | P-pin | 2,896 | a318e077dfae |
|
||||
| baseline.json | P-pin | 25,571 | 060502ea7dd8 |
|
||||
| incremental.diff | D-snapshot | 22,898 | 8e2c79a86c98 |
|
||||
| results.json | R-raw | 182,747 | 7fd5e51a1785 |
|
||||
|
||||
## research/refinement_example_20261013
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| baseline.json | P-pin | 8,286 | 591478100da8 |
|
||||
| before.json | R-raw | 818 | 7ab0962775b1 |
|
||||
| incremental.patch | D-snapshot | 8,682 | 7ad8719d0167 |
|
||||
| manifest.json | P-pin | 1,798 | bf1eee8a7cf8 |
|
||||
| notes.txt | K | 1,185 | 7ff019ad023d |
|
||||
| results.json | R-raw | 1,118 | 94697b0988b9 |
|
||||
| stdout.txt | R-raw | 325 | 501446f557f4 |
|
||||
|
||||
## research/refinement_followup_20261013
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| README.txt | K | 4,887 | af65e889f20e |
|
||||
| baseline.json | P-pin | 5,343 | 7c60ad8ad692 |
|
||||
| cleanup.json | R-raw | 1,253 | 15cf342fba2e |
|
||||
| cpu_results.json | R-raw | 1,056 | 1166dffd2a09 |
|
||||
| cpu_results_attempt1.json | R-raw | 642 | d139d5508105 |
|
||||
| cpu_stdout.txt | R-raw | 499 | d1b33ea20563 |
|
||||
| cpu_stdout_attempt1.txt | R-raw | 879 | 6a9fe7fce39a |
|
||||
| gpu_before.json | R-raw | 589 | 46762a0ab207 |
|
||||
| gpu_before_no_launch.json | R-raw | 589 | 074982d1b2d4 |
|
||||
| gpu_rectangle_before.json | R-raw | 589 | 831e3793339f |
|
||||
| gpu_rectangle_before_no_launch_1791886104981638567.json | R-raw | 589 | c33885d50bfd |
|
||||
| gpu_rectangle_results.json | R-raw | 1,003 | 9c6da219ac6c |
|
||||
| gpu_rectangle_stdout.txt | R-raw | 332 | 9185bf303954 |
|
||||
| gpu_results.json | R-raw | 1,189 | 53e4f1c44de1 |
|
||||
| gpu_seed1_before.json | R-raw | 589 | c77ea3485f84 |
|
||||
| gpu_seed1_results.json | R-raw | 996 | b718e8af84e4 |
|
||||
| gpu_seed1_stdout.txt | R-raw | 306 | 4d7de0897137 |
|
||||
| gpu_stdout.txt | R-raw | 68 | b0956fe3cdb0 |
|
||||
| incremental.patch | D-snapshot | 16,836 | 9df25d8c177a |
|
||||
| manifest.json | P-pin | 4,410 | 177704d6f1ae |
|
||||
| run_gpu.py | R-raw | 5,237 | b5af3f0d4f79 |
|
||||
|
||||
## research/refinement_prepare_20261013
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| README.txt | K | 8,939 | 8e210c28c7c5 |
|
||||
| baseline.json | P-pin | 46,348 | d5f257216b8d |
|
||||
| incremental.patch | D-snapshot | 15,751 | 0ddb32550584 |
|
||||
| manifest.json | P-pin | 2,113 | 9fd94ccf2c3e |
|
||||
| validation.json | R-raw | 3,567 | f057e7cbcd35 |
|
||||
| validation.txt | R-raw | 873 | 594daa45c58c |
|
||||
|
||||
## research/refinement_slot_20261013
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| baseline.json | P-pin | 67,717 | d498081e7c50 |
|
||||
| before.json | R-raw | 690 | 430e76b3aa8a |
|
||||
| cpu_results.json | R-raw | 1,421 | 4f6bc4d9428f |
|
||||
| incremental.patch | D-snapshot | 18,676 | 67a3e8cc9e68 |
|
||||
| manifest.json | P-pin | 2,270 | 6515458290f4 |
|
||||
| notes.txt | K | 2,612 | 08a713ba4b37 |
|
||||
| results.json | R-raw | 1,160 | 03e683027ba8 |
|
||||
| stdout.txt | R-raw | 643 | d57b91769826 |
|
||||
|
||||
## research/refinement_slot_followup_20261013
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| baseline.json | P-pin | 68,536 | 89a26ce79438 |
|
||||
| before.json | R-raw | 690 | e707df192ff2 |
|
||||
| incremental.patch | D-snapshot | 495 | c6f6fa11237d |
|
||||
| manifest.json | P-pin | 1,920 | 4840243a33aa |
|
||||
| notes.txt | K | 1,549 | 4b77583ca116 |
|
||||
| planar_velocity.cuh | R-raw | 1,911 | 87db7466c843 |
|
||||
| planar_velocity.sha256 | P-pin | 251 | 6694c4a1c1f0 |
|
||||
| results.json | R-raw | 1,050 | 6ef6eda854c6 |
|
||||
| stdout.txt | R-raw | 1,160 | 461860351c0c |
|
||||
|
||||
## research/refinement_step_20261013
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| README.txt | K | 10,671 | 88d6f24743f5 |
|
||||
| baseline.json | P-pin | 40,620 | 20f61559dd38 |
|
||||
| cpu_validation.json | R-raw | 1,231 | 7999fd30018c |
|
||||
| gpu_failure_validation.json | R-raw | 868 | 5f6db65ee4f9 |
|
||||
| gpu_failure_validation.txt | R-raw | 248 | d9a570a1e9e9 |
|
||||
| gpu_validation.json | R-raw | 672 | 2028f59e1055 |
|
||||
| gpu_validation.txt | R-raw | 632 | 9699918ee127 |
|
||||
| incremental.patch | D-snapshot | 26,516 | d95f9347633d |
|
||||
| manifest.json | P-pin | 2,075 | 32a7f1a7309e |
|
||||
|
||||
## research/repair-2026-10-10
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| TRON_HANDOFF.md | R-raw | 25,208 | a339786c7944 |
|
||||
| baseline-hashes.json | P-pin | 16,020 | 9b4e24cb1d10 |
|
||||
| baseline-status.txt | P-pin | 429 | 515be249b638 |
|
||||
| checkpoint-domain-2026-10-12.diff | D-snapshot | 14,443 | 035ed630dda1 |
|
||||
| classic-results.json | R-raw | 244,729 | 7297aa0d5bca |
|
||||
| classic-signals.npz | R-raw | 630,332 | 8cf6d1218aa0 |
|
||||
| final-gpu.log | R-raw | 191 | a0eec1a8ea31 |
|
||||
| final-unit.log | R-raw | 188 | 94efba2f1d42 |
|
||||
| provenance.json | P-pin | 1,020 | 25e22b4f0696 |
|
||||
| repair-architecture.md | K | 9,498 | 12051c3e8571 |
|
||||
| repair-numerical.md | K | 10,769 | 0c5757fe5f36 |
|
||||
| repair-state.md | K | 8,481 | 3c7f2d5b687a |
|
||||
| simplification-checks.log | R-raw | 1,045 | fa9d464be740 |
|
||||
|
||||
## research/shear_refinement
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| README.md | K-code | 4,142 | 67bdd8ed622b |
|
||||
| boundary_shear_tagging.py | K-code | 13,859 | b5415a1c4ea1 |
|
||||
| example.py | K-code | 6,323 | 66295d3f0273 |
|
||||
|
||||
## research/surface_actuation_20261014
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| baseline.json | P-pin | 54,139 | 0ad06888dbeb |
|
||||
| cpu_checkpoint_run.json | R-raw | 400 | 39681b60ff15 |
|
||||
| cpu_checkpoint_stdout.txt | R-raw | 114 | 929e4b8d4f46 |
|
||||
| cpu_initial.txt | R-raw | 620 | 29213c58a679 |
|
||||
| cpu_surface_command.txt | R-raw | 118 | 6d8c615a6e03 |
|
||||
| cpu_surface_exit.txt | R-raw | 2 | 573541ac9702 |
|
||||
| cpu_surface_stdout.txt | R-raw | 99 | ee9237fc26e5 |
|
||||
| gpu_run.json | R-raw | 1,698 | dc8f87eafaa9 |
|
||||
| gpu_stdout.txt | R-raw | 159 | b262891e52c3 |
|
||||
| incremental.diff | D-snapshot | 50,206 | 43090a1a8b11 |
|
||||
| manifest.json | P-pin | 7,527 | 35daa01271cb |
|
||||
| report.txt | K | 5,078 | 1162a6479f9f |
|
||||
|
||||
## research/wall_seam_pulse_20261014
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| analyze.py | R-raw | 10,343 | ed7cf6999a49 |
|
||||
| interpretation.txt | K | 3,514 | 90935db2aa99 |
|
||||
| results.json | R-raw | 15,137 | 678a0759871a |
|
||||
| run.json | R-raw | 1,170 | 53e303fd0d5d |
|
||||
| sources.csv | R-raw | 2,313 | 40d3736b8ef1 |
|
||||
| stdout.txt | R-raw | 1,179 | 756d8c38e213 |
|
||||
|
||||
## tests/validation/multigrid/cpuref_0_3_evidence
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| README.txt | K | 4,133 | 62897bfd9812 |
|
||||
| README_grok.md | K | 1,751 | 2d36e05661a8 |
|
||||
| baseline.json | P-pin | 39,291 | 188491096547 |
|
||||
| manifest.json | P-pin | 3,495 | 10c19f5fe5ca |
|
||||
| results_horsea.json | R-raw | 2,281 | 3b163384e376 |
|
||||
| stdout_grok.txt | R-raw | 7,143 | 5a0c270ea4ae |
|
||||
| stdout_horsea.txt | R-raw | 9,013 | adff8bb8d295 |
|
||||
|
||||
## tests/validation/multigrid/local_stress_v1_evidence
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| README.txt | K | 8,239 | 3513fd294223 |
|
||||
| TABLE_local_stress_observable_v1.md | K | 2,967 | 6115dcde0f46 |
|
||||
| baseline.json | P-pin | 43,991 | ab631ea4f2ad |
|
||||
| comparison.json | R-raw | 13,248 | d7d1b36eb247 |
|
||||
| manifest.json | P-pin | 4,132 | c6c44d8125cd |
|
||||
| results_horsea.json | R-raw | 2,671 | 79bdf001f948 |
|
||||
| run_once.py | R-raw | 4,313 | fa9c5239e993 |
|
||||
| source_manifest.json | P-pin | 622 | 0516f1860407 |
|
||||
| stdout_horsea.txt | R-raw | 17,091 | a20c554693df |
|
||||
| stdout_local_stress_observable_v1.txt | R-raw | 12,238 | 692ffe1a05da |
|
||||
|
||||
## tests/validation/multigrid/shear_v0_2_evidence
|
||||
|
||||
| File | Class | Bytes | Blob |
|
||||
|---|---|---:|---|
|
||||
| README.txt | K | 7,220 | 772f74ad40ff |
|
||||
| baseline.json | P-pin | 41,751 | 70d9c9fa71c0 |
|
||||
| comparison.json | R-raw | 7,679 | 0af8736f9a01 |
|
||||
| joint_report.md | K | 6,110 | eed871221298 |
|
||||
| manifest.json | P-pin | 3,796 | b22d03a1ba9e |
|
||||
| results_horsea.json | R-raw | 1,957 | b2cd48a07a08 |
|
||||
| run_once.py | R-raw | 3,245 | 0b8d5e21f326 |
|
||||
| source_manifest.json | P-pin | 574 | 4d1c742690c7 |
|
||||
| stdout_grok.txt | R-raw | 7,950 | 0e80b1aba7f6 |
|
||||
| stdout_horsea.txt | R-raw | 11,421 | 3c867cdac197 |
|
||||
@@ -0,0 +1,109 @@
|
||||
# Fig. 2 material collection: modern moving plant
|
||||
|
||||
Research-only child of `76873d911c4e2caba1bacc25aaa1495ea768453f`.
|
||||
No production/kernel/manuscript or DynamisLab edits. These are fresh common-release
|
||||
paired experiments, separate from the continuous OFF/ON/OFF demonstration videos.
|
||||
|
||||
## Fixed plant and cases
|
||||
|
||||
All cases use D40, Uref=.005, nu=.004, MRT/FP32/unshifted double buffering,
|
||||
the existing mean-parabolic/regularized inlet, NEQ outlet and bounce-back walls.
|
||||
One transverse assembly DOF: m*=4 based on all three disks, fnD/U=.2, zeta=0.
|
||||
No force filter or retuning. Existing +/-D, speed.025, nonfinite and no-donor stops.
|
||||
Structure RHS is previous native-step sum of pinball CME_y+Wen_y. Policy uses
|
||||
SI-mean packed CME and fixed lab probe signals; these are different force paths.
|
||||
SI=3200; EMA alpha=.9**.25 resets every SI as in the acquisition contract.
|
||||
Steady video used SI4000; its descriptive numbers are not the new collection.
|
||||
|
||||
| case | prelude/release clock | controller | collection |
|
||||
|---|---|---|---|
|
||||
| steady | new static pinball, 2,048,000 steps | constant wall speeds (0,-5.1,5.1)U, no PPO | 400 SI,160 D/U |
|
||||
| Karman | verified saved static release at4,576,000 | historical `karman_re100` PPO; actual pinball Re_D50, scale8/bias(0,-4,4) | 400 SI,160 D/U |
|
||||
| Taylor y0 | clean512,000 then static pinball512,000; clock1,024,000 | `vortex_taylor` PPO, scale4/samebias | 150 SI,60 D/U |
|
||||
|
||||
Zero/control share exact current/spare populations, flags, clock and zero initial
|
||||
structural state. Target is a separate no-pinball reference at the SAME absolute
|
||||
clocks, not a copy of a solid-containing release. Its different geometry is the
|
||||
definition of the reference, not identical microscopic initial conditions.
|
||||
Karman target must run to4,576,000; old target.npy is from earlier clocks and is
|
||||
not reused for same-clock field errors. Model/norm files are verified by SHA256
|
||||
in the driver and written with all source hashes into case.json.
|
||||
|
||||
## Taylor injection
|
||||
|
||||
Exactly one event at release in every role, inside the owning synchronized CUDA
|
||||
context: centre(600,510.5), R80, strength **.000075**. Reuse the existing initializer
|
||||
unchanged. It rewrites ALL interior cells to equilibrium and uploads BOTH buffers;
|
||||
this removes existing nonequilibrium globally. The impulse and first two SI of
|
||||
native force/displacement remain in the record. This is a declared limitation,
|
||||
not an independently qualified physical vortex generator.
|
||||
|
||||
Strength has inverse-time units: u_theta=(s*pi/2)r exp(-r²/R²). D20 R40/U.01/s.0003
|
||||
maps to D40 R80/U.005/s.000075 under diffusive scaling. Using .03*U at D40 would
|
||||
double u/U and quadruple p/U²; actual-function CPU positive/negative controls lock it.
|
||||
|
||||
Current Horsea `acquisition.py` SHA
|
||||
`ea674080501407d00ded6d23467423c516cd37e04d166d5adda16465100204d3`
|
||||
defines EIGHT offsets(-20,-15,-10,-5,0,5,10,15). `legacy_test/acquire.py` SHA
|
||||
`91cd29a368dfc53a0804ec37397d2e5f25f0f8721f01b560a0f4328b8fd1dd9c`
|
||||
selects the controlled centre-uy event: median first20, peak over38..87 inclusive.
|
||||
All roles use that common event index; own target/role peak delays are separately
|
||||
reported. The earlier five-offset remote summary is superseded by actual source.
|
||||
|
||||
## Estimands and storage
|
||||
|
||||
Primary: unaligned same-clock/event velocity-vector errors, Eq1
|
||||
`sqrt(mean_ROI((dux²+duy²)/Uref²))`. No target-energy denominator. Lab ROI is
|
||||
front-equilibrium-centre-relative x/D=[4,24], y/D=[-5,5], equivalent to sensor-plane
|
||||
x/D=[-6,14]; D40 inclusive columns1360..2160 and rows311..710. All ROI cells must
|
||||
be fluid and finite in every compared field; record support coverage.
|
||||
|
||||
Motion uses native last80 D/U for steady/Karman, whole60 D/U for Taylor; mean,
|
||||
centered RMS and half-range remain distinct. Karman complete-cycle means and
|
||||
eight independently phased nearest snapshots reuse actual acquisition helpers,
|
||||
centre-uy column3 and minimum crossing gap. Missing crossings yield unavailable
|
||||
phase diagnostics, never fabricated phase slots. Steady retains its last snapshot
|
||||
and separately labeled fixed-window mean. Field collection for steady/Karman is
|
||||
the last160 SI boundaries (96.4..160 D/U); motion window remains80..160 D/U.
|
||||
Taylor retains its eight common event snapshots. Fixed-window mean error differs
|
||||
from mean instantaneous error; both are labeled. Native six-channel DTW is a
|
||||
supplementary training-space metric, never field recovery or physical delay;
|
||||
its actual legacy lag uses flat sensor column1, unlike the phase helper's column3.
|
||||
|
||||
Use one FP32 full-grid RAM cache per role, plus compact ROI RAM histories for
|
||||
same-clock comparisons. Admit only with >=16GiB MemAvailable; no3.35GB disk field
|
||||
cache. Save only selected fields, means, explicit masks, scalars and source receipts.
|
||||
Nonfluid placeholders are zero-filled for helpers but always masked in plots and
|
||||
scores; nonfinite FLUID is a hard failure. Serialize compilation/GPU work. Verify
|
||||
compressed native histories before removing only redundant task scratch copies.
|
||||
|
||||
Plot standards: vorticity curl(u)D/U, five-point fluid stencil, common RdBu_r21bins
|
||||
with fixed[-3,3] limits and nearest interpolation; lab-fixed coordinates and ROI.
|
||||
Mean plots exclude cells that were not fluid at every collected boundary. Selected
|
||||
snapshots use actual step geometry. Raw arrays and scalar errors are not clipped.
|
||||
|
||||
## V5 boundary
|
||||
|
||||
Standard V5 `kar_re100` seeds41..45 DO exist (actual pinball Re_D50), but use
|
||||
2000x600 uniform/free-slip and different absolute geometry/normalization/action
|
||||
contracts. These are not silently transferred onto the present Legacy-contract
|
||||
plant. No verified retained trained V5 steady/Taylor bundle was found; a vortex
|
||||
environment prototype is not a trained policy. Existing V5 within-case results
|
||||
may be indexed separately; cross-generation scores cannot imply an identical plant.
|
||||
|
||||
## Execution
|
||||
|
||||
First run focused CPU contracts, independent source review, then each scene with
|
||||
`--smoke` (three32-step SI per role; no physical scores). Only the reviewed exact
|
||||
SHA may run physical cases, one at a time, new outputs outside the checkout:
|
||||
|
||||
```
|
||||
CUDA_VISIBLE_DEVICES=3 PYTHONPATH=src python research/fig2_collection/run.py --scene karman --out /tmp/celeris-results-fig2-collection/karman
|
||||
python research/fig2_collection/analyze.py /tmp/celeris-results-fig2-collection/karman
|
||||
python research/fig2_collection/plot.py /tmp/celeris-results-fig2-collection/karman
|
||||
```
|
||||
|
||||
Use the same invocation for steady/taylor with new output directories. No automatic
|
||||
extension or parameter sweep. All results are developmental material, not asserted
|
||||
settled/physically qualified. Preserve partial failures and distinguish missing
|
||||
evidence from passing gates.
|
||||
@@ -0,0 +1,88 @@
|
||||
# Fixed three-level rectangle unions
|
||||
|
||||
This page describes three-level `FixedPatchStepper` setups built from the
|
||||
`refinements` level list, with rectangle unions on either adjacent pair. The
|
||||
same constructor supports arbitrary depth; three or more levels require
|
||||
all-blocked storage and bodies/Jets only on the finest level. This is not
|
||||
general AMR: there is no per-region timestep, moving geometry, automatic
|
||||
dynamic refinement or L1 body support in the three-level form.
|
||||
All regions share one current/spare buffer pair per level. The existing schedule
|
||||
advances L0 once, L1 twice and L2 four times per base step, with aggregate transfers.
|
||||
No CUDA kernel changes are involved.
|
||||
|
||||
## Explicit coordinate frames
|
||||
|
||||
For a single scalar parent patch, pass a scalar rectangle as `refinements[1]`:
|
||||
`(x0,y0,x1,y1)` in half-open integer indices of the allocated L1 window,
|
||||
including its ghost band.
|
||||
|
||||
A rectangle list as `refinements[1]` accepts a scalar or a set parent and
|
||||
interprets every rectangle in the actual allocated L1 array, including ghost
|
||||
bands and holes. It never infers region-local coordinates. The physical root
|
||||
cell edge corresponding to an L1 index `(x,y)` is
|
||||
`parent.fine_origin + (x,y)/2`:
|
||||
|
||||
- A scalar L1 parent has a shifted window origin.
|
||||
- A set L1 parent has origin `(0,0)` and public shape `(2*ny,2*nx)`.
|
||||
- A child set has public shape twice the allocated L1 shape. Its root origin is
|
||||
the L1 allocated origin, even when the parent is a scalar window.
|
||||
|
||||
For a 16x16 root, scalar parent `(4,4,12,12)` and scalar child `(8,8,16,16)`
|
||||
are physically equivalent to parent set `[(4,4,12,12)]` with child set
|
||||
`[(12,12,20,20)]`. A child set on the *scalar* parent instead uses
|
||||
`[(8,8,16,16)]`. Reusing the same numbers after changing the parent frame can
|
||||
move the physical region.
|
||||
|
||||
Both adjacent pairs are built from their unions, without a fixed rectangle-gap
|
||||
rule. Adjacent, overlapping and concave unions are accepted only when their
|
||||
actual transfer dependencies close. The whole child union must preserve
|
||||
inherited ACTIVE coverage, uncovered ACTIVE donors/receivers, surviving pulls, and the upstream
|
||||
restriction footprint. Sparse holes remain unowned; inherited INNER remains
|
||||
stream-only and OUTER remains invalid. Block sizes must divide their allocated
|
||||
level grids. Sparse storage owns every grid-aligned tile intersecting the union
|
||||
plus its four-cell ghost band; rectangle and support edges need not align with
|
||||
tile edges.
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
run = FixedPatchStepper(
|
||||
cfg, context=ctx,
|
||||
refinements=[[(4, 4, 20, 28), (24, 4, 44, 28)], [(16, 16, 32, 40), (56, 16, 80, 40)]],
|
||||
level_blocks=[(4, 4)] * 3,
|
||||
)
|
||||
```
|
||||
|
||||
This example uses a 48x32 root. `initialize` and `download` use three Q-major
|
||||
dense arrays. Public arrays and masks still scale with the full allocated
|
||||
extent; sparse device buffers do not remove that host-memory limit.
|
||||
|
||||
Stationary whole-circle L2 bodies and Jets (`level_objects[2]`, `level_jets[2]`) use root edge
|
||||
coordinates and a single L2 boundary object. Body IDs are physical object-list
|
||||
positions, not region IDs or caller `obj_id`. Complete boundary stencils must
|
||||
avoid the transfer footprint. Change a child Jet with
|
||||
`set_jet_amplitude(index, value, level=2)` (`level` is required); L1 bodies/Jets remain unsupported.
|
||||
|
||||
## Verification
|
||||
|
||||
CPU geometry, table, pre-CUDA rejection, schedule and cleanup tests:
|
||||
|
||||
```sh
|
||||
PYTHONPATH=src python -m unittest discover -s tests/unit -p 'test_refinement*.py' -v
|
||||
```
|
||||
|
||||
`tests/unit/test_union_refinement.py` covers union dependencies and tile
|
||||
ownership; `tests/unit/test_hierarchy.py` covers composed geometry through four
|
||||
levels. `tests/unit/test_raw_exchange.py` checks the four-level host schedule
|
||||
with CUDA mocks. These establish topology/control-flow coverage, not numerical
|
||||
qualification at every depth or interface shape.
|
||||
|
||||
Explicit GPU gates are in
|
||||
`tests/validation/multigrid/test_refinement_three_level_multipatch_gpu.py`.
|
||||
They cover physical-frame equivalence, twins, asymmetric refinement, multiple
|
||||
children, reversed order, independently varied aligned layouts, public/raw
|
||||
masks and two L2 bodies with static/zero/driven/switched Jets. Snapshots are
|
||||
0/1/2/8. CPU mocks do not execute CUDA and do not establish numerical accuracy.
|
||||
GPU equivalence gates supplement the separately frozen independent dense
|
||||
three-level numerical replay; passing either alone is not a conservation,
|
||||
performance or physical-accuracy claim.
|
||||
@@ -0,0 +1,120 @@
|
||||
# Re_D = 50 Kármán inflow: paired pinball VIV / frozen PPO demo
|
||||
|
||||
Development experiment, frozen before results, 2026-10-31. No new production
|
||||
method, structural damping, force filter, policy training, or main merge.
|
||||
[Force-spike research index](research/moving_boundary_force_spikes.md).
|
||||
|
||||
## Plant and structure
|
||||
|
||||
Base `e9213dd2cc9cfed0e8487a3cf4ebdd94d23dc64d`; fixed-policy contract from
|
||||
`580397eaf83c85b233495791ecc51662a374a247`. Reuse `steady_pinball` config,
|
||||
coordinate map and exact held-force oscillator. D40, U=.005, nu=.004, MRT,
|
||||
2559 x 1022, FP32 unshifted double buffers. Regularized parabolic inlet,
|
||||
NEQ extrapolation outlet, bounce-back y walls (.5,1020.5); no BC changes.
|
||||
D20 coordinates map x'=2x, y'=.5+2(y-.5).
|
||||
Upstream cylinder (400,510.5), radius40, is static. Pinballs radius20 at
|
||||
(1200,510.5), (1252,540.5), (1252,480.5) share only transverse translation.
|
||||
Lab probes radius10 at (1600,590.5), (1600,510.5), (1600,430.5) stay fixed.
|
||||
|
||||
One shared `Translation`, travel ±D, max wall speed .025, existing clearance
|
||||
and per-step move guards unchanged. M2: m*=2 based on all three disks,
|
||||
M=7539.8223686, fn=.000025, K=.000186037660, C=zeta=0; release y=v=0.
|
||||
Each native step uses previous-step sum(CME_y+Wen_y), then exact oscillator
|
||||
update with held force. Wall speed is interval displacement y[n+1]-y[n].
|
||||
Cover/uncover impulses are logged, never added to the selected RHS. This
|
||||
estimator remains provisional; existing spike/convergence limitations remain.
|
||||
|
||||
## Same release state, two clocks
|
||||
|
||||
A static precursor retains the accepted Kármán sequence: upstream+probes,
|
||||
2,048,000-step warmup, 150 x 3,200-step no-pinball target samples, add static
|
||||
pinballs/sync, second 2,048,000-step warmup. Save both DDF buffers, flags,
|
||||
clock and last instantaneous force. Construct each moving arm fresh at the
|
||||
same zero-offset geometry, check flags, copy both buffers and clock, verify
|
||||
exact copy hashes. This one-time research initialization is not a moving
|
||||
checkpoint or FSI rollback. Initial policy observation and spin are zero.
|
||||
|
||||
Frozen model SHA256 `148240c1dcb8b11d8e5a0a9e991f6874c4e799c9744707bf0fb32a8efeb0468d`;
|
||||
normalizer `534fda818c030a56960e95d0f3ac1e350d887d03db7f80f1d6453195a502b7f0`.
|
||||
Only these explicit supplied assets are accepted. Policy is CPU deterministic.
|
||||
Native policy signals: packed CME (same `read_force` path), lab area-mean
|
||||
velocity, each averaged over SI3200. Convert to original D20 training units:
|
||||
forces x2, area-mean velocity x2 x78, then frozen force-first normalization
|
||||
and clipping. Fine-grid probe pixel footprint is not exactly identical;
|
||||
using the original78 cells avoids a hidden area-count normalization change.
|
||||
The moving plant, motion-induced force, lab-frame wake displacement and D40
|
||||
resolution remain out of training distribution. No transfer guarantee.
|
||||
|
||||
A=(8a+(0,-4,4))*.005; EMA alpha=.9^(1/4), reset0 each SI; omega=+A_eff/20.
|
||||
This preserves historical physical actuator timescale under dt/4.
|
||||
The zero arm substitutes a=(0,.5,-.5), so all spins are identically zero.
|
||||
Policy interval averaging does **not** average the native structural RHS.
|
||||
|
||||
## Bound, output, and interpretation
|
||||
|
||||
One serial pair, zero then controlled: 400SI=1,280,000 native steps=160D/U
|
||||
=32Tn per arm. No retuning/automatic extension. Stop on nonfinite state,
|
||||
no_donor, travel/speed/move rejection, or four-hour whole-pair wall cap.
|
||||
A failure stops the remaining run; retain valid rows and completed intervals.
|
||||
NaN trailing rows are unexecuted, not zero-valued observations.
|
||||
|
||||
Report first/last80D/U windows, mean offset separately from centered RMS,
|
||||
half-range, peak, frequency and drift; native versus SI-averaged force,
|
||||
CME/Wen/node/crossing terms and action/observation clipping. Last80D/U is
|
||||
the principal descriptive window, not an asserted settled window. If zero
|
||||
arm half-range <.1D there, classify weak response and do not claim vibration
|
||||
suppression. Report continuous ratios regardless. Cloaking uses retained
|
||||
canonical last30 lagged sensor DTW against this precursor's no-pinball target,
|
||||
with fixed-body D20 results contextual only. These are development criteria,
|
||||
not paper uncertainty, grid convergence, or proof of validated FSI.
|
||||
|
||||
Save native18-column rows (~184MB/arm), small SI signals, target, config,
|
||||
release two buffers (~188MiB), hashes and terminal reports outside checkout.
|
||||
No per-step field output. Expected new data <650MB, check actual resources.
|
||||
|
||||
```
|
||||
CUDA_VISIBLE_DEVICES=0 PYTHONPATH=src python research/karman_viv/run.py \
|
||||
--model /tmp/celeris-karman-viv-assets/model.zip \
|
||||
--norm /tmp/celeris-karman-viv-assets/norm.json --out /tmp/NEW_OUTPUT
|
||||
```
|
||||
|
||||
First `--smoke`: same D40 geometry, warmup32/target2x8/warmup32,
|
||||
4x8 response steps each arm; strictly plumbing only. CPU source checks and
|
||||
independent exact-tip review precede GPU. Preserve original DynamisLab files.
|
||||
|
||||
## One predeclared m*=4 exploration (2026-10-31)
|
||||
|
||||
The m*=2 attempt at `516975ef6482f983ace347cb10de7450d2fbd680` stopped
|
||||
at the declared travel guard in both arms: zero 10.469375 D/U, PPO 27.5525 D/U.
|
||||
Its principal 80–160 D/U paired window is unavailable. Early attenuation is
|
||||
not sustained suppression; control-only DTW is not a paired cloaking result.
|
||||
Those results remain unchanged and retained.
|
||||
|
||||
The sole next candidate doubles M and K together: m*=4, M=15079.644737231,
|
||||
K=0.000372075320164, fn=0.000025, C=zeta=0. This increases inertia and stiffness,
|
||||
not damping. Half response under an identical prescribed external force is
|
||||
the selection rationale only; coupled flow feedback can invalidate it. This
|
||||
is an exploratory development case, not independent validation or a sweep.
|
||||
|
||||
Reuse the exact saved static release, config, target, model and normalizer.
|
||||
`--release-dir` checks precursor metadata, config equality, both DDF/flags
|
||||
hashes and clock against the original transfer receipt. Each fresh arm still
|
||||
checks its upload against that seed. No warmup, moving restart or new release
|
||||
file is generated. All fluid/geometry/EMA/SI/RHS settings, 400SI per arm,
|
||||
zero damping, ±D guard and other stop conditions above remain unchanged.
|
||||
The original failure stops the remaining run rule also remains unchanged.
|
||||
|
||||
```
|
||||
CUDA_VISIBLE_DEVICES=0 PYTHONPATH=src python research/karman_viv/run.py \
|
||||
--model /tmp/celeris-karman-viv-assets/model.zip \
|
||||
--norm /tmp/celeris-karman-viv-assets/norm.json --out /tmp/NEW_M4_OUTPUT \
|
||||
--mass-ratio 4 --release-dir /tmp/celeris-results-karman-viv-516975e/pair
|
||||
```
|
||||
|
||||
Report matched valid windows only, separately retaining mean offset,
|
||||
centered RMS, half-range, interval/native forces, crossing/diagnostic counts
|
||||
and paired DTW only where both arms have sufficient data. The larger
|
||||
controlled force excursions remain unresolved: retained m*=2 data strongly
|
||||
associate them with the post-action-reset ramp, not exclusively current-step
|
||||
node switching. No force smoothing, action-contract change, enlarged travel
|
||||
band or further parameter adjustment follows an unsuccessful outcome.
|
||||
@@ -0,0 +1,26 @@
|
||||
# Device state lifecycle (uniform Simulation, FixedPatchStepper)
|
||||
|
||||
State is grouped by what a change invalidates. This file describes the code as
|
||||
it is; it adds no framework. Line references are to candidate 0f8fdbc3.
|
||||
|
||||
| Class | Contents | How it changes | Owner rule |
|
||||
|---|---|---|---|
|
||||
| 1. Module and its globals | Compile-time (visible to the compiler, fixed per module): `config.h` macros incl. `NX`/`NY`, `COLLISION_MODEL`, `BLOCK_ROOT_BC`, `WALL_*`. Runtime per-module globals (not visible to the compiler; written by host code): `__constant__` `d_params`, `d_w`, `d_cx`, `d_cy`, `d_block_channel`, `d_block_wall`; plus bound kernel handles | Globals are written once by the owner right after `load_module`. Uniform grid: `Simulation._recompile` (construction, body-topology sync) loads a new module and re-uploads; `update_runtime_params` rewrites `d_params` (omega, force, n_objects) between runs. Steppers: never rewritten after construction, so they are immutable for the instance's lifetime although they are runtime values. The blocked slot/reservoir root reads its slot from the `d_block_wall` constant (the former dense route used `WALL_*` macros; both were bit-identical in the parity gates). | Every owner loads its own module (`compiler.load_module` = `module_from_file`, no cache). A loaded module is never shared between live owners: globals are per module, so sharing would share mutable `d_params`. |
|
||||
| 2. Geometry, layout, tables | flags, curved-link tables, block layouts and halo pairs, transfer (explode/coalesce) tables, block kinds | Immutable for the life of an instance, except translating circles on the uniform grid: their swept-band flags and cut links are rewritten on the device every advancing step (`MovingCircleCells`/`MovingCircleLinks`, docs/moving_bodies.md); the host flag mirror is then stale for those cells. Uniform grid otherwise: rebuilt by body sync. `FixedPatchStepper`: a geometry change is a new instance (`remap_finest`), committed only after a successful transfer. | No in-place table edits. |
|
||||
| 3. Controls and dependent boundary columns | Jet amplitude -> per-link `surface_velocity`; body actions (uniform grid) | Between steps, without a table or module rebuild (`set_jet_amplitude`). | Input (index, level, amplitude) is validated before any device write; invalid input changes nothing and the instance stays usable. The host copy commits only after the upload returned. Any error after validation leaves the device column undefined and fails the instance: `FixedPatchStepper` status `failed`, `Simulation._failed`; every later device-touching public method (`Simulation`: `stream`, `set_jet_amplitude`, `initialize`, `sync_bodies`, `run`/`step`, `read_surface_exchange`, `read_body(s)`, `get_macroscopic`, `get_ddf`, `update_runtime_params`, `snapshot`, `restore`, save/load checkpoint) raises; cached host readers and host-side staging (e.g. `get_flags` without translating circles, `add_body`/`remove_body` before a sync) do not touch the device and stay callable; with translating circles `get_flags` reads the device flags back and refuses after a failure. Translating-circle targets follow the same rule: `set_body` validates before mutation, the applied offset commits only after a successful synchronized step, and a failed moving step fails the instance (docs/moving_bodies.md). `close()` still releases resources and stays retryable. |
|
||||
| 4. Per-step state | population double buffers and their parity, raw-exchange ledgers, observations | Device-only during `step(n)` / `run(n)`; buffer swaps are host-handle swaps. | Valid on the host only after the single wait at the end of the call. |
|
||||
|
||||
Storage routes are separate concerns:
|
||||
|
||||
- Original uniform grid (`uniform.cu`, `Simulation`): whole-domain `NX`/`NY`.
|
||||
- Blocked levels (`blocked.cu`; every `FixedPatchStepper` level, including the
|
||||
single level of `refinements=[]`): `NX`/`NY` are one block window including halo.
|
||||
- Dense refinement levels (`refinement.cu`) were removed: `level_blocks` is
|
||||
required and every refinement level is blocked.
|
||||
|
||||
A single-rectangle refinement (`FixedPatch2D`) is stored in its own fine
|
||||
window frame (`FixedPatchStepper.__init__`,
|
||||
`BlockLayout2D.build(*pair.fine_shape, ...)`). Only a rectangle set
|
||||
(`FixedPatchSet2D`) uses the level-wide frame `(2*ny, 2*nx)`, whose
|
||||
`fine_layout` requires that full grid to be divisible by the tile
|
||||
(`refinement.py:240-252`).
|
||||
@@ -0,0 +1,451 @@
|
||||
# Moving circles on the uniform dense grid
|
||||
|
||||
## Status and user guide (current)
|
||||
|
||||
Development-stage feature, integrated from the reviewed slices S1–S3a
|
||||
(production code identical to `653fd997`). Physical evidence and its limits:
|
||||
`docs/validation/moving_bodies_stage1.md`. The force used as a structural RHS
|
||||
is a declared stage choice, not an established result.
|
||||
|
||||
*What it does.* Translating circles (with optional spin) on the dense
|
||||
double-buffer D2Q9 path: per-step cut links from an FP64 geometry record
|
||||
(M2 `MovingCircleLinks`), reclassification and refill of covered/uncovered
|
||||
cells (M1 `MovingCircleCells`), moving-wall Bouzidi with wall velocity
|
||||
`u + omega x r`, and separate per-body diagnostics.
|
||||
|
||||
*API.*
|
||||
- `Simulation.add_body("circle", center=(x, y), radius=r,
|
||||
translation=Translation(offset_box, max_speed))` before `initialize()`;
|
||||
`offset_box = (x_min, x_max, y_min, y_max)` in lattice cells around the
|
||||
base centre (must contain 0), `0 < max_speed ≤ .5`.
|
||||
- `set_body(id, offset=(dx, dy), vx=..., vy=..., omega=...)` sets a pending
|
||||
target (validated against the applied offset: box, Euclidean step ≤ .5
|
||||
cell, speed, no sliding hold); `vx`/`vy` are the interval wall velocity.
|
||||
- `run(1)` advances a pending target and commits it only after the step
|
||||
synchronizes with `no_donor == 0`; `run(n > 1)` with a pending target
|
||||
raises; without a target `run(n)` holds the geometry (spin allowed).
|
||||
Direct `LBMStepper.step` refuses while a target is pending.
|
||||
- `moving_diagnostics()` returns per body the columns of
|
||||
`MovingTables.DIAG` (CME, Wen term, link mass, cover/uncover momentum and
|
||||
mass, eq_only, no_donor, crossings) accumulated since obs were zeroed;
|
||||
`obs`/`read_force` keep their contract (CME on the body).
|
||||
- `get_flags()` reads device flags back when moving circles exist.
|
||||
- `snapshot()` / `restore()` save and restore populations only, keeping the
|
||||
current clock, controls, observations, geometry and flags. Use them only
|
||||
with unchanged geometry; restoring across a translation is unsupported
|
||||
and is not rejected at runtime. They do not provide FSI rollback.
|
||||
|
||||
*Supported:* dense double buffer, D2Q9, FP32 unshifted, SRT/MRT, circles,
|
||||
spin. *Rejected before mutation:* EsoPull, ddf shifting, D3Q19, refinement /
|
||||
blocked steppers, Jets or surface actuation on a moving circle,
|
||||
`sync_bodies` and checkpoints while a moving circle exists, swept bands that
|
||||
touch the domain edge, other bodies, sensors or force regions.
|
||||
|
||||
*Failure lifecycle.* Device-side failures (upload, step, sync, no_donor)
|
||||
mark the Simulation failed; later run/step/sync/checkpoint calls and direct
|
||||
stepper calls refuse until `close()`.
|
||||
|
||||
*Known limitations.* No mass correction at curved walls (static or moving);
|
||||
cover/uncover and Wen terms are diagnostics, not a selected force law; the
|
||||
host loop costs a fixed per-step synchronization (≈ 1 ms/step measured on a
|
||||
7.2 M-cell grid, run(1) class); outer boundaries are the single dense
|
||||
channel package (see `configs/CONFIG.md`).
|
||||
|
||||
## Design record (staged contract, kept as written)
|
||||
|
||||
The sections below are the contract the slices were reviewed against
|
||||
(S0 → S3a). They are kept unchanged for provenance; where they say "draft",
|
||||
"proposed" or "until S2/S3", the status above supersedes them.
|
||||
|
||||
Original scope (Frank via TRON, thread C0C78UFKGRM/1793335557.460509):
|
||||
uniform-grid prescribed translation and single-cylinder free transverse VIV;
|
||||
base main `b2034f87e03656c5f67ab88562a70d6c338b9918`.
|
||||
|
||||
## 1. Working standards
|
||||
|
||||
- Lean, readable kernels in the existing idiom (`kernels/step/*.cu`, shared
|
||||
`apply_bouzidi_link`); Python manages state and validation. No framework,
|
||||
no compatibility layer, no new dependency.
|
||||
- The existing stationary/rotating path (`CurvedBoundaryKernel`, host link
|
||||
packing, `sync_bodies`) stays byte-identical. Moving circles are a separate,
|
||||
explicitly enabled path with its own numerical contract (this file).
|
||||
- One authority per state (section 4). No per-step full-domain download,
|
||||
rebuild or recompile; local swept-band device updates are in scope.
|
||||
- Small slices (S1 host spec, S2 kernels without motion, S3 motion + refill,
|
||||
S4 oscillator); each reviewed SHA is frozen before targeted runs.
|
||||
- Tolerances, benchmark parameters and the force composition used in the
|
||||
structural RHS are declared before the runs that judge them. Fresh vs carried
|
||||
evidence and existing baseline failures are recorded; smoke, convergence and
|
||||
physical validation are reported separately. No undeclared force filtering.
|
||||
- External code (waLBerla GPLv3, FluidX3D source-available, VIVSIM) is a
|
||||
concept reference only; nothing is copied.
|
||||
|
||||
## 2. Current update order (main b2034f87, dense double buffer)
|
||||
|
||||
`Simulation.run(n)`: upload host action (if `upload_act`) → zero obs (if
|
||||
`zero_obs`) → `DoubleBufferStepper.step(n)` → download obs → synchronize.
|
||||
|
||||
Per step (`lbm/stepper.py` `step`):
|
||||
|
||||
1. `CurvedBoundaryKernel` over the packed cut links: reads post-collision
|
||||
`G^{n-1}` at `k_f` (and `k_f - c` for q < 1/2), adds the moving-wall term
|
||||
(`Uw = -omega*ry, Vw = omega*rx` + optional per-link `surface_velocity`),
|
||||
writes the reflected value into slot `opp` of the solid node `k_s`, and
|
||||
accumulates `c(f_toward + f_reflected)` and torque into `obs`.
|
||||
2. `OneStep` pull/collide `ddf → temp` (collides FLUID cells; obstacle
|
||||
interiors flagged `SOLID|OBSTACLE|BC_CURVED`), then buffer swap.
|
||||
3. `ForceRegionKernel`, `SensorKernel`.
|
||||
|
||||
Raw `obs` force is the force **on the body** (link derivation in section 6;
|
||||
DFG docs report `Cd > 0` from it). Translation `vx, vy` in the action slots is
|
||||
currently stored but not read by any curved kernel.
|
||||
|
||||
## 3. Proposed update order (moving circles)
|
||||
|
||||
Per step n, before the existing step 1:
|
||||
|
||||
- **M1 `MovingCircleCells`** (one thread per swept-band cell): classify with the
|
||||
analytic predicates `in_old = inside(x, c^{n-1})`, `in_new = inside(x, c^n)`;
|
||||
write `flag = in_new ? SOLID|OBSTACLE|BC_CURVED : FLUID`; covered cells
|
||||
(`!in_old && in_new`) accumulate `node_cover`; fresh cells
|
||||
(`in_old && !in_new`) are refilled (section 5) and accumulate `node_uncover`.
|
||||
- **M2 `MovingCircleLinks`** (one thread per band cell × direction): compute
|
||||
q and hit point at `c^n` (FP64, same formula as `find_circle_intersection`,
|
||||
same clamp [0.01, 1] and fallback classes as `CircleGeometry.build_cut_links`),
|
||||
skip non-cut slots, call `apply_bouzidi_link` with
|
||||
`u_w = (vx^n, vy^n) + omega × (hit - c^n)`, accumulate the link terms
|
||||
(section 6).
|
||||
|
||||
Then the unchanged steps 1–3. M2 must follow M1 because a q < 1/2 link may
|
||||
read `k_f - c` at a fresh cell.
|
||||
|
||||
Exclusivity: moving bodies are never packed into the `CurvedBoundaryKernel`
|
||||
link arrays (`n_curved` covers stationary/rotating bodies only), so M2 is the
|
||||
sole writer of their solid slots and the sole source of their link force; no
|
||||
double write and no double `obs`. The stationary path's packing, launch and
|
||||
arithmetic are unchanged.
|
||||
|
||||
Completeness: after M1, every (fluid cell, direction) pair in the swept band
|
||||
whose neighbour is `in_new` is visited by M2. This holds because the band is
|
||||
the circle AABB at the declared extreme offsets plus 2 cells, and the host
|
||||
rejects per-step moves with `|c_new - c_old|_2 > 0.5` and bands touching the domain edge,
|
||||
other bodies, sensors or force regions. Each M2 write lands at
|
||||
`index_f(k_s, opp)`, the exact slot the adjacent fluid cell pulls, so every
|
||||
fluid pull from a solid slot of a moving body is BFL-written.
|
||||
|
||||
## 4. State, masks and authority
|
||||
|
||||
- Host `ObjectState` is the single authority for one displacement
|
||||
`offset = (dx, dy)` relative to the immutable base centre, plus
|
||||
`velocity = (vx, vy)` and `omega`. Centres are always derived
|
||||
(`c = base + offset`), never stored as independent state. Velocity is
|
||||
supplied, never differenced from offsets.
|
||||
- `c^{n-1}` is derived from the last *committed* offset, `c^n` from the
|
||||
offset being applied. Per body a small device **motion record**
|
||||
`{c^{n-1}, c^n, u^n}` is uploaded with the action buffer; action-slot meaning
|
||||
is not overloaded. (CANDIDATE layout; OPEN.)
|
||||
- Fail-closed commit: an enqueued upload is not a completed one. The new
|
||||
offset becomes the committed offset only after the stream synchronization
|
||||
that follows the upload and the step group succeeds. Any upload or later
|
||||
synchronization failure leaves host and device motion state unknown: the
|
||||
simulation is marked unusable (existing `_require_usable` lifecycle), and
|
||||
no API may report a host/device match afterwards.
|
||||
|
||||
### 4a. Applied geometry vs pending target (CANDIDATE, narrow API)
|
||||
|
||||
Two distinct facts per moving body, one authority each:
|
||||
`applied` = offset of the geometry last applied on the device, changed only
|
||||
by a successful commit; `pending` = an optional requested target
|
||||
`(offset, velocity)`, changed only by `set_body`. A setter returning proves
|
||||
nothing about the device. The uploaded motion record is derived each run:
|
||||
`{c_old = base + applied, c_new = base + (pending.offset if pending is not
|
||||
None else applied), u = pending.velocity if pending is not None else 0}`
|
||||
(explicit `is not None`, so a zero offset or zero velocity is a valid target). Translational wall velocity exists only on a step
|
||||
that advances to a pending target; a hold step (`c_old == c_new`) has
|
||||
translational `u_w = 0` (spin unchanged), so a non-advancing circle never
|
||||
acts as a sliding wall. One moving step consumes one target.
|
||||
|
||||
| situation | contract |
|
||||
|---|---|
|
||||
| `set_body` target | validated against `applied` (box, `|Δc|_2 ≤ 0.5` cell, speed bound) before mutation; on success replaces `pending` |
|
||||
| target with `offset == applied` and nonzero translational velocity | `ValueError` before mutation (would be a hold step with sliding wall velocity) |
|
||||
| two setters before a run | last wins; each validated against `applied`, not against the earlier pending target |
|
||||
| `run(1)` with pending | upload record, step, sync; on success `applied := pending.offset` (applied stores only the offset), `pending := None` |
|
||||
| `run(1)` without pending | hold: `c_old == c_new`, no cover/uncover, links at `applied`, translational `u_w = 0` |
|
||||
| `run(n > 1)` with pending | `ValueError` before mutation (single-step-only moving API) |
|
||||
| `run(n > 1)`, no pending | allowed: hold for n steps, translational `u_w = 0`, spin only |
|
||||
| `run(0)` | no motion upload, no commit; `pending` kept |
|
||||
| validation failure | `ValueError`, nothing mutated, retry allowed |
|
||||
| upload/launch/sync failure after enqueue | simulation unusable; `applied` and `pending` are not reported as device truth; no re-entry |
|
||||
|
||||
Displacement norm: Euclidean per-step `|c_new - c_old|_2 ≤ 0.5` lattice
|
||||
cells (declared bound; CANDIDATE value).
|
||||
- Membership is never read from a flag that M1 is overwriting. The host
|
||||
verifies at `add_body` that every swept-band cell has base flag FLUID, so the
|
||||
band's base state is known without reading `flag_gpu`.
|
||||
- `flag_gpu` is the device authority for band cells while a moving body
|
||||
exists; the host flag mirror is stale for those cells and is not used.
|
||||
|
||||
## 5. Refill of fresh cells (CANDIDATE)
|
||||
|
||||
- Stored time level: everything in `ddf` at M1 is post-collision `G^{n-1}`; the
|
||||
refill writes all 9 slots at that same level, so every slot of a fresh cell
|
||||
that the following pull or a q < 1/2 link may read is defined. Donor values
|
||||
are read at the same level `G^{n-1}` (old-fluid cells, untouched by M1).
|
||||
- `G = f_eq(rho_bar, u_w(x)) + G_neq(x_d)` where `rho_bar` = mean density of
|
||||
valid neighbours and `x_d` = the valid neighbour best aligned with the outward
|
||||
normal `(x - c^n)/|x - c^n|`; `G_neq(x_d) = G(x_d) - f_eq(rho(x_d), u(x_d))`.
|
||||
- Valid donor: inside the domain, base FLUID, `!in_old && !in_new`.
|
||||
- Sets: `V(x)` = the 8 lattice neighbours that are in the domain, base FLUID
|
||||
and `!in_old && !in_new`. `rho_bar` = mean density over `V(x)`. NEQ donor =
|
||||
the member of `V(x)` with the largest `c·n` among those with `c·n > 0`
|
||||
(`n` = outward normal at `c^n`); none → NEQ part 0 (counted as `eq_only`).
|
||||
- `V(x)` empty → no defined density: the cell is refilled with
|
||||
`f_eq(RHO, u_w(x))` so all 9 slots stay defined, the `no_donor` counter is
|
||||
incremented, and the host treats `no_donor > 0` after the run as a hard
|
||||
failure (simulation unusable). It is not a silent fallback.
|
||||
- Non-emptiness is NOT assumed from the displacement bound. Geometry
|
||||
assumptions: circle radius `R ≥ R_min` (CANDIDATE 4 cells), `|Δc|_2 ≤ 0.5`.
|
||||
S1 includes a host enumeration over sub-cell centre positions and
|
||||
displacement directions on a fine grid within these bounds that checks every
|
||||
fresh cell has nonempty `V(x)`; it is evidence for those bounds, not a
|
||||
proof, and runtime keeps the counter.
|
||||
- Fresh cells only write, old-fluid cells only read: no race.
|
||||
|
||||
## 6. Discrete momentum ledger (to review; not a selection)
|
||||
|
||||
Notation per step n: `F^n` = fluid set after M1; links L = (k_f, dir) at
|
||||
`c^n`; `f_t = G_dir(k_f)`; `f_r` = value M2 writes into `(k_s, opp)`.
|
||||
Fluid momentum before streaming:
|
||||
|
||||
P_pre = P(G^{n-1} on F^{n-1}) - sum_cover sum_q c_q G_q + sum_fresh sum_q c_q G_q^refill
|
||||
|
||||
During the pull, every population entering a fluid cell comes from a fluid
|
||||
cell except the BFL-written slots; `f_t` leaves into solid and is never pulled
|
||||
by a fluid cell. Collision conserves momentum for SRT/MRT without forcing.
|
||||
Hence, in exact arithmetic,
|
||||
|
||||
P_fluid^n - P_fluid^{n-1} = - sum_L c (f_t + f_r) - I_cover + I_uncover + B^n + S^n
|
||||
|
||||
with `B^n` external-boundary momentum (inlet/outlet/walls) and `S^n` forcing.
|
||||
So **`F_CME + node_cover - node_uncover`** is, by construction, the body
|
||||
momentum that balances the fluid ledger of *this* storage/update order.
|
||||
Branch details: halfway fallback links (`f_r = f_t` plus the moving-wall
|
||||
addend) and q < 1/2 links enter the link accumulators exactly like Bouzidi
|
||||
links, with `c(f_t + f_r)`. In the q < 1/2 branch `G_dir(k_f - c)` is an
|
||||
interpolation input only, not a fluid-momentum sink. Pull-slot completeness
|
||||
is the section 3 contract. The scope excludes `ddf_shifting` (rejected), so
|
||||
the unshifted force form applies. The balance is a fluid-side identity; it
|
||||
does not close body+fluid globally in a domain with inlet/outlet/forcing
|
||||
(`B^n`, `S^n`), and the solid-slot writes are boundary plumbing, not physical
|
||||
streaming packets.
|
||||
|
||||
The Wen 2014 relative-velocity link sum adds `-u_w (f_t - f_r) = u_w dm` per
|
||||
link (`dm = f_r - f_t`, the BFL mass defect). That term has no counterpart in
|
||||
the fluid ledger above. Peng et al. (PRE 2016 submitted, §II.C, Eqs. 20–21)
|
||||
show for a straight wall that the bounce-back error accumulated before a node
|
||||
switch cancels with the switching momentum. Whether `sum u_w dm` approximates
|
||||
`I_cover - I_uncover` here (implying double counting if both are used) is
|
||||
**NOT demonstrated** for this implementation: it needs a bounded experiment
|
||||
(prescribed slow translation; cumulative `sum u_w dm` vs cumulative node
|
||||
impulse, per crossing cycle). Momentum conservation is also distinct from
|
||||
Galilean invariance, which G4 tests.
|
||||
|
||||
External reference note: waLBerla's covered/refill momentum switches
|
||||
(`conserveMomentumWhenMapping`, `conserveMomentumWhenRestoring`) default to
|
||||
false (Astra), so their existence does not establish which combination its
|
||||
validation cases use. A bookkeeping identity alone does not select the
|
||||
physical force either.
|
||||
|
||||
Mass ledger (same proposition status). With `M^n` the active-fluid mass
|
||||
summed over `F^n` at the sample point,
|
||||
|
||||
M^n - M^{n-1} = sum_L dm - m_cover + m_uncover + B_m^n
|
||||
|
||||
(`dm = f_r - f_t`, `m_cover`/`m_uncover` = summed `sum_q G` of covered and
|
||||
refilled cells, `B_m` external-boundary mass flux; collision conserves mass).
|
||||
|
||||
Sample point (fixed): post-collision storage after the swap of step n, i.e.
|
||||
the same level `G` that M1 reads at step n+1; both ledgers are evaluated
|
||||
there. Ledger residual = left side minus every listed term. Zero mass flux
|
||||
does not imply zero momentum exchange: closed walls (bounce-back, free-slip)
|
||||
still exchange momentum, so "no inlet/outlet, no forcing" does NOT give
|
||||
`B = S = 0`. The rounding-level momentum check therefore uses either a
|
||||
momentum-isolated case (periodic in both directions, no forcing) or counts
|
||||
the wall impulse explicitly as part of `B`; the mass check may use a closed
|
||||
domain. Otherwise `B`, `S` are not separately measured, the residual is
|
||||
reported as their estimate and is not a pass criterion.
|
||||
Both ledger identities are **proposed, unreviewed**: they are not called
|
||||
proven until review and a host replay agree.
|
||||
|
||||
Accumulators (separate, per body, per step window; all reported raw):
|
||||
`link_cme`, `link_wen_correction` (= `sum u_w dm`), `node_cover`,
|
||||
`node_uncover` (momentum), `link_dm`, `mass_cover`, `mass_uncover` (mass),
|
||||
plus counters of crossings, `eq_only` and `no_donor`, so force spikes can be
|
||||
correlated with crossing events.
|
||||
|
||||
**OPEN — structural RHS candidates (not selected):**
|
||||
(a) `link_cme + node_cover - node_uncover`; (b) `link_cme + link_wen_correction`
|
||||
(no node impulse). Selection follows the ledger review and the bounded
|
||||
experiment above.
|
||||
|
||||
## 7. Rejection semantics
|
||||
|
||||
- Before any mutation (`ValueError`, no device write, host state unchanged):
|
||||
moving body with EsoPull, `ddf_shifting`, refinement/blocked stepper, D3Q19,
|
||||
Jets or surface actuation on that body, `sync_bodies`/checkpoint while a
|
||||
moving body exists; swept band touching domain boundaries, other bodies,
|
||||
sensors or force regions; `set_body` offset outside the declared box,
|
||||
per-step move `|c_new - c_old|_2 > 0.5` cell (the single bound of 4a), speed
|
||||
above the declared bound.
|
||||
- Host motion state is committed only after the upload *and* the following
|
||||
synchronization of the step group succeed (section 4); any failure in
|
||||
between makes the simulation unusable and no host/device match is reported.
|
||||
- The only soft device diagnostic is `eq_only` (NEQ part omitted, counted).
|
||||
`no_donor > 0` is a hard failure: it is checked after the step group and
|
||||
before the step is committed or any results are returned; on failure the
|
||||
simulation is unusable (section 5).
|
||||
|
||||
## 8. Coupling and units (CANDIDATE)
|
||||
|
||||
Lattice units, rho0 = 1, per unit span. Step n uses `c^n`, `u^n` and yields
|
||||
`F^n`. Weak staggered update
|
||||
`v^{n+1} = v^n + (F^n - c v^n - k y^n)/m`, `y^{n+1} = y^n + v^{n+1}`
|
||||
(Newmark is an alternative; OPEN). Mass, natural frequency, damping and `U_r`
|
||||
follow the chosen benchmark's own definitions. Leontini, Thompson & Hourigan,
|
||||
JFS 22:857–864 (2006), DOI 10.1016/j.jfluidstructs.2006.04.003, as read by
|
||||
Grok from the full text: Re = 200, `m* = m/m_f = 10` (m_f displaced fluid
|
||||
mass), `zeta = c/c_crit = 0.01`, `U* = U/(f_N D)` with `f_N` the natural
|
||||
frequency in fluid assuming an inviscid added-mass term; the paper also
|
||||
reports frequencies normalised by the in-vacuo value. Our runner derives `k`
|
||||
from that in-fluid `f_N` (added-mass coefficient as stated in the paper) and
|
||||
never from the vacuum formula; `c_crit` convention and the original
|
||||
comparison data are still OPEN. Stability/convergence is gated by fluid
|
||||
time/space refinement of the coupled run, not assumed from the mass ratio;
|
||||
structural sub-stepping does not substitute for fluid-coupling time
|
||||
refinement.
|
||||
|
||||
## 9. Gates (map; tolerances OPEN, declared before runs)
|
||||
|
||||
G0 zero-motion regression, split: G0a populations of the existing stationary
|
||||
and spin-only path bitwise unchanged vs main; G0b moving path at rest (with
|
||||
and without spin) reproduces the stationary link set and populations; force
|
||||
estimator outputs are compared separately from populations, since the moving
|
||||
path adds estimator terms · G1 raw force sign (`Cd > 0`) ·
|
||||
G2/G3 prescribed translation incl. ledger accumulators · G4 matched
|
||||
relative-flow (moving body in quiescent fluid vs fixed body in uniform
|
||||
stream), optional boost, co-moving sanity · G5 Dütsch et al. 1998 Re 100,
|
||||
KC 5 in-line (needs 2-component offset) · G6 Leontini free transverse VIV
|
||||
(m* = 10, ζ = 0.01, Re = 200, definitions pending) · G7 time-level contract
|
||||
frozen before the oscillator.
|
||||
|
||||
Candidate pre-run engineering tolerances (Astra; for discussion, not
|
||||
literature limits or measured outcomes; norms, averaging window, convergence
|
||||
protocol and physical reference uncertainty must be fixed before adoption, and
|
||||
none may be weakened after seeing runs):
|
||||
normalised momentum-ledger residual FP32 ≤ 5e-6 (FP64 oracle ≤ 2e-13);
|
||||
10-cycle relative mass drift ≤ 1e-4; prescribed-motion grid study D = 40/80/160
|
||||
with change in the force-response amplitude (observed quantity and norm to be
|
||||
named before adoption) ≤ 2 % and phase ≤ 2°; enlarged domain
|
||||
amplitude change ≤ 1 %; matched-frame force RMS ≤ 2 % and improving with
|
||||
refinement; VIV refinement amplitude ≤ 2 %, frequency ≤ 1 %, five consecutive
|
||||
cycle amplitudes within 1 %.
|
||||
|
||||
Conditions stated before any moving kernel (S2/S3), not only at the
|
||||
oscillator stage: (i) fluid refinement protocol for the prescribed-motion
|
||||
gates — diffusive scaling (dx halved, dt quartered, physical Re, KC and
|
||||
amplitude fixed), the observed quantities and norms named in advance;
|
||||
(ii) Galilean constant-boost G4-boost requires boundaries compatible with a
|
||||
uniform boost (periodic in the boost direction or boundaries that move with
|
||||
it); if the current dense configuration cannot represent that, G4-boost is
|
||||
recorded as not runnable rather than replaced by another test.
|
||||
|
||||
## 10. Proposed minimal S1 scope (host only; held until cross-review)
|
||||
|
||||
- `add_body` moving-circle declaration: base centre, declared offset box
|
||||
(x/y), speed bound; swept-band computation and band-placement validation.
|
||||
- `set_body(offset=..., velocity=..., omega=...)` validation before mutation
|
||||
(section 7), applied/pending state and the run-transition table of 4a,
|
||||
and the fail-closed commit of section 4.
|
||||
- Host enumeration check of refill-donor non-emptiness (section 5) within
|
||||
the declared `R_min` and displacement bound.
|
||||
- Motion-record host layout and upload path; exclusion of moving bodies from
|
||||
the packed `CurvedBoundaryKernel` links (stationary packing unchanged).
|
||||
- Explicit rejections for unsupported modes.
|
||||
- S1 execution guard: until the S2 moving kernels exist, any `run(n)` with
|
||||
`n > 0` (and `step(n)`) while a moving body is declared raises before any
|
||||
device mutation (no action/motion upload, no launch), including the
|
||||
nominal at-rest case, because the moving body is excluded from the static
|
||||
packed links and nothing else would apply its boundary. `run(0)` keeps its
|
||||
existing behaviour. Simulations without moving bodies are unaffected.
|
||||
Preparation/commit helpers are exercised by host tests with mocks; no
|
||||
operational unsupported stepping path is exposed.
|
||||
- Host tests (Astra runs them): rejection-before-mutation, band geometry,
|
||||
derived centres, fail-closed behaviour under an injected upload/sync
|
||||
failure, stationary packing byte-identical, execution guard (positive-step
|
||||
run with a moving body raises before upload/launch; stationary unaffected). No kernels, no GPU runs, no
|
||||
y-only VIV oscillator (S4), no force RHS.
|
||||
|
||||
## 10a. S2a — fixed-centre moving links (implemented on `claude/moving-bodies-s2a`)
|
||||
|
||||
- `MovingCircleLinks` (`kernels/step/moving_circle.cu`, dense double buffer)
|
||||
runs before the static curved kernel when moving tables are attached: one
|
||||
thread per (band cell, direction) slot, FP64 `{cx, cy, r}` at the applied
|
||||
offset, q/hit/clamp/fallback in the order of `build_cut_links` with explicit
|
||||
`_rn` operations (host/device bit parity is a test target, not a claim),
|
||||
then the unchanged `apply_bouzidi_link` with spin wall velocity only.
|
||||
- `obs` keeps its contract (CME and torque from `apply_bouzidi_link`). A
|
||||
separate per-body diagnostics buffer receives `cme`, the Wen term
|
||||
`u_w * dm`, `link_dm` and the link count from the same link outputs; it is
|
||||
zeroed with obs and only exists when moving circles do. Optional
|
||||
`slot_debug` (q, fallback, rx, ry per slot) is null in production.
|
||||
- Displacement is disabled: `set_body(offset=..., vx=..., vy=...)` on a
|
||||
translating circle raises before mutation, before and after initialize, so
|
||||
no pending target can exist and `run`/`step`/direct `LBMStepper.step` all
|
||||
hold at the applied geometry. `initialize()` never reads or consumes
|
||||
`pending`. `stepper.blocked` is cleared only when the moving tables are
|
||||
attached (initialize, stepper recreation).
|
||||
- S3 rule (not implemented): once targets are re-enabled, any pending target
|
||||
must raise in `run`/`step` and in `LBMStepper.step` alike before any launch,
|
||||
swap or step-count change; zero-step calls never consume it.
|
||||
- Not validation: a pass of the zero-motion gates says nothing about moving
|
||||
geometry. GPU parity (G0a/G0b) is unverified until run on a free device.
|
||||
|
||||
## 10b. S3a — translation with refill (implemented on `claude/moving-bodies-s3a`)
|
||||
|
||||
- Targets are enabled again (4a). `set_body(offset, vx, vy)` validates against
|
||||
`applied`; a pending target blocks direct `LBMStepper.step(n > 0)` before any
|
||||
launch; `run(n > 1)` with a target raises before mutation; `run(0)` never
|
||||
consumes it; `run(1)` advances it.
|
||||
- Per advancing step, on one stream: upload the immutable FP64 records
|
||||
`{c_old, c_new, r, u}` (only when changed) → M1 `MovingCircleCells` → M2
|
||||
`MovingCircleLinks` (`u_w = u + omega x r` at the hit point) → static curved →
|
||||
`OneStep` → swap → force region → sensors → synchronize → read `no_donor` →
|
||||
commit (`applied := pending.offset`) → upload the hold record
|
||||
(`c_old = c_new = applied`, `u = 0`) → synchronize. Hold steps launch no M1
|
||||
and are the S2a path. Commit point: the advancing step-group sync plus a
|
||||
zero `no_donor` count; a failure before it commits nothing. The hold-record
|
||||
upload stages the next step after the commit: if it (or its sync) fails,
|
||||
`applied` already matches the moved device geometry, but the Simulation is
|
||||
still marked failed and refuses reuse. Any failure from the first upload on
|
||||
marks the circles and the Simulation failed.
|
||||
- M1 classifies with the old/new predicates only (no flag reads). Covered
|
||||
cells add raw `sum c G` / `sum G` of `G^{n-1}` to `cover_*` and become
|
||||
`SOLID|OBSTACLE|BC_CURVED`. Uncovered cells: donors are fluid in both
|
||||
geometries; `rho_bar` over all of them; NEQ from the donor with the largest
|
||||
unnormalized `c·n > 0` (first direction wins ties, `n` from `c_new`);
|
||||
`u_w` (translation + spin) at the cell position; all nine slots written;
|
||||
raw `sum c G`, `sum G` of the refill go to `uncover_*`; no donor →
|
||||
`f_eq(RHO, u_w)` plus `no_donor` (hard failure before commit); no NEQ donor
|
||||
→ `eq_only`.
|
||||
- `get_flags()` reads the device flags back (synchronized) when moving tables
|
||||
exist; otherwise it returns the host array as before.
|
||||
- Not selected: the structural force. CME+node vs CME+Wen stay OPEN until X1
|
||||
and G4 have run.
|
||||
|
||||
## 11. Remaining decisions
|
||||
|
||||
Structural RHS (section 6); motion-record layout; refill details; coupling
|
||||
scheme; benchmark definitions and digitized reference data; tolerances;
|
||||
execution/resource feasibility (Astra, pending); whether a quiescent domain
|
||||
(zero inlet velocity) runs cleanly in the current config.
|
||||
@@ -0,0 +1,266 @@
|
||||
# CelerisLab Performance Analysis Report
|
||||
|
||||
Date: 2026-05-31
|
||||
GPU: Tesla V100-SXM2-16GB (CUDA 12.4)
|
||||
Test grid: 384x192 D2Q9, MRT, double_buffer, FP32
|
||||
Tools: cProfile (Python), Nsight Systems (GPU timeline), Nsight Compute (kernel metrics)
|
||||
|
||||
## 1. Performance Tree (384x192, MRT, 1 cylinder + 1 sensor)
|
||||
|
||||
### Per-step breakdown (batch=100, 100 steps per launch group)
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────┐
|
||||
│ One LBM Step (~100 steps, ~7.8ms total) │
|
||||
├──────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ Python Layer (CPU) ~40 μs/step (0.5%) │
|
||||
│ ├── _launch_curved() ~6 μs │
|
||||
│ ├── step_fn() (cuLaunchKernel) ~22 μs │
|
||||
│ ├── _launch_sensor() ~5 μs │
|
||||
│ └── loop overhead (Python for _ in range) ~5 μs │
|
||||
│ │
|
||||
│ GPU Kernel Layer (V100) ~13 μs/step (99.5%) │
|
||||
│ ├── CurvedBoundaryKernel ~4.0 μs (30%) │
|
||||
│ │ grid=(2,1,1) block=256 regs=31 288 threads total │
|
||||
│ │ → latency-bound (too few threads to fill SM) │
|
||||
│ ├── OneStep ~5.9 μs (44%) │
|
||||
│ │ grid=(2,192,1) block=256 regs=39 73,728 threads │
|
||||
│ │ → mixed compute+memory (53% DRAM bw, 22% SM util) │
|
||||
│ └── SensorKernel ~3.5 μs (26%) │
|
||||
│ grid=(2,1,1) block=256 regs=21 305 threads total │
|
||||
│ → latency-bound │
|
||||
│ │
|
||||
│ Memory Transfers (negligible, <1 μs/step) │
|
||||
│ ├── set_body(): 72 bytes H2D (action upload) │
|
||||
│ └── read_force(): 60 bytes D2H (obs download, async) │
|
||||
└──────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Wall-clock contributions (2000 steps, batch=100)
|
||||
|
||||
| Layer | Total time | Per step |
|
||||
|-------|-----------|----------|
|
||||
| Python (cProfile) | 0.901s (warmup+measured, 70 batches) | ~12.9ms/100-step batch |
|
||||
| GPU kernel (Nsight) | 0.071s (5300 kernel invocations) | 13.4 μs |
|
||||
| Batch NVTX range (nsys) | 7.8ms for batch=100 | 78 μs/step (incl. Python) |
|
||||
|
||||
**Key insight:** The per-step GPU kernel time is only ~13 μs. The nsys batch timing (78 μs/step) includes Python overhead, kernel launch overhead, and stream synchronization.
|
||||
|
||||
## 2. Python Layer Details (from cProfile, T4)
|
||||
|
||||
| Function | Cumulative time | Calls | Per call | % of run time |
|
||||
|----------|----------------|-------|----------|---------------|
|
||||
| Simulation.__init__ | 1.125s | 1 | 1.125s | 62% (one-time) |
|
||||
| LBMStepper.step | 0.901s | 70 | 12.9ms | 50% of step time |
|
||||
| pycuda function_call | 0.769s | 21001 | 36.6 μs | 42% of step time |
|
||||
| _launch_sensor (inside step) | 0.409s | 7000 | 58 μs | — |
|
||||
| _launch_curved (inside step) | 0.311s | 7000 | 44 μs | — |
|
||||
| pycuda _build_arg_buf | 0.357s | 21001 | 17 μs | 20% of step time |
|
||||
| manager.sync_to_gpu | 0.017s | 1 | — | one-time (init) |
|
||||
| set_body | <0.001s | 20 | <50 μs | negligible |
|
||||
| read_force | <0.001s | 20 | <50 μs | negligible |
|
||||
|
||||
**Conclusion:** The Python layer is extremely thin. The dominant cost in `stepper.step()` is `pycuda.driver.function_call` (~37 μs per kernel launch) which is the `cuLaunchKernel` overhead from the Python-CUDA bridge. This is an unavoidable cost of using pycuda.
|
||||
|
||||
## 3. GPU Kernel Details (from Nsight Systems)
|
||||
|
||||
### OneStep (MRT, 384x192, 5300 invocations)
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| Grid | (2, 192, 1) |
|
||||
| Block | (256, 1, 1) |
|
||||
| Registers per thread | 39 |
|
||||
| Min duration | 5.57 μs |
|
||||
| **p50 duration** | **5.86 μs** |
|
||||
| p90 duration | 6.11 μs |
|
||||
| Max duration | 7.65 μs |
|
||||
| Total (5300 steps) | 31.2 ms |
|
||||
|
||||
### CurvedBoundaryKernel (1 cylinder at center, 5300 invocations)
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| Grid | (2, 1, 1) |
|
||||
| Block | (256, 1, 1) |
|
||||
| Registers per thread | 31 |
|
||||
| Total threads | 288 active out of 512 launched (56% utilization) |
|
||||
| **p50 duration** | **4.00 μs** |
|
||||
| Total (5300 steps) | 21.2 ms |
|
||||
|
||||
### SensorKernel (1 sensor, 5300 invocations)
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| Grid | (2, 1, 1) |
|
||||
| Block | (256, 1, 1) |
|
||||
| Registers per thread | 21 |
|
||||
| **p50 duration** | **3.55 μs** |
|
||||
| Total (5300 steps) | 18.9 ms |
|
||||
|
||||
### Batch Scaling (from Nsight NVTX ranges)
|
||||
|
||||
| Batch size | Total time (100 steps) | Effective per step |
|
||||
|------------|----------------------|-------------------|
|
||||
| 1 step/launch | 8.08 ms | 80.8 μs |
|
||||
| 10 steps/launch | 7.86 ms | 78.6 μs |
|
||||
| 100 steps/launch | 7.78 ms | **77.8 μs** |
|
||||
|
||||
**Observation:** Batch size has only a 4% effect on total time between batch=1 and batch=100. This is because the GPU kernel itself is only ~13μs of the total ~78μs. The remaining ~65μs is the pycuda launch overhead + stream sync.
|
||||
|
||||
## 4. SRT vs MRT Comparison (from cProfile + ncu)
|
||||
|
||||
| Metric | SRT (T1) | MRT (T2) | Ratio |
|
||||
|--------|----------|----------|-------|
|
||||
| stepper.step total (70×100 steps) | 0.190s | 0.191s | **1.01x** |
|
||||
| pycuda function_call count | 7001 | 7001 | 1.0x |
|
||||
| pycuda function_call time | 0.146s | 0.147s | 1.01x |
|
||||
| ncu Duration | 10.05 μs | 10.53 μs | 1.05x |
|
||||
| Registers per thread | — | 39 | — |
|
||||
| SM Throughput | 18.88% | 22.23% | 1.18x |
|
||||
| Memory Throughput | 52.73% | 52.92% | 1.00x |
|
||||
| FMA pipe utilization | 27.3% | 32.3% | 1.18x |
|
||||
| Executed IPC (active) | 1.18 | 1.24 | 1.05x |
|
||||
| L1/TEX hit rate | 6.82% | 6.82% | 1.0x |
|
||||
| L2 hit rate | 54.03% | 54.06% | 1.0x |
|
||||
| Simulation.__init__ | 1.113s | 1.298s | 1.17x |
|
||||
|
||||
**Key finding: MRT is only 5% slower than SRT at this grid size.** Both are dominated by memory access (53% DRAM bandwidth utilization), not compute. MRT's extra FMA operations increase SM throughput from 18.9% to 22.2% but don't elongate wall time because the kernel is limited by the L1TEX scoreboard stalls (49.9% of warp cycles). The top stall reason is **waiting for L1TEX data** (scoreboard dependency), not waiting for compute pipelines.
|
||||
|
||||
The grid (384 blocks) is too small to fill the GPU — only 0.8 full waves across 80 SMs. At production scales (3000×300), the SM throughput for MRT would approach 50-60% and the 5% gap over SRT would widen to ~15-20%.
|
||||
|
||||
## 5. CUDA API Breakdown (from Nsight Systems)
|
||||
|
||||
| CUDA API | Total time (over whole run) | Per call | Notes |
|
||||
|----------|---------------------------|----------|-------|
|
||||
| cuCtxCreate_v2 | 123 ms | 123 ms | One-time, CUDA context creation |
|
||||
| cuModuleLoad | 1.46 ms + 1.02 ms | 1.2 ms | Kernel compilation (one-time per compile) |
|
||||
| cuLaunchKernel (warmup + measured) | ~47 μs per call | 47 μs | pycuda overhead from cProfile ~37 μs + CUDA driver overhead |
|
||||
| cuMemcpyHtoD (init: 14KB) | 21-45 μs | varies | Config data upload |
|
||||
| cuMemcpyHtoD (action: 72 bytes) | ~1.15 μs | 1.15 μs | Body rotation upload |
|
||||
| cuMemcpyDtoH (DDF: 2.6MB) | 1.02 ms + 2.26 ms | 1-2 ms | Full DDF download (get_macroscopic) — one-time in profiled run |
|
||||
|
||||
**DTOH overhead:** The 72-byte action H2D takes ~1.15 μs, and the 60-byte obs D2H would take ~1 μs. These are truly negligible at any scale.
|
||||
|
||||
## 6. Bottleneck Identification
|
||||
|
||||
### Current bottleneck (384x192): pycuda kernel launch overhead
|
||||
|
||||
At this grid size, GPU compute time (13 μs/step) is dominated by pycuda's cuLaunchKernel overhead (~37 μs per kernel × 3 kernels = ~111 μs + Python loop ~7 μs = ~~78 μs/step from nsys, ~129 μs/step from cProfile). The **GPU is idle about 80% of the time** waiting for the next kernel launch.
|
||||
|
||||
### What would change at larger grids
|
||||
|
||||
| Grid size | GPU time/step (est.) | pycuda overhead | GPU idle |
|
||||
|-----------|--------------------|----------------|----------|
|
||||
| 384x192 | ~13 μs | ~37 μs × 3 = 111 μs | **80%** |
|
||||
| 600x600 | ~33 μs | ~37 μs × 3 = 111 μs | 55% |
|
||||
| 1000x500 | ~47 μs | 111 μs | 35% |
|
||||
| 3000x300 (exp_ctrl) | ~530 μs | 111 μs | **17%** |
|
||||
| 5000x500 | ~1.6 ms | 111 μs | 7% |
|
||||
|
||||
**At your production scale (3000x300), GPU utilization would be ~83%.** The pycuda overhead becomes acceptable.
|
||||
|
||||
### Where optimization would matter
|
||||
|
||||
1. **Reducing pycuda kernel launch overhead** — This is the #1 bottleneck for small grids. The 37 μs/launch comes from pycuda's argument buffer packing (`_build_arg_buf: 17 μs`) + CUDA driver overhead. Switching to `pycuda.driver.LaunchKernel` with pre-packed arguments could reduce this, but it would require significant changes to pycuda.
|
||||
|
||||
2. **Combining curved boundary into OneStep** — Would eliminate 2 of 3 kernel launches per step (save ~74 μs). For your production grid (3000x300), this would save about 12% of total time.
|
||||
|
||||
3. **Using larger batch sizes** — Already confirmed: batch=100 vs batch=1 saves about 4% total time on 384x192. The savings increase with grid size.
|
||||
|
||||
### Where optimization would NOT matter
|
||||
|
||||
1. **`set_body()` / `read_force()` overhead** — Already <1 μs. Not worth any optimization effort.
|
||||
2. **GPU memory bandwidth** — The DDF read/write (5.3 MB/step) is only 2.5% of V100 HBM2 bandwidth. Not the bottleneck.
|
||||
3. **Python loop overhead** — 5 μs/step loop from `for _ in range(n)` is negligible.
|
||||
4. **Registry / Body API** — dict lookups and property access are sub-microsecond. Not relevant.
|
||||
|
||||
## 7. Performance Model
|
||||
|
||||
```
|
||||
Per-step time (384x192 MRT) =
|
||||
Python_overhead(~40 μs) ← fixed for any grid size
|
||||
+ CurvedBoundaryKernel(~4 μs per link-group)
|
||||
+ OneStep(~5.9 μs)
|
||||
+ SensorKernel(~3.5 μs per sensor-group)
|
||||
|
||||
Per-step time (general) ≈
|
||||
pycuda_launch_kernels_3 × 37 μs
|
||||
+ grid_cells × (pull_load + collide + pull_store) / V100_FLOPs
|
||||
|
||||
Scaling:
|
||||
- 384x192: ~78 μs/step (GPU 17%, pycuda 83%)
|
||||
- 3000x300: ~640 μs/step (GPU 83%, pycuda 17%)
|
||||
- 6000x600: ~2.5 ms/step (GPU 96%, pycuda 4%)
|
||||
```
|
||||
|
||||
## 8. Nsight Compute Deep-Dive Metrics
|
||||
|
||||
### OneStep (MRT) — Nsight Compute full metrics
|
||||
|
||||
| Metric | Value | Interpretation |
|
||||
|--------|-------|----------------|
|
||||
| Duration (ncu) | 10.53 μs | (ncu includes replay passes; nsys p50=5.86 μs is the real runtime) |
|
||||
| Registers per thread | 39 | Well below V100 limit of 64. **No register spill to local memory.** |
|
||||
| Grid | (2, 192, 1) × 256 = 384 blocks | Only 0.8 full waves — grid too small to fill 80 SMs |
|
||||
| Memory Throughput | 52.9% of HBM2 peak | Moderate bandwidth usage |
|
||||
| SM Throughput | 22.2% of peak | Low — limited by L1TEX scoreboard stalls |
|
||||
| FMA pipe active | 32.3% of active cycles | Most-used pipeline, but not saturated |
|
||||
| L1/TEX hit rate | 6.82% | Low — DDF reads are scattered across the grid |
|
||||
| L2 hit rate | 54.0% | Moderate — half of cache-line requests hit L2 |
|
||||
| Top stall reason | L1TEX data wait (49.9%) | Scoreboard dependency on global memory reads |
|
||||
| IPC (active) | 1.24 inst/cycle | Far below V100's theoretical 4 IPC |
|
||||
| Active warps/scheduler | 6.09 | Out of 16 max — low occupancy |
|
||||
| Eligible warps/scheduler | 0.97 | Only 1 warp per cycle is ready to issue |
|
||||
|
||||
**Why the kernel does not saturate the GPU:**
|
||||
- The grid (384 blocks = 73,728 threads) is too small. V100 has 80 SMs with 64 warps each = 5120 warps capacity. This kernel only uses 384 blocks × 2 warps/block = 768 warps (15% occupancy).
|
||||
- Scoreboard stalls dominate (49.9%). Each warp waits on L1TEX for nearly half its cycles. This is the DDF pull phase: reading from neighbor cells at scattered memory addresses.
|
||||
- The memory access pattern is suboptimal: only 26.9 of 32 bytes per sector are utilized for global loads that miss L2.
|
||||
|
||||
**Optimization potential:** The ncu reports "Est. Speedup: 6.45%" for memory access pattern improvements and "47.27%" for reducing L1TEX stalls. The 47% figure is misleading — it comes from the low grid occupancy, not from actual compute inefficiency. At production grid sizes (3000×300), active warps per scheduler would increase to ~12+ and the stall ratio would drop significantly.
|
||||
|
||||
### CurvedBoundaryKernel — Nsight Compute full metrics
|
||||
|
||||
| Metric | Value | Interpretation |
|
||||
|--------|-------|----------------|
|
||||
| Duration (ncu) | 5.60 μs | Tiny kernel, completely latency-bound |
|
||||
| Grid | (2, 1, 1) × 256 = 512 threads | Only 2 blocks — **0.0 full waves** |
|
||||
| Registers per thread | (from nsys) 31 | Low — no spill |
|
||||
| Memory Throughput | 0.63% of HBM2 | Essentially zero bandwidth utilization |
|
||||
| SM Throughput | 0.20% of peak | The GPU is doing nothing for this kernel |
|
||||
| Active warps/scheduler | 1.87 | Out of 16 max — extremely low occupancy |
|
||||
| Eligible warps/scheduler | 0.06 | Nearly 0 — almost never ready to issue |
|
||||
| No Eligible | 94.45% | **94% of cycles have no warp ready to issue** |
|
||||
| Est. Local Speedup | 97.57% | Nsight says there's 97% headroom |
|
||||
|
||||
**This is a latency-bound kernel by design.** Only 288 threads for the curved links. The 5.6 μs runtime is dominated by launch overhead (context switching, instruction cache misses). There is no meaningful optimization for this kernel because it cannot use more threads — there are only 288 cut links.
|
||||
|
||||
**Impact:** At 4 μs per step, this kernel adds negligible runtime. Even with 100 cut links, the total curved time would still be <10 μs.
|
||||
|
||||
### SensorKernel — Nsight Compute full metrics
|
||||
|
||||
| Metric | Value | Interpretation |
|
||||
|--------|-------|----------------|
|
||||
| Duration (ncu) | 4.54 μs | Even smaller than curved |
|
||||
| Memory Throughput | 0.63% of HBM2 | Near-zero |
|
||||
| SM Throughput | 0.14% of peak | GPU doing nothing |
|
||||
| Active warps/scheduler | 1.84 | Extremely low |
|
||||
| Eligible warps/scheduler | 0.04 | Almost never ready |
|
||||
| No Eligible | 96.83% | 97% idle cycles |
|
||||
| L1/TEX hit rate | 48.53% | Much better than OneStep (localized access pattern) |
|
||||
|
||||
Same conclusion: negligible overhead, no meaningful optimization possible.
|
||||
|
||||
## 9. Recommendations
|
||||
|
||||
1. **For production runs (3000x300)** — The architecture is well-optimized. Use `--batch 10` to amortize pycuda overhead. GPU utilization is ~83%.
|
||||
|
||||
2. **For small-grid sweeps (384x192)** — The pycuda launch overhead dominates. If you need to run many small-grid parameter sweeps, consider:
|
||||
- Grouping multiple independent simulations into a single process
|
||||
- Or accepting that small-grid runs are launch-overhead limited
|
||||
|
||||
3. **For kernel tuning** — At production scale (3000x300), the main kernel (OneStep MRT) uses only 39 registers (no spill), achieves 53% DRAM throughput and 22% SM throughput on 384x192. At 3000x300, SM throughput would approach 50-60% and GPU utilization would be ~83%. No further kernel optimization is needed for current use cases.
|
||||
|
||||
4. **Three-kernel architecture is not a problem** — Despite being split into 3 kernels (CurvedBoundary + OneStep + Sensor), the total GPU kernel time is only ~13.4 μs/step. The curved and sensor kernels are latency-bound with negligible impact. Merging them into OneStep would save ~7 μs/step but add branch divergence in the OneStep grid kernel.
|
||||
@@ -0,0 +1,99 @@
|
||||
# Moving-boundary force spikes: evidence and source index
|
||||
|
||||
Updated 2026-10-31.
|
||||
|
||||
This note indexes supplied audited observations and primary-source extractions.
|
||||
It does not report a newly measured cure or implement an alternative method.
|
||||
Paper details below were supplied by the parent investigation; no new source
|
||||
retrieval or independent paper verification was performed for this note.
|
||||
|
||||
## Current implementation and interpretation
|
||||
|
||||
- Celeris M1 reconstructs a fresh node as `feq(rho_bar, u_wall) + donor NEQ`.
|
||||
- In exact arithmetic, the donor non-equilibrium component has zero mass and
|
||||
momentum when formed against the donor's own equilibrium moments.
|
||||
- Re-projecting that same reconstruction onto the same wall velocity therefore
|
||||
does not, by itself, change its mass or momentum or supply a cure for spikes.
|
||||
- Floating-point residuals should be measured separately from this algebraic fact.
|
||||
- Peng's alternative differs upstream: extrapolate PDFs from three donors, then
|
||||
replace selected moments. It is not simply another projection of current M1.
|
||||
- PPO interval-force observations and native per-step FSI right-hand-side forces
|
||||
are distinct signals; comparisons must identify which signal is being used.
|
||||
|
||||
## Audited run observations supplied to this note
|
||||
|
||||
- D40 revision: `e9213dd2cc9cfed0e8487a3cf4ebdd94d23dc64d`.
|
||||
- Window: first `97.303 D/U` of physical time.
|
||||
- Maximum displacement: `max |y|/D = 0.304893`.
|
||||
- Maximum native force-coefficient increment: `max |ΔCy| = 0.66688`.
|
||||
- D20 over the same physical-time window: `max |ΔCy| = 1.80735`.
|
||||
- The largest D40 event involved 30 nodes.
|
||||
- These are supplied audited observations, not measurements made for this note.
|
||||
- Time steps and trajectories differ between runs. This comparison establishes
|
||||
neither spatial convergence nor a unique cause for the force spikes.
|
||||
|
||||
Evidence locations supplied by the investigation:
|
||||
|
||||
- Horsea: `/tmp/celeris-results-pinball-resolution`.
|
||||
- Mac: `validation-evidence/pinball-force-diagnosis`.
|
||||
|
||||
These locations index run evidence, not local copies of the cited papers.
|
||||
|
||||
## Tao, Hu, and Guo (2016): time-step decoupling
|
||||
|
||||
Computers & Fluids **133**, 1–14. DOI:
|
||||
[10.1016/j.compfluid.2016.04.009](https://doi.org/10.1016/j.compfluid.2016.04.009).
|
||||
[Publisher abstract](https://www.sciencedirect.com/science/article/pii/S0045793016301116).
|
||||
|
||||
- Abstract-level support only: non-equilibrium refill reduces oscillations.
|
||||
- With local iteration, the compared refill methods give similar oscillation magnitudes.
|
||||
- Time-step decoupling reduces oscillations further in the reported sedimentation,
|
||||
Couette, and Poiseuille examples.
|
||||
- The exact decoupling schedule and time-step ratios have not been verified.
|
||||
- This abstract does not establish equivalence to an arbitrary force filter.
|
||||
- Do not implement a claimed reproduction until the actual methods are available.
|
||||
|
||||
## Marson et al. (2021): local iterations
|
||||
|
||||
Physical Review E **103**, 053308. DOI:
|
||||
[10.1103/PhysRevE.103.053308](https://doi.org/10.1103/PhysRevE.103.053308).
|
||||
[Open repository record](https://archive-ouverte.unige.ch/unige:151868).
|
||||
|
||||
- §VI, p. 18 discusses pressure waves associated with fresh nodes.
|
||||
- Appendix E.3, p. 25 and Fig. 18, p. 24 describe the local procedure.
|
||||
- Copy a local sublattice, perform local collision and streaming, write the fresh
|
||||
nodes, and repeat before the global collision and streaming operation.
|
||||
- One to three iterations performed best in the reported tests; this is not a
|
||||
universal iteration-count recommendation.
|
||||
- The reported smoothed torque-noise assessment is qualitative here.
|
||||
- Its thin-shell setting differs from the current moving-body configuration.
|
||||
|
||||
## Peng (2016): extrapolation and moment replacement
|
||||
|
||||
Computers & Mathematics with Applications **72**, 349–374. DOI:
|
||||
[10.1016/j.camwa.2015.08.027](https://doi.org/10.1016/j.camwa.2015.08.027).
|
||||
|
||||
- §5.1.2, Eq. (50), p. 368: extrapolate PDFs along an outward normal direction:
|
||||
`f_new(x) = 3 f(x + e) - 3 f(x + 2e) + f(x + 3e)`.
|
||||
- §5.1.3, Eq. (51): wall equilibrium plus donor non-equilibrium is the family
|
||||
containing the current M1 reconstruction.
|
||||
- §5.1.4, Eqs. (52)–(54): in MRT space, replace momentum with `j = rho0 u_wall`,
|
||||
preserve the other moments, then apply the inverse transform.
|
||||
- A compressible Celeris adaptation must choose the appropriate density;
|
||||
copying the paper's `rho0` blindly is not justified.
|
||||
- Three valid donors require new eligibility checks and fallback behavior beyond
|
||||
the current one-link shared-body clearance rule.
|
||||
- §§5.2–5.3 retain nonzero fluctuations in specific configurations; these results
|
||||
do not promise elimination of force spikes in the present problem.
|
||||
|
||||
## Bounded next investigation
|
||||
|
||||
1. Retain current M1 as the baseline and compare matched prescribed trajectories
|
||||
over matched physical-time windows.
|
||||
2. Record raw force RHS, node crossings, donor moments, mass and momentum changes,
|
||||
impulse, spectra, and trajectory response together.
|
||||
3. Evaluate local iterations, Peng-style reconstruction, and force filtering as
|
||||
separate interventions, with explicit definitions and diagnostics.
|
||||
4. Obtain the actual time-step-decoupling methods before implementing that method.
|
||||
|
||||
The current task indexes evidence only; it makes no alternative-method change.
|
||||
@@ -0,0 +1,61 @@
|
||||
# Opt-in shifted blocked candidate
|
||||
|
||||
This candidate is based on fbe7377. The default remains unshifted. Enable with
|
||||
`LBMConfig(ddf_shifting=True)` only on the supported routes below.
|
||||
|
||||
| Route | Candidate support |
|
||||
|---|---|
|
||||
| PeriodicBlockStepper, FP32 D2Q9 SRT double-buffer, no LES | shifted or unshifted |
|
||||
| FixedPatchStepper, every level blocked and same representation | shifted or unshifted |
|
||||
| Passive stationary circular BFL boundary and raw exchange | supported candidate scope |
|
||||
| Synchronized three-level child remap | private raw shifted snapshot, exact overlap/copy |
|
||||
| Dense root/refinement or mixed representation | rejected for shifted |
|
||||
| Slot/reservoir, surface actuation, velocity Jet | existing public shifted exclusion retained |
|
||||
| Other collision/lattice/storage/streaming/LES combinations | existing exclusions retained |
|
||||
|
||||
The D2Q9 equilibrium helper accepts a retained density offset only in shifted
|
||||
compilation. BlockStep computes delta=sum(g) before adding the unit density;
|
||||
velocity uses the existing macro calculation. The existing SRT collision and
|
||||
all unshifted expressions remain. No global precision type or duplicate
|
||||
collision implementation is introduced. Ordinary shifted Simulation callers
|
||||
still use the existing rho−1 overload; this candidate does not change their
|
||||
numerical method.
|
||||
|
||||
Public initialize receives physical populations and performs shifted subtraction
|
||||
in FP64 before the one FP32 storage cast. Public shifted download returns FP64
|
||||
physical populations with exact-rational D2Q9 background weights. Internal raw
|
||||
snapshots retain FP32 g and a representation tag; runtime remap never decodes
|
||||
and re-encodes overlap. Exact mass is interpreted as 1+sum(g), and momentum as
|
||||
sum(c*g); analyses should use raw values for tiny perturbation budgets. The
|
||||
FP32 BFL force constants have their own arithmetic rounding; no exact global
|
||||
conservation claim follows from shifting.
|
||||
|
||||
Planar helper formulas include their shifted reference-density offsets and have
|
||||
actual-header host tests. Their public shifted route remains excluded until a
|
||||
separate test-gated migration. Next velocity-Jet work must validate physical
|
||||
wall density, incoming/outgoing populations, raw force/mass, ownership and
|
||||
transfer interactions before relaxing that restriction.
|
||||
|
||||
Evidence so far: selected-cell CUDA replay favored retained-delta shifting;
|
||||
this is not full-solver validation. Host algebra/storage/remap tests and staged
|
||||
GPU continuation, three-grid cylinder physics, raw budgets, Couette helper
|
||||
stress and measured runtime are separate gates. Original failed experiments
|
||||
remain evidence; no acceptance threshold is relaxed.
|
||||
|
||||
## Direct-input-momentum equilibrium candidate
|
||||
|
||||
The shifted BlockStep now constructs the linear equilibrium term from input
|
||||
momentum j, without reconstructing rho*u. For opposite axis pairs the odd term
|
||||
is j/3; for diagonal pairs it is (jx +/- jy)/12, evaluated with explicit
|
||||
round-to-nearest division. The even term is
|
||||
w*[delta + 4.5*(c dot j)*(c dot u) - 1.5*(j dot u)].
|
||||
This is the same second-order D2Q9 equilibrium in exact arithmetic. Original SRT,
|
||||
storage, boundaries, and transfers are unchanged. No collision residual or force
|
||||
is corrected afterward. Existing four/five-argument equilibrium APIs are retained;
|
||||
only shifted blocked collision calls the new six-argument momentum helper.
|
||||
|
||||
The all-fluid read-only CUDA replay reduced signed x-momentum error by 120–2285x
|
||||
at five sampled states, with lower mass/momentum and second-moment RMS errors.
|
||||
Signed mass bias was larger (~1e-12/cell/hop), so full evolving mass budgets remain
|
||||
mandatory. This local evidence does not establish physical convergence or speed.
|
||||
The unshifted default and its arithmetic path remain unchanged.
|
||||
@@ -0,0 +1,150 @@
|
||||
# Uncontrolled steady pinball: development protocol
|
||||
|
||||
Frozen before results: 1280 x 512 D2Q9/FP32/MRT, unshifted double buffer;
|
||||
rho=1, mean U=.01, nu=.004, D=20, Re_D=50. Centres are (600,255.5),
|
||||
(626,270.5), (626,240.5), radius10. No upstream cylinder. Passive probes stay
|
||||
at (800,295.5), (800,255.5), (800,215.5), radius5. Every omega is zero.
|
||||
Parabolic inlet, regularized NEQ damping1; y bounce-back planes .5/510.5;
|
||||
NEQ-extrapolated outlet with backflow clamp (the configured blend is inactive in
|
||||
this MRT route). Initial fluid is
|
||||
parabolic equilibrium. Fixed warmup is 4 NX/U=512000 steps.
|
||||
|
||||
Geometry and fluid parameters follow DynamisLab 609116ec26f19766f5e9ce2b0df427d4e24faae8,
|
||||
`legacy_test/core/legacy_env_builder.py:build_steady_cloak` and the retained
|
||||
`config_lbm_pinball_legacy_re50d_u001.json`. This is a modern Celeris reconstruction,
|
||||
not a bitwise Legacy reproduction: Legacy uses shifted incompressible MRT, a
|
||||
different curved interpolation and prescribed parabolic outlet velocity. Current
|
||||
Celeris uses standard MRT, two-branch BFL and extrapolated outlet velocity.
|
||||
The fixed-hold control uses the SAME modern settings as the free case.
|
||||
|
||||
## Shared translation and ownership
|
||||
|
||||
`Translation(..., shared=True)` is explicitly transverse only. Reusing one
|
||||
envelope INSTANCE declares common motion; equal but separate envelopes are not
|
||||
linked. Before initialization and every positive Simulation.run, group members
|
||||
must have identical applied offsets, effective target offsets and interval wall
|
||||
velocities. Stage each member with set_body, then call run(1) once. An incomplete
|
||||
or inconsistent target group is rejected before device uploads and can be fixed.
|
||||
Existing pending-target direct-stepper restrictions remain.
|
||||
|
||||
Only members of that group may have overlapping whole swept bands. Their fixed
|
||||
surface clearance must exceed4 lattice cells. This conservative bound exceeds
|
||||
2 sqrt(2)+MAX_STEP = 3.329: M1 changed cells lie in old/new disks and read one-link
|
||||
neighbors; M2 reads at most two links outside its new disk. Old/new relative
|
||||
displacement is at most .5. Thus reads cannot reach another member's old/new
|
||||
solid or M1 write region. M1 writes are disjoint. M2 writes opposite population
|
||||
slots inside its own new disk, also disjoint. Separate first_slot ranges still
|
||||
allocate each body's logical band/debug storage. Shared band cells alone do not
|
||||
write anything: M1 returns unless membership changes; M2 returns unless a cut
|
||||
link exists. Unrelated moving/static body and probe overlaps still reject.
|
||||
|
||||
This is a sufficient restricted-group condition, not support for near-contact
|
||||
or independent motion. The r4, distance8.3, dy=.5 counterexample remains rejected.
|
||||
CPU tests enumerate candidate donors/write footprints over subcell phases;
|
||||
GPU tests compare fixed vs hold and member-order permutations through crossings
|
||||
at wall speed .01 over the full +/-D envelope (8000 steps). The initial .5-speed
|
||||
fixture failed with NaNs; a single-circle control also failed at step69. That
|
||||
Mach~.866 fixture was unsuitable as a low-Mach numerical gate. Its failure is
|
||||
retained; the geometric MAX_STEP proof is unchanged, not a stability guarantee.
|
||||
CUDA kernels and arithmetic are unchanged.
|
||||
|
||||
## New structural parameters (not inherited from the paper)
|
||||
|
||||
One transverse state y,v; total assembly M=10 rho (3 pi D^2/4)=9424.77796,
|
||||
fn=U/(5D)=.0001, Tn=10000, zeta=.01, K=M(2 pi fn)^2,
|
||||
C=2 zeta M(2 pi fn). Initial y=v=0, no seed or later kick. Force is the sum
|
||||
of the three instantaneous CME_y+Wen_y values from the previous fluid step;
|
||||
node impulses are logged separately and never added. The damped oscillator is
|
||||
integrated exactly for that piecewise-constant force over dt=1. Wall velocity
|
||||
is y[n+1]-y[n], not the endpoint oscillator velocity. No filtering or retuning.
|
||||
|
||||
Observe600000 steps=60Tn=300 D/U after warmup, in each of free and fixed-hold
|
||||
cases. Final20Tn is a descriptive comparison window; ten-Tn blocks expose drift.
|
||||
No settled/periodic claim follows merely from reaching the cap. Stop on |y|>D,
|
||||
nonfinite values, no_donor, rejected displacement or speed>.05. Report any quiet
|
||||
response honestly. No automatic extension. --smoke uses32 warmup+32 steps only.
|
||||
|
||||
Native-step rows retain y,v, each body's CME/Wen/node terms and refill counters;
|
||||
each600000x15 FP64 file is72MB. No full-field output or policy training. Compile
|
||||
and run on one device serially, keep original outputs and dirty trees untouched.
|
||||
This stage makes no claim of physical grid convergence or vibration suppression.
|
||||
|
||||
Run from checkout with PYTHONPATH=src and the existing Python environment:
|
||||
`python research/steady_pinball/run.py --smoke --out <new-external-directory>`
|
||||
then separately `--out <new-free-directory>` and `--fixed --out <new-fixed-directory>`.
|
||||
|
||||
## Zero-damping development follow-up (predeclared 2026-10-31)
|
||||
|
||||
The original d0bcefa run and its zeta=.01 results remain historical evidence.
|
||||
The current runner exposes three fixed `--case` choices, all with C=0 as requested:
|
||||
|
||||
| Case | M / (rho 3 pi D^2/4) | fn | M | K | Purpose |
|
||||
|---|---:|---:|---:|---:|---|
|
||||
| Z0 | 10 | .0001 | 9424.77796 | .00372075320 | Remove damping only |
|
||||
| M2 | 2 | .0001 | 1884.95559 | .000744150640 | Reduce mass and stiffness together at fixed fn |
|
||||
| R2 | 2 | .00006 | 1884.95559 | .000267894231 | Change stiffness only relative to M2 |
|
||||
|
||||
R2 deliberately places fn at the retained fixed-body lift peak, f=.00006
|
||||
(St=.12 on mean U). This is an informed development choice, not independent
|
||||
physical validation or a promise of lock-in. All geometries, fluid settings,
|
||||
512000-step fixed warmup, y0=v0=0, force time level and unfiltered RHS are unchanged.
|
||||
No run result may select a replacement parameter or an automatic extension.
|
||||
|
||||
Each case has a 600000-step cap, the same 300 D/U physical duration. This equals
|
||||
60 natural periods for Z0/M2 and 36 for R2. Compare the common final200000 native
|
||||
steps, and six100000-step blocks, retaining actual natural/response frequencies
|
||||
and ongoing drift. Do not call those blocks ten R2 periods. No settled-VIV claim
|
||||
follows from a larger displacement. Report all three outcomes, including quiet
|
||||
responses or stopped cases, alongside the existing fixed and damped-free records.
|
||||
|
||||
Unchanged stops: |y|>D, invalid move/speed, nonfinite values or no_donor. A 1800s
|
||||
per-case wall cap and GPU headroom check bound resource use. Preserve partial rows;
|
||||
do not add damping, clip trajectories, filter forces, or relax any stop. Each
|
||||
case adds72MB of scalar history, no full fields. The separate Legacy/modern
|
||||
baseline diagnosis does not change this FSI protocol.
|
||||
|
||||
## Matched D40 resolution comparison (predeclared 2026-10-31)
|
||||
|
||||
The first finer case is M2, with exactly the same mass ratio2, reduced velocity5,
|
||||
zero structural damping, initial rest state and physical geometry as the retained
|
||||
D20 M2. Targeting a development response of0.5--1D does not imply this case will
|
||||
reach it. Do not change the structure within this comparison or discard a smaller
|
||||
response. D60 is a supported scaling choice, not an automatically scheduled run.
|
||||
|
||||
For s=D/20 use dx'=dx/s, dt'=dt/s^2, U'=.01/s, nu'=.004, rho'=1,
|
||||
fn'=fn/s^2, M'=s^2 M and K'=K/s^2. The same physical force per unit span
|
||||
has F'_lat=F_lat/s. For D40 this gives U=.005, fn=.000025,
|
||||
M=7539.82237, K=.000186037660, Re_D=50, and Tn=40000 steps.
|
||||
The y walls are at .5 and ny-1.5, while x inlet/outlet source nodes are at0
|
||||
and nx-1. Therefore map x'=s*x and y'=.5+s*(y-.5), with
|
||||
nx'=s*(1280-1)+1, ny'=s*(512-2)+2. D40 uses2559x1022 and centres
|
||||
(1200,510.5),(1252,540.5),(1252,480.5); every radius, probe and envelope scales
|
||||
with D. The parabolic profile retains the same normalized wall coordinate.
|
||||
This preserves the existing ghost-source boundary convention, without asserting
|
||||
that it is an exact continuum open-boundary location.
|
||||
|
||||
Warmup=2048000 and response=2400000 native steps at D40: the SAME256 and300
|
||||
D/U durations as D20, including60 natural periods after release. Compare the
|
||||
six50-D/U blocks and the common final100-D/U window. Report max absolute y/D,
|
||||
half-range, RMS, frequency and drift; peak-to-peak is not amplitude. No settling
|
||||
claim follows from completion. Keep raw individual CME/Wen/node terms and all
|
||||
crossing/fallback counters. Normalize net force by .5*rho*U^2*D in each case.
|
||||
Report native crossing/non-crossing force increments separately, plus D40
|
||||
four-step block means aligned with D20 intervals (diagnostic only, never replace
|
||||
the raw spikes). Report final-window high-frequency variance above f*D/U=1,
|
||||
using demeaned FFT Parseval weights, with the same physical cutoff for both cases.
|
||||
Different motion histories confound spike-size comparisons; this is simultaneous
|
||||
space/time/Mach refinement, not proof of a unique coarse-grid cause.
|
||||
|
||||
Only one full D40 M2 is initially scheduled, after CPU checks and a32+32-step
|
||||
smoke. Stop on the unchanged geometry/speed/nonfinite/no_donor checks or a7200s
|
||||
whole-case wall cap; save completed rows and status. The velocity cap scales to
|
||||
.025 so its physical bound is unchanged. No force filtering, trajectory clipping,
|
||||
automatic parameter search or extension. Scalar history is288MB; no full fields
|
||||
or DDF snapshots are written. Two FP32 population buffers require about188MiB,
|
||||
before flags, moving tables and context overhead; measure actual peak usage in
|
||||
the smoke and full run. Keep all D20 outcomes. No production source changes.
|
||||
|
||||
Commands (one GPU and serial compilation, existing environment):
|
||||
`python research/steady_pinball/run.py --case M2 --D 40 --smoke --out <new-smoke-dir>`
|
||||
then `python research/steady_pinball/run.py --case M2 --D 40 --wall-seconds 7200 --out <new-full-dir>`.
|
||||
@@ -0,0 +1,96 @@
|
||||
# Supported settings: 2D Jet + fixed multilevel refinement (candidate 888c8038)
|
||||
|
||||
Every entry names the guard that enforces it (file and function or kernel guard,
|
||||
at source revision 888c80381c006e976be2af8a452288729fc17c1b) and, where one
|
||||
exists, an existing test that exercises it. A setting not listed here is not
|
||||
claimed. Observations at the end are tied to the exact case in which they were
|
||||
measured; they are not general bounds.
|
||||
|
||||
## Lattice, storage, collision
|
||||
|
||||
| Setting | Supported | Guard |
|
||||
|---|---|---|
|
||||
| Dimension / lattice | 2D D2Q9 only (3D refinement is future work) | `lbm/refinement.py` `FixedPatch2D.from_config`; `#error` guards in `lbm/kernels/blocked.cu` |
|
||||
| Precision / streaming | FP32 storage, double buffer | same guards |
|
||||
| Collision on refinement levels | SRT or MRT; TRT and LES rejected | `lbm/refinement.py` `FixedPatch2D.from_config` (re-checked for fine boundaries in `prepare_fine_boundary`) |
|
||||
| Shifted (ddf_shifting) storage | supported (every level is blocked); one representation on all levels | `lbm/refinement_stepper.py` `FixedPatchStepper._check_storage` |
|
||||
| Fine relaxation | 1/tau_fine must lie inside the configured omega guards | `lbm/refinement.py` `FixedPatch2D.from_config` |
|
||||
| Single blocked level `FixedPatchStepper(refinements=[], level_blocks=[(by, bx)], level_objects=[circles])` (replaces `PeriodicBlockStepper`, removed in 8e1feff) | doubly periodic, SRT only, no LES/Jets/projection/exchange observation, stationary passive circles; `download()` returns a 1-tuple | `lbm/refinement_stepper.py` `_check_levels`, `FixedPatchStepper.__init__`; `lbm/blocks.py` `static_circle_tables` |
|
||||
| Refinement storage | blocked on every level: `level_blocks` is required, one tile `(by, bx)` per level dividing that level; a whole-level tile (`(ny, nx)` at the root, the fine window shape for one rectangle) always divides. Dense and mixed dense/blocked storage were removed (parity of D/D, D/B and B/B recorded at 1573942 and 2469af7) | `lbm/refinement_stepper.py` `_check_levels`, `FixedPatchStepper.__init__` |
|
||||
|
||||
Tests: `tests/unit/test_refinement_mrt.py`, `tests/validation/multigrid/test_refinement_mrt_gpu.py`,
|
||||
`tests/unit/test_shifted_storage.py`, `tests/unit/test_shifted_block_operators.py`.
|
||||
|
||||
## Refinement hierarchy (`FixedPatchStepper(cfg, *, context, refinements, ...)`)
|
||||
|
||||
| Setting | Supported | Guard |
|
||||
|---|---|---|
|
||||
| Depth | at least one refinement level; one entry per level in `level_blocks`/`level_objects`/`level_jets` | `lbm/refinement_stepper.py` `_check_levels` |
|
||||
| Single L1 rectangle | two-coarse-cell margin to the domain edge | `lbm/refinement.py` `FixedPatch2D.from_config` |
|
||||
| Several L1 rectangles (union) | require `level_blocks[0]` and `level_blocks[1]`; transfers must close (dependency checks, no fixed gap rule) | `lbm/refinement_stepper.py` `_check_levels`; `lbm/refinement.py` `_check_parent_pull_closure` |
|
||||
| Nested levels | depth >= 3 must be all blocked; a blocked level requires blocked levels below; a scalar child needs a scalar parent | `lbm/refinement_stepper.py` `_check_levels`; `lbm/hierarchy.py` `build_hierarchy` |
|
||||
| Nested transfer support | child only over inherited ACTIVE cells, donors/receivers uncovered ACTIVE, no child over the parent restriction footprint | `lbm/refinement.py` `_nested_kind` |
|
||||
| Tile shape | positive `(by, bx)`; the level allocation must be divisible by the tile (no partial tiles yet) | `lbm/refinement_stepper.py` `_check_levels`, `lbm/refinement.py` `FixedPatchSet2D.fine_layout` (shape); `lbm/blocks.py` `BlockLayout2D.build` (divisibility) |
|
||||
| Coarse boundary | `periodic`, `slot_reservoir` or `channel` | `lbm/refinement_stepper.py` `FixedPatchStepper.__init__` |
|
||||
| `slot_reservoir` | on-site velocity bottom slot, reservoir top, velocity 0, 2 <= slot width < nx, patch rows 4..ny-4 | `lbm/refinement_stepper.py` `FixedPatchStepper.__init__`; `lbm/refinement.py` `prepare_fine_boundary` |
|
||||
| `channel` | all levels blocked; Zou-He inlet, pressure-NEQ outlet, stationary bounce-back walls; transfers away from the closure | `lbm/channel.py` `validate_channel_config`, `validate_channel_transfers` |
|
||||
| Explosion | `constant` (default); `projected_linear` only periodic, all-blocked SRT, no bodies/Jets, no LES (experimental) | `lbm/refinement_stepper.py` `FixedPatchStepper.__init__` |
|
||||
| L2 runtime remap (`remap_finest`) | periodic three-level L2 sets only, no L0/L1 bodies, identical pinned boundary | `lbm/refinement_stepper.py` `FixedPatchStepper.remap_finest` |
|
||||
|
||||
Tests: `tests/unit/test_refinement_three_level_multipatch.py`, `tests/validation/multigrid/test_refinement_multipatch.py`,
|
||||
`test_refinement_three_level.py`, `test_refinement_three_level_multipatch_gpu.py`, `test_refinement_blocked_base.py`,
|
||||
`test_refinement_blocked_fine.py`, `test_channel_root_gpu.py`, `tests/unit/test_channel_root.py`,
|
||||
`tests/unit/test_projected_pair_stepper.py`, `test_runtime_child_remap_gpu.py`, `test_pinned_body_remap_gpu.py`.
|
||||
|
||||
## Bodies and Jets on refined levels
|
||||
|
||||
| Setting | Supported | Guard |
|
||||
|---|---|---|
|
||||
| Bodies | stationary circles without sensor/force-region roles, entirely inside the patch union, fully resolved, disjoint, stencil away from the two-hop transfer footprint | `lbm/refinement.py` `prepare_fine_boundary` |
|
||||
| Level | not on L0; only on the finest level of a nested hierarchy | `lbm/refinement_stepper.py` `_check_levels` |
|
||||
| Jet condition | velocity only; `pressure` is reserved and raises NotImplementedError | `body/jets.py` `Jet.__post_init__` |
|
||||
| Jet geometry | each Jet selects resolved links of exactly one stationary body; no Jet/Jet or Jet/SurfaceActuation overlap; abs(amplitude) < 1 lattice | `body/jets.py` `Jet.__post_init__`, `jet_link_shapes`, `_surface_links` |
|
||||
| Jets with shifted storage | only in the all-blocked stepper with SRT and no LES | `body/jets.py` `_surface_links` |
|
||||
| SurfaceActuation | unshifted storage only | `body/objects.py` `SimObject.validate_surface_actuation` |
|
||||
| Raw boundary exchange (force) | blocked body levels only; the window ledger requires `observe_raw_exchange` | `lbm/refinement_stepper.py` `FixedPatchStepper.__init__` |
|
||||
| Checkpoint with Jets | refused | `simulation.py` `Simulation.save_checkpoint` |
|
||||
|
||||
Raw exchange is the cut-link momentum reaction (wall + aperture), not a validated
|
||||
nozzle thrust or stress load. Jet amplitude is a lattice velocity, not a flow rate.
|
||||
|
||||
Tests: `tests/unit/test_jets.py`, `test_jets_review.py`, `test_shifted_jets.py`, `test_raw_exchange.py`,
|
||||
`tests/validation/multigrid/test_refinement_jets.py`, `test_shifted_jets_gpu.py`, `test_raw_exchange_gpu.py`,
|
||||
`test_exchange_window.py`, `test_fine_surface_gpu.py`.
|
||||
|
||||
## Observations from specific tested cases (not general bounds)
|
||||
|
||||
- SRT channel root vs uniform OneStep, strict-parity test
|
||||
`tests/validation/multigrid/test_channel_root_gpu.py::ChannelRootGPU::test_uniform_matched_root`:
|
||||
in one of its 18 sub-cases (2 storage modes x 3 profile/clamp/damp settings x 3 blocks; which
|
||||
one is not recorded), 1 of the 4320 compared values differs, max abs 2.33e-10, max rel 1.77e-7
|
||||
(about 2 ULP). The test remains failed; its cause and any general bound are unresolved.
|
||||
- MRT root parity test
|
||||
`tests/validation/multigrid/test_refinement_mrt_gpu.py::RefinementMRTGPU::test_uniform_matched_mrt_root`
|
||||
(12 sub-cases: 2 storage modes x 2 profiles x 3 blocks, default outlet settings) passed bitwise
|
||||
in the Horsea focused GPU run at K1 7813334 (2026-10-21).
|
||||
- Periodic Taylor-Green Re 100, measured at 36ffc8b1 (V3 matched pair, N128 depth 2):
|
||||
every per-sample screen passed; the constant explosion's aggregate worst velocity L2,
|
||||
0.004418, exceeds its preregistered 0.002 budget, while projected_linear passed that budget.
|
||||
- Curved-wall pressure (pilot harness, exact-q analytic annulus, tau 0.8): the coarse swirl r1
|
||||
case exceeded its terminal density-gain cap (1.105e-4 vs 1e-4), so the frozen 9-case matrix
|
||||
is NOT_ESTABLISHED. No validated fix exists. This is a pilot harness, not production code.
|
||||
- DFG 2D-1 Re 20 (V4, SRT, t* 60, pressure-NEQ outlet and local Zou-He inlet): refined and uniform
|
||||
runs were NOT_STEADY under the frozen steady rule, so no interval verdict was given.
|
||||
|
||||
## Moving circles (dense `Simulation`, uniform grid only)
|
||||
|
||||
Translating circles with optional spin are supported on the dense double
|
||||
buffer D2Q9 FP32 path only (not on `FixedPatchStepper` or refined levels).
|
||||
API, supported/rejected modes and limits: `docs/moving_bodies.md`; stage-1
|
||||
evidence: `docs/validation/moving_bodies_stage1.md`.
|
||||
|
||||
## Not supported in this release
|
||||
|
||||
3D, dynamic/automatic AMR (tagging, time-varying hierarchies beyond `remap_finest`),
|
||||
moving bodies on refined levels, pressure Jets, Jet checkpoints, LES or TRT on refined
|
||||
levels, partial (non-dividing) tiles.
|
||||
@@ -0,0 +1,172 @@
|
||||
# Synchronized leaf G remap and manual continuation
|
||||
|
||||
This is a CPU state-transfer component, **not a runtime adaptive solver**.
|
||||
It changes only an L2 rectangle union in a three-level periodic hierarchy.
|
||||
The body-free case is shown first; stationary L2 bodies/Jets follow the bounded
|
||||
support contract below. L0/L1 topology, relaxation parameters, direction order,
|
||||
physical frame and completed time remain unchanged. Existing geometry checks
|
||||
validate child support/nesting and actual transfer dependencies, without a fixed
|
||||
rectangle-gap rule. The three-level remap limit is unchanged by the stepper's
|
||||
arbitrary-depth level-list support. The CPU helper itself adds no CUDA,
|
||||
scheduler, allocator, boundary handling, collision or ghost refill. A bounded
|
||||
runtime adapter is described below.
|
||||
|
||||
```python
|
||||
from CelerisLab.lbm.refinement import FixedPatchSet2D
|
||||
from CelerisLab.lbm.synchronized_remap import RemapTopology, remap_synchronized
|
||||
|
||||
# cfg: D2Q9/SRT/FP32/unshifted/double_buffer, nz=1, no LES
|
||||
parent = FixedPatchSet2D.from_config(cfg, [(4, 4, 20, 28), (24, 4, 44, 28)])
|
||||
old = RemapTopology.from_config(cfg, parent, [(16, 16, 32, 40)])
|
||||
new = RemapTopology.from_config(cfg, parent, [(20, 16, 36, 40)])
|
||||
candidate = remap_synchronized(
|
||||
old, new, current_g, base_count=7, level_steps=(7, 14, 28),
|
||||
phase="postcollision_g", origin=(0., 0.), spacing=1.,
|
||||
)
|
||||
```
|
||||
|
||||
The example has a 48×32 root; both child supports allow 4×4 blocks.
|
||||
Child bounds use the parent's allocated L1 coordinates, not rectangle-local
|
||||
indices. A scalar FixedPatch2D parent is also supported: its shifted L1 window
|
||||
origin is retained. Physical lower edges are `origin + spacing*(x,y)` on L0,
|
||||
`origin + spacing*(parent.fine_origin + (x,y)/2)` on L1 and
|
||||
`origin + spacing*(parent.fine_origin + (x,y)/4)` on L2.
|
||||
|
||||
Factory options `coarse_boundary` and `objects` must declare `"periodic"` and
|
||||
an empty collection; L2 bodies use `objects` as described below.
|
||||
LBMConfig's channel settings do not select this operator's boundary mode.
|
||||
Geometry metadata is factory-created;
|
||||
manual mutation/forging of metadata is unsupported. Caller certifies the
|
||||
actual state matches the declared boundary and has no forcing, that all device
|
||||
work and old readers are quiescent, and that inputs are the **current owned-leaf
|
||||
postcollision G**.
|
||||
Count/phase stamps check consistency, not freshness or active-buffer identity.
|
||||
|
||||
`current_g` is three NumPy Q-major arrays `(9,ny,nx)`. For blocked inputs,
|
||||
pass `layouts=(base_layout, fine_layout, child_layout)`; each optional `None`
|
||||
entry denotes dense input. Every leaf must have an owner. Only owner cores
|
||||
are read, never redundant block halos. Mixed precision is rejected. FP64 is
|
||||
accepted for CPU reference tests; this does not enable FP64 runtime storage.
|
||||
Outputs `candidate.g` are separate dense arrays regardless of input layout.
|
||||
Memory scales with public grid extents, not only sparse allocated blocks.
|
||||
|
||||
Same-level leaf overlap is copied bitwise in physical coordinates. Newly
|
||||
refined L2 copies all nine values from its valid old L1 parent. Newly exposed
|
||||
L1 receives the complete four-child mean, including q0. Covered parents,
|
||||
ghosts and holes never serve as donors; NaN/Inf outside leaves is ignored,
|
||||
while nonfinite required leaves or nonpositive density reject the operation.
|
||||
Restriction uses FP64 quarter-weight accumulation and rounds to the input
|
||||
dtype. New nonleaves are NaN. Source arrays/metadata are not changed.
|
||||
|
||||
`candidate` retains `base_count`, `level_steps`, `phase`, `origin`, `spacing`
|
||||
and new `topology.leaf_masks`. Existing `FixedPatchStepper.initialize` resets
|
||||
the counter: using it is **not** a continuation adapter. This component neither
|
||||
publishes a candidate nor retires old state. Runtime table rebuild/halo refill
|
||||
and correct first-step scheduling are handled only by the explicit adapter below.
|
||||
|
||||
Tests accumulate leaf-area integrals in FP64 for each population, mass and
|
||||
momentum. The declared absolute tolerance is `2e-13 * sum(abs(old population
|
||||
integrals))` for FP64, `2e-7 * scale` for FP32, accounting for reduction and
|
||||
restriction rounding (not a solver accuracy bound). Coarse→fine→coarse copy
|
||||
round-trips preserve state; coarsening arbitrary fine structure loses it and
|
||||
is not invertible. No kinetic accuracy or stability claim follows.
|
||||
|
||||
```sh
|
||||
PYTHONPATH=src python -m unittest discover -s tests/unit -p 'test_synchronized_remap.py' -v
|
||||
```
|
||||
|
||||
## Explicit runtime continuation
|
||||
|
||||
`replacement = current.remap_finest(rectangles)` returns a new ready
|
||||
`FixedPatchStepper` at the **same absolute step_count**. It supports only
|
||||
periodic three-level runs with no L0/L1 bodies and an existing L2
|
||||
`FixedPatchSet2D`; stationary L2 bodies/Jets follow the support contract below.
|
||||
Scalar or union L1 parents are supported; scalar `child=` is deliberately
|
||||
rejected. L0/L1, relaxation and block sizes stay fixed.
|
||||
No tagger, scheduler, in-place replacement, or general rollback is provided.
|
||||
|
||||
The method holds the stepper lock, validates geometry, synchronizes its stream,
|
||||
and downloads the actual current owned leaves. It certifies postcollision G
|
||||
and completed 1:2:4 counts internally, applies the CPU helper, rebuilds all
|
||||
geometry/transfer/kind/halo buffers, and uploads both current and spare buffers.
|
||||
No old halo is reused. The regular step schedule fills transit ghosts/halos
|
||||
before use. `initialize` itself still resets the count to zero.
|
||||
|
||||
The old stepper remains ready, unchanged and independently usable. The caller
|
||||
owns **both** objects and must close both before closing their shared CUDA
|
||||
context. Candidate construction or upload failure releases only candidate
|
||||
resources; an actual old-device synchronization/read failure marks the old
|
||||
stepper failed, consistent with its existing failure semantics.
|
||||
|
||||
```python
|
||||
replacement = current.remap_finest([(20, 16, 36, 40)])
|
||||
# Explicitly choose the returned continuation only after success.
|
||||
current.close()
|
||||
current = replacement
|
||||
current.step() # advances the preserved absolute count by one
|
||||
```
|
||||
|
||||
CPU lifecycle mocks cover fresh current-buffer reads, exact transfer, separate
|
||||
ownership, time preservation, ordinary initialization reset, unsupported states
|
||||
and geometry, and candidate/source failure cleanup. GPU tests are predeclared
|
||||
in `tests/validation/multigrid/test_runtime_child_remap_gpu.py`: identity next
|
||||
step bitwise, shifted A→B→A with two intervals between changes, uniform moving
|
||||
and nonequilibrium states, exact CPU remap and overlap, both buffers reset,
|
||||
finite leaves, exact masks and absolute counts. They were not run on the CPU
|
||||
host. The separate independent FP64 capture/replay gate is max population
|
||||
error **3e-6**, with exact masks; remap mass/momentum allow FP32 roundoff.
|
||||
Per-population conservation is not an advancement target under collision.
|
||||
|
||||
### Bounded pinned-body extension
|
||||
|
||||
`replacement = current.remap_finest(rectangles, objects=original_objects)`
|
||||
also accepts stationary Circles inside the L2 union. Each body's **physical
|
||||
boundary, complete BFL support and current per-link velocity must remain
|
||||
identical**. Rectangles are not pinned: they may be split, merged or resized,
|
||||
and other fluid coverage may change, including within the same connected union,
|
||||
provided that physical support is unchanged. Existing nesting, union transfer
|
||||
dependencies, full-circle containment, reverse cut-link
|
||||
coverage and two-hop BFL transfer-footprint checks still apply. This is manual
|
||||
remapping, not adaptive body tracking or runtime body editing.
|
||||
|
||||
Supply all original root edge-frame definitions in their construction order.
|
||||
Do not pass `current.boundaries[2].objects`: those are projected fine-local copies.
|
||||
There is no retained mutable original-object registry. Before reading device
|
||||
state, remapping reprojects the supplied definition onto the old topology and
|
||||
compares exact ordered circle centers/radii, flags, physical cut links, body
|
||||
IDs, q, lever arms, hits, BFL support,
|
||||
legacy SurfaceActuation specification and current per-link velocity against
|
||||
the existing boundary. Omission, changed geometry/actuation or changed physical
|
||||
boundary/BFL support fail without device reads or allocations; reordered bodies fail
|
||||
too. Root object IDs are still assigned by list position, as in the constructor.
|
||||
|
||||
Jets are taken from the live L2 boundary, including the most recent successful
|
||||
`set_jet_amplitude(..., level=2)`. There is no replacement-Jets argument or
|
||||
constructor-time Jet snapshot. New blocked addresses may differ; the physical
|
||||
boundary and velocities must match exactly.
|
||||
|
||||
`RemapTopology.from_config(..., child_objects=..., child_jets=...)` prepares a
|
||||
typed `FineBoundary2D`; it derives L2 fluid leaves as ACTIVE minus SOLID. No
|
||||
caller mask is accepted. Solids, ghosts and holes are never donors and remain
|
||||
NaN, physical-fluid overlap is exact, and exposed L1 still restricts all four
|
||||
old fluid children. The helper checks old/new physical boundary and velocity
|
||||
equality too. Its immutable `pinned_rectangles` is legacy containment metadata,
|
||||
not a remap eligibility constraint; it may be empty for a seam-spanning body.
|
||||
Scalar-parent window offsets remain part of the coordinate conversion.
|
||||
|
||||
Focused CPU mocks: `tests/unit/test_pinned_body_remap.py`.
|
||||
`tests/unit/test_union_body_support.py` also checks seam-spanning circles,
|
||||
rectangle repartition/resize, unchanged physical support and live-Jet
|
||||
preservation. These host checks do not establish GPU evolution accuracy.
|
||||
GPU declarations:
|
||||
`tests/validation/multigrid/test_pinned_body_remap_gpu.py`, covering no-op
|
||||
next-step bitwise identity, moved-fluid A→B→A, current-amplitude preservation,
|
||||
physical boundary/velocity equality, source independence and absolute counts.
|
||||
Multiple-body CPU coverage: `tests/unit/test_multiple_pinned_remap.py`.
|
||||
`tests/validation/multigrid/test_multiple_pinned_remap_gpu.py` adds two pins,
|
||||
two independently updated Jets, variable fluid-region counts and add/move/remove
|
||||
immediate comparisons with CPU transfer. All nine solid-excluded area-weighted
|
||||
population integrals, exact overlap and nonleaf NaNs are checked.
|
||||
These new GPU cases have **not been run here**. They do not establish evolution
|
||||
accuracy. A 3e-6 FP32-vs-FP64 evolution gate requires a separate independent
|
||||
BFL reference; the body-free replay gate above does not establish that claim.
|
||||
@@ -0,0 +1,44 @@
|
||||
# Test Suite Overview
|
||||
|
||||
## Test hierarchy
|
||||
|
||||
Three tiers:
|
||||
|
||||
- **`tests/unit/`** — pure Python, no GPU. Covers isolated logic (pending edits, sync plan construction, flag masks, equilibrium helpers).
|
||||
- **`tests/integration/`** — requires GPU. Covers the full body topology sync pipeline (recompile, DDF patch, unified obs/act) and stream API.
|
||||
- **`tests/validation/`** — requires GPU, long-running (hours). Physics regression against Kan99b, Sah04, and sensor accuracy references.
|
||||
|
||||
## Running tests
|
||||
|
||||
```
|
||||
conda run -n pycuda_3_10 python -m pytest <test_path> -v
|
||||
```
|
||||
|
||||
| What you want to verify | Command |
|
||||
|---|---|
|
||||
| Body module logic after refactor | `pytest tests/unit/ -v` |
|
||||
| sync_bodies pipeline (no DDF patch) | `pytest tests/integration/test_sync_bodies_skeleton.py -v` |
|
||||
| DDF patch after add/remove | `pytest tests/integration/test_ddf_patch.py -v` |
|
||||
| Unified action/obs + stream API | `pytest tests/integration/test_unified_obs.py -v` |
|
||||
| Full body add/remove e2e | `pytest tests/integration/test_body_sync_e2e.py -v` |
|
||||
| All integration tests | `pytest tests/integration/ -v` |
|
||||
| All tests (unit + integration) | `pytest tests/unit/ tests/integration/ -v` |
|
||||
| Physics regression | `python tests/validation/run_kan99b_rotating_cylinder.py` |
|
||||
|
||||
## Per-file coverage
|
||||
|
||||
| File | GPU | Tests | What it covers |
|
||||
|---|---|---|---|
|
||||
| `test_pending_edits.py` | No | 14 | stage_add / stage_remove / has_pending_edit / clear_pending_edits lifecycle |
|
||||
| `test_sync_plan.py` | No | 16 | build_flags_for, build_compact_lists_for, build_next_objects, build_sync_plan, commit_pending |
|
||||
| `test_body_flags.py` | No | 6 | FRC_REGION / SENSOR_FLAG / OBSTACLE bits for each body type |
|
||||
| `test_equilibrium.py` | No | 4 | compute_feq_d2q9 and compute_macro_from_ddf numerical correctness |
|
||||
| `test_sync_bodies_skeleton.py` | Yes | 7 | sync_bodies flow: recompile, esopull guard, step count preservation, pending discard |
|
||||
| `test_ddf_patch.py` | Yes | 5 | DDF patch after add/remove: finite forces, released region is fluid |
|
||||
| `test_unified_obs.py` | Yes | 5 | host-only set_body, auto transfer, stream API, DRL loop pattern |
|
||||
| `test_body_sync_e2e.py` | Yes | 2 | Full add -> remove -> checkpoint -> load -> run cycle |
|
||||
|
||||
## Notes
|
||||
|
||||
- `pycuda.autoinit` is required for all integration tests (selects GPU 0 by default; set `CUDA_VISIBLE_DEVICES` to change).
|
||||
- The curved boundary kernel produces NaN in obstacle-adjacent fluid cells over long runs; DDF patch tests use 50-step verification windows.
|
||||
@@ -0,0 +1,53 @@
|
||||
# Bounded 2D implementation and validation scope
|
||||
|
||||
This inventory starts from dev `8403956a9afc0b0bb89265cec374392013d89016` and
|
||||
integrates only the reviewed LES normalization production correction from
|
||||
`95cb6d2b9f43c1bdd46cbf27f03f0dfc0877cfb0`. The merged production bytes match that
|
||||
tested candidate exactly; the scope-test changes are retained from `53fad767`.
|
||||
GPU receipts remain associated with their exact tested commits, not relabeled as
|
||||
a new merged-commit run. Historical source identities and gates remain unchanged.
|
||||
|
||||
## Implementation boundaries
|
||||
|
||||
- Uniform D2Q9 supports SRT, TRT and MRT. An available collision selector does not
|
||||
qualify every wall, inlet/outlet, forcing, storage or LES combination.
|
||||
- Fixed refinement supports SRT/MRT, FP32 and double-buffer streaming; TRT and LES
|
||||
are rejected. Shifted refinement requires all-blocked storage. Refined channel
|
||||
boundaries have narrower configuration guards than uniform boundaries.
|
||||
- Uniform checkpoints support compatible same-method continuation. Changing
|
||||
collision or LES parameters is a different evolution, not exact continuation.
|
||||
Jet checkpoints and refined checkpoints are unsupported; synchronized remapping
|
||||
is not persistent restart.
|
||||
- Keep these conclusions 2D. Local D3Q19 operator tests do not establish a supported
|
||||
3D Simulation runtime.
|
||||
|
||||
## Evidence and remaining gaps
|
||||
|
||||
| Area | Available evidence | Boundary of the conclusion |
|
||||
|---|---|---|
|
||||
| MRT cylinder flow and observation windows | Full matched uniform/refined MRT DFG and the window-ledger campaign passed their frozen periodicity, reference and matched-comparison gates. The window campaign used `185a919`; its MRT/no-LES numerical path remains unchanged. Current dev also contains independently scoped test/documentation changes and the LES correction, which do not extend MRT qualification. | This does not qualify other collision/boundary combinations or every refinement interface. Timing improvements are not additional accuracy evidence. |
|
||||
| Uniform forced channel | Six Poiseuille GPU cases on `8403956`: SRT/TRT/MRT at wall-normal resolutions H16/H32 passed. | This is the tested analytic channel configuration, not open-boundary or all-layout qualification. |
|
||||
| Uniform restart | Ten SRT/MRT checkpoint GPU tests passed on `8403956`; the separate representative TRT same-method double-buffer continuation GPU case also passed (one test). | This covers the tested same-method continuation configurations. No LES, Jet or refined checkpoint claim follows. |
|
||||
| Taylor–Green refinement | Independent topology checks are available. The actual-rate phase GPU regression passed one test across two layouts, with errors 1.584e-7 and 4.500e-9. | The physical interface-accuracy gap remains open. Passing topology and phase checks does not establish convergence or close that accuracy gate. |
|
||||
| Porous Couette and annulus | Prior campaign evidence exists and must remain associated with its original setup and source. | The reconstructed annulus is a validation helper, not qualification of a public boundary-condition API. Do not infer absence of evidence from a missing current rerun. |
|
||||
| LES normalization | The reviewed correction is integrated. Exact `95cb6d2` GPU validation passed all nine observations and frozen gates, with three warm-up/reset records, verified 101-source/import identity, DONE and exit 0. Last two SGS decrement relative errors were 6.276e-4 and 6.124e-5 against the unchanged 0.15 gate. | Scope is unforced uniform D2Q9/SRT, shifted FP32, double-buffer streaming and the tested wall-bounded x-periodic shear. No TRT/MRT LES, forcing, EsoPull, objects, refinement or 3D turbulence qualification follows. |
|
||||
|
||||
Historical uniform SRT cylinder-startup and inlet-rounding findings remain separate
|
||||
from the passed MRT DFG result. Raw exchange/window consistency is a measurement
|
||||
contract, not a general stress or force-accuracy certification. Existing source-pinned
|
||||
runners may intentionally reject a newer checkout; never silently repin old receipts.
|
||||
|
||||
## Remaining work
|
||||
|
||||
The related host checks passed (67 checks); they do not replace the GPU or
|
||||
physical-accuracy evidence above. Preserve the existing SRT checkpoint cases,
|
||||
historical LES manifests and all frozen numerical criteria.
|
||||
|
||||
Continue the TG accuracy investigation using its actual fine-level rates and
|
||||
the established analytic convention. Keep the physical accuracy gate open until
|
||||
the relevant comparison passes. Review this integration independently before
|
||||
publication; no new merged-commit GPU run is claimed here.
|
||||
|
||||
No repeat of the accepted full MRT DFG or Cartesian expansion across unsupported
|
||||
combinations is required by this document. Main integration remains a separate
|
||||
review of complete, bounded feature scope.
|
||||
@@ -0,0 +1,60 @@
|
||||
# DFG 2D-2 Re100 GPU campaign (validation-only)
|
||||
|
||||
## Current experimental source provenance
|
||||
|
||||
This development branch now includes the reviewed AMR-channel source changes originating in `5338864748ac67fe2544487c059ba149ebf916da` and `47b05bc8abfc957fe876b0c63bdb386e3c6cbaa5`. The current full-source manifest pins the latter reviewed source snapshot, including the new channel files. This is an explicit new experiment; neither source review nor host tests transfer historical d79 GPU/flow acceptance to it. The channel GPU gate has not yet run at integration time.
|
||||
|
||||
New run JSON records the source-origin pin plus `checkout_revision` (actual Git HEAD), `checkout_dirty`, and the experimental-source label. The origin pin is not claimed to be the run's checkout commit. Numerical definitions and thresholds are unchanged. Runs require a Git checkout for this runtime identity; source hash checks remain active.
|
||||
|
||||
Historical d79 Re100/Jet execution stays reproducible at `69e9b78de9483a5ff21e2d0c74311d240bfaf88c`; the d79 LES diagnostic checkpoint is `20ae6770924df15f31305aad56e44a54a3dd4d88`. Their manifests and existing result files are not rewritten. Use those commits to reproduce or interpret old d79 evidence. The current AMR-channel experiment requires its own GPU and applicable flow evidence.
|
||||
|
||||
## Scope and locked definitions
|
||||
|
||||
Explicitly pinned AMR-channel experimental production snapshot (see provenance below). Uniform D2Q9/MRT, shifted FP32, double buffer, no LES, stationary cylinder and no-slip walls. This is not an AMR, jet, or full canonical-outlet certification.
|
||||
|
||||
Physical geometry: [0,2.2] × [0,0.41], center (0.2,0.2), radius .05, rho=1, nu=.001, inlet mean=1 and peak=1.5. D is lattice diameter; dx=.1/D, dt=U_lattice*dx, nu_lattice=U_lattice*D/100. U_lattice=.01 gives peak inlet Mach .02598. Existing local Zou–He inlet is selected in validation config only. Existing pressure-NEQ outlet is unclamped: **it does not impose the canonical vector do-nothing condition nu*d_n(u)-p*n=0**. The existing production channel-flow initial condition is used, not zero velocity. Periodic eligibility is delayed to t*=250 (25 physical seconds), with fixed end t*=300 (30 seconds).
|
||||
|
||||
Official source: https://wwwold.mathematik.tu-dortmund.de/~featflow/en/benchmarks/cfdbenchmarking/flow/dfg_benchmark2_re100.html
|
||||
|
||||
The 20141124 official newer reference archive has higher-order line-integration force data and supersedes the older example table for this comparison. The compact tests/validation/data/dfg_re100/reference_cycle.json preserves the last complete lift-minimum cycle from lv6/dt4. Reference Cd=[3.164266,3.227392], Cl=[-1.021286,.986571], pressure difference=[2.420371,2.507013], St=.301841. These are derived sampled extrema, not exact analytical values. Official mean=(min+max)/2 and amplitude=max-min; separate time averages are also recorded.
|
||||
|
||||
## Exact commands and startup ownership
|
||||
|
||||
Use the existing CUDA/PyCUDA environment; no package installation or production edits required. From the repository root, use a new task-owned output path:
|
||||
|
||||
export PYTHONPATH="$PWD/src${PYTHONPATH:+:$PYTHONPATH}"
|
||||
python -m pytest -q tests/unit/test_re100.py
|
||||
CUDA_VISIBLE_DEVICES=0 python tests/validation/run_dfg_re100.py --diameter 20 --speed .01 --mode pilot --output output/validation/pilot_d20_u001 > pilot.log 2>&1
|
||||
|
||||
Pilot is t*=5 (10,000 steps), with dense .02-t* sampling to calibrate diagnostic cost. It cannot pass periodicity or external benchmark validation. Root launch owner reviews health, memory, timing and stdout before full runs; the full pair is not launched automatically.
|
||||
|
||||
CUDA_VISIBLE_DEVICES=0 python tests/validation/run_dfg_re100.py --diameter 40 --speed .01 --mode full --output output/validation/full_d40_u001 > d40.log 2>&1
|
||||
CUDA_VISIBLE_DEVICES=1 python tests/validation/run_dfg_re100.py --diameter 80 --speed .01 --mode full --output output/validation/full_d80_u001 > d80.log 2>&1
|
||||
|
||||
These are separate invocations, not a parallel shell script. A single root launch owner serializes startup/compilation across all Horsea work. Do not launch the next process until the previous log contains an explicit `READY {...}` line. READY comes after the first physical sample, including Simulation initialize, sim.run, read_force and get_macroscopic, so lazy runtime/diagnostic paths are exercised. That sample remains in the physical trajectory/history. No hidden warmup/reset, no later new diagnostic kernel. Do not treat a process merely existing as READY. Keep separate output directories and retain exit codes/logs. GPU assignment is chosen by root after checking existing workloads; shown indices are examples of physical device selection.
|
||||
|
||||
## Measurement, frozen criteria and outcomes
|
||||
|
||||
Force uses advancing link-momentum exchange, accumulated in batches <=100 steps, combined in FP64; Cd/Cl=2F/(U_lattice² D). Force timestamp is the batch midpoint. Pressure uses fluid-only h/2h extrapolation to cylinder front/back points and physical conversion 1/(3 U_lattice²), at each sample endpoint. For phase comparisons endpoint pressure is interpolated to the same cycle phase. Both raw times are saved.
|
||||
|
||||
Before t*=240 sample width=.5; afterwards .02 (about 166 samples per lift cycle). Pilot uses dense sampling throughout. Extract complete lift-minimum-to-minimum cycles using quadratic local minimum locations, accepting periods 2–5 t*. Latest five complete cycles must be consecutive with the last ending no more than 5 t* before the final observation, and must start at or after t*=250. Eligibility requires lift amplitude >=.2, period range/mean <=.005, Cd/Cl/pressure min and max ranges <=.005 absolute, cycle-mean mass range/mean <=1e-4, and each cycle's mean mass-flux imbalance <=.005. Instantaneous flux equality is not required in this unsteady compressible LBM diagnostic.
|
||||
|
||||
Reference gates: Cd extrema relative errors <=2%, Cl extrema absolute errors <=.03, pressure extrema relative errors <=2%, St relative error <=2%. These are predeclared engineering tolerances, not official uncertainty intervals. Phase-aligned waveform RMS errors, extrema, midpoint means, time means, amplitudes, outlet residual, sampled density bounds and Mach are all reported. Waveform RMS is diagnostic (no retroactive gate). No threshold changes after GPU results. At cap, failed periodicity stays incomplete. Invalid/nonfinite state, rho outside [.5,1.5], or sampled max Mach>.2 causes a safety stop; this is a gross-health guard, not a Mach-independence claim.
|
||||
|
||||
A case_reference_pass requires both periodicity and reference gates. Every raw case keeps suite_validated=false. The two-grid comparison must report each case and errors; matched-Mach D40/D80 is evidence of resolution sensitivity only, not an asymptotic convergence order. If either fails or finer errors increase materially, report the failure instead of adjusting thresholds. No full canonical/AMR/Mach-independent validation claim is allowed.
|
||||
|
||||
## Resource and calibration plan
|
||||
|
||||
D20: 441×84=37,044 nodes, pilot 10,000 steps. D40: 881×166=146,246 nodes, 1,200,000 full steps. D80: 1761×330=581,130 nodes, 2,400,000 full steps. Main double-buffer DDF arrays alone cost 72 bytes/node: 2.7/10.5/41.8 MB decimal. Flags, masks, macro host arrays, body buffers and CUDA context/JIT memory add overhead; root verifies actual free GPU/host memory and disk before launch. Conservative per-process reservation: 1 GiB VRAM and 2 GiB host RAM, excluding shared/compiler overhead; measurements take precedence.
|
||||
|
||||
Historical Re20 D80 U=.01 step throughput was ~6082 MLUPS (45.9 seconds/480k steps). At equal throughput D80 Re100 full advancing steps would take ~229 seconds, excluding dense full-field downloads/reduction and compile overhead. D40 estimate must be calibrated, not assumed proportional. Pilot records startup_seconds, step_seconds, measurement_seconds, mlups. For each full grid, calibrate a same-grid pilot if D20 cannot predict cost adequately. Full has about 3480 records (480 coarse+3000 dense); use measured seconds/step × full steps plus seconds/record ×3480 plus startup. D20-to-D80 extrapolation is only a rough planning upper/lower guide, not an ETA commitment.
|
||||
|
||||
Only geometry.npz, one final_field.npz, history.csv, summary.json and stdout/stderr are persisted. No per-step or repeated full-field snapshots. D80 final float64 rho/ux/uy plus mask are <15 MB uncompressed; history/summary several MB, compact versioned reference/source guards <50 KiB. Budget <100 MB per case and <500 MB whole campaign including logs and optional externally retained archives, safely below 2 GiB; root still checks baseline Horsea usage. Retain sparse evidence only.
|
||||
|
||||
## CPU validation and remaining execution
|
||||
|
||||
Ten tests cover geometry/units/config, pressure scaling, periodic and nonperiodic synthetic histories, immutable production hashes, and self-reference comparison. CUDA execution is not available in the preparation environment and has not been claimed. Run pilot first on Horsea; do not confuse successful CPU tests with GPU readiness.
|
||||
|
||||
## Reference provenance and reproduction
|
||||
|
||||
Only the compact derived cycle is versioned. Its source URL, official ZIP SHA-256, column selection, and cycle-selection description are embedded in reference_cycle.json. Raw archives and GPU results are not repository inputs. To reproduce it, obtain the exact archive identified there, verify its SHA-256, and extract logs/results_cc2d_bench2_referencenew/bdforces_q2_lv6_dt4 and pointvalues_q2_lv6_dt4. Use physical time column 2 multiplied by 10, drag/lift columns 4/5, and pressure columns 7 minus 12 (one-based columns). Build rows with mass=flux_in=flux_out=1, then call periodic.extract(rows, min_time=0) and select the last complete cycle. The source guard is tests/validation/data/dfg_re100/source_manifest.json; it verifies the current reviewed production snapshot rather than equating its origin with the validation branch HEAD.
|
||||
@@ -0,0 +1,49 @@
|
||||
# DFG 2D-1 (Re 20) against the official reference intervals
|
||||
|
||||
`tests/validation/run_dfg_re20.py` runs the steady DFG 2D-1 case on the refined
|
||||
channel root (D40 root, D80 wide fine patch) and on the uniform D80 grid. Geometry,
|
||||
inflow, initial state, layout and observation are those of the pinned Re100 runner
|
||||
(`run_refined_dfg.py`, `re100_helpers.py`, both unchanged); only the lattice
|
||||
viscosity is set for Re 20 (root tau 0.56, fine 0.62, uniform 0.62, lattice speed 0.01).
|
||||
|
||||
Label: "compared against the official reference bands", not a full benchmark
|
||||
certification: the outlet is pressure-NEQ (`neq_extrap`), not do-nothing, and the
|
||||
inlet is local Zou-He.
|
||||
|
||||
## Quantities
|
||||
|
||||
- Cd = 2 Fx / (rho U^2 D), Cl = 2 Fy / (rho U^2 D), interval means over each sample.
|
||||
- p_diff = p(0.15, 0.2) - p(0.25, 0.2), linear extrapolation to the exact surface
|
||||
points (`re100_helpers.pressure_probes`). The helper returns dp / (rho U^2) in
|
||||
scaled units; p_diff = dp * 0.04 for U = 0.2 m/s, rho = 1. Both are reported.
|
||||
- Official intervals (Schaefer & Turek 1996): Cd [5.57, 5.59], Cl [0.0104, 0.0110],
|
||||
p_diff [0.1172, 0.1176].
|
||||
|
||||
## Bounds and steady rule (frozen before any run)
|
||||
|
||||
- End time t* = 60 (30 s physical): 240,000 refined root steps, 480,000 uniform steps.
|
||||
- One sample every t* = 0.5 (0.25 s) at the end of a synchronized root step; Cd and
|
||||
Cl are interval means. Trailing window t* 50..60 inclusive (21 samples).
|
||||
- Steady rule (our engineering choice, not official): in the window, for each of Cd,
|
||||
Cl, p_diff, max - min <= 10 % and |least-squares slope x window| <= 2 % of its
|
||||
official interval width (range 2e-3 / 6e-5 / 4e-5; slope 4e-4 / 1.2e-5 / 8e-6).
|
||||
Absolute limits, so the small Cl is never a divisor. Never relaxed after a run.
|
||||
- The verdict uses the window mean; the distance to the nearest interval edge is
|
||||
reported for each quantity (negative outside).
|
||||
- Force sign: fluid on cylinder, x along the inflow, y up from the bottom wall; Cd > 0
|
||||
and the official Cl > 0 (`cd_positive` is reported).
|
||||
- Not steady at t* = 60: status `NOT_STEADY`, no interval verdict. Health limits
|
||||
(Mach <= 0.2, rho in [0.5, 1.5]) stop the run with `UNHEALTHY`.
|
||||
- Steady: `WITHIN_INTERVALS` or `OUTSIDE_INTERVALS`, with the per-quantity verdict.
|
||||
|
||||
## Run
|
||||
|
||||
```
|
||||
python tests/validation/run_dfg_re20.py --output <new-dir> --plan
|
||||
CUDA_VISIBLE_DEVICES=<n> python tests/validation/run_dfg_re20.py --case both \
|
||||
--collision SRT --output <new-dir> --max-wall-seconds <cap>
|
||||
```
|
||||
|
||||
The uniform D80 control separates method error from refinement error. `--plan` writes `plan.json` only. A GPU run writes `plan.json` and `result.json`
|
||||
(per case: lattice parameters, every sample, window ranges, status, verdict).
|
||||
Host contract tests: `tests/unit/test_dfg_re20.py`.
|
||||
@@ -0,0 +1,242 @@
|
||||
# Prescribed in-line oscillation: Dütsch Re 100 / KC 5 — PROTOCOL (review draft)
|
||||
|
||||
Production under test: `claude/moving-bodies-s3a` at `653fd997` (unchanged).
|
||||
Primary source: Dütsch, Durst, Becker & Lienhart, J. Fluid Mech. 360, 249–271
|
||||
(1998), doi:10.1017/S002211209800860X. Source facts below were verified from
|
||||
the paper (Slack C0C78UFKGRM/1793335557.460509, TRON 1793356317–1793356724,
|
||||
page numbers given). Everything marked ENGINEERING is our a-priori choice,
|
||||
fixed before any benchmark result; it is not a paper uncertainty.
|
||||
|
||||
## 0. Source facts (with provenance)
|
||||
|
||||
- Motion (p.251): `x_c = -A sin(2 pi f t)`; paper phase phi = 0 is the mean
|
||||
position moving left at `-U_max`. KC = 5 gives `A/D = 5/(2 pi) = .7957747`.
|
||||
- Start (p.254): the computation starts a quarter cycle before phi = 0, at
|
||||
`x = +A` with zero velocity (phi = -90°).
|
||||
- Experiment (pp.252, 254–256): D = 10 mm, L = .65 m, tank 1.2 × .7 × .7 m,
|
||||
rho = 998.2 kg/m³, mu = 1.00818 mPa·s, Re = 100, KC = 5; LDA with 1° phase
|
||||
bins and 200 samples per node and degree; no quantified experimental error
|
||||
recovered.
|
||||
- Profiles (Fig. 8, p.260): LAB-FIXED stations x1 = -6, 0, 6, 12 mm, i.e.
|
||||
x/D = -.6, 0, .6, 1.2, at phi = 180°, 210°, 330°; u1 and u2 versus x2.
|
||||
- Original numerics (§2): cylinder-fixed accelerated frame (`x_i = x~_i +
|
||||
x_i,s`, outer velocity `-u_c`, inertial source `-rho du_c/dt`), O-grid outer
|
||||
diameter 120 D, illustrated 192 circumferential nodes, 720 steps/cycle; tank
|
||||
influence neglected.
|
||||
- Force fit (verified): force ON THE BODY per unit span
|
||||
`F1 = -0.5 rho D c_d xdot|xdot| - (pi/4) rho D² c_i xddot` with `x = -A sin phi`;
|
||||
normalized by `0.5 rho D U_max²`: `c_d cos phi |cos phi| - (pi² c_i / KC) sin phi`.
|
||||
`c_i` is the ADDED-MASS coefficient; total inertia `c_m = c_i + 1` is a
|
||||
different convention and is not used.
|
||||
- Table 1 computed Morison coefficients (c_d, c_i) for 96 / 192 / 384 perimeter
|
||||
nodes at dt/T = 1/720: (2.15, 1.42), (2.10, 1.45), (2.09, 1.45). These are
|
||||
fitted computed coefficients, not a measured force and not an error bar. The
|
||||
paper states the coarse direct force is closer to the finest direct force
|
||||
than the Morison fit, but gives no waveform-error norm.
|
||||
|
||||
## 1. Kinematics, time levels and phase bookkeeping
|
||||
|
||||
- Our run is in the LAB frame: the circle moves, the fluid is initially at rest
|
||||
(rho = 1, u = 0); no fictitious inertial source is added. Lab-fixed profile
|
||||
stations are compared directly (no frame transform needed).
|
||||
- Geometry reference: the circle's base centre is the INITIAL position, the
|
||||
right turning point `x_mean + A`; the declared offset box is x in [-2A, 0],
|
||||
y = 0. The body is never teleported: offset 0 at s = 0.
|
||||
- Elapsed time s = n dt from the start. Analytic position relative to the mean
|
||||
`x(s) = A cos(2 pi s / T)`, velocity `u(s) = -U_max sin(2 pi s / T)`; paper
|
||||
phase `phi = (360 s / T - 90) mod 360`.
|
||||
- Step n moves from s_n to s_{n+1}: target offset `x(s_{n+1}) - A`; wall
|
||||
velocity = the single-step interval average `(x(s_{n+1}) - x(s_n)) / dt`
|
||||
(analytic, supplied, not differenced from stored offsets). The per-step
|
||||
force of `run(1)` / `read_force(normalize=True)` is attributed to that same
|
||||
interval.
|
||||
- Paper cycle k = 1, 2, ... spans `s in [T/4 + (k-1) T, T/4 + k T)`; the
|
||||
initial quarter cycle (s < T/4) is cycle 0 and never scored. Every logged
|
||||
sample carries (k, phi). Example: phi = 330° of cycle 1 is at s = 7T/6.
|
||||
- T is chosen as a multiple of 360 native steps, so phi = 180°, 210°, 330° fall
|
||||
exactly on step boundaries and 1° bins hold whole steps.
|
||||
|
||||
## 2. Resolution ladder (uniform grid, fixed Mach), ENGINEERING
|
||||
|
||||
| D (cells) | T (steps) | U_max = 5 D / T | nu_lat = U_max D / 100 | tau (3 nu + .5) |
|
||||
|---|---|---|---|---|
|
||||
| 20 | 2,520 | .039683 | .0079365 | .5238 |
|
||||
| 40 | 5,040 | .039683 | .015873 | .5476 |
|
||||
| 80 | 10,080 | .039683 | .031746 | .5952 |
|
||||
|
||||
- MRT collision. Mach fixed (Ma ≈ .0687); a separate Mach check at D = 40
|
||||
with T = 10,080 (U_max halved, tau .5238) is labelled MACH and not part of the
|
||||
ladder.
|
||||
- Per-step displacement ≤ U_max ≈ .04 cells (bound .5).
|
||||
|
||||
## 3. Domain and boundaries (finite-domain reproduction), ENGINEERING
|
||||
|
||||
The paper's 120 D O-grid is not reproduced; our rectangular box is a
|
||||
reproduction choice. The native dense channel (zero-velocity inlet,
|
||||
pressure-NEQ outlet, bounce-back y walls) is a finite-domain approximation,
|
||||
not infinite still fluid. The G4 x-periodic / y-slip override is a separately
|
||||
labelled sensitivity family and never mixed into the primary ladder. The
|
||||
runner owner confirms the zero-velocity inlet is supported as configured
|
||||
before any run.
|
||||
|
||||
Order (closed):
|
||||
1. Smoke + ledger at D = 40, native BC, 40 D × 40 D (finite box).
|
||||
2. Domain sensitivity before any literature statement: same BC, D = 40,
|
||||
L ∈ {20 D, 40 D, 60 D}; record the change in Fx waveform, c_d, c_i and the
|
||||
scored profiles.
|
||||
3. Optional labelled BC sensitivity: one x-periodic / y-slip case at D = 40,
|
||||
40 D; reported as a delta against native only.
|
||||
4. Only after step 2 passes: the D = 20 / 40 / 80 ladder on the chosen BC and
|
||||
domain.
|
||||
|
||||
Domain criteria (a-priori, ENGINEERING; separate from the Table 1 bands): the
|
||||
reference is 60 D at D = 40; 20 D and 40 D are compared with it on the common
|
||||
window (same cycle indices) and the common valid point set:
|
||||
- `RMS(Fx_L - Fx_60D) / F_ref ≤ .01` over the window (per-step waveforms);
|
||||
- `|c_d,L - c_d,60D| ≤ .02` and `|c_i,L - c_i,60D| ≤ .02` (window fits);
|
||||
- `max(|u_L - u_60D|, |v_L - v_60D|)` over common points `/ U_max ≤ .02`.
|
||||
The chosen domain is the smallest of {20 D, 40 D} passing all three; if
|
||||
neither passes, the domain verdict is FAIL and the ladder is not run.
|
||||
- Memory/runtime: measured by a smoke run before each new size; measurements
|
||||
inform scheduling only, never tolerances.
|
||||
|
||||
## 4. Observables (raw, per step, preserved)
|
||||
|
||||
- `obs` Fx, Fy (CME) and all `MovingTables.DIAG` columns per step: CME,
|
||||
CME + Wen and CME + cover − uncover reported separately; crossings, eq_only,
|
||||
no_donor (no_donor must stay 0).
|
||||
- Velocity u1, u2 on lab-fixed lines x/D = -.6, 0, .6, 1.2 (relative to the
|
||||
mean cylinder position) versus x2, at the scored phases. Lab frame
|
||||
throughout; if any body-frame intermediate is used, position and velocity
|
||||
are both transformed.
|
||||
- Sampling cost: raw force and diagnostics counters are read every step
|
||||
(small). Flags and velocity fields are read only at the steps inside the
|
||||
three prescribed 1° phase bins (φ ∈ [180, 181), [210, 211), [330, 331),
|
||||
T/360 steps each) of the cycles needed for settling and scoring, plus
|
||||
sparse declared audits; never every step.
|
||||
- Point set: fixed x2/D sample points per station, identical on every grid
|
||||
and declared before running; per point the interpolation weights are
|
||||
recorded; the scored set is the common subset valid on all compared grids
|
||||
at that phase, with its coverage recorded; point sets never change silently.
|
||||
- Interpolation: bilinear on cell centres using only cells that are fluid at
|
||||
that step (flags read back via `get_flags()`); weights renormalized over the
|
||||
fluid corners; a sample with no fluid corner, or inside the circle at that
|
||||
step, is MISSING and logged, never set to zero. One-degree bins keep valid
|
||||
fluid weights. The numerical average need not mimic the 200 LDA samples.
|
||||
|
||||
## 5. Periodic-regime gate (every case, before any statistic), ENGINEERING
|
||||
|
||||
Ledger rows, same schema for every case: dx, dt (in D and T units); U_max, nu,
|
||||
Re, KC (lattice and nondimensional); T (native steps, nondimensional);
|
||||
duration (native steps, s/T, paper cycles); discard; accepted window; cycle
|
||||
ledger; verdict PASS or FAIL-CLOSED.
|
||||
|
||||
Scales: `F_ref = 0.5 rho U_max² D`, `U_ref = U_max`; never a near-zero mean
|
||||
force as denominator.
|
||||
|
||||
- Settling metrics, cycle k−1 → k, phase-aligned by step within the cycle
|
||||
(error budget: one fifth of the tightest comparison band of the same
|
||||
observable, so residual drift cannot obscure a domain or resolution pass):
|
||||
- waveform `RMS(dFx) / F_ref ≤ .002`;
|
||||
- `|d mean|`, `|d RMS|`, `|d peak|` of Fx, each `/ F_ref ≤ .002`;
|
||||
- scored profiles (fluid-only) `|du| / U_max`, `|dv| / U_max ≤ .004` at the
|
||||
three phases × four stations;
|
||||
- Morison `|dc_d| ≤ .004`, `|dc_i| ≤ .004`.
|
||||
- Conservative comparison: every domain and cross-resolution criterion is
|
||||
applied to `|difference| + drift_a + drift_b`, where drift is the largest
|
||||
pair metric of that case inside the scored window.
|
||||
- These constants (protocol.py SETTLE, DOMAIN, CROSS) are frozen before any
|
||||
physical result; no post-result loosening.
|
||||
- Rule: all metrics for N = 3 consecutive whole paper cycles → settled.
|
||||
|
||||
Cycle indexing (worked example, binding). Paper cycle k spans
|
||||
`s/T in [0.25 + (k-1), 0.25 + k)`, i.e. φ0 → φ0; cycle 0 is the startup
|
||||
quarter `s/T < 0.25`. Pair p_k compares cycle k−1 with cycle k.
|
||||
|
||||
- Discarded: cycles 0, 1, 2 (s/T < 2.25). Pairs are formed only between
|
||||
cycles ≥ 3, so the first pair is p_4 (3 → 4).
|
||||
- Settling proof for a case: three consecutive pairs all pass; K_case = the
|
||||
first cycle AFTER the last of those pairs. Earliest possible: pairs 3→4,
|
||||
4→5, 5→6 pass ⇒ K_case = 7.
|
||||
- Common window: K = max over compared cases of K_case; every case scores the
|
||||
same three complete cycles K, K+1, K+2 and must stay settled continuously:
|
||||
every pair p_j for j = its own K_case .. K+2 must pass (including the wait
|
||||
between its local settle and the common K), otherwise that case is
|
||||
FAIL-CLOSED.
|
||||
- Cap: cycle k ends at s/T = k + 0.25, so the last admissible scored cycle is
|
||||
11 (ends 11.25 T) and K ≤ 9. Examples: K = 7 → cycles 7–9 (ends 9.25 T);
|
||||
K = 9 → cycles 9–11 (ends 11.25 T); any K_case > 9 → FAIL-CLOSED.
|
||||
- Run length: cases run sequentially; each runs to the end of cycle 11
|
||||
(11.25 T: 28,350 / 56,700 / 113,400 steps for D = 20 / 40 / 80; the 12 T
|
||||
cap is 30,240 / 60,480 / 120,960) and keeps its scalar and profile data, then
|
||||
the common K is chosen. An unscorable partial cycle 12 is not run.
|
||||
- Profiles: an empty common valid point set is FAIL-CLOSED; coverage, missing
|
||||
points, bin time weights (equal per step) and the original fluid corner
|
||||
weight sums are reported.
|
||||
- The earlier G4 timing check (100 coarse vs 400 diffusive-fine steps) was a
|
||||
matched short transient, not periodic evidence.
|
||||
|
||||
## 6. Metrics and per-observable criteria (ENGINEERING, not paper uncertainty)
|
||||
|
||||
Three criteria stay separate; the G4 same-grid 2% target is not reused.
|
||||
|
||||
- Morison fit: least squares of the normalized per-step force over the
|
||||
accepted window against the two basis functions, each averaged over its
|
||||
single step interval, fixed paper phase, no free phase shift; c_d and
|
||||
added-mass c_i per force candidate.
|
||||
- Cross-resolution: every scored observable's error against its reference must
|
||||
decrease monotonically D20 → D40 → D80 (necessary, not sufficient).
|
||||
- Against Table 1 (computed fit, not measured force): at D ≥ 40,
|
||||
`|c_d - 2.09| ≤ .15` and `|c_i - 1.45| ≤ .15`, and monotone.
|
||||
- Force waveform against its own Morison reconstruction: residual reported
|
||||
only, no pass/fail (the paper reports fit error above its coarse numerical
|
||||
error and gives no percentage).
|
||||
- Fig. 8 LDA profiles: QUALITATIVE ONLY. The original figure could not be
|
||||
accessed or rendered; no digitized ordinates and no measurement uncertainty
|
||||
exist. After a digitization with figure number, tool and uncertainty note:
|
||||
`RMS(|du|, |dv|) / U_max ≤ .15` at D ≥ 40 and monotone; LDA error stays
|
||||
UNQUANTIFIED and is stated with every comparison.
|
||||
- Fy sanity (not literature): `|mean Fy| / F_ref ≤ .05` in the accepted window.
|
||||
- No force candidate is selected for an RHS by these results; each is
|
||||
reported.
|
||||
|
||||
Superseded (earlier drafts): the velocity-jump start, guessed stations and
|
||||
phases, "C_M" for c_i, and the uncertainty wording; cycles 4–6, the 30-cycle
|
||||
cap and the earlier tolerance numbers.
|
||||
|
||||
## 6b. Amendment: duration-only diagnostic (declared before the run)
|
||||
|
||||
- Background: the D40 domain stage (20 D / 40 D / 60 D, 11.25 T each) failed
|
||||
settling in every box (no window). That result stands.
|
||||
- One declared diagnostic: D = 40, 60 D box, from rest, through cycle 31
|
||||
(157,500 steps = 31.25 T). Physics, settling tolerances, bands and
|
||||
production unchanged; three proof pairs plus a continuously settled
|
||||
K..K+2 with K ≤ 29.
|
||||
- Invocation: `run.py --D 40 --box 60 --cycles 31` then
|
||||
`analyze.py --horizon 31`; the JSON records `horizon` and `horizon_mode`.
|
||||
Without `--horizon` the analyzer is the original cap-11 scoring.
|
||||
- Failure at 31.25 T: report and stop; no automatic extension, matrix, D80
|
||||
or VIV. A pass shows only that this box settles with time; it is not a
|
||||
domain or literature pass.
|
||||
- The phase-locked high-frequency force component (residual of the mean
|
||||
waveform after its Morison reconstruction, above 20/T) is reported per case
|
||||
as unqualified; it needs separate qualification before any Morison or
|
||||
literature statement.
|
||||
|
||||
## 6a. Driver unit tests (CPU, before any run)
|
||||
|
||||
- Phase/cycle arithmetic: s ↔ (k, φ), cycle boundaries, bin membership,
|
||||
window/cap selection for K = 7, 8, 9, 10.
|
||||
- Solid-aware interpolation: all-fluid, partial-solid (renormalized weights),
|
||||
no-fluid (MISSING) and inside-circle cases.
|
||||
- Interval-averaged Morison bases and the two-parameter fit on a synthetic
|
||||
waveform with known c_d, c_i.
|
||||
|
||||
## 7. Order and scope
|
||||
|
||||
Protocol review → one-shot Dütsch driver (analytic `set_body` + `run(1)`,
|
||||
cycle ledger, lab-fixed fluid-only station sampler, two-basis Morison fit; no
|
||||
reusable runner until the first smoke shows shared helpers pay off; no
|
||||
production change) → smoke (memory/runtime) → domain sensitivity →
|
||||
ladder → physical-validation verdict → only then single-cylinder VIV. No AMR,
|
||||
no pinball, no manuscript work.
|
||||
@@ -0,0 +1,115 @@
|
||||
# Jet-circle closed-control-volume pilot
|
||||
|
||||
## Current experimental source provenance
|
||||
|
||||
This development branch now includes the reviewed AMR-channel source changes originating in `5338864748ac67fe2544487c059ba149ebf916da` and `47b05bc8abfc957fe876b0c63bdb386e3c6cbaa5`. The current full-source manifest pins the latter reviewed source snapshot, including the new channel files. This is an explicit new experiment; neither source review nor host tests transfer historical d79 GPU/flow acceptance to it. The channel GPU gate has not yet run at integration time.
|
||||
|
||||
New run JSON records the source-origin pin plus `checkout_revision` (actual Git HEAD), `checkout_dirty`, and the experimental-source label. The origin pin is not claimed to be the run's checkout commit. Numerical definitions and thresholds are unchanged. Runs require a Git checkout for this runtime identity; source hash checks remain active.
|
||||
|
||||
Historical d79 Re100/Jet execution stays reproducible at `69e9b78de9483a5ff21e2d0c74311d240bfaf88c`; the d79 LES diagnostic checkpoint is `20ae6770924df15f31305aad56e44a54a3dd4d88`. Their manifests and existing result files are not rewritten. Use those commits to reproduce or interpret old d79 evidence. The current AMR-channel experiment requires its own GPU and applicable flow evidence.
|
||||
|
||||
Status: CPU preparation only. No GPU run or production change. Current source origin: reviewed AMR-channel snapshot 47b05bc8abfc957fe876b0c63bdb386e3c6cbaa5; this new experiment has no inherited d79 GPU acceptance. tests/validation/data/jet_circle_cv/source_manifest.json checks all tracked source file hashes before importing GPU code.
|
||||
|
||||
## Execute only after root-owned GPU serialization
|
||||
|
||||
From the repository root, with REPO set to the repository root and an absent output directory:
|
||||
|
||||
```sh
|
||||
PYTHONPATH=src python -m pytest -q tests/unit/test_jet_circle_cv.py
|
||||
python tests/validation/run_jet_circle_cv.py --repo "$REPO" --output "$OUTPUT" --plan
|
||||
CUDA_VISIBLE_DEVICES="$VERIFIED_IDLE_GPU" python tests/validation/run_jet_circle_cv.py --repo "$REPO" --output "$OUTPUT"
|
||||
```
|
||||
|
||||
The runner does not select, reserve, or contact a GPU machine. It requires one explicit CUDA_VISIBLE_DEVICES value, at least 1 GiB free, and refuses an existing output directory. It imports existing PyCUDA; no installation. Default pilot: 800 base steps, 8 output windows, at most 1800 seconds after READY. READY is printed only after both steppers compile, execute one base/two fine warmup hops, exercise download/raw paths, and reset initial state/time. A pre-READY silence may be compilation, not stepping progress. Root owns any overall startup timeout and all launch serialization.
|
||||
|
||||
## Physical/numerical case
|
||||
|
||||
Periodic root box 192 by 128, center (96,64) in root cell-edge coordinates, D=24.084, U0=.03, nu=.0072252, Re_D=100, beta=Vj/U0=.1, rho0=1. Unforced D2Q9 SRT FP32, no DDF shifting, no LES. The slightly noninteger diameter was selected solely to avoid q clipping at all three planned scales. Circle is stationary. Two uniform radial sectors at pi/2 and 3pi/2, half-width pi/12: top blows outward +.003, bottom sucks inward -.003; remaining wall has zero velocity. This periodic transient is NOT DFG, infinite-stream drag, or statistical high-Re validation. End time is t*=t U0/D approximately .9965.
|
||||
|
||||
AMR bounds (48,32,144,96). Finest dx=dt=.5 in root lattice units, nu_fine=2 nu, finest D=48.168. Full-domain fine reference is 384 by 256 with exactly the same finest spacing, timestep, viscosity, collision and storage. Root tau=.5216756, fine tau=.5433512, Mach approximately .05196.
|
||||
|
||||
AMR uses actual public FixedPatchStepper Jet construction and raw observation. The uniform blocked reference reuses the existing test_raw_exchange_gpu.py optional-input validation adapter: production Jet-derived velocity/force-arm arrays feed the unchanged blocked curved kernel. Its normal public PeriodicBlockStepper API is passive-only. This does not claim there is no uniform Jet route anywhere: Simulation.add_jet exists, but the same-blocked-kernel adapter removes a backend/storage confound for this comparison. No new public backend is introduced. Runtime asserts matching directions, q, fallback and true hit coordinates after frame conversion; both sectors must resolve links. Unclamped q/no fallback is required.
|
||||
|
||||
## Independent measurements and signs
|
||||
|
||||
Two closed rectangles: (72,44,120,84) and (64,40,128,88), wholly within the finest patch. Every contour face has two active-fluid stencil layers. Capture physical postcollision populations at t=0 and every completed base interval. Collision conserves density/momentum; these are valid endpoint moments, NOT precollision stress estimates.
|
||||
|
||||
For each contour, M and P sum fluid-cell rho and rho*u times h^2, excluding the staircase solid. Face midpoint quadrature integrates rho*u dot n and [rho*u*u+p*I-mu*(grad u+grad u.T)] dot n. Velocity gradients use centered differences in root-length units, mu=rho*nu, p=(rho-1)/3. Constant pressure subtraction integrates to zero on a closed rectangle. No raw exchange enters these field quantities.
|
||||
|
||||
Trapezoidal time integration samples every base step over the SAME reported [step_start,step_end] as cumulative raw impulses/masses. For each window:
|
||||
|
||||
- mass into fluid through body surface = delta M + integral outer mass flux
|
||||
- raw boundary reaction target = -delta P - integral outer momentum-minus-traction flux
|
||||
|
||||
Raw rows are [Jx,Jy,angular impulse,mass into fluid]; each uniform fine hop scales by [.25,.25,.125,.25], exactly as the AMR interval ledger. Both fine hops are accumulated. AMR observation time endpoints and the public raw reduction are checked. Reports separate total, wall, aperture, blowing and suction raw rows. Coefficients divide force by .5*rho0*U0^2*D. These are momentum reactions including aperture transport; neither raw aperture nor total raw reaction is labelled solid-only hydrodynamic traction.
|
||||
|
||||
Independent aperture mass estimates integrate measured rho*u dot e_r over true arcs using 64-point Gauss quadrature and nearest active-fluid samples. No target velocity or raw row enters this estimate. Reports include maximum sampling distance, actual signed raw mass rates and nominal signed volume flux ±2*(pi/12)*R*Vj. Near-wall nearest-node sampling is only a first-order diagnostic, not certified wall extrapolation. Nominal volume flux is not asserted to equal measured mass flow at finite density variation.
|
||||
|
||||
Inventory near the circle is a staircase-cell approximation; its geometric error and face/time quadrature errors can appear in CV residuals. Two-contour spread and grid refinement are essential. No exact continuum force value, solid traction recovery, jet hardware load, or physics acceptance is claimed. Output status is deliberately PILOT_DIAGNOSTIC_ONLY even on successful execution.
|
||||
|
||||
## Scope, refinement, resources
|
||||
|
||||
Default one pilot only. Estimated device envelope 128 MiB, required free 1 GiB; bounded JSON only, conservatively under 2 MiB, no population snapshots or per-step logs. Every base step downloads both fields for independent quadrature, so PCIe/CPU diagnostic cost is intentional. Six CPU tests cover descriptor/source identity, uniform flux cancellation, affine convective divergence, quadratic viscous sign/coefficient, matched geometry/Jet selection and diffusive scaling.
|
||||
|
||||
Optional --scale 2 or 4 doubles/quadruples all lengths and divides U,V by that scale, holds lattice nu fixed, and scales steps/windows by scale^2: physical Re and t* match, Mach decreases. Source and geometry guards repeat. Device estimate scales as scale^2; memory gate requires twice the estimate or 1 GiB, whichever is greater. Scale 4 is not part of default authorization/readiness. --re 400 requires --allow-re400 and a separate reviewed root launch decision after Re100 evidence; no automatic promotion.
|
||||
|
||||
Compare AMR/reference velocity error, signed reaction coefficients, each contour's independently measured reaction and residual, contour spread, signed mass budgets, and measured aperture flux. Freeze numerical tolerances only after agreeing a scientifically appropriate convergence criterion; this preparation imposes only structural/finite-state guards. A completed pilot cannot establish convergence.
|
||||
|
||||
Follow-on design retained: porous Couette crossflow with u=U*expm1(Re_V*y/H)/expm1(Re_V), v=V and unequal exact wall shear. It requires validation-only planar geometry and is intentionally not implemented here.
|
||||
|
||||
### Amplitude, geometry, and high-Re limits
|
||||
|
||||
Both Jet amplitudes are constant throughout the run and every fine substep; geometry is fixed. There is no runtime switch, per-step forcing schedule, or moving-wall velocity in this campaign. Construction/packing happens once, with identical uploaded amplitudes in the uniform adapter. This avoids any substep timing ambiguity from amplitude changes.
|
||||
|
||||
Every case records actual tau_root and tau_fine. For this fixed s=1 geometry and speed, Re400 would give nu=.0018063, tau_root=.5054189 and tau_fine=.5108378, close to the SRT limit .5. The implemented Re choices are a bounded campaign menu, not a universal physical Reynolds-number ceiling. Higher-Re evidence may require a larger initial resolved geometry or a different justified grid/relaxation design before launch. Diffusive refinement at constant lattice nu improves spatial/Mach resolution but does not move tau farther from .5; simply selecting scale=2 does not cure a poor tau. No all-Re, LES or three-dimensional realism claim follows from this pilot.
|
||||
|
||||
The source guard checks production file content against the current reviewed source origin, not validation-branch HEAD. This runner is validation-only; generated results and frozen execution-package archives are not committed.
|
||||
|
||||
## Measurement-only continuation (frozen design before execution)
|
||||
|
||||
The original 800-step pilot and its audit remain historical evidence, not an acceptance target. The following adds diagnostics only; it neither modifies production kernels nor adjusts velocity commands to improve measured flux. Use the canonical validation Git branch, with the same source-manifest check and checkout provenance record. No standalone replacement source archive is needed.
|
||||
|
||||
Run the pair serially under root-owned GPU allocation, from the checked-out repository:
|
||||
|
||||
```sh
|
||||
python tests/unit/test_jet_circle_cv.py -v
|
||||
python tests/unit/test_jet_cv_measurements.py -v
|
||||
CUDA_VISIBLE_DEVICES="$VERIFIED_IDLE_GPU" python tests/validation/run_jet_circle_cv.py --repo "$PWD" --output "$NEW_OUTPUT_S1" --continuation --steps 3200 --scale 1
|
||||
CUDA_VISIBLE_DEVICES="$VERIFIED_IDLE_GPU" python tests/validation/run_jet_circle_cv.py --repo "$PWD" --output "$NEW_OUTPUT_S2" --continuation --steps 3200 --scale 2
|
||||
python tests/validation/analyze_jet_cv_continuation.py "$NEW_OUTPUT_S1" "$NEW_OUTPUT_S2" --output "$COMPARISON_JSON"
|
||||
```
|
||||
|
||||
Both output directories must be absent. `--plan` prints configuration without CUDA. `--continuation` deliberately accepts only Re100, scale1/2, and 3200 reference steps: a bounded campaign, not a physical Re ceiling. Actual steps are 3200 and 12800, reaching the same t*=3.986048829. Physical circle/box/contours and beta remain fixed; all root lengths grow by s, U and jet speed shrink by s, lattice nu remains .0072252. Both runs retain tau_root=.5216756 and tau_fine=.5433512, with Mach .0519615/s. This diffusive refinement changes the finite-Mach/compressibility error as well as grid resolution; it is not an isolated spatial-error order study.
|
||||
|
||||
### Units, cadence, and reconstructibility
|
||||
|
||||
Reference length/time are one scale-1 root lattice length/time; density reference is one. Convert scale-s root quantities by: length /s, time /s², velocity times s, mass /s², momentum and impulse /s, force times s, angular impulse /s², pressure times s². Volume and mass rates are unchanged. The nominal signed aperture volume rate is ±.0189155293672 in reference units at every scale. A mass flux divided by rho_ref times that rate is a reference-density diagnostic, not an actual-volume-flow ratio. Saved Q and M remain separate.
|
||||
|
||||
Exact raw observations accumulate every completed base interval, including both fine substeps. Field downloads occur only at shared reference times 0..100 at dt=1, then 100..3200 at dt=4: 876 samples per run, compared with 3201/12801 possible every-base samples. Every 100-reference-time window boundary is included. Trapezoidal integration uses the actual variable time gap, with the raw ledger covering exactly the same endpoints. No missing sample is silently treated as unit dt. Sampling is denser during abrupt startup; it is not a guarantee of resolving all high-frequency acoustic modes. Offline coarsening can expose some time-quadrature sensitivity but cannot rule out unresolved-frequency aliasing.
|
||||
|
||||
`samples_s*.npz` stores at every sample: density minima/maxima/max perturbation and max speed for uniform fluid, AMR root leaves and AMR fine leaves; composite full-domain mass; CV endpoint inventory and flux; separate advective, pressure and negative-viscous-traction momentum fluxes; nearest-fluid mass proxy; extrapolation ray primitive values; linear/quadratic reconstructed Q and M; and cumulative raw wall/aperture/total/blowing/suction rows. Associated JSON identifies axes, units, conversion factors, hashes and snapshot metadata. Composite AMR mass sums root leaves at area1 and fine leaves at area.25, then divides by s². Covered cells are excluded. Global periodic mass change minus total raw body mass is reported, so a transfer/interface mass error cannot hide behind the two contours lying wholly within the fine patch.
|
||||
|
||||
Five compressed primitive snapshots at reference times 0,100,800,1600,3200 retain rho, reference velocity, origin and spacing for uniform, AMR root and AMR fine grids. Inactive/solid entries are NaN. These are full primitive grids at sparse times, not downsampled images or distributions. They permit independent spatial quadrature, field inspection, masks and inventory reconstruction. Per-sample split flux/inventory arrays allow independent temporal integration without rerunning GPU work. FP32 saved primitive snapshots introduce their own rounding; FP64 sampled diagnostic/ray arrays remain in the sample file.
|
||||
|
||||
### Independent aperture estimators and limitations
|
||||
|
||||
Thirty-two Gauss points per true aperture arc, with rays at distances 1.5,2.5,3.5 finest-cell widths into the fluid, sample rho,u,v by bilinear interpolation using only active fluid nodes. No commanded wall value or raw population enters reconstruction. Linear and quadratic outward-normal extrapolations separately reconstruct rho and u; integrate Q=integral(u.n ds) and M=integral(rho*u.n ds). Retain ray positions, normals, weights, primitive samples and coefficients, making every estimate reproducible. The nearest-fluid 64-point mass proxy is preserved for continuity with the pilot and remains explicitly a proxy.
|
||||
|
||||
Neither estimator is an exact wall value or validated wall model. Extrapolation amplifies noise and may yield unphysical density; do not clamp it to force agreement. Sector endpoints contain nonsmooth prescribed velocity changes, and interpolation may mix their neighborhood. Linear-versus-quadratic spread, ray density extrema, resolution changes and analytic manufactured tests constrain interpretation, but their agreement is not proof of low bias. Two grids alone cannot establish asymptotic convergence. Nominal geometry/profile flux is exact for the commanded uniform radial profile; comparison with reconstructed Q diagnoses estimator plus numerical-boundary error, not automatically a Jet defect. Raw reaction remains momentum transport plus traction; no nozzle-load or solid-only force claim.
|
||||
|
||||
### Predeclared comparison criteria
|
||||
|
||||
These criteria are fixed before the continuation runs. There is no new physical acceptance threshold and no tolerance fitted to the pilot:
|
||||
|
||||
1. Structural validity: exact source/provenance, matched geometry/parameters, unclamped q/no fallback, both apertures resolved, finite positive active-node density and finite velocity at every saved field sample, complete scheduled samples, contiguous matching raw intervals, and all declared files/hashes. Runtime does not promise positivity between saved samples.
|
||||
2. Report every window's signed and gross quantities, maximum sampled errors, and early (reference t<=800) versus later (t>800) norms separately. Normalize mass residual by rho_ref*abs(Q_command)*window_duration, and reaction residual by .5*rho_ref*U_ref²*D_ref*duration. Avoid dividing by a near-zero net mass or instantaneous force.
|
||||
3. Recompute contour residuals using the complete sampled grid and every second/fourth sample, always retaining endpoints. Save their changes as a temporal-sensitivity proxy, not an error bound. Compare both contours and both backends; show mass, Cx and Cy components separately.
|
||||
4. A directionally resolved reduction in a component's RMS CV residual is flagged only if coarse-minus-fine RMS exceeds twice the largest observed temporal coarsening change. This is an evidence-of-trend flag, never a physics PASS. If a component plateaus or grows, decompose temporal/spatial/staircase/boundary effects before proposing production changes.
|
||||
5. Compare reconstructed Q/command and M/(rho_ref*command) separately, at identical physical windows, retaining both extrapolations. Regard refinement improvement as persuasive only when it exceeds estimator spread and temporal variation. Inspect density and global mass alongside it. Agreement of AMR and uniform ledgers alone cannot validate their shared boundary treatment.
|
||||
6. Four D/U in a periodic unforced domain remains transient consistency evidence. Two scales do not prove order, stable shedding, infinite-stream drag, all-Re capability, or readiness to promote Re400. Formal physical acceptance needs an additional reference/error budget and appropriate time/domain evidence.
|
||||
|
||||
### Runtime and storage budget
|
||||
|
||||
Actual earlier scale-1 pilot cost was 52.3884s launch-to-exit, 46.1414s after READY for800 steps with full-field diagnostics every base step. A naive same-diagnostic3200-step scale-1 extrapolation is about210s; the new876 field samples reduce transfer count but add ray diagnostics and compression. Use conservative planning envelopes210–500s for scale1 and900–3200s for scale2, not timing guarantees. The scale2 conservative envelope accounts for4x cells and4x root steps; sparse sampling mitigates but does not eliminate that cost. Post-READY safety caps are1200s and5400s respectively, replacing the unsuitable fixed1800s assumption. Root owns compilation/startup timeout and serial launch decisions.
|
||||
|
||||
Device-envelope estimates remain128/512MiB for s1/s2, at least1GiB free (or twice estimate). Output estimate is under64MiB per run including five primitive snapshots and876 sample records; no all-time populations are saved. Plan/metadata and sampled files are rewritten at each100-reference-time window to retain bounded partial evidence if interrupted. READY still follows compiled warmup and state/time reset, before measured stepping begins.
|
||||
@@ -0,0 +1,40 @@
|
||||
# Smagorinsky baseline/candidate helper diagnostic
|
||||
|
||||
This validation-only diagnostic compares exact d79 production headers with a temporary candidate. It does not modify production source. The candidate changes only the D2Q9 and D3Q19 closed-form factors from 18 to 18 sqrt(2), plus comments defining |S| = sqrt(2 S:S) and self-consistent effective tau. The small reviewed patch and expected header hashes are in `tests/validation/les/data`; no copied headers, solver trees, raw results, or binary fixtures are versioned.
|
||||
|
||||
## Prepare and verify on the CPU
|
||||
|
||||
From the repository root, choose a new output directory:
|
||||
|
||||
```sh
|
||||
python tests/validation/les/prepare.py --output-dir output/les-host/candidate
|
||||
python tests/validation/les/test_candidate.py --candidate-dir output/les-host/candidate --output output/les-host/host_results.json
|
||||
```
|
||||
|
||||
Preparation checks both actual production header hashes against d79, copies only `descriptors.cuh` and `turbulence_smag.cuh` into output-local baseline/patched include trees, applies the reviewed patch only to the latter, and verifies all four resulting hashes. It refuses an existing candidate directory. The host test verifies candidate hashes again and refuses an existing evidence file. The Git branch HEAD may include validation commits; header content, rather than HEAD identity, is the pin.
|
||||
|
||||
The independent host oracle constructs second-order Hermite populations and solves the independently derived quadratic by bisection:
|
||||
|
||||
tau * (tau - tau0) = 9 Cs^2 ||Pi_neq|| / (sqrt(2) rho)
|
||||
|
||||
There are **736 parameter cases**, covering D2Q9/D3Q19; Cs=0,.08,.16,.24; tau0=.6,.8,1.2; rho=.7,1,1.3; equilibrium, isotropic stress, pure shear, and trace-free diagonal extension; all coordinate planes and both signs; density-scaled Pi and separate fixed-Pi/nonunit-rho probes. The test checks quadratic residuals, closed/default-three/converged-200 iterations, bit-identical unchanged iterative output, and an additional explicit cap-active manufactured probe. Existing g++ and Python stdlib are sufficient; no installation is attempted. Compilation products are temporary. Previously reviewed host maxima were omega error 1.394302e-7 and quadratic residual 1.201202e-7; this is not CUDA fast-math evidence.
|
||||
|
||||
## Authorized GPU diagnostic
|
||||
|
||||
Use the existing working PyCUDA/NumPy environment and an explicitly selected device, through the same serialized GPU launch owner as the other campaigns:
|
||||
|
||||
```sh
|
||||
CUDA_VISIBLE_DEVICES="$VERIFIED_IDLE_GPU" python tests/validation/les/run_gpu.py --run-gpu --device 0 --output-dir output/les-gpu
|
||||
```
|
||||
|
||||
Device 0 is the logical device after CUDA visibility filtering. The output directory must not exist. The runner materializes and verifies the isolated include trees under `output/les-gpu/candidate`, then runs baseline and patched processes sequentially. Each process compiles one SourceModule at a time synchronously and synchronizes each probe. There are no background jobs, worker pools, or parallel compiler calls. No machine contact, device selection, reservation, or environment setup is performed by the runner.
|
||||
|
||||
Each version has exactly **48 scalar GPU cases**, 96 total: D2Q9/D3Q19, Cs=.16/0, equilibrium/shear/isotropic/cap-active manufactured stress, and closed/default-three/converged-200 branches. This is the frozen GPU matrix, not the expanded 736-case host matrix. Outputs `baseline.json` and `patched.json` contain raw scalar omega values and device name. Completion means only the diagnostic executed; an independent comparison against the declared host oracle is still required. A failed run leaves partial evidence for inspection and must not be overwritten.
|
||||
|
||||
## Interpretation and limits
|
||||
|
||||
Full-stress versus deviatoric-stress selection, iterative viscosity cap, iteration count/relaxation, omega guards, collision dispatch, and AMR guards remain unchanged. Closed and iterative paths intentionally remain different for isotropic or cap-active stresses. No settings or Cs defaults change. High stress is a helper diagnostic, not an admissible flow-state claim.
|
||||
|
||||
The corrected scalar formula is justified only under the stated stress-strain estimate. MRT full-trace stress does not generally share one shear relaxation rate, so its bulk coupling remains uncertified. Force-corrected non-equilibrium stress and Guo-force interaction also remain uncertified. These manufactured tests are unforced and do not cover full TRT/MRT collision, streaming modes, shifted storage, walls/Jets, flow solutions, or 3D turbulence. Existing guard statements are preserved, not newly comprehensively tested; the main matrix is guard-inactive. No AMR LES support is added or enabled.
|
||||
|
||||
Production integration and removal of this temporary candidate fixture are separate decisions after GPU and applicable flow evidence. CPU success alone does not approve a production change.
|
||||
@@ -0,0 +1,46 @@
|
||||
# Moving circles — stage-1 evidence (development level)
|
||||
|
||||
Owner criterion (Yanqi via TRON): prescribed motion and one free VIV case both
|
||||
"reasonably close" to a predeclared reference = development-stage success.
|
||||
This is practical closeness, not a formal validation claim. Every number
|
||||
below is from Astra's receipts as posted in Slack C0C78UFKGRM thread
|
||||
1793335557.460509; raw outputs stay on Horsea under `/tmp/celeris-results-*`
|
||||
and the Mac evidence directory (not in git).
|
||||
|
||||
## Code
|
||||
|
||||
- Production: `src/` identical to `653fd997` (slices S1 `983020b6`,
|
||||
S2a `b920a303`, S3a `653fd997`). CPU suites and GPU hold/crossing gates
|
||||
passed on those slices (G0a/G0b population-bitwise; X1 crossing ledger).
|
||||
- Research drivers: `research/duetsch_re100_kc5/` (`dd37883d`, capture
|
||||
`a0aea3b9`) and `research/viv_re150/` (`fb507aa1`), run as committed.
|
||||
|
||||
## Prescribed in-line oscillation (Dütsch et al. 1998, Re 100, KC 5)
|
||||
|
||||
- Protocol: `docs/validation/duetsch_re100_kc5_protocol.md`.
|
||||
- Frozen settling gate (.002 F_ref waveform): **FAILED** and kept on record:
|
||||
D40 domain stage (20/40/60 D, 11.25 T) and the 60 D duration diagnostic
|
||||
(31.25 T, 0/28 pairs; last waveform drift .00613 F_ref).
|
||||
- Unscored late-cycle CME fits c_d ≈ 2.02–2.05, c_i ≈ 1.46–1.48 vs the
|
||||
paper's computed (2.09, 1.45); fields clean and symmetric (owner view).
|
||||
The owner accepts ~0.61 % cycle drift at D40 for this stage; the gate is
|
||||
not re-scored.
|
||||
- Fig. 8 LDA profiles: qualitative only (no digitized ordinates).
|
||||
|
||||
## Free transverse VIV (Kolahdouz §4.1.1 setup, Qin §4.5 target)
|
||||
|
||||
- Predeclaration: `docs/validation/viv_re150_predeclare.md` (agreed at
|
||||
`1abfe954` under its former name `leontini_viv_predeclare.md`); run at `fb507aa1`, single case, D = 40, 75 D × 60 D.
|
||||
- Result: status `scored`, 336,384 steps (t U/D = 336.4); A_max = .5464 D vs
|
||||
.520 D (+5.1 %, inside the declared ±10 % band); mean half peak-to-peak
|
||||
.5448 D; f/f_n = .955; block drifts .78/.29/.18 %, last-five spreads
|
||||
.15/.11/.10 %; finite, no_donor = 0, no seed; 337.7 s, ~1.0 ms/step.
|
||||
|
||||
## Limitations (binding)
|
||||
|
||||
- One resolution (D40) per case; no grid or time convergence.
|
||||
- Structural RHS = CME + Wen is a theory-motivated stage choice; CME-only
|
||||
and node-impulse variants were not run as RHS; no force law is validated.
|
||||
- Boundary mismatches: NEQ outlet with backflow clamp vs traction outlet;
|
||||
finite box; the strict Dütsch settling failure is unexplained.
|
||||
- No mass correction at curved walls; ~1 ms/step host-coupled overhead.
|
||||
@@ -0,0 +1,70 @@
|
||||
# Matched SRT uniform / refined DFG Re100 preparation
|
||||
|
||||
Status: CPU-preflight checked; **not GPU executed or approved to execute**. No physical acceptance or speedup claim. No production source changes. Root owns GPU admission and integration.
|
||||
|
||||
## Frozen setup
|
||||
|
||||
Canonical source snapshot: integrated commit `cd3a657f9d3833e812c3cca173525f165b48710a`. Production origin remains candidate `47b05bc8abfc957fe876b0c63bdb386e3c6cbaa5` (on `5338864`, on `69e9b78`); production files are byte-identical. The integrated Re100 helper header/PIN records that origin explicitly. Both commit identities are retained in the manifest. `tests/validation/data/refined_dfg/source_manifest.json` hashes all production source files plus the existing DFG geometry/pressure helper, periodicity helper and official reference cycle. An integrated checkout may have a different commit but must have identical pinned file contents. No MRT external-reference run is reused as the matched uniform control.
|
||||
|
||||
Both cases: SRT, shifted FP32, double buffer, no LES, no applied force, stationary cylinder, local Zou–He parabolic inlet, halfway y walls, identical pressure-NEQ outlet with **all nine nonequilibrium components damped by 0.5**, backflow clamp disabled. This outlet is not the exact canonical DFG do-nothing condition. Raw cylinder reaction observation is a diagnostic, not applied forcing.
|
||||
|
||||
Physical units use D=0.1 m, mean U=1 m/s, ν=0.001 m²/s, density reference=1; domain 2.2×0.41 m, cylinder center (0.2,0.2) m. Uniform D80: 1761×330, dx=0.00125 m, dt=0.0000125 s, ν_lattice=.008. Refined root D40: 881×166, dx=.0025 m, dt=.000025 s, ν_lattice=.004; fine dx/dt/ν match uniform D80. All lattice mean speeds are .01.
|
||||
|
||||
Fixed half-open patch **(40,24,320,140)** in root edge coordinates maps to x=[.09875,.79875] m, y=[.0575,.3475] m. The body and about six diameters of downstream wake are fine; wall layers and far wake remain coarse. Bounds are frozen before outcomes, not tuned afterward. Geometry-only leaf-count and nominal collision-work ratios to uniform are ~.419 and ~.321. These omit real launch/transfer/halo/measurement costs and are not measured speedups. The narrow root block height is legal but potentially expensive; do not infer speed from leaf count.
|
||||
|
||||
Exact root dimensions are tiled by (by,bx)=(2,881); no padding. Fine allocated shape (240,568), including four-cell halos, uses (8,8). `host_geometry` calls production channel transfer-overlap checks and complete fine cut-link/donor/transfer guards before any CUDA import.
|
||||
|
||||
### Half-cell conversion
|
||||
|
||||
Uniform integer nodes have physical coordinates (i*dx, (j-.5)*dx). Root edge coordinates therefore map to ((X-.5)*dx_root, (Y-1)*dx_root). Body edge center=(80.5,81), radius=20; wall edges Y=1,165; source planes X=.5,880.5. Fine local body nodes are `(body_edge - fine_origin)/.5 - .5`.
|
||||
|
||||
Body and physical wall planes match exactly. The axes have different phases. With fine origin O=(38,22):
|
||||
|
||||
- x_f = [O_x+(j+.5)/2-.5] dx40 = (j+75.5) dx80, versus x_uniform = i dx80. Fine x samples have a half-fine-cell (quarter-root-cell) offset.
|
||||
- y_f = [O_y+(k+.5)/2-1] dx40 = (k+42.5) dx80, versus y_uniform = (l-.5) dx80. The y samples align exactly for l=k+43.
|
||||
|
||||
This difference follows from the inlet's ghost-node plane versus the half-way y-wall planes. The host phase test checks both mappings. Compare interpolated observables, not pointwise arrays or bitwise equality; x-phase error, the different fine collision arithmetic, wall resolution, and coarse/fine transfer effects all contribute to discrepancies. No field-difference acceptance is claimed by this runner. Initial fluid state samples the same analytic parabolic equilibrium as uniform production initialization; root boundary ghosts start at rest. It is not asserted to be bitwise identical across different grids/arithmetic.
|
||||
|
||||
## Observations and gates
|
||||
|
||||
- Every AMR base step is individually followed by `read_raw_exchange(..., window='last_base_step')`: two fine substeps, root-lattice per-unit-depth impulse integrated over [n,n+1]. `step(n)` alone retains only its last base interval, so it cannot support averaging the whole batch.
|
||||
- Uniform `Simulation.run(batch)` / `read_force` gives the mean over that batch; multiply by batch before accumulating. Cd/Cl divide the interval mean reaction by 0.5 U_lattice² D_lattice in each case. Force unit is ρ dx³/dt² per depth, so fine-uniform lattice force is twice root force for the same physical load.
|
||||
- Force timestamps are observation-interval midpoints. Pressure uses physical decoded postcollision density at the interval end, extrapolated from fluid-only points one/two **fine** cells outside the cylinder using existing `pressure_probes`. Pressure difference is normalized by ρ_ref U_physical². Existing periodic helpers align pressure onto force cycles.
|
||||
- Public AMR downloads exclude nonleaves. Fixed geometry masks, not state-dependent finiteness masks, check all fluid populations and sum ρ dx_level²; covered root cells, body, boundaries and fine halos are excluded. Corrupt NaN fluid cannot disappear from the mass check. Mass is per-unit-depth ρ_ref·m². Uniform uses its physical fluid flags and dx². Different sampling of the circular boundary means initial discrete fluid volume can differ slightly; compare temporal stability, not identical absolute mass.
|
||||
- Flux samples root/uniform x-index 2 and -3, summed with dx and physical velocity conversion. Those planes differ by grid-scale offsets; cycle-average inlet/outlet balance is the gate, not direct pointwise flux equality.
|
||||
- Dense measurement width Δt*=.02 in the pilot and for t*≥240, otherwise .5. Pilot ends t*=5; full ends t*=300. Same existing five-cycle periodicity, mass, flux, and reference gates are imported without modification. Both official-reference diagnostics and refined-versus-uniform cycle comparisons are written. `matched_case_pass` refers only to matched SRT agreement, not certification of canonical DFG or the broader suite.
|
||||
- Safety stop: nonfinite state/reaction, Mach>.2, or density outside [.5,1.5]. GPU durations include required exchange reads and synchronization in stepping; full wall time also includes host measurements. Do not report pure-kernel throughput from these numbers.
|
||||
|
||||
## Commands
|
||||
|
||||
From the repository root, CPU only:
|
||||
|
||||
```sh
|
||||
PYTHONPATH=src python tests/unit/test_refined_dfg.py
|
||||
python tests/validation/run_refined_dfg.py --mode plan --output /tmp/refined-dfg-plan-new
|
||||
```
|
||||
|
||||
Fourteen CPU tests are retained in tests/unit/test_refined_dfg.py. Plan JSON is configuration output only; no preparation result files are committed. The initial attempt to use pytest was unavailable in this interpreter; tests use standard-library unittest and NumPy instead.
|
||||
|
||||
Only after root channel GPU gates pass and root explicitly admits an idle physical GPU, root may run:
|
||||
|
||||
```sh
|
||||
CUDA_VISIBLE_DEVICES=<admitted-device> timeout --signal=TERM --kill-after=30s <caller-hard-budget>s python tests/validation/run_refined_dfg.py --mode pilot --gpu-gates-approved --max-wall-seconds <caller-soft-budget> --output <new-pilot-directory>
|
||||
CUDA_VISIBLE_DEVICES=<admitted-device> timeout --signal=TERM --kill-after=30s <caller-hard-budget>s python tests/validation/run_refined_dfg.py --mode full --gpu-gates-approved --max-wall-seconds <caller-soft-budget> --pilot-results <completed-pilot-directory> --output <new-full-directory>
|
||||
```
|
||||
|
||||
`--gpu-gates-approved` is a caller attestation, not proof that GPU tests ran. Full mode additionally requires both matched healthy pilots through t*=5 with identical source hashes, bounds and runner hash. No GPU/Mac/remote operation has been performed for this preparation. Pilot/full outputs must be new/empty. Uniform runs first; an unhealthy case stops the campaign. A full run that fails periodic/matched gates exits nonzero.
|
||||
|
||||
## Bounded execution and receipt validation
|
||||
|
||||
No pilot throughput is known yet; the caller must set a finite positive `--max-wall-seconds` rather than treating an invented estimate as calibration. After valid pilots, the full-run calibrated budget is 3 × sum_over_cases[startup_seconds + 60 × (pilot_wall_seconds − startup_seconds)]. The full run uses the smaller of that estimate and the caller's explicit ceiling. This uses total measured pilot evolution/observation cost and the full/pilot physical-time ratio (300/5); 3× is a declared safety margin, not a runtime guarantee. The plan records both budgets.
|
||||
|
||||
The campaign deadline begins before the first case initialization. Cooperative checks surround initialization, every AMR root step or uniform ≤100-step batch, and measurements. On observed expiry, the runner stops, writes a nonpassing `wall_time_limit` receipt, and exits 3. A blocking CUDA call cannot be interrupted by these checks: the external `timeout` watchdog is required, with a hard budget chosen slightly above the soft budget to permit cleanup. Hard termination may leave partial CSV data and no final receipt; that never qualifies as a completed pilot.
|
||||
|
||||
Each case emits `READY` with strict finite JSON and saves `ready.json` only after its first healthy complete observation, after initialization, actual stepping, force readback, macro/pressure/mass/flux paths and CSV flush all succeeded. No early initialization-only READY is emitted.
|
||||
|
||||
Full-run pilot validation rejects nonfinite JSON constants and numeric overflow, wrong case/mode/status, nonboolean health, missing/duplicate/out-of-order rows, wrong step counts or observation times, missing numeric observations, health-limit violations, absent/mismatched READY receipts and invalid timing calibration. It requires exactly 250 observations spanning the full dense t*=5 pilot, source/runner hashes and frozen bounds. Tests include the reviewer's exact NaN-endpoint regression and malformed receipt variants. Synthetic test fixtures exist only in temporary directories and are not simulation results.
|
||||
|
||||
## Integrated source import guard
|
||||
|
||||
The runner's source defaults to this repository root. Before geometry or GPU work, it verifies the pinned source/helper/reference contents and requires the imported CelerisLab package to be exactly `<source>/src/CelerisLab/__init__.py`. An installed DynamisLab copy or another cached checkout is rejected. Integration changes paths/readability and this explicit import assertion; geometry, numerical definitions, gates, and receipt validation remain frozen. Any new path-formatted runner has its own hash, so old preparation pilot receipts cannot authorize a full run of this integrated runner.
|
||||
@@ -0,0 +1,71 @@
|
||||
# Matched MRT DFG pilot preparation
|
||||
|
||||
Preparation only: this test-only extension reuses the existing runner and existing MRT
|
||||
operator. GPU admission awaits reviewed MRT capability results; no pilot/full execution
|
||||
is implied by CPU preflight. No production, historical SRT manifest, reference data,
|
||||
periodic gate, geometry, initialization or observation algorithm is changed here.
|
||||
|
||||
## Selection and provenance
|
||||
|
||||
Use `--collision MRT` for **both** uniform D80 and refined root D40/fine D80. There are
|
||||
no independently selectable collision models per case. Default remains SRT.
|
||||
|
||||
MRT verifies `data/refined_dfg/source_manifest_mrt.json`, pinned to reviewed numerical
|
||||
source snapshot `3ea131e92c057843034f11a1c574301a2430dfce`, including the shared geometry,
|
||||
pressure/cycle helpers and official reference. Test-only commits may change HEAD without
|
||||
changing this numerical source pin. Plan, READY, case summaries and comparison separately
|
||||
record `checkout_revision` and `checkout_dirty` using existing source-provenance helper;
|
||||
the runner hash remains separate. Collision is recorded in every receipt, and full-mode
|
||||
validation rejects missing or different collision labels in plan, either summary or either
|
||||
READY receipt, in addition to existing source/runner/health/time checks.
|
||||
|
||||
The historical SRT manifest remains byte-for-byte unchanged. SRT on the MRT candidate
|
||||
checkout deliberately fails that source pin; use a matching historical checkout via
|
||||
`--source` for SRT. No fallback or automatic repinning is permitted. Historical SRT
|
||||
failure/diagnostic evidence remains attached to its original source and runner hashes;
|
||||
it cannot authorize an MRT full run. The existing failed-observation step-reporting
|
||||
undercount is not changed in this narrowly scoped selection patch.
|
||||
|
||||
## Frozen physical comparison
|
||||
|
||||
All settings remain those documented in `refined_dfg.md`: U_lattice=.01, physical mean
|
||||
U=1 m/s, D=.1 m, shear ν=.001 m²/s, fixed physical domain/body/wall planes, patch
|
||||
(40,24,320,140), shifted FP32 double buffers, no LES/forcing/Jets, finest dx=.00125 m,
|
||||
finest dt=.0000125 s, unchanged half-cell frame conversion and axis-specific phase.
|
||||
Force interval accumulation, physical leaf mass, pressure interpolation, flux sampling,
|
||||
safety thresholds, t*=5 pilot and t*=300 cap are unchanged. Existing accuracy/periodicity
|
||||
criteria are imported unchanged. Both MRT cases are fresh runs; old MRT or SRT results
|
||||
are not substituted as controls.
|
||||
|
||||
Both cases use the **existing MRT pressure-NEQ branch**: only unknown directions q2/6/8
|
||||
are extrapolated. This differs from SRT's all-nine .5-damped branch; the retained
|
||||
`srt_neq_damp=.5` configuration value is inactive under MRT. Backflow clamp remains off.
|
||||
The outlet is still noncanonical relative to exact DFG do-nothing conditions.
|
||||
|
||||
The reused MRT operator keeps fixed kinetic rates `s_e=s_eps=s_q=1.2` on all levels;
|
||||
only the shear rate follows existing per-level viscosity. Physical bulk relaxation
|
||||
therefore differs between coarse and fine levels. Transfer operators and subcycling
|
||||
are unchanged. This is the candidate's declared behavior, not a new fully mode-scaled
|
||||
MRT transfer scheme. Do not tune rates, the patch or gates after seeing outcomes.
|
||||
Capability smoke/parity gates do not establish DFG accuracy or speedup.
|
||||
|
||||
## CPU and admission commands
|
||||
|
||||
From this checkout:
|
||||
|
||||
```sh
|
||||
python tests/unit/test_refined_dfg.py
|
||||
python tests/validation/run_refined_dfg.py --collision MRT --mode plan --output /tmp/new-mrt-dfg-plan
|
||||
```
|
||||
|
||||
After root verifies the candidate MRT root/parity/refinement capability results and admits
|
||||
an idle device, the paired pilot may use the existing bounds and external watchdog:
|
||||
|
||||
```sh
|
||||
CUDA_VISIBLE_DEVICES=<admitted-device> timeout --signal=TERM --kill-after=30s <hard-budget>s python tests/validation/run_refined_dfg.py --collision MRT --mode pilot --gpu-gates-approved --max-wall-seconds <soft-budget> --output <new-mrt-pilot-directory>
|
||||
```
|
||||
|
||||
The flag is caller attestation, not evidence. An unhealthy first case prevents the second.
|
||||
Existing strict pilot receipt validation and calibrated wall-time controls remain; full
|
||||
mode is not being admitted as part of this preparation. Root must review both healthy
|
||||
pilot outcomes and separately decide any full-run admission.
|
||||
@@ -0,0 +1,58 @@
|
||||
# Refined DFG MRT timing harness (measurement only)
|
||||
|
||||
`tests/validation/time_refined_dfg.py` times the matched MRT refined/uniform DFG Re100 setup of
|
||||
`run_refined_dfg.py` (same configuration, geometry and initial state functions). No numerical,
|
||||
physics-gate or production change; no force or accuracy result is produced.
|
||||
|
||||
| Variant | Loop | Force reads |
|
||||
|---|---|---|
|
||||
| A | refined `step(1)` + `read_raw_exchange` per base step | runner-like force-read workload (values discarded) |
|
||||
| B | refined `step(1)` only, no host reads (`observe_raw_exchange` stays on) | timing-only |
|
||||
| C | refined single `step(N)` | timing-only; ledger keeps the final base interval only |
|
||||
| E | uniform `sim.run(<=100)` + `read_force` | runner-like force-read workload (values discarded) |
|
||||
| E' | uniform single `sim.run(2N)` | timing-only; at most a whole-window average, different summation order |
|
||||
|
||||
- No variant retains a valid force history; A/E omit the runner's interval aggregation and
|
||||
validation, and no variant includes macro/probe/CSV costs. Results are not full benchmark
|
||||
throughput.
|
||||
- Status lines: `CONSTRUCTED` (construction/JIT complete) and `WARM_READY` (first warm-up and
|
||||
health check passed) per case.
|
||||
- Equal simulated duration: N refined base steps vs 2N uniform D80 steps.
|
||||
- Every repeat starts from the same fresh state (refined `initialize`, uniform `snapshot/restore`)
|
||||
and the same warm-up; construction/JIT, warm-up, downloads and parity checks are untimed.
|
||||
- The actual stepping stream is synchronized explicitly before and after each timed loop; the
|
||||
wall timer (`time.perf_counter`) is the only source. No CUDA-event span is called kernel time.
|
||||
- `--max-wall-seconds` is required for GPU runs (outer timeout, checked between variants and
|
||||
every 100 steps in per-step loops).
|
||||
- Final populations and NaN masks must be bitwise identical to the first A repeat (A/B/C) or the
|
||||
first E repeat (E/E'); refined and uniform grids are never compared. Leaf/fluid populations
|
||||
must be finite. Physical health (finite leaf/fluid macros, rho in [0.5, 1.5], max Mach <= 0.2,
|
||||
the existing runner limits) is checked after warm-up and after each timed window. Matching NaN
|
||||
is accepted only as a storage mask; any infinity or level-count mismatch fails parity. All
|
||||
parity/health checks are untimed.
|
||||
- Cases run sequentially (uniform, then refined) in one process with startup serialized;
|
||||
variants are interleaved within each repeat. A-B and B-C are measured comparative
|
||||
differences under GPU variability, not exact causal decompositions.
|
||||
|
||||
Usage (root selects one verified idle GPU):
|
||||
|
||||
PYTHONPATH=src python -m unittest tests/unit/test_time_refined_dfg.py
|
||||
python tests/validation/time_refined_dfg.py --output <new> --plan
|
||||
CUDA_VISIBLE_DEVICES=<gpu> python tests/validation/time_refined_dfg.py --output <new> --max-wall-seconds <s>
|
||||
|
||||
Defaults: 2000 base steps, 200 warm-up base steps, 3 repeats. Profiler capture and the
|
||||
`observe_raw_exchange=False` variant are deferred until these measurements exist.
|
||||
|
||||
## A versus observation-window ledger (`tests/validation/time_window_dfg.py`)
|
||||
|
||||
Measurement-only comparison on the same shifted-MRT refined setup: A (per-base `step(1)` +
|
||||
`read_raw_exchange`, summed per 80-base-step interval), W (`start_exchange_window`, `step(80)`,
|
||||
one window read) and W1 (window with 80 x `step(1)`, isolating the read pattern from call
|
||||
batching). Same fresh state, warm-up and simulated duration; populations must be bitwise equal
|
||||
to the first A repeat and per-interval total impulses within the documented engineering
|
||||
tolerance, all outside timing. The candidate source is recorded (checkout revision, dirty flag,
|
||||
file hashes); frozen refined-DFG manifests/results are not used or changed.
|
||||
|
||||
PYTHONPATH=src python -m unittest tests/unit/test_time_window_dfg.py
|
||||
python tests/validation/time_window_dfg.py --output <new> --plan
|
||||
CUDA_VISIBLE_DEVICES=<gpu> python tests/validation/time_window_dfg.py --output <new> --max-wall-seconds <s>
|
||||
@@ -0,0 +1,117 @@
|
||||
# Opt-in observation-window ledger in the DFG runner
|
||||
|
||||
This test-only integration adds `--exchange-window` to `run_refined_dfg.py`. It uses the
|
||||
existing production ledger; no collision, boundary, transfer, physical setup, reference,
|
||||
periodicity gate or acceptance threshold changes. Default remains the historical
|
||||
per-base-step observation path. Uniform stepping/force accumulation is unchanged.
|
||||
|
||||
For the refined case, each existing observation interval opens a new ledger at completed
|
||||
base step `begin`, advances exactly the same `n` base intervals, and reads the integrated
|
||||
root-lattice impulse for `[begin, begin+n]`. The contract requires root units, `window`
|
||||
kind, `2*n` fine samples, matching endpoints, and fine dt=.5. The existing coefficient
|
||||
calculation still divides this impulse by `n` and `.5*U_lattice**2*D_root`; force timestamps
|
||||
remain `(begin+n/2)*U_lattice/D_root`. It does not divide an already averaged force again.
|
||||
Pressure/macro/physical-leaf mass measurements and safety checks remain at the original
|
||||
interval end. Pilot interval is 80 root steps; early full-run intervals remain 2000, and
|
||||
any final shortened interval uses its actual `n`.
|
||||
|
||||
The opt-in uses one `step(n)` call and one window read per observation, rather than `n`
|
||||
Python calls/readbacks. Internal subcycling and per-base synchronization remain owned by
|
||||
the same backend. Cooperative deadline checks surround that complete interval; unlike
|
||||
the default path they cannot interrupt between base steps inside `step(n)`. The existing
|
||||
external hard watchdog is still required. The full-run cadence/cap is documented here,
|
||||
but this preparation does not admit a full run or a GPU operation.
|
||||
|
||||
## Provenance and receipt separation
|
||||
|
||||
`source_manifest_window.json` pins the reviewed a233c9032487a6006e950d1e327079b00466c410
|
||||
snapshot (production ledger origin d930) plus existing helper/reference files. Both SRT
|
||||
and MRT are supported by this explicit opt-in source pin; collision selection remains
|
||||
independent and shared by the two cases. Existing SRT and MRT manifests are untouched.
|
||||
Default mode continues to reject the changed candidate under those historical pins;
|
||||
use a matching historical `--source` checkout to run its default path. There is no
|
||||
silent repinning, source fallback, or reuse of historical outputs as candidate evidence.
|
||||
|
||||
Plan, READY, summaries, timeout/comparison receipts now record `observation_mode` as
|
||||
`last_base_step` or `window`, alongside collision and actual checkout provenance. On a
|
||||
uniform receipt this labels its **paired campaign's refined observation mode**, not a
|
||||
change to uniform observation. Full-mode pilot validation rejects missing or mismatched
|
||||
mode labels in the plan, either case summary, and either READY receipt. Source/runner
|
||||
hash, collision, completeness and health checks remain. Cross-mode pilot reuse is denied.
|
||||
|
||||
The earlier short A/W/W1 timing/capability evidence is not a full-run speedup or accuracy
|
||||
claim. Mathematical impulse integration/units are unchanged; floating-point reduction
|
||||
order can differ, so bitwise equality of force sums is not promised. Physics acceptance
|
||||
continues to use the existing frozen gates. Historical failures/results are untouched.
|
||||
|
||||
CPU preparation commands, from the repository root:
|
||||
|
||||
```sh
|
||||
python tests/unit/test_refined_dfg.py
|
||||
PYTHONPATH=src python -m unittest tests.unit.test_raw_exchange_window tests.unit.test_time_window_dfg -v
|
||||
python tests/validation/run_refined_dfg.py --collision MRT --exchange-window --mode plan --output /tmp/new-window-dfg-plan
|
||||
```
|
||||
|
||||
Root must independently review and admit any execution. An admitted paired pilot uses
|
||||
the existing watchdog, device selection, `--gpu-gates-approved`, positive
|
||||
`--max-wall-seconds` and a new output directory, adding only `--exchange-window` to the
|
||||
selected collision's pilot command. No GPU or remote action was performed for this patch.
|
||||
|
||||
## Public Jet diagnostic option
|
||||
|
||||
`--collision MRT --exchange-window --jet-scenario zero|fixed|reverse` selects
|
||||
unshifted FP32, no LES, constant transfer on both existing public backends. Default
|
||||
`none` and the historical manifests remain unchanged. `zero` registers both Jets at
|
||||
zero amplitude and retains every existing DFG verdict, including pressure. `fixed`
|
||||
uses outward radial parabolic sectors at pi/2 and 3pi/2, half-width pi/12, peaks
|
||||
(+.001,-.001). Both use the existing D40/D80 geometry and U=.01. Sector origins are
|
||||
(80.5,81) in root edge coordinates and (160,160.5) in uniform node coordinates;
|
||||
radial extent is [0,1.005R]. `reverse` keeps those peaks through t*=300, updates both
|
||||
public setters at that completed boundary, and continues to 305 with opposite signs.
|
||||
|
||||
Fixed diagnostic windows are 250–260, 260–270, 270–280, 280–290 and 290–300; reversal
|
||||
adds 300–305. Histories retain exact interval endpoints and root/uniform lattice
|
||||
impulses. The refined window uses total exchange; uniform uses public `read_force`
|
||||
batch averages. Driven windows report mean/min/max/RMS Cd/Cl without applying DFG
|
||||
reference or periodicity gates. Exit zero means healthy execution, not qualification;
|
||||
`matched_case_pass` remains false. No independent CV or stress-load claim is made.
|
||||
|
||||
This opt-in records current source/helper hashes with the existing manifest format,
|
||||
checkout revision/dirty state and runner hash. Pilot/full must match that snapshot
|
||||
and the exact scenario. It does not relabel current source as historical evidence.
|
||||
Use the existing bounded plan/pilot/full commands with the three option flags above;
|
||||
full requires the matching completed t*=5 paired pilot. `step_seconds` includes force
|
||||
readback; observation/overhead and total wall time are separate, not kernel throughput.
|
||||
|
||||
Add `--observe-cv` to record independent scalar control-volume samples from the
|
||||
already downloaded public macros. The pilot exercises this path at t*=.02..5;
|
||||
full records 501 endpoints at 290..300. Each `cv_history.jsonl` row contains actual
|
||||
root time, preceding interval start/duration/impulse, and two inventories/outward
|
||||
fluxes ordered [mass,Px,Py]. Exclude the first row's preceding impulse: that row
|
||||
supplies the initial inventory. Uniform native impulse converts by .5² to root
|
||||
units; refined ledger impulse is already in root units. Explicit native-aligned
|
||||
contours differ by .25 root cells in x and are recorded in the plan. Cropping
|
||||
retains the two-cell face-gradient stencils. No fields or per-link arrays are saved.
|
||||
`cv_observation_seconds` is the CV portion of observation/overhead time. Helper hash
|
||||
and the observation flag must match pilot/full. Time integration, temporal
|
||||
coarsening and any physical assessment remain separate offline work.
|
||||
|
||||
## Bounded resolution and placement controls
|
||||
|
||||
Defaults remain `--case both --uniform-diameter 80 --placement wide`. Single-case
|
||||
runs use `--case uniform` or `--case refined` and never report a matched-case pass.
|
||||
Their own reference/periodicity or driven-diagnostic results remain available.
|
||||
A single zero-Jet full run exits successfully only when its periodicity and the
|
||||
unchanged complete DFG reference verdict pass; driven completion is not qualification.
|
||||
|
||||
The D160 option requires `--case uniform --uniform-diameter 160` and an explicit
|
||||
public Jet scenario. U and Jet speeds stay .01 and ±.001; viscosity is .016,
|
||||
grid 3521×658, center (320,320.5), radius80. CV uses root spacing/time factor .25,
|
||||
origin (.375,.75), impulse factor .0625, root viscosity .004, and x-face shift .125.
|
||||
|
||||
`--case refined --placement compact` selects root bounds (48,48,128,128), fine
|
||||
168×168 and origin (46,46), with the same D40/fineD80 body/Jet resolution. Its CV
|
||||
contours are (52,52,112,112) and (50,50,120,120); complete face-gradient stencils
|
||||
are clear of both solids and the transfer footprint. Compact is refined-only.
|
||||
CV metadata gives each grid's spacing/origin/contours explicitly. Case, uniform
|
||||
diameter and placement must match the newly completed pilot in every receipt.
|
||||
@@ -0,0 +1,161 @@
|
||||
# Periodic 2D Taylor–Green AMR campaign (prepared, not GPU-qualified)
|
||||
|
||||
This validation harness complements DFG Re100 and Jet/body tests. It measures
|
||||
smooth 2D periodic decay and errors crossing fixed refinement interfaces at
|
||||
Re_L=100 and 1000. It does **not** certify 3D turbulence, LES, Jet performance,
|
||||
wall conditions, dynamic refinement or general high-Re flows.
|
||||
|
||||
## Reference and conventions
|
||||
|
||||
Primary implementation-author documentation, checked 2026-10-18:
|
||||
- TensorMesh, exact velocity and pressure with a consistent phase:
|
||||
https://docs.tensor-mesh.com/example_gallery/fluid/taylor_green.html
|
||||
- AeroSim Nassu, 2D decay, energy and lattice-length Re definition:
|
||||
https://docs.aerosim.io/nassu/validation/analytical/04_taylor_green_vortex_2d/README.html
|
||||
|
||||
We use the TensorMesh phase, rescaled to length L=N root cells:
|
||||
|
||||
k = 2*pi/L; A(t) = U*exp(-2*nu*k*k*t)
|
||||
ux = -A*cos(k*x)*sin(k*y)
|
||||
uy = A*sin(k*x)*cos(k*y)
|
||||
p/rho0 = -A*A/4 * (cos(2*k*x)+cos(2*k*y))
|
||||
E = <|u|^2>/2 = U*U/4 * exp(-4*nu*k*k*t)
|
||||
|
||||
Pressure is kinematic, with rho0=1. A global velocity sign reversal leaves
|
||||
pressure unchanged; exchanging sine/cosine without the corresponding pressure
|
||||
phase can reverse its sign. CPU tests independently check momentum residuals.
|
||||
The nonlinear acceleration is a pressure gradient, **not zero**; the AeroSim
|
||||
page's prose calling advection zero is not adopted. Do not mix phase variants
|
||||
from different references. The formulas above are verified by substitution,
|
||||
not by trusting a copied pressure expression.
|
||||
|
||||
Re_L=U*L/nu, not Re_k=U/(nu*k)=Re_L/(2*pi). U=.03 in lattice units,
|
||||
Ma=U/cs=.0519615, cs^2=1/3, nu_root=.03*N/Re_L. Acoustic refinement uses
|
||||
h_l=dt_l=2^-l: lattice velocity stays U, nu_l=2^l*nu_root and
|
||||
tau_l=.5+3*nu_l. The worst root tau is .50288 (N32/Re1000), omega=1.98855,
|
||||
inside the existing config guard. No viscosity clamping or guard override.
|
||||
|
||||
All initial arrays are physical FP64 equilibrium populations, supplied to the
|
||||
public shifted-FP32 postcollision-G initializer. rho=1+3p at each true cell
|
||||
center. These are valid equilibrium postcollision states, but do not include
|
||||
Chapman–Enskog nonequilibrium stress; startup acoustic/kinetic error remains in
|
||||
the measurements and is shared with uniform baselines. The incompressible
|
||||
reference is not an exact finite-Mach LBM solution. This is why resolution alone
|
||||
need not remove the full error floor.
|
||||
|
||||
## Geometry and workload
|
||||
|
||||
All patches use level-wide union form, so origins are zero, including fine
|
||||
arrays with holes. Coordinates are (index+.5)*2^-level. Metrics integrate only
|
||||
ACTIVE leaves, each weighted by 4^-level. Covered cells and halo cells never
|
||||
enter norms or mass. Geometry tests prove exact single coverage at root-cell
|
||||
resolution. All blocks are 8x8, and both root dimensions are periodic.
|
||||
|
||||
At each root N=32,64:
|
||||
- 2 levels: L1 rectangle (N/8,N/8,7N/8,3N/4), in L0 indices.
|
||||
- 3 levels: same L1 plus L2 rectangle (3N/4,N/2,3N/2,5N/4), in L1 indices.
|
||||
|
||||
These off-axis boundaries cross nonzero flow and gradients rather than sitting
|
||||
only on symmetry or stagnation lines. Whole geometry scales with N.
|
||||
|
||||
16 cases: at each Re, uniform N=32,64,128,256 plus AMR (root32/root64)x(depth2/depth3).
|
||||
Each AMR case therefore has both a same-root uniform baseline and a uniform
|
||||
baseline at its finest spacing. Uniform N is its own lattice length, so nu and
|
||||
step count are scaled to represent the same nondimensional solution.
|
||||
Samples t*=tU/L = 0,.12,.24,.36,.48. End time is 16*N base steps, a meaningful
|
||||
.48 domain turnover or 3.016 vortex-scale turnover times (scale 1/k).
|
||||
At Re1000 energy decays about 7.3%; at Re100 about 53.1%. No plots or full fields;
|
||||
each case writes five diagnostic rows and provenance, incrementally.
|
||||
|
||||
## Running (GPU owner must schedule launches)
|
||||
|
||||
CPU checks, from the repository root:
|
||||
|
||||
PYTHONPATH=src python -m unittest discover -s tests/validation/taylor_green -p 'test_*.py' -v
|
||||
|
||||
One GPU case, on the scheduled worker after checking occupancy:
|
||||
|
||||
CUDA_VISIBLE_DEVICES=<physical-id> python tests/validation/taylor_green/run_case.py --repo /path/to/reviewed/checkout --re 100 --n 32 --depth 1 --output output/taylor_green/re100_n32_d1.json
|
||||
|
||||
Depth 1 is uniform. Run uniform cases before AMR for each Re; inspect baseline
|
||||
screening failures before proceeding. For a complete matrix, repeat the uniform
|
||||
call with N=32,64,128,256 and AMR calls with N=32,64 / depth=2,3, at each Re.
|
||||
Use serial process startup on the parent's assigned Horsea GPUs. This harness
|
||||
does not schedule or acquire GPUs. No GPU was used during preparation.
|
||||
|
||||
python tests/validation/taylor_green/assess.py output/taylor_green/re*_n*_d*.json --output output/taylor_green/assessment.json
|
||||
|
||||
The local API/geometry review used clean staging commit
|
||||
cd3a657f9d3833e812c3cca173525f165b48710a. This is **not** a claim of results on d79
|
||||
or any historical commit. Each runtime output records actual Git HEAD/dirty
|
||||
state, an aggregate source-tree hash, plus SHA256 of all harness Python files. Assessment refuses dirty checkouts and mixed source
|
||||
or harness identities. Keep reports outside the checkout or .gitignore them so
|
||||
new outputs do not change its dirty flag between cases. The source-tree hash excludes bytecode caches; production qualification requires
|
||||
a clean checkout.
|
||||
The runner uses the existing PeriodicBlockStepper / FixedPatchStepper periodic
|
||||
paths only. It does not depend on the new channel-root implementation.
|
||||
|
||||
## Preregistered assessment, before any GPU results
|
||||
|
||||
All sampled times must satisfy finite screening ceilings:
|
||||
- Relative composite velocity L2 <= 5%
|
||||
- Relative globally gauge-adjusted pressure L2 <= 15%
|
||||
- Relative kinetic-energy error <= 5%
|
||||
- Composite mass drift from downloaded t0 <= 1e-5
|
||||
|
||||
These are screening budgets, not literature-certified tolerances. Acceptance
|
||||
also requires all 16 cases, common source/harness, correct nondimensional times
|
||||
and viscosity, and baseline-relative checks on worst post-startup-sample errors:
|
||||
- AMR error <= max(2 * same-root uniform error, declared numerical floor).
|
||||
- Root64 AMR error <= max(.9 * root32 AMR error, floor), for each depth/Re.
|
||||
- Uniform256 error <= max(.9 * uniform32 error, floor).
|
||||
|
||||
Floors: velocity .002, pressure .02, energy .004. They are declared low-Mach /
|
||||
equilibrium-startup budgets, not fitted to observed results. Ma^2=.0027 motivates
|
||||
their scale; it is an asymptotic expectation, not a proof of those coefficients.
|
||||
The coarse baseline sets the AMR budget because much of the domain remains
|
||||
coarse. The finest uniform error and AMR/fine ratio are always reported, with no
|
||||
claim that partial refinement should match a fully fine domain. A pass below a
|
||||
floor is bounded accuracy, not a measured convergence order. Report errors and
|
||||
ratios even for a pass. Failure requires diagnosis or a separately preregistered
|
||||
follow-up, never retroactive tolerance tuning. Higher Re is deliberately absent;
|
||||
Re100/1000 must first be stable, resolved and reviewed.
|
||||
|
||||
Diagnostics use one global pressure gauge, direct cell-center analytic values,
|
||||
kinetic energy per unit reference mass, and actual leaf cell areas. Composite
|
||||
midpoint quadrature introduces a small initial energy integration error, retained
|
||||
rather than subtracted. Mass drift is relative to downloaded t0, so density
|
||||
initialization and mixed-grid quadrature do not masquerade as time drift.
|
||||
|
||||
## Pilot scheduling and transfer-consistency scope
|
||||
|
||||
Start with one uniform case and one matched AMR case; the 16-case matrix is a
|
||||
qualification plan, not authorization to launch every case automatically. The
|
||||
GPU owner reviews the pilot before expanding it. Each process prints a flushed
|
||||
READY only after initialization, a real base step exercising every level's
|
||||
kernel/halo/transfer path, and a finite positive-density download check. That
|
||||
step belongs to the measured trajectory; it is not discarded warmup. PROGRESS
|
||||
messages contain each of the five diagnostic samples. READY alone is not an
|
||||
accuracy pass. Reports include per-level active cells, hops and collision updates.
|
||||
|
||||
The complete matrix costs 768,540,672 active collision updates and 21,504 root
|
||||
intervals, excluding ghost streaming, halos, transfers and diagnostic work.
|
||||
Uniform N256 is the largest case (268,435,456 updates / 4096 intervals per Re).
|
||||
AMR N64/depth3 needs 50,987,008 updates / 1024 intervals. These are work counts,
|
||||
not GPU wall-time estimates. Baseline comparisons remain available on failed
|
||||
screens and partial pilots; absent/nonfinite operands are null, never passing.
|
||||
|
||||
Acoustic viscosity scaling and unchanged lattice velocity do not by themselves
|
||||
prove nonequilibrium-stress consistency across refinement interfaces. A smooth
|
||||
collocated Chapman–Enskog postcollision nonequilibrium has a (tau-1)*h factor;
|
||||
the existing implementation instead uses volumetric piecewise-constant explosion
|
||||
and stream-only ghosts. Whether that actual transfer construction achieves the
|
||||
needed stress accuracy is an unresolved question for this pilot to measure.
|
||||
It is not a proven defect, and a collocated-state scaling factor must not be
|
||||
inserted into this different transfer operator without a separate derivation
|
||||
and validation. This campaign measures the current operator and makes no
|
||||
theoretical stress-consistency certification or production-kernel change.
|
||||
|
||||
## Repository integration
|
||||
|
||||
The four Python harness files remain together under tests/validation/taylor_green, so runtime provenance hashes precisely this harness directory. Formatting changes produce a new harness identity; preparation and integrated receipts must not be mixed. All analytic definitions, numerical floors, assessment gates, sample times, and source-import assertions are unchanged. Production source is unchanged from the cd3 snapshot; these periodic tests do not waive the separate channel GPU gate.
|
||||
@@ -0,0 +1,90 @@
|
||||
# Bounded uniform-grid LES flow validation: prepared, GPU NOT RUN
|
||||
|
||||
## Status and scope
|
||||
|
||||
Prepared for independent review, then an explicitly authorized Horsea run only. No production files were edited, no normalization patch was applied to a full solver checkout, and no GPU was used. This is a small end-to-end **wall-bounded, x-periodic** shear-decay test, not a fully periodic 2D test. It exercises the actual production Simulation → Stepper → OneStep → Smagorinsky → SRT dispatch and double-buffer pull streaming, plus existing halfway bounce-back walls.
|
||||
|
||||
The original fully periodic-y plan is unsupported at the pinned revision: both `one_step_double.cu:90` and `one_step_esopull.cu:133` replace wall-adjacent incoming populations for every fluid node on y=1 and NY-2 regardless of its neighboring flags. `tests/validation/run_poiseuille.py:1–10` already documents this. Merely changing all flags to FLUID does not remove this behavior. The present test deliberately matches those real walls; it does not modify the kernels or claim a periodic-y public API.
|
||||
|
||||
Only unforced SRT, D2Q9, FP32 shifted storage and double-buffer streaming are included. No MRT/TRT, force correction, EsoPull, AMR, Jet, 3D turbulence or physical LES coefficient calibration is certified. In continuum this unidirectional incompressible shear is trace-free; small finite-Mach/discretization stresses in the LBM are not asserted to vanish exactly. The underlying scalar-helper audit remains the cleaner normalization isolation.
|
||||
|
||||
## Exact source contract
|
||||
|
||||
Baseline is explicitly repinned to the production snapshot in `cd3a657f9d3833e812c3cca173525f165b48710a`, whose reviewed AMR-channel source origin is `47b05bc8abfc957fe876b0c63bdb386e3c6cbaa5`. This new experiment does not inherit historical d79 GPU/flow acceptance. The original preparation remains associated with d79; its results are not rewritten.
|
||||
|
||||
`tests/validation/data/les_flow/source_pins.json` records all 101 tracked production source files from that snapshot. The runner checks every hash before importing CelerisLab or touching a GPU. It accepts only:
|
||||
|
||||
- `--variant baseline`: all baseline hashes, including helper SHA256 `ff7f000297ee0817e255ad9fcb6a13b647e3ddd5b206518d35f38d2895a9f501`.
|
||||
- `--variant corrected`: the same source bytes except helper SHA256 `a3db46c2e7d27530b2d1436e65cdbed0b72cc7e047bfbeef2a640877271b51aa`, from the independently reviewed `tests/validation/les/data/smagorinsky_normalization.patch` artifact.
|
||||
|
||||
The runner records the actual checkout commit and exact imported package. It never applies a patch itself. Run it against separate isolated full checkouts. The patch candidate's minimal header tree is not a runnable solver checkout. A source mismatch is a blocker, not permission to regenerate pins from an arbitrary new checkout.
|
||||
|
||||
Relevant pinned implementation evidence:
|
||||
|
||||
- `tests/integration/test_numerical_gpu.py:24–85`: equilibrium construction, installation of spatial postcollision state, count=1 adapter, raw population observation and x-periodic/walled flags.
|
||||
- `tests/validation/run_poiseuille.py:29–78`: production Simulation use with periodic x, halfway y walls and downloaded populations.
|
||||
- `src/CelerisLab/lbm/kernels/core/layout.cuh:87–104`: actual modulo neighbors.
|
||||
- `src/CelerisLab/lbm/kernels/boundary/bounce_back.cuh:18–38`: incoming populations copied from opposite local input directions.
|
||||
- `src/CelerisLab/lbm/kernels/operators/helpers.cuh:53–61`: LES effective omega feeds actual SRT collision.
|
||||
- `src/CelerisLab/cuda/compiler_v2.py:56–95`: compiler snapshots into private temporary build directories; package sources are not rewritten.
|
||||
|
||||
## Geometry, units and initial state
|
||||
|
||||
8×34 nodes: 8 periodic-x columns, 32 fluid rows, 2 ghost-wall rows. Relative to the bottom physical wall, fluid centers are y=0.5,...,31.5; physical halfway walls are y=0 and 32. Every x edge fluid node is explicitly FLUID; all top/bottom ghost nodes are SOLID|BC_WALL. Thus unused inlet/outlet configuration has no inlet/outlet flags to act on. There are no bodies, Jets or external forces.
|
||||
|
||||
Lattice units: dx_LBM=dt_LBM=1, rho=1, nu=0.02, tau0=0.56, U=0.04, H=32. Initial u_x(y)=U sin(pi y/H), u_y=0. The maximum Mach number is 0.0693. Height-based Re=U H/nu=64; a wavelength-based Re would differ and is not used. No dimensional physical length/time/viscosity is asserted without a user-supplied unit mapping.
|
||||
|
||||
Initialize equilibrium populations, encode shifted FP32, upload both DB buffers and set completed-count=1 following the existing integration-test adapter. That count is storage metadata: physical elapsed time starts at 0 after installation. Observe density and momentum directly from current postcollision populations, adding the descriptor weights in float64; do not mix in cached macro fields. This uses a clearly labeled validation-only raw state/flag adapter, not a promised public `set_periodic` or `set_velocity_profile` API.
|
||||
|
||||
Cases: LES enabled/closed-form with Cs=0 (molecular control), Cs=.16 (ordinary-coefficient sanity), then Cs=1 (amplified normalization diagnostic). Cs=1 is intentionally not a physically recommended SGS coefficient. Initial peak modeled nu_t/nu = Cs² Δ² U(pi/H)/nu = 0.19635; estimated effective tau remains near 0.56–0.5718, far from omega guards. Standard default Cs=.16 yields a much weaker signal at these safe parameters and is not used to make a decisive short-run normalization claim. No defaults are changed.
|
||||
|
||||
Observe at elapsed steps 519, 1038, 2075, approximately 0.1, 0.2, 0.4 molecular decay times. Three cases total 6225 measured advancing launches plus 3 warm-up launches per checkout (6228 total), three snapshots each. Population buffers contain only 272×9 FP32 entries each (about 9.6 KiB), apart from ordinary driver/compiler/context overhead. No frames, trajectories or heavy output. Full result JSON is a few tens of KiB. Runtime depends on compilation/device; no performance claim is made.
|
||||
|
||||
## Independent continuum reference
|
||||
|
||||
For u=(u(y),0), |S|=sqrt(2 S:S)=|du/dy|. Therefore
|
||||
|
||||
du/dt = d/dy [(nu + (Cs Delta)^2 |du/dy|) du/dy],
|
||||
u(0,t)=u(H,t)=0.
|
||||
|
||||
`tests/validation/les_flow_oracle.py` integrates this equation directly with centered finite-volume face fluxes and SSPRK2, at 128 and 256 cells on the same physical H=32 domain. Stability step size uses the nonlinear flux derivative nu+2(Cs Delta)^2|gradient|. Boundary face gradients use the zero Dirichlet value across a half cell. It does not import or reproduce the LBM quadratic/helper. A separate fixed-n=256 test halves the CFL factor from .4 to .2 for Cs=0,.16,1 at every checkpoint, requiring relative changes below 1e-8; measured maximum is 1.8141e-10. This isolates temporal error from the spatial-refinement test.
|
||||
|
||||
Crucially the SGS filter Delta=1 stays fixed as the CPU oracle mesh changes from dy=.25 to .125. Confusing oracle spacing with filter width would change the PDE and invalidate convergence. Future LBM grid refinement also needs an explicit physical-unit/filter-width scaling contract; this artifact does not silently reinterpret Cs or Delta when resizing H.
|
||||
|
||||
Cs=0 is checked directly against U sin(pi y/H) exp[-nu(pi/H)^2 t]. The nonlinear reference includes evolving higher harmonics, rather than assuming it remains a sine. At the final time, host oracle predicts 5.1706% SGS reduction in the fundamental amplitude and 1.5409% full-profile separation between standard and old coefficient conventions. The old convention reference is computed by changing continuum Cs to Cs/2^(1/4), purely as a diagnostic; it does not replace standard acceptance.
|
||||
|
||||
## Predeclared criteria (do not tune after seeing GPU results)
|
||||
|
||||
- Initial decoded profile relative L2 <= 1e-5; otherwise no advancing test.
|
||||
- Molecular Cs=0 profile error against analytic decay <= 0.003 at every checkpoint.
|
||||
- Cs=1 full-profile error against standard nonlinear oracle <= 0.005 at every checkpoint.
|
||||
- Oracle 128/256-grid interpolated relative difference <= 8e-5 at every checkpoint.
|
||||
- Relative error in SGS fundamental-amplitude decrement <= 0.15 at the last two checkpoints. Decrement is measured from actual Cs=0 amplitude minus actual Cs=1 amplitude; reference uses analytic Cs=0 minus the nonlinear oracle. The first checkpoint remains a transient diagnostic for this increment gate.
|
||||
- Fluid mean-density drift <= 5e-5, max |u_y| <= 1e-5 and x-column velocity spread <= 1e-6 at every checkpoint; finite populations, strictly positive finite fluid density and finite decoded velocity/profile/diagnostics required throughout observations, including startup and warm-up.
|
||||
|
||||
Reasons: molecular 0.3% leaves room for finite-lattice dispersion, equilibrium-start kinetic transient and FP32 error at H=32; nonlinear 0.5% is substantially below the predicted 1.54% old-vs-standard separation. The 15% increment tolerance is below the old convention's approximately 29% viscosity-coefficient deficit, while allowing continuum/lattice differences. Directly subtracting the two measured amplitudes reduces common lattice error. Oracle convergence is over 60 times tighter than the nonlinear profile bound. These are declared engineering test gates, not GPU-validated uncertainty estimates; a failure requires diagnosis/refinement and an explicitly revised experiment, never a post-hoc tolerance edit to obtain a pass.
|
||||
|
||||
Both baseline and candidate are judged against the same standard convention. Baseline is expected to fail SGS criteria if the flow reproduces the scalar finding; an exit 1 with valid evidence is useful. The runner reports old-convention profile error but never masks baseline failure. Candidate passing alone is insufficient if baseline does not demonstrate meaningful discrimination. Review both results and source pins together.
|
||||
|
||||
## Host verification and later GPU commands
|
||||
|
||||
From the repository root, using existing Python/NumPy and the existing pytest environment:
|
||||
|
||||
PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=src python -m pytest -q tests/unit/test_les_flow_oracle.py tests/unit/test_les_flow_runner.py
|
||||
|
||||
Nine tests cover analytic decay, independent-oracle mesh convergence, symmetry/positivity/energy decay, filter invariance, fixed-grid timestep halving, signal discrimination, invalid density/velocity rejection, source pins/candidate/tamper rejection and the no-GPU-without-opt-in CLI guard. The integrated tests preserve those checks. No PyCUDA import or GPU run is required for them. Cs=.16 uses the same 0.5% full-profile safety/sanity bound; its SGS increment is not a discriminatory normalization gate.
|
||||
|
||||
The source-guard tests materialize temporary candidate headers with the existing reviewed LES preparation tool; the GPU entrypoint uses `tests/validation/run_uniform_les_flow.py`, `tests/validation/les_flow_oracle.py`, and `tests/validation/data/les_flow/source_pins.json` in that repository layout.
|
||||
|
||||
After review, make isolated full baseline and corrected checkouts of the exact base. Apply only `tests/validation/les/data/smagorinsky_normalization.patch` to the corrected checkout; do not edit the benchmark/production tree. On authorized Horsea, with existing NumPy, PyCUDA, nvcc and driver, run sequentially and select the authorized physical GPU explicitly:
|
||||
|
||||
CUDA_VISIBLE_DEVICES=<physical-GPU> PYTHONDONTWRITEBYTECODE=1 python tests/validation/run_uniform_les_flow.py --run-gpu --device 0 --root <isolated-baseline> --variant baseline --output <new-evidence-dir>/baseline.json
|
||||
CUDA_VISIBLE_DEVICES=<physical-GPU> PYTHONDONTWRITEBYTECODE=1 python tests/validation/run_uniform_les_flow.py --run-gpu --device 0 --root <isolated-corrected> --variant corrected --output <new-evidence-dir>/corrected.json
|
||||
|
||||
`--device 0` is the logical ordinal within CUDA_VISIBLE_DEVICES. Do not use a shell `&&` between these: baseline's expected standard-criterion failure must not suppress the corrected run. Existing output files are refused. A JSON `READY` line is printed separately for each case only after source verification, compilation, initialization, raw-state installation, one actual advancing OneStep launch, post-warm-up macro validation, complete restoration of both DB buffers/flags/count to the initial state, profile readback and CUDA synchronization. It gives source identity, device, Cs, warm-up/reset confirmation, installed-profile error and maximum measured steps. This is the first trustworthy startup checkpoint, not a statement that the physics passed. `DONE` is printed after all three cases and all criteria; failures/compile errors before that remain incomplete runs.
|
||||
|
||||
Deliver both JSON files and stdout/stderr with artifact hashes. Review before any production integration. AMR LES guards remain untouched.
|
||||
|
||||
## Isolated candidate preparation
|
||||
|
||||
Use the current validation commit for two separate full checkouts, preserving the baseline. In the corrected checkout only, apply `tests/validation/les/data/smagorinsky_normalization.patch` with `git apply`; do not commit that experimental production change or update the pins. The runner requires exactly the baseline bytes plus the reviewed helper hash. The header-only scalar diagnostic tree is insufficient for this end-to-end flow. Baseline and corrected commands must run as separate Python processes; package import caching must never combine their implementations. Both reject an imported CelerisLab package outside the explicitly supplied checkout, including an installed DynamisLab copy. Retain the actual checkout commit, variant, exact header hash, and experimental source label with each result.
|
||||
@@ -0,0 +1,155 @@
|
||||
# Single-cylinder free transverse VIV, Re 150 (Kolahdouz/Qin) — PREDECLARATION (agreed at 1abfe954)
|
||||
|
||||
(File renamed from `leontini_viv_predeclare.md`; the Leontini Re 200 case is only the queued second case below.)
|
||||
|
||||
Stage goal (Yanqi via TRON): prescribed Dütsch case + one VIV case both
|
||||
"reasonably close" to a predeclared reference = development-stage success, then
|
||||
cleanup. The frozen Dütsch settling failure (0/28 pairs at 31.25 T) stays on
|
||||
record. Practical closeness is not a formal validation claim. Agreed by
|
||||
Claude, Grok and Astra at 1abfe954; implemented in research/viv_re150/.
|
||||
|
||||
## Primary case (one case)
|
||||
|
||||
- Reference: Qin et al., arXiv:2003.12186, §4.5 (maximum amplitudes at
|
||||
U_red = 3…8: .075, .551, .520, .459, .370, .084 D in the text, as quoted by
|
||||
Grok/Astra) for the target; setup from Kolahdouz et al., arXiv:2003.12046,
|
||||
§4.1.1 (read 2026-10-30 via ar5iv): U* sweep 3–8 with amplitudes only in
|
||||
Fig. 3(b) (no text values), domain [−30, 45] D × [−30, 30] D with the
|
||||
cylinder "initially at rest and centered at the origin", uniform inflow on
|
||||
the left, zero normal traction and tangential velocity at the outlet, zero
|
||||
normal velocity and tangential traction on y = ±30 D; no initial
|
||||
perturbation and no total simulated time stated.
|
||||
- Re = 150, U* = U/(f_n D) = 5, m/(rho D²) = 2 (m* = rho_s/rho_f = 8/pi),
|
||||
zeta = 0, f_n = sqrt(K/M)/(2 pi) in vacuum. Transverse DOF only.
|
||||
- Target: A_max = .520 D (peak amplitude, Qin §4.5). Multi-code reference
|
||||
(Kolahdouz ILE-NS, Qin II-LBM). Reference uncertainty: not stated; the
|
||||
spread between codes is not quantified here.
|
||||
|
||||
## Our reproduction (declared differences)
|
||||
|
||||
- D = 40, MRT, dense double buffer; U_lat = .04, nu = U D / 150 = .010667,
|
||||
tau = .532.
|
||||
- Nominal 75 D × 60 D lattice allocation (3000 × 2400), based on the
|
||||
Kolahdouz §4.1.1 layout. Coordinate clarification of the existing run:
|
||||
the driver uses `(30 D, (ny - 1)/2)` = `(1200, 1199.5)` in lattice
|
||||
coordinates, or `(30 D, 29.9875 D)`. The earlier `(30 D, 30 D)` wording
|
||||
described the nominal box, not the exact executed centre.
|
||||
Free-slip reflection planes are at `y = .5` and `y = ny - 1.5 = 2398.5`;
|
||||
their separation is 2398 cells = 59.95 D, with the centre exactly midway,
|
||||
29.975 D from each wall. Node counts are not physical wall-to-wall lengths.
|
||||
This corrects the description, without changing the historical geometry
|
||||
or results. Qin's own box ([0, 40 D] × [0, 20 D], centre (10 D, 10 D)) is
|
||||
the target paper's, not ours.
|
||||
- Boundaries: uniform Zou–He inlet, NEQ outlet (rho = 1, backflow clamp),
|
||||
free-slip y walls. Kolahdouz uses a traction outlet: declared mismatch.
|
||||
- Qin's own VIV box (40 D × 20 D) is not used; a smaller box would be a
|
||||
declared cost cut with more blockage, not "the same case".
|
||||
- Allowed y offset ±1.5 D; peak transverse speed ≈ .026 cells/step (bound .5).
|
||||
|
||||
## Structure, coupling and time levels
|
||||
|
||||
- M = 2 rho D² (lattice rho = 1), f_n = U/(5 D) = 2e-4 per step, K = M (2 pi f_n)²,
|
||||
zeta = 0. Equation of motion uses the structural mass only.
|
||||
- Per-step sequence (binding): known (y_n, v_n) and the last completed force
|
||||
F_last → candidate (y_{n+1}, v_{n+1}) by the update below → `set_body` with
|
||||
offset y_{n+1} and wall velocity (y_{n+1} − y_n)/dt with lattice dt = 1 (interval average; a
|
||||
different quantity from the endpoint v_{n+1}) → `run(1)` → only on success:
|
||||
commit y_n ← y_{n+1}, v_n ← v_{n+1}, F_last ← force read for that step (failure
|
||||
semantics: see the window section). Whether the
|
||||
measured force represents the interval's start, midpoint or end is not
|
||||
asserted; the one-step lag is declared, not corrected.
|
||||
- Initial state: fluid initialized by `Simulation.initialize()` to the uniform
|
||||
inlet velocity U everywhere (the code's actual initial condition; the
|
||||
source gives no fluid initial condition), body at rest at the declared
|
||||
centre, y_0 = v_0 = 0, F_last = 0.
|
||||
- Structural update over one step with constant force F = F_last (exact
|
||||
harmonic solution, zeta = 0): y_e = F/K, w = 2 pi f_n,
|
||||
y^{n+1} = y_e + (y^n − y_e) cos w + (v^n / w) sin w,
|
||||
v^{n+1} = −(y^n − y_e) w sin w + v^n cos w.
|
||||
- Primary RHS (single coupled run): CME + Wen (theory-motivated stage choice:
|
||||
Galilean-invariant link correction; G4 could not separate it from CME).
|
||||
Raw CME and the node terms are logged as diagnostics of that trajectory;
|
||||
the node impulse is not added. A run with CME-only as RHS is a separate,
|
||||
labelled sensitivity case, decided separately. Neither RHS is claimed proven.
|
||||
|
||||
## Window, failure semantics, acceptance (engineering, development stage)
|
||||
|
||||
Clocks: lattice dt = 1; T_n = 1/f_n = 5,000 steps. Response cycles are
|
||||
counted from the measured signal; T_n is used only for the seed check.
|
||||
|
||||
- Start: body at rest at the declared centre (the only initial condition the
|
||||
source states), y_0 = v_0 = 0, F_last = 0; fluid uniform at U (as
|
||||
initialized by the code; our choice, not the source's).
|
||||
- Seed (conditional, one time, declared): at step n_seed = 200,000
|
||||
(t = 40 T_n), if max |y_t| over states t in [175,000, 200,000) is below
|
||||
.01 D, then
|
||||
in that step, after the check and before the candidate update, set
|
||||
v_n += 2 pi f_n (.01 D) (F_last unchanged) and proceed normally; the
|
||||
geometry moves continuously through the update. `seed_applied`, step and
|
||||
size are logged; never repeated or changed.
|
||||
- Cycle boundary (discrete, fixed threshold): step n closes a cycle iff
|
||||
y[n−1] < 0 and y[n] ≥ 0 (upward crossing of the equilibrium y = 0);
|
||||
y_0 = 0 is not a crossing; no boundary fewer than 2 samples after the
|
||||
previous one.
|
||||
- Per cycle: positive peak max(y), negative peak min(y), mean offset
|
||||
(time-mean of y), amplitude a = (max − min)/2 (the only amplitude used for
|
||||
settling).
|
||||
- Eligibility: a completed cycle is counted (toward the settling proof and
|
||||
the 150 budget) only if a ≥ .01 D; ineligible cycles are logged, never
|
||||
counted, so near-zero motion cannot settle or pass.
|
||||
- Seed reset: if the seed is applied, the incomplete cycle at n_seed is
|
||||
discarded and the settling proof starts empty; the 150 budget and the
|
||||
native cap keep running from t = 0.
|
||||
- Windows: adjacent non-overlapping blocks of 10 counted cycles;
|
||||
W_k = mean amplitude of block k (W_k ≥ .01 D by eligibility, so no zero
|
||||
denominator).
|
||||
- Block rule R(k), k ≥ 2: |W_k − W_{k−1}| / W_{k−1} ≤ .02 and, for the last 5
|
||||
cycles of block k, max_i |a_i − ā_5| / ā_5 ≤ .01 with ā_5 their mean.
|
||||
- Settled at the end of block k when R(k) holds. Scoring = the next two
|
||||
blocks k+1, k+2 (20 counted cycles); both must satisfy R. If one fails,
|
||||
that block becomes the new reference: the settling proof restarts from it
|
||||
and continues within the caps (deterministic; no other retry). A pass
|
||||
requires one complete stable 20-cycle scoring window before a cap; success
|
||||
stops after its 20th cycle.
|
||||
- Caps (both always armed; the first hit wins and is reported): 150 counted
|
||||
response cycles including the 20 scoring cycles (so settling must complete
|
||||
by counted cycle 130) → `timeout_response_cycles`; 1,000,000 native steps
|
||||
(200 T_n) → `timeout_native_steps`.
|
||||
- Durations reported: total steps, t U/D, counted and uncounted cycles,
|
||||
measured T_resp (mean boundary interval); N_resp / f_n only as a labelled
|
||||
secondary clock.
|
||||
- Growth is not a failure: initial VIV growth is physical. Checked every
|
||||
step (FAIL-CLOSED): non-finite y, v or force; |y| > 1.0 D (the tighter
|
||||
gate; about twice the largest reference peak, .551 D) or the ±1.5 D offset
|
||||
box reached; no_donor > 0; a failed upload/step/sync.
|
||||
- On any failure the driver stops and reports; it never retries,
|
||||
sub-iterates, retunes the RHS or parameters, or starts a second case.
|
||||
Device-side failures (upload/step/sync, no_donor) mark the Simulation
|
||||
failed through the existing lifecycle; input rejection by `set_body`
|
||||
(offset box, speed, step bound) and timeouts end the driver run without
|
||||
that mark.
|
||||
- Target metric over the 20 scoring cycles: A_max/D = max over those cycles
|
||||
of max(|positive peak|, |negative peak|) about y = 0 (Qin reports "maximum
|
||||
amplitude"); also reported: mean amplitude, positive and negative peaks,
|
||||
mean offset, f/f_n (no target).
|
||||
- Acceptance: |A_max − .520 D| ≤ .052 D (±10 %), stated together with the
|
||||
boundary mismatch and the absence of a quoted reference uncertainty. A pass
|
||||
is "reasonably close" for the stage: not grid convergence, not force-RHS
|
||||
validation, and it does not touch the Dütsch settling record.
|
||||
- Driver reads force and the small diagnostics per step only; field reads
|
||||
only at a few predeclared snapshots. No runtime claim: there is no measured
|
||||
timing on this grid yet (the D40/60D receipt is a different, sampled case).
|
||||
|
||||
## Plumbing smoke (not the benchmark)
|
||||
|
||||
`run.py --smoke --D 20 --steps 32` runs exactly 32 steps of the same BC
|
||||
package and coupling loop (no seed, settle or score; never scored);
|
||||
status `smoke_ok` iff every step is finite, no_donor stays 0 and the body
|
||||
stays inside its box. The physical case is only the default invocation
|
||||
(`--D 40`, no `--smoke`).
|
||||
|
||||
## Queued, not in this stage
|
||||
|
||||
Leontini et al. JFS 22 (2006) Re = 200, m* = 10, zeta = 0.01, U* = 5.0 (needs
|
||||
the owners' c_crit convention and a Fig. 1 digitization). D80, literature
|
||||
claims, pinball, AMR, BC redesign, threshold changes.
|
||||
@@ -0,0 +1,489 @@
|
||||
# Force region 最小方案设计
|
||||
|
||||
目标是在现有功能冻结的前提下,为项目增加一个**局部体力施加区域**,用于研究局部驱动与流场结构之间的关系。该功能的第一阶段只追求可用、低风险、低侵入,不追求最泛化的抽象,也不与 sensor 合并。
|
||||
|
||||
当前代码已经具备三条很明确的数据链:全场 `OneStep` 推进、稀疏 `curved` link 链、稀疏 `sensor` cell 链。`force_region` 更接近第三类:它是一个静态几何 footprint,加上运行时 action,而不是一个需要改变主域 flag 的边界对象。因此,第一阶段更适合沿用 `sensor` 风格的稀疏 cell 管理,而不是引入全场 owner map。
|
||||
|
||||
## 目标与非目标
|
||||
|
||||
| 类别 | 内容 |
|
||||
|---|---|
|
||||
| 目标 | 在圆形区域内对流体施加局部体力 |
|
||||
| 目标 | 运行时更新区域体力参数,不重新编译 |
|
||||
| 目标 | 尽量少改现有主热路径和已有稳定功能 |
|
||||
| 非目标 | 与 sensor 统一成单一抽象 |
|
||||
| 非目标 | 非圆形几何 |
|
||||
| 非目标 | 3D |
|
||||
| 非目标 | 多区域重叠叠加规则的完整设计 |
|
||||
| 非目标 | 数值上最严格的“逐格 collision 内联 forcing”实现 |
|
||||
|
||||
## 需求边界
|
||||
|
||||
第一阶段建议只支持以下能力:
|
||||
|
||||
- `force_region` 是一个圆形 footprint
|
||||
- 区域内部施加均匀体力 `fx, fy`
|
||||
- 区域几何在初始化后不变
|
||||
- 体力大小可在运行时更新
|
||||
- 只对 fluid cell 生效
|
||||
- 不要求读取区域平均速度
|
||||
- 不要求与 `sensor` 或 `body` 的接口完全统一
|
||||
|
||||
这意味着第一阶段的问题不是“建立通用 actuator 体系”,而是“在现有框架内插入一条最小局部 forcing 数据链”。
|
||||
|
||||
## 现有代码中与该功能直接相关的结构
|
||||
|
||||
| 模块 | 当前作用 | 与 force region 的关系 |
|
||||
|---|---|---|
|
||||
| `body/geometry/circle` | 生成圆形 footprint | 可复用 |
|
||||
| `body/manager` | 汇总 compact list 并上传 GPU | 适合新增 force-region list |
|
||||
| `lbm/curved_links` | 稀疏 SoA 容器 | 可参考 `SensorSoA` 形式扩展 |
|
||||
| `lbm/kernels/step/aux_kernels` | 稀疏辅助 kernel | 适合新增 `ForceRegionKernel` |
|
||||
| `lbm/stepper` | 编排主 step 与辅助 kernel | 适合插入 force-region launch |
|
||||
| `operators/helpers` | 现有全局 Guo forcing 路径 | 可复用公式与语义 |
|
||||
|
||||
需要特别注意的一点是:现有全局体力通过 `d_params.fx/fy/fz` 进入 `collide_dispatch()`。这条路径服务的是**全场统一 forcing**。局部体力如果要完全沿用同一语义,最严格的做法是让每个 cell 在线程内部读取本地 force。但这会推动设计进入全场 owner map 或 per-cell force field,而这不符合第一阶段的低侵入目标。
|
||||
|
||||
## 推荐的第一阶段总路线
|
||||
|
||||
推荐路线是:
|
||||
|
||||
- `force_region` 作为一种新对象类型存在
|
||||
- 它不修改 domain flag
|
||||
- 它只产出稀疏 cell footprint
|
||||
- 由一个独立的 `ForceRegionKernel` 在主 step 外对这些 cell 做局部 forcing 修正
|
||||
|
||||
换句话说,第一阶段采用的是:
|
||||
|
||||
- **主推进仍保持全场统一**
|
||||
- **局部 forcing 通过稀疏后处理 kernel 注入**
|
||||
|
||||
这不是最终最泛化的架构,但它与现有 `sensor` 管理方式一致,工作量低,也最不容易破坏当前稳定基线。
|
||||
|
||||
## 为什么不优先采用全场 owner map
|
||||
|
||||
全场 owner map 的优点是语义干净:`OneStep` 的每个 cell 都可直接知道自己是否属于某个区域,再把局部体力并入 collision forcing。这在数值上更直接,也更容易扩展到复杂局部 forcing。
|
||||
|
||||
但在当前阶段,这条路的代价偏高:
|
||||
|
||||
- 需要给全场新增一个 device-side 标识数组
|
||||
- 需要改主 step kernel 形参和热路径逻辑
|
||||
- 需要明确多区域覆盖规则
|
||||
- 需要同时处理 double-buffer 与 esopull 路径中的局部 forcing 接入方式
|
||||
|
||||
对当前目标来说,这会把“加一个可用功能”变成“改造主推进语义”。因此,第一阶段更合适的路线仍是稀疏 compact list。
|
||||
|
||||
## 为什么不把 force region 直接并入 sensor
|
||||
|
||||
二者的几何 footprint 确实相似,都可以表示成“圆形覆盖的一批 cell”。但功能角色不同:
|
||||
|
||||
| 类型 | 本质 | 时序位置 |
|
||||
|---|---|---|
|
||||
| `sensor` | 读出局部信息 | step 后 |
|
||||
| `force_region` | 修改 DDF 演化 | step 中或 step 后的局部修正 |
|
||||
|
||||
因此,第一阶段不建议在抽象层面合并二者。更合理的做法是:
|
||||
|
||||
- 复用几何 footprint 生成逻辑
|
||||
- 保持独立对象语义
|
||||
- 保持独立 kernel 与独立 compact list
|
||||
|
||||
这样既能少写代码,也不会把接口语义搅乱。
|
||||
|
||||
## 对象层建议
|
||||
|
||||
`force_region` 建议作为一种新的 body-side 对象类型,而不是把普通刚体、sensor、局部 forcing 区域全部塞进同一语义分支。
|
||||
|
||||
### 推荐最低要求
|
||||
|
||||
| 字段 | 作用 |
|
||||
|---|---|
|
||||
| `obj_id` | 索引 action 与 compact list |
|
||||
| `geometry` | 圆形 footprint 来源 |
|
||||
| `state` | 可沿用通用容器,但第一阶段基本不用 |
|
||||
| `control` 或 action slot | 存 `fx, fy` |
|
||||
| `type tag` | 区分普通 body、sensor、force_region |
|
||||
|
||||
### 不必在第一阶段敲死的点
|
||||
|
||||
下面这些都可以留给 coder 选择:
|
||||
|
||||
- 是加 `is_force_region` 布尔字段,还是引入更清楚的 `role` / `kind` 标签
|
||||
- `fx, fy` 放在 `state`、`control`,还是直接只存在 `action` 打包层
|
||||
- `add_body("force_region", ...)` 还是单独加 `add_force_region(...)`
|
||||
|
||||
第一阶段更重要的是把数据链接起来,而不是先做完美 API。
|
||||
|
||||
## 几何层建议
|
||||
|
||||
`body/geometry/circle` 已经有生成 sensor cells 的逻辑。这里最自然的做法不是复制一份,而是把“圆形 footprint cell 枚举”抽成一个中性函数。
|
||||
|
||||
### 推荐抽象
|
||||
|
||||
建议在 circle geometry 中形成一个中性能力,例如:
|
||||
|
||||
- `build_footprint_cells()`
|
||||
|
||||
然后:
|
||||
|
||||
- `sensor` 使用这批 cells 作为采样点
|
||||
- `force_region` 使用同一批 cells 作为施力点
|
||||
|
||||
### 第一阶段不必决定的点
|
||||
|
||||
- footprint 是否严格包含圆内格点中心
|
||||
- 是否允许边界一圈采用不同准则
|
||||
- 是否为将来的 polygon/mesh 提前抽公共父类 helper
|
||||
|
||||
只要 footprint 定义在 host 和测试中保持一致即可。
|
||||
|
||||
## flag 处理建议
|
||||
|
||||
`force_region` 第一阶段**不应修改 flag field**。
|
||||
|
||||
原因很直接:
|
||||
|
||||
- 它不是 solid
|
||||
- 它不是 boundary condition
|
||||
- 它不是 sensor flag
|
||||
- 它不参与 channel topology 构造
|
||||
|
||||
因此它应当是“有 footprint,但不 overlay flag”的对象。
|
||||
|
||||
这意味着在 `build_flags()` 过程中:
|
||||
|
||||
- 普通 body 继续覆盖 obstacle / curved 标记
|
||||
- sensor 继续覆盖 sensor 标记
|
||||
- force_region 返回零 mask,或根本不进入该分支
|
||||
|
||||
两种实现都可以,留给 coder 决定。若追求语义更清楚,倾向于根本不让它参与 flag merge。
|
||||
|
||||
## compact list 设计建议
|
||||
|
||||
第一阶段建议新增一条与 sensor 平行的数据链:
|
||||
|
||||
- `force_region cells`
|
||||
- `force_region obj_id`
|
||||
|
||||
### 数据最小集
|
||||
|
||||
| 列 | 类型 | 作用 |
|
||||
|---|---|---|
|
||||
| `cells` | `uint32` | 被施力格点索引 |
|
||||
| `obj_id` | `int32` | 从 action 中取 `fx, fy` |
|
||||
|
||||
这与 `SensorSoA` 的结构完全同型,只是消费 kernel 不同。
|
||||
|
||||
### 可选实现
|
||||
|
||||
| 方案 | 特点 |
|
||||
|---|---|
|
||||
| 单独建 `ForceRegionSoA` | 语义清楚,后续好扩展 |
|
||||
| 复用 `SensorSoA` 结构实现新字段 | 改动少,但语义稍混 |
|
||||
|
||||
第一阶段更推荐单独建 `ForceRegionSoA`。这会多一点样板代码,但可读性更好,也避免后续 `sensor` 和 `force_region` 在 field 中混淆。
|
||||
|
||||
## action contract 建议
|
||||
|
||||
当前 `action` buffer 在 2D 下每对象为 `3 * dim = 6` 个 `float`,而现阶段只真正使用了最后一个 `omega`。这给了第一阶段一个很好的低成本入口:
|
||||
|
||||
- 不改 action buffer 总长度
|
||||
- 不改编译期 layout 宏
|
||||
- 先在已有 slot 中约定 `fx, fy` 的位置
|
||||
|
||||
### 一个可行的最小约定
|
||||
|
||||
| slot | 含义 |
|
||||
|---|---|
|
||||
| `0` | `fx` |
|
||||
| `1` | `fy` |
|
||||
| `5` | `omega` |
|
||||
|
||||
其余位置保留。
|
||||
|
||||
### 这里不必现在敲死
|
||||
|
||||
这部分可以留给 coder 做最终选择,只要满足两点:
|
||||
|
||||
- `force_region` kernel 能稳定读到 `fx, fy`
|
||||
- 现有 `CurvedBoundaryKernel` 继续稳定读到 `omega`
|
||||
|
||||
若 coder 认为显式 helper 更重要,可以新增类似 `action_force_x()` / `action_force_y()` 的 device helper,而不是在 kernel 中直接写魔数偏移。
|
||||
|
||||
## kernel 路线建议
|
||||
|
||||
第一阶段最合适的是新增一个独立 kernel,例如:
|
||||
|
||||
- `ForceRegionKernel`
|
||||
|
||||
它应当像 `SensorKernel` 一样按 compact list 启动,而不是并入 `OneStep`。
|
||||
|
||||
### 建议职责
|
||||
|
||||
每个线程处理一个 force-region cell:
|
||||
|
||||
1. 读该 cell 的线性索引 `k`
|
||||
2. 读所属对象 `obj_id`
|
||||
3. 从 `action` 中读 `fx, fy`
|
||||
4. 从当前 DDF 缓冲中加载该 cell 的 `f[NQ]`
|
||||
5. 计算 `rho, ux, uy`
|
||||
6. 按现有 Guo forcing 语义构造 `Fin`
|
||||
7. 对该 cell 的分布函数做 forcing 修正
|
||||
8. 写回 DDF
|
||||
|
||||
### 需要特别控制的事
|
||||
|
||||
第一阶段最好不要在这个 kernel 内部引入过多策略分支。尤其避免一开始就支持:
|
||||
|
||||
- 多个不同 forcing scheme
|
||||
- 复杂边界跳过逻辑
|
||||
- 非均匀空间 force
|
||||
- 区域内按距离衰减的 force
|
||||
|
||||
先只做“圆内均匀体力”。
|
||||
|
||||
## ForceRegionKernel 应该写在哪个时间位置
|
||||
|
||||
现有 `stepper` 顺序大致为:
|
||||
|
||||
1. curved boundary
|
||||
2. main step
|
||||
3. sensor
|
||||
|
||||
第一阶段建议将其改为:
|
||||
|
||||
1. curved boundary
|
||||
2. main step
|
||||
3. force region
|
||||
4. sensor
|
||||
|
||||
### 这样做的原因
|
||||
|
||||
- 主推进链尽量不动
|
||||
- force region 作为局部修正子步存在
|
||||
- sensor 若未来同时存在,可以读到施力后的局部结果
|
||||
|
||||
### 这里保留给 coder 的决策点
|
||||
|
||||
`ForceRegionKernel` 也可以放在 sensor 前后不同位置,但需要统一解释语义:
|
||||
|
||||
| 放置位置 | 语义 |
|
||||
|---|---|
|
||||
| 主 step 之后、sensor 之前 | sensor 读到施力后的状态 |
|
||||
| sensor 之后 | sensor 读到施力前主步结果 |
|
||||
|
||||
若第一阶段不做 sensor 联动,则这只是将来兼容性的选择。默认更建议放在 sensor 之前。
|
||||
|
||||
## DDF 更新方式的设计空间
|
||||
|
||||
这里是实现中最需要留白的部分。第一阶段文档不应把写法锁死,但应给出边界。
|
||||
|
||||
### 必须满足的原则
|
||||
|
||||
- 局部体力的数值语义尽量对齐现有 `forcing_guo.cuh`
|
||||
- 不应在 `ForceRegionKernel` 中引入与现有 collision family 矛盾的私有公式
|
||||
- 若采用 operator splitting,应在注释中明确说明它不是“主 collision 内联 forcing”
|
||||
|
||||
### 可接受的实现方向
|
||||
|
||||
| 方向 | 特点 |
|
||||
|---|---|
|
||||
| 直接按 Guo forcing 增量对 `f[i]` 做修正 | 最小、直观 |
|
||||
| 抽一个独立 helper,复用 `compute_guo_forcing()` | 与现有 forcing 公式最一致 |
|
||||
| 在 kernel 中根据 collision family 调整 prefactor | 更接近现有 `collide_*` 写法,但代码稍重 |
|
||||
|
||||
### 第一阶段更适合的判断
|
||||
|
||||
更推荐:
|
||||
|
||||
- 尽量复用 `compute_guo_forcing()`
|
||||
- 用很薄的一层 helper 完成 DDF 增量写回
|
||||
|
||||
但是否把 `c_tau = 1 - omega/2` 放在 kernel 里、helper 里,还是借新函数收口,可以留给 coder。
|
||||
|
||||
## 数值语义说明
|
||||
|
||||
第一阶段方案本质上是一个**局部 forcing 修正子步**,而不是严格在 `OneStep` 内逐格并入 collision forcing。这一点需要在实现处用注释写清楚。
|
||||
|
||||
### 这个选择的代价
|
||||
|
||||
- 语义上更像 operator splitting
|
||||
- 与全局 forcing 在热路径中的时序并不完全相同
|
||||
- 在强 forcing 情况下,可能与将来更严格实现有差异
|
||||
|
||||
### 这个选择的收益
|
||||
|
||||
- 主 kernel 改动极小
|
||||
- 不需要全场 owner map
|
||||
- 易于复用现有稀疏对象链路
|
||||
- 第一阶段很快能得到可用结果
|
||||
|
||||
对当前“先追求使用”的目标,这个 tradeoff 是合理的。
|
||||
|
||||
## 过滤规则建议
|
||||
|
||||
第一阶段应当保持规则简单。
|
||||
|
||||
### 建议规则
|
||||
|
||||
- 只对 `is_fluid(fl)` 的格点施力
|
||||
- 对 obstacle / wall / inlet / outlet 一律跳过
|
||||
- 与 curved body footprint 重叠时,由 cell flag 决定是否生效,而不是 force-region 自己猜
|
||||
|
||||
### 这里不必先完善的点
|
||||
|
||||
- actuator 与 actuator 的重叠叠加规则
|
||||
- 对 inlet/outlet 邻近区域的特殊处理
|
||||
- 对 sensor / force_region 同 id 绑定的逻辑
|
||||
|
||||
如果第一阶段允许多个 force region 存在,最简单的策略是先约束:
|
||||
|
||||
- footprint 不应重叠
|
||||
|
||||
或者:
|
||||
|
||||
- 重叠行为未定义,由上层调用者避免
|
||||
|
||||
## 配置与 API 建议
|
||||
|
||||
这里也不需要一次性定死。
|
||||
|
||||
### 最小外部接口至少应支持
|
||||
|
||||
- 新建一个圆形 `force_region`
|
||||
- 运行时更新它的 `fx, fy`
|
||||
|
||||
### 可选 API 形式
|
||||
|
||||
| 形式 | 特点 |
|
||||
|---|---|
|
||||
| `add_body("force_region", ...)` | 改动少,沿用现有入口 |
|
||||
| `add_force_region(...)` | 语义更清楚 |
|
||||
|
||||
### 运行时控制也有两种自然路线
|
||||
|
||||
| 形式 | 特点 |
|
||||
|---|---|
|
||||
| 扩展 `set_body(id, fx=..., fy=...)` | 改动小 |
|
||||
| 新增 `set_force_region(id, fx=..., fy=...)` | 语义清楚 |
|
||||
|
||||
第一阶段若追求少改代码,可优先沿用现有 `set_body()`。若 coder 认为 API 语义更重要,也可以新增专门入口。
|
||||
|
||||
## 对 `ObjectManager` 的建议
|
||||
|
||||
`ObjectManager` 已经偏大,因此第一阶段不建议再把很多新判断揉成一团。更合适的方式是:
|
||||
|
||||
- 在现有结构上增加一条最薄的新分支
|
||||
- 尽量与 `sensor` 的组织方式平行
|
||||
- 不在 `build_flags()` 中塞 force-region 的特例
|
||||
|
||||
### 在实现层面建议保持的分工
|
||||
|
||||
| 职责 | 位置 |
|
||||
|---|---|
|
||||
| 圆形 footprint 枚举 | `geometry` |
|
||||
| force-region SoA 打包 | `body/coupling` 或与其平行的位置 |
|
||||
| GPU buffer 生命周期 | `field` / SoA 容器 |
|
||||
| kernel 调度 | `stepper` |
|
||||
|
||||
这能避免 `manager` 再次回到“万能管理器”的方向。
|
||||
|
||||
## 对测试的建议
|
||||
|
||||
第一阶段至少需要三类测试。
|
||||
|
||||
### 1. 结构测试
|
||||
|
||||
- `force_region` 不改变 flag field
|
||||
- compact list cell 数与 footprint 预期一致
|
||||
- action 更新后 GPU buffer 内容可追踪
|
||||
|
||||
### 2. 数值冒烟测试
|
||||
|
||||
- 静止流场中施加恒定 `fx` 后,区域内流体沿 x 方向加速
|
||||
- `fx > 0` 与 `fx < 0` 响应方向相反
|
||||
- `fy` 路径同理
|
||||
|
||||
### 3. 回归保护
|
||||
|
||||
- 未添加 `force_region` 时,结果与当前版本一致
|
||||
- 添加 `force_region` 但 `fx=fy=0` 时,结果与当前版本一致或只存在舍入级差异
|
||||
|
||||
### 暂不要求的测试
|
||||
|
||||
- 与解析解严格比对
|
||||
- 多 region 重叠叠加
|
||||
- 强 forcing 的稳定性边界扫描
|
||||
|
||||
## 第一阶段完成后的理想状态
|
||||
|
||||
完成后,项目应具备以下能力:
|
||||
|
||||
- 能创建一个圆形局部施力区域
|
||||
- 能在运行时改变其 `fx, fy`
|
||||
- 不需要重新编译
|
||||
- 不需要引入全场 owner map
|
||||
- 不破坏现有 curved boundary 与 sensor 链路
|
||||
- 不迫使 `body` 与 `lbm` 做新的深度耦合
|
||||
|
||||
从架构角度看,第一阶段的关键成果不是“得到最完美的 actuator 抽象”,而是验证:
|
||||
|
||||
- 稀疏 cell list 路线足以支撑局部 forcing 研究
|
||||
- 现有系统能容纳一条新的 compact-list kernel 链路
|
||||
|
||||
## 第二阶段可能的演进方向
|
||||
|
||||
这些不属于当前实现范围,但第一阶段设计应避免把它们堵死:
|
||||
|
||||
- 读取 force-region 内平均速度或其他观测量
|
||||
- 将 `force_region` 与 `sensor` 的 footprint builder 进一步共用
|
||||
- 升级为更一般的 `region operator`
|
||||
- 改为在 `OneStep` 内逐格读取局部 force
|
||||
- 支持非圆形几何与 3D
|
||||
|
||||
第一阶段不需要为这些能力写完结构,只需要不要在命名和数据布局上把后路堵死。
|
||||
|
||||
## 建议的实现顺序
|
||||
|
||||
### 阶段 1
|
||||
|
||||
建立最小对象与 footprint 数据链。
|
||||
|
||||
- 新增 `force_region` 类型
|
||||
- 让 circle geometry 能产出中性 footprint cells
|
||||
- 新增 force-region SoA 与 GPU upload
|
||||
|
||||
### 阶段 2
|
||||
|
||||
接入运行时 action。
|
||||
|
||||
- 在 action slot 中为 `fx, fy` 留位置
|
||||
- 增加 host 侧更新接口
|
||||
- 保证不影响现有 `omega` 读取
|
||||
|
||||
### 阶段 3
|
||||
|
||||
新增局部 forcing kernel 并接入调度。
|
||||
|
||||
- 写 `ForceRegionKernel`
|
||||
- 接入 `stepper`
|
||||
- 明确与 sensor 的先后顺序
|
||||
|
||||
### 阶段 4
|
||||
|
||||
补最小测试与文档注释。
|
||||
|
||||
- 结构测试
|
||||
- 冒烟测试
|
||||
- 未启用时的回归保护
|
||||
|
||||
## 最终判断
|
||||
|
||||
第一阶段最稳妥的最小方案不是全场 owner map,也不是把 force-region 并进 sensor,而是:
|
||||
|
||||
- 把它当作一种新的稀疏 cell-list 对象
|
||||
- 复用圆形 footprint 生成逻辑
|
||||
- 通过独立 `ForceRegionKernel` 对局部 DDF 做 forcing 修正
|
||||
- 在接口和数据布局上只做最低必要改动
|
||||
|
||||
这条路线与现有代码风格最一致,也为后续更严格或更泛化的实现保留了余地。
|
||||
@@ -0,0 +1,398 @@
|
||||
# Force region 验证清单
|
||||
|
||||
这份清单面向当前已经实现的最小版 `force_region`:
|
||||
|
||||
- 2D
|
||||
- 圆形 footprint
|
||||
- 运行时设置均匀 `fx, fy`
|
||||
- operator-split 的局部 Guo forcing 修正
|
||||
- 不与 sensor 绑定
|
||||
|
||||
当前最合理的验证思路不是一次追求“单一终极 benchmark”,而是分三层推进:
|
||||
|
||||
1. **代码回归层**:先确认新功能没有破坏旧链路
|
||||
2. **物理正确性层**:先做最稳的流体响应验证
|
||||
3. **研究使用层**:再进入圆柱尾迹中的局部强迫实验
|
||||
|
||||
文献上,LBM forcing 的核心依据仍是 Guo forcing 的离散处理 [Guo02d]。对 body-force 驱动的通道流,Poiseuille 流是最经典的基准之一,[Zou95b] 给出了平板间 Poiseuille 流的解析结果,[Guo02d] 也把 steady Poiseuille flow 作为 forcing 验证的一部分。对**空间变化** forcing 的风险与误差来源,[Sil20b] 给出了很直接的提醒:非均匀 body force 会把离散误差暴露得更明显,因此验证必须包含**网格、黏度、幅值**三个维度的稳健性检查。
|
||||
|
||||
## 一句话总策略
|
||||
|
||||
先不要一上来把 `force_region` 扔进圆柱尾迹做复杂控制。先用最简单、最容易解释的流场把它跑顺:
|
||||
|
||||
- 零强迫回归
|
||||
- 单方向局部加速
|
||||
- 长通道近似 Poiseuille
|
||||
- 再进圆柱尾迹
|
||||
|
||||
## 第一层
|
||||
|
||||
### 必做回归检查
|
||||
|
||||
这些检查不依赖文献,但必须先过。
|
||||
|
||||
| 编号 | 目的 | 设置 | 预期结果 | 是否阻塞 |
|
||||
|---|---|---|---|---|
|
||||
| R1 | 新功能不引入假障碍 | 只加 `force_region`,不加圆柱 | `n_curved == 0`,flag 场不出现 obstacle / curved 覆盖 | 是 |
|
||||
| R2 | 零强迫不改变解 | 加 `force_region`,但 `fx=fy=0` | 与无 `force_region` 基线一致,或只剩舍入级差异 | 是 |
|
||||
| R3 | force 设置后可持续生效 | `set_force()` 后步进,再触发一次 action 刷新链路 | force 不被静默清零 | 是 |
|
||||
| R4 | 符号方向正确 | 同一算例跑 `+fx` 和 `-fx` | 主流响应方向相反,幅值同量级 | 是 |
|
||||
|
||||
R2 很关键。它回答的是:当前实现是不是“只是多了一条 dormant 数据链”,而不是“只要建了 force_region 就改了解”。
|
||||
|
||||
## 第二层
|
||||
|
||||
### 物理正确性主验证
|
||||
|
||||
这部分建议按从简单到复杂的顺序做。
|
||||
|
||||
## Case A
|
||||
|
||||
### 静止流场中的单圆局部加速
|
||||
|
||||
这是最小物理 sanity check。
|
||||
|
||||
#### 设置建议
|
||||
|
||||
- 格子:`nx = 256`, `ny = 128`
|
||||
- 碰撞:先用 `SRT`,LES 关闭
|
||||
- 流动初值:入口速度设为 0 或足够小,先得到近静止背景流
|
||||
- 不加圆柱
|
||||
- force region:
|
||||
- 圆心 `(96, 64)`
|
||||
- 半径 `r = 12`
|
||||
- 先做 `fx > 0, fy = 0`
|
||||
- 强迫幅值:从小值开始,例如 `fx = 1e-6`, `5e-6`, `1e-5`
|
||||
- 每组运行到准稳态或至少足够长,使局部响应明显
|
||||
|
||||
#### 该看什么
|
||||
|
||||
- `ux` 在 force region 附近应整体偏正
|
||||
- 区域下游应形成沿 `+x` 延伸的动量尾迹
|
||||
- `uy` 的主量级应明显小于 `ux`
|
||||
- 将 `fx` 改成负值后,整幅图应沿 x 方向近似镜像
|
||||
|
||||
#### 预期结果
|
||||
|
||||
这个 case 没有一个成熟的“标准 benchmark 数字”,但应满足最基本物理响应:
|
||||
|
||||
- 加速方向与 force 方向一致
|
||||
- 幅值随 `fx` 单调增强
|
||||
- 小 force 下解的结构应平滑,不应出现棋盘格、局部爆点或非对称破缺
|
||||
|
||||
#### 判定标准
|
||||
|
||||
| 检查项 | 通过标准 |
|
||||
|---|---|
|
||||
| 方向性 | `fx > 0` 时主响应沿 `+x`,`fx < 0` 时相反 |
|
||||
| 单调性 | 增大 `fx` 后,局部 `ux` 峰值与尾迹强度单调增大 |
|
||||
| 对称性 | 在无背景横向偏置时,上下半区统计应近似对称 |
|
||||
| 稳定性 | 小幅强迫下不出现数值振荡或孤立噪点 |
|
||||
|
||||
这个 case 的作用不是给出论文级定量结论,而是先证明:**局部 forcing 至少在最简单流场中按直觉工作。**
|
||||
|
||||
## Case B
|
||||
|
||||
### 长通道中的近 Poiseuille 验证
|
||||
|
||||
这是最重要的文献支持主验证。
|
||||
|
||||
Poiseuille 流是 LBM forcing 的经典基准,[Guo02d] 用 steady Poiseuille flow 验证 forcing 处理,[Zou95b] 给出了平板间 Poiseuille 流的解析形式。对当前代码,最现实的做法不是强行构造完全理想的周期通道,而是在**长通道中用超大圆形 force region 近似全域恒定体力驱动**,只在远离入口和出口的位置取剖面比较。
|
||||
|
||||
#### 建议设置
|
||||
|
||||
- 格子:`nx = 1024`, `ny = 128`
|
||||
- 碰撞:先用 `SRT`;通过后再试 `TRT` / `MRT`
|
||||
- LES:关闭
|
||||
- 圆柱:不加
|
||||
- 入口速度:尽量设小,避免 inlet 自身主导流场
|
||||
- force region:
|
||||
- 圆心放在通道中段,例如 `(512, 64)`
|
||||
- 半径取足够大,使绝大多数通道内部 fluid cell 都被覆盖,例如 `r = 600`
|
||||
- 强迫方向:`fx > 0, fy = 0`
|
||||
- 强迫幅值:先从小值开始,避免压缩性误差,例如 `1e-6` 量级
|
||||
|
||||
#### 为什么这样设
|
||||
|
||||
当前 `force_region` 只有圆形 footprint,没有全域矩形 forcing,也没有 x 周期边界。因此最稳妥的近似是:
|
||||
|
||||
- 用超大圆把中部通道几乎全覆盖
|
||||
- 只在远离入口和出口的位置取横截面
|
||||
- 检查剖面是否接近抛物线
|
||||
|
||||
#### 该比对什么
|
||||
|
||||
对 fully developed Poiseuille,经典剖面是抛物线 [Zou95b]:
|
||||
|
||||
\[
|
||||
u(y) = u_{max}\left(1 - \frac{y^2}{L^2}\right)
|
||||
\]
|
||||
|
||||
其中中心线速度最大,壁面速度为 0。对当前代码,最重要的不是把解析常数拟合到最后一位,而是确认以下结构性特征:
|
||||
|
||||
- 中部横截面是单峰抛物形
|
||||
- 中心线最大
|
||||
- 贴壁速度接近 0
|
||||
- `uy` 远小于 `ux`
|
||||
- 沿 x 方向进入发展段后,剖面变化减小
|
||||
|
||||
#### 推荐取样方式
|
||||
|
||||
在以下几个 x 位置取横截面:
|
||||
|
||||
- `x = 256`
|
||||
- `x = 512`
|
||||
- `x = 768`
|
||||
|
||||
只要中后段两条剖面几乎重合,就说明流场已经接近 fully developed,可拿来与抛物线拟合。
|
||||
|
||||
#### 预期结果
|
||||
|
||||
- 中段与后段 `ux(y)` 应近似抛物线 [Guo02d, Zou95b]
|
||||
- 若 `fx` 增大,剖面整体抬高,但形状仍保持单峰抛物型
|
||||
- 中段以后,剖面随 x 的变化应减弱
|
||||
|
||||
#### 如何定量判定
|
||||
|
||||
建议做三个量:
|
||||
|
||||
| 指标 | 解释 | 通过建议 |
|
||||
|---|---|---|
|
||||
| 抛物线拟合残差 | 用最小二乘拟合 `u(y)=a-b(y-yc)^2` | 中后段残差明显小于入口附近 |
|
||||
| 发展段一致性 | 比较两个下游截面 | 两条曲线基本重合 |
|
||||
| 横向速度污染 | `max |uy| / max |ux|` | 远小于 1 |
|
||||
|
||||
#### 关于误差的解释
|
||||
|
||||
不要把这个 case 解释得过头。因为当前代码的边界条件并不是“理想周期 x + 纯 body-force 驱动”,所以更合理的表述是:
|
||||
|
||||
- 这是一个**近 Poiseuille** 验证
|
||||
- 它主要验证 `force_region` 是否能在长通道里生成正确的 fully-developed 流动结构
|
||||
- 它不是对解析解逐点 machine-accuracy 的测试
|
||||
|
||||
另外,[Zou95b] 指出 bounce-back 边界会引入一阶壁面误差。因此如果壁面附近有明显偏差,不必立刻把它归咎于 `force_region` 本身;重点看的是中部剖面形状与下游收敛行为 [Zou95b]。
|
||||
|
||||
## Case C
|
||||
|
||||
### 幅值扫描
|
||||
|
||||
这个 case 用来回答:当前 operator-split forcing 在多大范围内是“线性可解释”的。
|
||||
|
||||
#### 设置建议
|
||||
|
||||
复用 Case B,只扫描 `fx`:
|
||||
|
||||
- `1e-6`
|
||||
- `2e-6`
|
||||
- `5e-6`
|
||||
- `1e-5`
|
||||
- `2e-5`
|
||||
|
||||
#### 预期结果
|
||||
|
||||
在小 force 区间内:
|
||||
|
||||
- 中心线速度大致随 `fx` 单调增加
|
||||
- 抛物剖面形状保持不变,仅幅值放大
|
||||
- 若开始出现明显非对称、密度波动或剖面畸变,说明已进入“不再适合作为线性基准”的区间
|
||||
|
||||
#### 该记录的量
|
||||
|
||||
- 中心线最大速度
|
||||
- 下游某截面的体积流量
|
||||
- `rho` 偏离 1 的最大值
|
||||
|
||||
这一步的目的不是证明某个严格比例律,而是找到一个**数值上舒服的工作区间**。后面做圆柱尾迹控制时,应优先选这个区间内的 force 幅值。
|
||||
|
||||
## Case D
|
||||
|
||||
### 网格与黏度稳健性
|
||||
|
||||
这是空间变化 forcing 必须做的检查,[Sil20b] 对这一点尤其值得参考。该文的核心提醒不是“所有非均匀 forcing 都会错”,而是:**空间变化 body force 更容易把离散误差暴露出来**,因此需要明确看网格和黏度敏感性 [Sil20b]。
|
||||
|
||||
#### 推荐做法
|
||||
|
||||
选用 Case B 或 Case A 中一个已经表现稳定的设置,然后做:
|
||||
|
||||
### 网格扫描
|
||||
|
||||
- `256 x 64`
|
||||
- `512 x 128`
|
||||
- `1024 x 256`
|
||||
|
||||
保持物理几何比例一致。
|
||||
|
||||
### 黏度扫描
|
||||
|
||||
固定一个小 force 幅值,扫两到三个 `nu`。
|
||||
|
||||
#### 预期结果
|
||||
|
||||
- 网格加密后,主剖面与主流结构应收敛
|
||||
- 黏度变化会改变速度幅值和扩散尺度,但不应引入新的奇怪畸变
|
||||
- 如果某个设置对黏度特别敏感,优先检查强迫是否过强、局部 Mach 数是否过高、或 region 是否离边界太近
|
||||
|
||||
#### 如何解读
|
||||
|
||||
[Sil20b] 的重点是在 TRT 下讨论空间变化 force 的离散误差来源,并指出某些 force 展开会引入额外不一致项。当前实现采用的是一个 operator-split 的局部 Guo 修正,而不是把空间变化 force 直接并入 `OneStep` 的逐格 collision。因此这一步更应被视为:
|
||||
|
||||
- 对当前实现的**数值稳健性检查**
|
||||
- 而不是与 [Sil20b] 的离散系统逐条同构比较
|
||||
|
||||
## 第三层
|
||||
|
||||
### 研究使用前的圆柱尾迹验证
|
||||
|
||||
在前两层都通过后,再进入最关心的 case:圆柱尾迹中的局部 forcing。
|
||||
|
||||
这里最重要的不是先追一个“标准答案数值”,而是先建立**可解释的响应地图**。
|
||||
|
||||
## Case E
|
||||
|
||||
### 圆柱后方局部推流
|
||||
|
||||
可用你已经验证过的固定圆柱 baseline,先选最稳的低 Re 工况,例如二维层流涡街基线。
|
||||
|
||||
#### 建议设置
|
||||
|
||||
- 使用你当前已经验证可靠的 2D 固定圆柱基线
|
||||
- 先选一个自然涡街清晰、但还不太剧烈的 Re
|
||||
- force region 放在圆柱后方近尾迹区
|
||||
|
||||
例如:
|
||||
|
||||
- 圆柱中心 `(xc, yc)`
|
||||
- force region 中心可先试:
|
||||
- `(xc + 2D, yc)`
|
||||
- `(xc + 3D, yc)`
|
||||
- 半径先从 `0.3D` 到 `0.8D` 扫
|
||||
- 先做 `fx > 0, fy = 0`
|
||||
|
||||
#### 该看什么
|
||||
|
||||
- 尾迹中心线速度是否回升
|
||||
- 近尾迹回流区是否缩短
|
||||
- `Cl` 振幅是否降低
|
||||
- `Cd_mean` 是否变化
|
||||
- 涡脱落频率 `St` 是否偏移
|
||||
- streakline / vorticity 图是否出现更对称或更拉长的尾迹结构
|
||||
|
||||
#### 预期结果
|
||||
|
||||
对于圆柱尾迹中的外加 forcing,不同 forcing 形式都说明了同一个大方向:**局部强迫会改写尾迹结构、拖曳、升力波动与脱落频率**。[Kim05b] 虽然研究的是壁面 blowing/suction 而不是体力区,但其结果清楚表明:分布式 forcing 可以显著抑制或改变 Kármán 涡街,从而改变 mean drag 与 lift fluctuation [Kim05b]。
|
||||
|
||||
对当前 `force_region`,更合理的预期是:
|
||||
|
||||
- 小 `fx > 0`:尾迹被顺流“拉长”,回流区可能缩短
|
||||
- 足够合适的位置和幅值下:`Cl_rms` 下降,尾迹更接近对称
|
||||
- 过强 forcing:可能引入新的不稳定结构,而不是单调“变好”
|
||||
|
||||
#### 判定方式
|
||||
|
||||
建议不要只看一张图,至少同时记录:
|
||||
|
||||
| 量 | 作用 |
|
||||
|---|---|
|
||||
| `Cd_mean` | 看平均阻力变化 |
|
||||
| `Cl_rms` | 看升力波动是否被抑制 |
|
||||
| `St` | 看脱落频率是否移动 |
|
||||
| vorticity / streakline 图 | 看结构是否更对称、更拉长、或出现新模态 |
|
||||
|
||||
#### 这个 case 的定位
|
||||
|
||||
这是**研究型验证**,不是严格 benchmark。
|
||||
|
||||
更准确地说,它回答的是:
|
||||
|
||||
- `force_region` 是否足够稳定和可控,能够进入尾迹控制实验
|
||||
- 不同位置、半径、幅值是否产生可解释的流场响应
|
||||
|
||||
而不是:
|
||||
|
||||
- 某个单一数字是否必须匹配文献到几个百分点
|
||||
|
||||
## 推荐的执行顺序
|
||||
|
||||
建议按下面顺序推进。
|
||||
|
||||
| 顺序 | 算例 | 作用 |
|
||||
|---|---|---|
|
||||
| 1 | R1-R4 | 先清掉实现错误 |
|
||||
| 2 | Case A | 验证最基本物理响应 |
|
||||
| 3 | Case B | 做文献支持最强的主验证 |
|
||||
| 4 | Case C | 找到安全幅值区间 |
|
||||
| 5 | Case D | 看网格与黏度稳健性 |
|
||||
| 6 | Case E | 进入圆柱尾迹研究 |
|
||||
|
||||
## 每个算例建议保存的输出
|
||||
|
||||
为了后面快速回看,建议每个 case 固定保存下面这些量。
|
||||
|
||||
| 输出 | 是否必需 | 说明 |
|
||||
|---|---|---|
|
||||
| 配置文件快照 | 必需 | 保证能复现实验 |
|
||||
| `fx, fy` 与 region 几何 | 必需 | force center, radius, amplitude |
|
||||
| 一张 `ux` 场图 | 必需 | 看主流响应 |
|
||||
| 一张 vorticity 图 | 推荐 | 看结构变化 |
|
||||
| 一条下游横截面 `ux(y)` | 必需 | Poiseuille 与 channel 类验证最关键 |
|
||||
| `rho` 最大偏离 | 推荐 | 监控压缩性污染 |
|
||||
| 若有圆柱:`Cd_mean`, `Cl_rms`, `St` | 必需 | 尾迹控制最关键 |
|
||||
|
||||
## 最低通过线
|
||||
|
||||
如果时间紧,只要先达到下面这三条,就可以开始把 `force_region` 用进研究实验:
|
||||
|
||||
1. **零强迫回归通过**
|
||||
2. **静止流场中局部加速方向正确、幅值单调**
|
||||
3. **长通道中下游横截面能稳定收敛到近抛物剖面**
|
||||
|
||||
做到这三条,说明这个新功能至少已经:
|
||||
|
||||
- 不破坏旧功能
|
||||
- 有正确方向性
|
||||
- 能在最经典的 body-force 场景中生成合理结构
|
||||
|
||||
## 如何解读失败
|
||||
|
||||
### 若 Case A 失败
|
||||
|
||||
优先怀疑:
|
||||
|
||||
- action slot 读写
|
||||
- force region footprint
|
||||
- `is_fluid(flag[k])` 过滤
|
||||
- `ForceRegionKernel` 写回 DDF 的路径
|
||||
|
||||
### 若 Case B 失败
|
||||
|
||||
优先怀疑:
|
||||
|
||||
- force region 是否真的覆盖了足够长的通道中段
|
||||
- inlet/outlet 是否过强地主导了解
|
||||
- force 幅值是否太大
|
||||
- 取样截面是否还在入口发展段
|
||||
|
||||
### 若 Case D 失败
|
||||
|
||||
优先怀疑:
|
||||
|
||||
- spatially varying forcing 本身的离散误差被放大
|
||||
- 当前 operator-split 修正对该参数区间不够稳
|
||||
- 需要收缩到更小 force、更低 Mach、更细网格
|
||||
|
||||
## 最后的建议
|
||||
|
||||
当前 `force_region` 最适合先被当作一个**研究工具**,而不是一开始就当作“已严格 benchmark 的标准物理模块”。最稳妥的路线是:
|
||||
|
||||
- 用 [Guo02d] 和 [Zou95b] 支撑主验证思路
|
||||
- 用 [Sil20b] 提醒自己必须做稳健性检查
|
||||
- 用 [Kim05b] 作为圆柱尾迹控制的高层参考,理解应该关注哪些响应量
|
||||
|
||||
这样做,既能尽快把功能用于研究,也不会把验证叙事说得过头。
|
||||
|
||||
## 参考依据
|
||||
|
||||
- Guo, Zheng, Shi 讨论了 forcing term 的离散效应,并将 steady Poiseuille flow 作为数值验证的一部分 [Guo02d]
|
||||
- Zou, Hou, Doolen 给出了平板间 Poiseuille 流的解析解,并指出 bounce-back 壁面会引入一阶误差 [Zou95b]
|
||||
- Silva 分析了空间变化 body force 在 LBM 中的离散误差来源,说明非均匀 forcing 必须做网格与黏度稳健性检查 [Sil20b]
|
||||
- Kim 和 Choi 表明分布式 forcing 可以显著改变圆柱尾迹、drag、lift fluctuation 和 shedding mode,可作为圆柱尾迹研究阶段的高层参照 [Kim05b]
|
||||
@@ -0,0 +1,247 @@
|
||||
# Rotating cylinder validation against [Kan99b]
|
||||
|
||||
## Goal
|
||||
|
||||
This validation should stay small, direct, and defensible.
|
||||
|
||||
The main design rules are:
|
||||
|
||||
- use the paper's direct numeric anchor at `Re = 100, alpha = 1.0` as the main hard benchmark
|
||||
- use a low-rotation case to test the lift trend
|
||||
- use suppression cases to test flow classification, not exact threshold fitting
|
||||
- do not treat values read from figures near `alpha_L` as tight amplitude targets
|
||||
|
||||
This keeps the matrix representative without overfitting to sensitive threshold points.
|
||||
|
||||
## Strong numeric anchors from [Kan99b]
|
||||
|
||||
The strongest exact benchmark in the paper is the convergence case at `Re = 100, alpha = 1.0`.
|
||||
|
||||
| Quantity | Reference value |
|
||||
|---|---:|
|
||||
| `St` | 0.1655 |
|
||||
| `mean C_L` | -2.4881 |
|
||||
| `mean C_D` | 1.1040 |
|
||||
| `C'_L` | 0.3631 |
|
||||
| `C'_D` | 0.0993 |
|
||||
|
||||
For low rotation at `Re = 100`, the paper also gives the mean lift trend
|
||||
|
||||
\[
|
||||
\overline{C_L} \approx -2.48\alpha
|
||||
\]
|
||||
|
||||
which is a good secondary benchmark for small `alpha`.
|
||||
|
||||
The suppression thresholds are given as trends:
|
||||
|
||||
| Reynolds number | Expected `alpha_L` |
|
||||
|---|---:|
|
||||
| 60 | about 1.4 |
|
||||
| 100 | about 1.8 |
|
||||
| 160 | about 1.9 |
|
||||
|
||||
These threshold values should be used as regime guides, not as tight one-point numeric targets. In the suppression curve from [Kan99b] shown above, the boundary is exactly the kind of place where a small solver difference can change the observed state.
|
||||
|
||||
## Fixed solver setup
|
||||
|
||||
| Item | Setting |
|
||||
|---|---|
|
||||
| Dimension | 2D |
|
||||
| Lattice | D2Q9 |
|
||||
| Streaming | double buffer |
|
||||
| Curved boundary | current Bouzidi moving wall implementation |
|
||||
| Inlet profile | uniform |
|
||||
| Top and bottom boundaries | free slip |
|
||||
| Outlet | neq extrapolation |
|
||||
| LES | off |
|
||||
| Precision | FP32 |
|
||||
| Cylinder diameter | `D = 30` lattice units |
|
||||
| Cylinder radius | `R = 15` lattice units |
|
||||
| Rotation input | update body omega only |
|
||||
|
||||
The baseline domain remains the current medium far field unless a later boundary sensitivity check shows otherwise.
|
||||
|
||||
## Inlet recommendation by collision model
|
||||
|
||||
Kan99b is an open-flow validation, not a confined-channel benchmark.
|
||||
|
||||
| Collision | Recommended inlet | Secondary choice | Avoid as primary |
|
||||
|---|---|---|---|
|
||||
| SRT | `equilibrium` | `regularized` | `zou_he_local` |
|
||||
| TRT | `regularized` | `equilibrium` | `zou_he_local` until the anchor is stable |
|
||||
| MRT | `regularized` or `zou_he_local` | `equilibrium` | `channel_stabilized` |
|
||||
|
||||
Keep one inlet family per collision model across the primary matrix.
|
||||
|
||||
## Lattice-unit mapping
|
||||
|
||||
Use
|
||||
|
||||
\[
|
||||
U_\infty = 0.03
|
||||
\]
|
||||
|
||||
With `D = 30`,
|
||||
|
||||
\[
|
||||
\nu = \frac{U_\infty D}{Re} = \frac{0.9}{Re}
|
||||
\]
|
||||
|
||||
| `Re` | `nu` | SRT equivalent `omega` |
|
||||
|---|---:|---:|
|
||||
| 60 | 0.015000 | 1.83486 |
|
||||
| 100 | 0.009000 | 1.89753 |
|
||||
| 160 | 0.005625 | 1.93470 |
|
||||
|
||||
The body rotation rate is
|
||||
|
||||
\[
|
||||
\omega_{body} = \frac{2 \alpha U_\infty}{D} = 0.002\alpha
|
||||
\]
|
||||
|
||||
| `alpha` | body omega |
|
||||
|---|---:|
|
||||
| 0.5 | 0.0010 |
|
||||
| 1.0 | 0.0020 |
|
||||
| 1.6 | 0.0032 |
|
||||
| 2.0 | 0.0040 |
|
||||
|
||||
## Primary matrix
|
||||
|
||||
This is the recommended main validation set.
|
||||
|
||||
| Case | `Re` | `alpha` | Role |
|
||||
|---|---:|---:|---|
|
||||
| K1 | 100 | 0.5 | low-rotation lift trend check |
|
||||
| K2 | 100 | 1.0 | strongest hard anchor |
|
||||
| K3 | 60 | 1.6 | low-Re suppression classification |
|
||||
| K4 | 100 | 2.0 | mid-Re suppression classification |
|
||||
| K5 | 160 | 2.0 | high-Re suppression classification |
|
||||
|
||||
Optional baseline if needed for debugging or plots:
|
||||
|
||||
| Case | `Re` | `alpha` | Status |
|
||||
|---|---:|---:|---|
|
||||
| K0 | 100 | 0.0 | optional |
|
||||
|
||||
This matrix covers:
|
||||
|
||||
- one periodic low-rotation trend point
|
||||
- one exact hard anchor with full force data
|
||||
- suppression behavior at low, medium, and high Reynolds number
|
||||
|
||||
## How to judge each case
|
||||
|
||||
### K1
|
||||
|
||||
Use K1 to check the low-rotation lift law.
|
||||
|
||||
Target:
|
||||
|
||||
\[
|
||||
\overline{C_L} \approx -2.48 \times 0.5 \approx -1.24
|
||||
\]
|
||||
|
||||
This is a trend check, not a strict fluctuation-amplitude benchmark.
|
||||
|
||||
### K2
|
||||
|
||||
Use K2 as the hard benchmark case.
|
||||
|
||||
Preferred agreement band:
|
||||
|
||||
| Quantity | Preferred band |
|
||||
|---|---:|
|
||||
| `St` | within 3 percent |
|
||||
| `mean C_L` | within 4 percent |
|
||||
| `mean C_D` | within 5 percent |
|
||||
| `C'_L` | within 8 percent |
|
||||
| `C'_D` | within 10 percent |
|
||||
|
||||
### K3 to K5
|
||||
|
||||
Use K3 to K5 as suppression classification cases.
|
||||
|
||||
Primary success signature:
|
||||
|
||||
- `C'_L` collapses toward zero in the final window
|
||||
- no sustained alternating wake remains
|
||||
- flow classification agrees with the expected suppressed regime
|
||||
|
||||
These are not exact threshold-fitting cases. Do not over-interpret a small residual fluctuation if the wake is otherwise clearly in the suppressed class.
|
||||
|
||||
## Optional threshold bracket check
|
||||
|
||||
If later you want a more explicit threshold study, use pairs around `alpha_L` rather than a single point on the boundary.
|
||||
|
||||
Recommended pairs:
|
||||
|
||||
| `Re` | Lower point | Upper point |
|
||||
|---|---:|---:|
|
||||
| 60 | 1.3 | 1.5 |
|
||||
| 100 | 1.7 | 1.9 |
|
||||
| 160 | 1.8 | 2.0 |
|
||||
|
||||
These should still be treated as regime-location checks, not hard force targets.
|
||||
|
||||
## Run policy
|
||||
|
||||
| Case type | Total steps | Warmup | Statistics |
|
||||
|---|---:|---:|---:|
|
||||
| K1 and K2 | 180000 to 220000 | first 40 percent | last 60 percent |
|
||||
| K3 to K5 | 220000 to 280000 | first 50 percent | last 50 percent |
|
||||
|
||||
The final statistics window should contain at least 20 shedding periods whenever the case remains periodic.
|
||||
|
||||
## TRT re-entry rule
|
||||
|
||||
Bring TRT back in this order:
|
||||
|
||||
1. K2 only
|
||||
2. if K2 is stable and credible, run K1
|
||||
3. only then run K3 to K5
|
||||
|
||||
This prevents TRT from expanding the matrix before the hard anchor is trustworthy.
|
||||
|
||||
## Deliverables
|
||||
|
||||
For each collision model, deliver:
|
||||
|
||||
- one table of run settings including collision, inlet scheme, wall type, `Re`, `alpha`, `nu`, and body omega
|
||||
- one CSV per run with force history
|
||||
- selected field images for wake classification
|
||||
- one summary table with `mean C_D`, `mean C_L`, `C'_D`, `C'_L`, and `St`
|
||||
- one short note stating whether suppression behavior matches [Kan99b]
|
||||
|
||||
## Recommended primary settings summary
|
||||
|
||||
| Collision | Wall | Inlet | Status |
|
||||
|---|---|---|---|
|
||||
| SRT | free slip | `equilibrium` | primary |
|
||||
| TRT | free slip | `regularized` | primary if K2 is stable |
|
||||
| MRT | free slip | `regularized` or `zou_he_local` | primary |
|
||||
|
||||
## MRT-only runner mapping
|
||||
|
||||
The current executable entrypoint is `tests/run_kan99b_rotating_cylinder.py`, and this round uses MRT-only scheduling:
|
||||
|
||||
- primary matrix is `K1-K5` with `MRT + regularized` inlet
|
||||
- one extra control run is added at K2 with `MRT + zou_he_local`
|
||||
- all runs keep `uniform` inlet profile, `free_slip` y-wall, `neq_extrap` outlet
|
||||
- output rows include `case_id`, `variant`, `collision`, `inlet_scheme`, `grid`, `steps`, `burn_in`, `St`, `St_error_pct` (for K2), and force metrics
|
||||
- K2 gate uses this document's per-metric tolerances for `St`, `mean C_L`, `mean C_D`, `C'_L`, `C'_D`
|
||||
|
||||
Example commands:
|
||||
|
||||
```bash
|
||||
conda run -n pycuda_3_10 python tests/run_kan99b_rotating_cylinder.py \
|
||||
--json-out tests/output/kan99b_validation/summary_runs.json
|
||||
|
||||
conda run -n pycuda_3_10 python tests/run_kan99b_rotating_cylinder.py \
|
||||
--case K2 --save-vorticity
|
||||
```
|
||||
|
||||
## Reference
|
||||
|
||||
[Kan99b] S. Kang, H. Choi, and S. Lee, “Laminar flow past a rotating circular cylinder,” 1999.
|
||||
@@ -0,0 +1,243 @@
|
||||
# Sah04 confined-cylinder validation against [Sah04]
|
||||
|
||||
## Goal
|
||||
|
||||
This validation should use a small set of direct periodic anchors from [Sah04], plus a small secondary block for near-onset flow-state checks.
|
||||
|
||||
The main design rules are:
|
||||
|
||||
- do not use interpolated values from figures as hard targets
|
||||
- do not use points on or extremely near critical curves as primary pass fail anchors
|
||||
- report realized blockage and realized Reynolds number, not just nominal inputs
|
||||
- use finer grids for high blockage so the narrow wall gaps are not under-resolved
|
||||
|
||||
This keeps the primary matrix small but still representative across moderate and high confinement.
|
||||
|
||||
## What counts as a hard benchmark from [Sah04]
|
||||
|
||||
The strongest periodic-flow anchors are the direct DNS values stated in the paper for developed unsteady states.
|
||||
|
||||
| Case | Blockage `beta` | Reynolds number | `St` target | Why it is a hard anchor |
|
||||
|---|---:|---:|---:|---|
|
||||
| S1 | 0.3 | 100 | 0.2115 | direct periodic DNS value |
|
||||
| S2 | 0.5 | 200 | 0.3513 | direct periodic DNS value |
|
||||
| S3 | 0.8 | 160 | `T ≈ 1.806`, so `St ≈ 0.5537` | direct case given in the paper |
|
||||
| S4 | 0.9 | 200 | 0.5314 | direct periodic DNS value |
|
||||
|
||||
These should be the primary Sah04 validation anchors.
|
||||
|
||||
## What should not be a hard target
|
||||
|
||||
The following are useful for qualitative or secondary checks, but not for the main validation gate:
|
||||
|
||||
- critical onset values from Table IV
|
||||
- any `St` or force value obtained by reading or interpolating a plot
|
||||
- cases chosen only to complete a rectangular parameter grid
|
||||
- points too close to the codimension two region or nearby neutral stability boundaries
|
||||
|
||||
This matters because the paper's stability map has several sensitive regions, especially at high blockage and near symmetry breaking. In the stability figure from [Sah04] shown above, those boundaries are exactly where a small setup difference can change the observed state.
|
||||
|
||||
## Geometry and blockage mapping
|
||||
|
||||
Keep the confined-channel layout and no-slip walls.
|
||||
|
||||
The validation table must always report both nominal and realized blockage.
|
||||
|
||||
With `D = 30` lattice units, the recommended realizations are:
|
||||
|
||||
| Case | `beta_nominal` | Suggested `H` | `beta_real` | Notes |
|
||||
|---|---:|---:|---:|---|
|
||||
| S1 | 0.3 | 100 | 0.3000 | exact |
|
||||
| S2 | 0.5 | 60 | 0.5000 | exact |
|
||||
| S3 | 0.8 | 38 or 37 | 0.7895 or 0.8108 | pick one and report it explicitly |
|
||||
| S4 | 0.9 | 33 | 0.9091 | use this, not `H = 35` |
|
||||
|
||||
Do not silently rename `beta_real` as the paper blockage.
|
||||
|
||||
## Grid density policy
|
||||
|
||||
High blockage cases need more wall-normal resolution than the base grid.
|
||||
|
||||
Minimum rule:
|
||||
|
||||
- for `beta < 0.8`, the baseline grid with `D = 30` is acceptable for the first pass
|
||||
- for `beta >= 0.8`, increase grid density by at least 2 times in each spatial direction before treating the result as validation quality
|
||||
|
||||
A practical way to do this is to keep geometry similarity while doubling the characteristic resolution:
|
||||
|
||||
- base cases: `D = 30`
|
||||
- high blockage validation cases: at least `D = 60`
|
||||
|
||||
Recommended high blockage realizations on the refined grid:
|
||||
|
||||
| Case | `beta_nominal` | Suggested refined `D` | Suggested refined `H` | `beta_real` |
|
||||
|---|---:|---:|---:|---:|
|
||||
| S3 | 0.8 | 60 | 75 | 0.8000 |
|
||||
| S4 | 0.9 | 60 | 67 | 0.8955 |
|
||||
|
||||
The point of this refinement is not only bulk accuracy. It is also to resolve the narrow cylinder wall gaps and reduce the risk that blockage effects are dominated by lattice geometry error.
|
||||
|
||||
## Primary matrix
|
||||
|
||||
This is the main Sah04 validation set.
|
||||
|
||||
| Case | `beta_nominal` | Primary target | Role |
|
||||
|---|---:|---|---|
|
||||
| S1 | 0.3 | `Re = 100`, `St = 0.2115` | moderate blockage periodic anchor |
|
||||
| S2 | 0.5 | `Re = 200`, `St = 0.3513` | medium blockage periodic anchor |
|
||||
| S3 | 0.8 | `Re = 160`, `St ≈ 0.5537` | high blockage periodic anchor |
|
||||
| S4 | 0.9 | `Re = 200`, `St = 0.5314` | very high blockage periodic anchor |
|
||||
|
||||
This matrix is smaller than the older grid, but it covers:
|
||||
|
||||
- moderate confinement
|
||||
- stronger confinement
|
||||
- high blockage periodic shedding
|
||||
- very high blockage periodic shedding
|
||||
|
||||
## Secondary onset block
|
||||
|
||||
These cases are recommended as flow-state checks, not hard `St` benchmarks.
|
||||
|
||||
| Case | `beta_nominal` | Suggested `Re` | Why it is useful | How to judge it |
|
||||
|---|---:|---:|---|---|
|
||||
| SO1 | 0.5 | about 130 | safely above first onset without sitting on the boundary | confirm sustained periodic state |
|
||||
| SO2 | 0.7 | about 120 | tests near-onset behavior in a more sensitive blockage range | confirm sustained periodic state |
|
||||
|
||||
These points exist to answer a different question from the primary matrix:
|
||||
|
||||
- does the solver enter and maintain the right flow regime once slightly above onset
|
||||
|
||||
For SO1 and SO2, judge by:
|
||||
|
||||
- persistent nonzero `C'_L`
|
||||
- a clean dominant spectral peak
|
||||
- repeatable periodic wake structure
|
||||
|
||||
Do not fail these runs because the measured `St` differs slightly from a value read from a nearby figure.
|
||||
|
||||
## Inlet and wall policy
|
||||
|
||||
Sah04 is a confined-channel benchmark, so inlet consistency matters more than inlet variety.
|
||||
|
||||
| Collision | Wall | Inlet | Status |
|
||||
|---|---|---|---|
|
||||
| SRT | no slip | `channel_stabilized` | primary |
|
||||
| TRT | no slip | `channel_stabilized` | primary |
|
||||
| MRT | no slip | `channel_stabilized` | primary |
|
||||
|
||||
Keep the inlet family fixed across collision models in the primary matrix.
|
||||
|
||||
Secondary inlet comparison, only after the primary set is working:
|
||||
|
||||
| Collision | Optional inlet | Status |
|
||||
|---|---|---|
|
||||
| MRT | `regularized` or `zou_he_local` | exploratory |
|
||||
| SRT or TRT | `equilibrium` or `regularized` | exploratory |
|
||||
|
||||
## Realized Reynolds number check
|
||||
|
||||
This is mandatory for Sah04.
|
||||
|
||||
For each run, record:
|
||||
|
||||
- nominal inlet definition
|
||||
- developed downstream velocity profile
|
||||
- measured `U_max,real`
|
||||
- measured bulk velocity if available
|
||||
- `beta_nominal`
|
||||
- `beta_real`
|
||||
- `Re_nominal`
|
||||
- `Re_real`
|
||||
|
||||
Use the paper-consistent label
|
||||
|
||||
\[
|
||||
Re_{real} = \frac{U_{max,real} D}{\nu}
|
||||
\]
|
||||
|
||||
for the final comparison table.
|
||||
|
||||
If `Re_real` drifts materially from the intended target, treat that as a setup problem before treating it as a Strouhal miss.
|
||||
|
||||
## Run policy
|
||||
|
||||
| Case block | Total steps | Burn | Statistics |
|
||||
|---|---:|---:|---:|
|
||||
| S1 and S2 | 100000 to 160000 | first 35 to 40 percent | last 60 to 65 percent |
|
||||
| S3 and S4 | 180000 to 260000 | first 45 percent | last 55 percent |
|
||||
| SO1 and SO2 | 140000 to 220000 | first 45 percent | last 55 percent |
|
||||
|
||||
For high blockage refined runs, prefer the longer end of the window.
|
||||
|
||||
## Evaluation rule
|
||||
|
||||
Use a two-layer rule.
|
||||
|
||||
### Primary periodic anchors
|
||||
|
||||
| Case | Hard target use |
|
||||
|---|---|
|
||||
| S1 to S4 | hard periodic benchmark anchors |
|
||||
|
||||
Preferred agreement band:
|
||||
|
||||
- within 5 percent when `Re_real` is close to target and the spectrum is clean
|
||||
- within 10 percent still acceptable if the run is clearly periodic and the residual mismatch is explainable by `Re_real` drift or geometry realization
|
||||
|
||||
### Secondary onset block
|
||||
|
||||
| Case | Hard target use |
|
||||
|---|---|
|
||||
| SO1 and SO2 | no hard `St` gate |
|
||||
|
||||
Success means:
|
||||
|
||||
- the flow is clearly unsteady and periodic
|
||||
- the dominant frequency is stable over long windows
|
||||
- the wake classification is consistent with being above onset
|
||||
|
||||
## Deliverables
|
||||
|
||||
For each run, deliver:
|
||||
|
||||
- one row with `beta_nominal`, `beta_real`, `Re_nominal`, `Re_real`, `nu`, collision, wall type, inlet scheme, and grid resolution
|
||||
- one downstream velocity-profile plot
|
||||
- one force-history CSV
|
||||
- one `St` estimate with the exact analysis window stated
|
||||
- selected wake images for flow classification
|
||||
|
||||
## Recommended minimum set
|
||||
|
||||
If compute budget is tight, run this order first:
|
||||
|
||||
| Priority | Runs |
|
||||
|---|---|
|
||||
| 1 | MRT on S1 to S4 |
|
||||
| 2 | SRT on S2 and S4 |
|
||||
| 3 | TRT on S2 and S4 |
|
||||
| 4 | SO1 and SO2 only after the primary anchors are behaving |
|
||||
|
||||
## MRT-only runner mapping
|
||||
|
||||
The current executable entrypoint is `tests/run_sah04_st_matrix.py`, and it is now aligned to this document's primary S1-S4 matrix:
|
||||
|
||||
- collision is fixed to `MRT`
|
||||
- inlet is fixed to `parabolic + channel_stabilized`
|
||||
- case set is `S1-S4` only
|
||||
- output rows include `case_id`, `collision`, `inlet_scheme`, `grid`, `steps`, `burn_in`, `St`, `St_error_pct`, `Re_real`, `beta_real`
|
||||
- default hard gate is 5% (`--gate-pct` can relax it to 10%)
|
||||
|
||||
Example commands:
|
||||
|
||||
```bash
|
||||
conda run -n pycuda_3_10 python tests/run_sah04_st_matrix.py \
|
||||
--json-out tests/output/sah04_mrt/summary.json
|
||||
|
||||
conda run -n pycuda_3_10 python tests/run_sah04_st_matrix.py \
|
||||
--case S3 --gate-pct 10 --final-vorticity-dir tests/output/sah04_mrt/vorticity
|
||||
```
|
||||
|
||||
## Reference
|
||||
|
||||
[Sah04] M. Sahin and R. G. Owens, “A numerical investigation of wall effects up to high blockage ratios on two-dimensional flow past a confined circular cylinder,” 2004.
|
||||
@@ -0,0 +1,181 @@
|
||||
229:无控制:
|
||||
```
|
||||
SIGNAL_FEATURES0 = {
|
||||
'action1': {
|
||||
'mean': 0.0,
|
||||
'components': [
|
||||
(0.1354, 0.0, 1.600),
|
||||
]
|
||||
},
|
||||
'action2': {
|
||||
'mean': -0.0,
|
||||
'components': [
|
||||
(0.1354, 0.0, 2.099),
|
||||
]
|
||||
},
|
||||
'action3': {
|
||||
'mean': 0.0,
|
||||
'components': [
|
||||
(0.1354, 0.0, 1.639),
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
234:隐身:
|
||||
```
|
||||
SIGNAL_FEATURES1 = {
|
||||
'action1': {
|
||||
'mean': 0.0,
|
||||
'components': [
|
||||
(0.1354, 0.0, 1.600),
|
||||
]
|
||||
},
|
||||
'action2': {
|
||||
'mean': -0.01806,
|
||||
'components': [
|
||||
(0.1354, 0.0, 2.099),
|
||||
]
|
||||
},
|
||||
'action3': {
|
||||
'mean': 0.01806,
|
||||
'components': [
|
||||
(0.1354, 0.0, 1.639),
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
欺骗:
|
||||
237 238 253:
|
||||
```
|
||||
SIGNAL_FEATURES2 = {
|
||||
'action1': {
|
||||
'mean': 0.0,
|
||||
'components': [
|
||||
(0.1354, 0.0026, 1.600), # 主频
|
||||
]
|
||||
},
|
||||
'action2': {
|
||||
'mean': -0.008730,
|
||||
'components': [
|
||||
(0.1354, 0.0045, 2.099), # 主频
|
||||
(0.2708, 0.0010, 0.612),
|
||||
]
|
||||
},
|
||||
'action3': {
|
||||
'mean': 0.008730,
|
||||
'components': [
|
||||
(0.1354, 0.0045, 1.639), # 主频
|
||||
(0.2708, 0.0010, -2.962),
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
257:
|
||||
```
|
||||
SIGNAL_FEATURES3 = {
|
||||
'action1': {
|
||||
'mean': 0.0,
|
||||
'components': [
|
||||
(0.1354, 0.0029, -2.619), # 主频
|
||||
(0.2708, 0.0008, 2.856),
|
||||
]
|
||||
},
|
||||
'action2': {
|
||||
'mean': -0.0140,
|
||||
'components': [
|
||||
(0.1354, 0.0050, -0.933), # 主频
|
||||
(0.2708, 0.0010, 0.801),
|
||||
(0.1806, 0.0003, 1.854),
|
||||
]
|
||||
},
|
||||
'action3': {
|
||||
'mean': 0.014,
|
||||
'components': [
|
||||
(0.1354, 0.0050, -1.398), # 主频
|
||||
(0.2708, 0.0010, 2.208),
|
||||
(0.1806, 0.0003, 1.810),
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
260 (f*1.5):
|
||||
```
|
||||
SIGNAL_FEATURES4 = {
|
||||
'action1': {
|
||||
'mean': 0.0,
|
||||
'components': [
|
||||
(0.2031, 0.0026, 1.600), # 主频
|
||||
]
|
||||
},
|
||||
'action2': {
|
||||
'mean': -0.008730,
|
||||
'components': [
|
||||
(0.2031, 0.0045, 2.099), # 主频
|
||||
(0.4062, 0.0010, 0.612),
|
||||
]
|
||||
},
|
||||
'action3': {
|
||||
'mean': 0.008730,
|
||||
'components': [
|
||||
(0.2031, 0.0045, 1.639), # 主频
|
||||
(0.4062, 0.0010, -2.962),
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
262: (f*1.5):
|
||||
```
|
||||
SIGNAL_FEATURES5 = {
|
||||
'action1': {
|
||||
'mean': 0.0,
|
||||
'components': [
|
||||
(0.2031, 0.0029, -2.619), # 主频
|
||||
(0.4062, 0.0008, 2.856),
|
||||
]
|
||||
},
|
||||
'action2': {
|
||||
'mean': -0.0140,
|
||||
'components': [
|
||||
(0.2031, 0.0050, -0.933), # 主频
|
||||
(0.4062, 0.0010, 0.801),
|
||||
(0.2709, 0.0003, 1.854),
|
||||
]
|
||||
},
|
||||
'action3': {
|
||||
'mean': 0.014,
|
||||
'components': [
|
||||
(0.2031, 0.0050, -1.398), # 主频
|
||||
(0.4062, 0.0010, 2.208),
|
||||
(0.2709, 0.0003, 1.810),
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
270 (f*2):
|
||||
```
|
||||
SIGNAL_FEATURES6 = {
|
||||
'action1': {
|
||||
'mean': 0.0,
|
||||
'components': [
|
||||
(0.2708, 0.0044, -2.619), # 主频
|
||||
(0.8124, 0.0012, 2.856),
|
||||
]
|
||||
},
|
||||
'action2': {
|
||||
'mean': -0.014,
|
||||
'components': [
|
||||
(0.2708, 0.0075, -0.933), # 主频
|
||||
(0.8124, 0.0015, 0.801),
|
||||
(0.5418, 0.0005, 1.854),
|
||||
]
|
||||
},
|
||||
'action3': {
|
||||
'mean': 0.014,
|
||||
'components': [
|
||||
(0.2708, 0.0075, -1.398), # 主频
|
||||
(0.8124, 0.0015, 2.208),
|
||||
(0.5418, 0.0005, 1.810),
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,493 @@
|
||||
## Streakline postprocessing design
|
||||
|
||||
这份说明面向一个最小可实现的离线后处理程序。输入是按时间保存的二维速度场序列,输出是接近实验染色图的 streakline 图像。核心路线是连续释粒,因为 streakline 正是“固定位置持续释放染料后,在某个时刻所有已释放粒子的位置集合” [Lan96]。对非定常尾迹,这比单帧 streamline 更贴近实验图像 [Lan96]。
|
||||
|
||||
搜索和全文阅读给出的信息已经足够支撑第一版实现。最直接的方案是按保存时刻连续注入粒子,用时空插值后的速度场推进粒子,再将粒子云渲染为图像 [Lan96, Ken96]。如果纯粒子结果过于尖锐,再在推进后加入一个很小的随机扩散项,作为对真实染色液扩散的近似。更完整的被动标量法当然更物理,但实现成本更高,不适合作为第一版 [Kim04]。
|
||||
|
||||
## Core recommendation
|
||||
|
||||
| 方法 | 与实验染色图的对应 | 实现复杂度 | 适合作为第一版 |
|
||||
|---|---|---:|---|
|
||||
| 单帧 streamline | 弱 | 很低 | 不推荐 |
|
||||
| 连续释粒 streakline | 强 | 低 | 最推荐 |
|
||||
| streakline 加少量扩散 | 很强 | 低到中 | 推荐作为第二步 |
|
||||
| 被动标量对流扩散 | 最强 | 中到高 | 暂不作为第一版 |
|
||||
|
||||
最小可实现路线如下:
|
||||
|
||||
- 从 CelerisLab 导出一串二维速度场快照 `u_x(x,y,t_k), u_y(x,y,t_k)`
|
||||
- 选定一个固定释放点或一小段释放线
|
||||
- 在每个保存时刻都注入新粒子
|
||||
- 在两个相邻快照之间,用时间插值和空间插值计算粒子速度
|
||||
- 用二阶或四阶时间积分推进粒子
|
||||
- 删去出域粒子与进入固体的粒子
|
||||
- 将当前时刻存活粒子按位置和年龄渲染成图像
|
||||
|
||||
这个程序逻辑直接对应 [Lan96] 的 streakline 算法,插值与推进细节由 [Ken96] 和 [Dar96] 支撑。
|
||||
|
||||
## Data contract
|
||||
|
||||
默认输入是规则 Cartesian 网格上的二维时间序列速度场。对当前项目,最自然的输入约定是:
|
||||
|
||||
| 名称 | 含义 |
|
||||
|---|---|
|
||||
| `t_k` | 第 `k` 个保存时刻 |
|
||||
| `ux[k, j, i]` | 时刻 `t_k` 的 x 方向速度 |
|
||||
| `uy[k, j, i]` | 时刻 `t_k` 的 y 方向速度 |
|
||||
| `mask[j, i]` | 可选,固体与流体标记 |
|
||||
| `x_i, y_j` | 网格坐标 |
|
||||
|
||||
第一版最好满足下面三条:
|
||||
|
||||
- 时间快照间隔固定或至少已知
|
||||
- 网格坐标固定不动
|
||||
- 固体几何位置已知,至少能判断粒子是否进入圆柱内部
|
||||
|
||||
如果输出来自 CelerisLab,本质上只需要把每个保存时刻的 `ux, uy` 和对应时间写出来即可。算法本身是通用的,并不依赖 LBM 本身。
|
||||
|
||||
## Mathematical model for the base streakline
|
||||
|
||||
### Particle motion
|
||||
|
||||
粒子位置满足拉格朗日运动方程 [Lan96]:
|
||||
|
||||
\[
|
||||
\frac{d \boldsymbol{x}}{dt} = \boldsymbol{u}(\boldsymbol{x}, t)
|
||||
\]
|
||||
|
||||
其中
|
||||
|
||||
\[
|
||||
\boldsymbol{x} = (x, y), \qquad \boldsymbol{u} = (u_x, u_y)
|
||||
\]
|
||||
|
||||
积分形式为 [Lan96]:
|
||||
|
||||
\[
|
||||
\boldsymbol{x}(t + \Delta t) = \boldsymbol{x}(t) + \int_t^{t+\Delta t} \boldsymbol{u}(\boldsymbol{x}(\tau), \tau) \, d\tau
|
||||
\]
|
||||
|
||||
streakline 在观察时刻 \(t_n\) 的定义是:从固定释放位置 \(\boldsymbol{x}_s\) 在过去各时刻持续注入的粒子,在 \(t_n\) 时刻的全部位置集合 [Lan96]。
|
||||
|
||||
### Time interpolation
|
||||
|
||||
速度场只在离散时刻存储,所以必须做时间插值。对位于 \(t_k \le t \le t_{k+1}\) 的任意子步,最简单的做法是线性时间插值 [Ken96]:
|
||||
|
||||
\[
|
||||
\delta = \frac{t - t_k}{t_{k+1} - t_k}
|
||||
\]
|
||||
|
||||
\[
|
||||
\boldsymbol{u}(\boldsymbol{x}, t) = (1 - \delta) \, \boldsymbol{u}_k(\boldsymbol{x}) + \delta \, \boldsymbol{u}_{k+1}(\boldsymbol{x})
|
||||
\]
|
||||
|
||||
这里 \(\boldsymbol{u}_k(\boldsymbol{x})\) 和 \(\boldsymbol{u}_{k+1}(\boldsymbol{x})\) 仍需通过空间插值得到。
|
||||
|
||||
### Spatial interpolation
|
||||
|
||||
在规则网格上,第一版直接用双线性插值即可。虽然 [Ken96] 讨论的是非结构网格上的点定位与线性插值,但其一般原则完全适用于规则网格:
|
||||
|
||||
- 先定位粒子所在单元
|
||||
- 再用单元顶点速度插值得到粒子点速度 [Ken96]
|
||||
|
||||
若粒子位于单元局部坐标 \((\xi, \eta) \in [0,1]^2\),四个角点速度为 \(\boldsymbol{u}_{00}, \boldsymbol{u}_{10}, \boldsymbol{u}_{01}, \boldsymbol{u}_{11}\),则
|
||||
|
||||
\[
|
||||
\boldsymbol{u}(\xi, \eta) = (1-\xi)(1-\eta) \boldsymbol{u}_{00}
|
||||
+ \xi (1-\eta) \boldsymbol{u}_{10}
|
||||
+ (1-\xi)\eta \boldsymbol{u}_{01}
|
||||
+ \xi\eta \boldsymbol{u}_{11}
|
||||
\]
|
||||
|
||||
## Time integration choice
|
||||
|
||||
[Lan96] 和 [Ken96] 都直接使用四阶 Runge Kutta。对你的第一版程序,推荐两个选项:
|
||||
|
||||
| 积分器 | 优点 | 缺点 | 建议 |
|
||||
|---|---|---|---|
|
||||
| RK2 | 简洁,容易调试 | 精度一般 | 最小原型可用 |
|
||||
| RK4 | 文献最一致,精度更稳 | 每步插值次数更多 | 默认推荐 |
|
||||
|
||||
RK4 的更新式为 [Lan96, Ken96]:
|
||||
|
||||
\[
|
||||
\boldsymbol{x}_{n+1} = \boldsymbol{x}_n + \frac{1}{6}(\boldsymbol{a} + 2\boldsymbol{b} + 2\boldsymbol{c} + \boldsymbol{d})
|
||||
\]
|
||||
|
||||
其中
|
||||
|
||||
\[
|
||||
\boldsymbol{a} = \Delta t \, \boldsymbol{u}(\boldsymbol{x}_n, t_n)
|
||||
\]
|
||||
|
||||
\[
|
||||
\boldsymbol{b} = \Delta t \, \boldsymbol{u}(\boldsymbol{x}_n + \tfrac{1}{2}\boldsymbol{a}, t_n + \tfrac{1}{2}\Delta t)
|
||||
\]
|
||||
|
||||
\[
|
||||
\boldsymbol{c} = \Delta t \, \boldsymbol{u}(\boldsymbol{x}_n + \tfrac{1}{2}\boldsymbol{b}, t_n + \tfrac{1}{2}\Delta t)
|
||||
\]
|
||||
|
||||
\[
|
||||
\boldsymbol{d} = \Delta t \, \boldsymbol{u}(\boldsymbol{x}_n + \boldsymbol{c}, t_n + \Delta t)
|
||||
\]
|
||||
|
||||
[Ken96] 特别强调,RK4 的每一个子步都要重新做点定位与时空插值。这在规则网格上不难实现,只是意味着一次完整步进需要四次速度查询 [Ken96]。
|
||||
|
||||
## Practical timestep guidance
|
||||
|
||||
第一版不必上自适应步长,但步长不能随意设大。搜索里最重要的精度提醒来自 [Dar96]:
|
||||
|
||||
- 非定常粒子积分的误差常常由时间离散控制,而不是概念本身
|
||||
- 合理步长必须不大于流动主要非定常时间尺度的同量级 [Dar96]
|
||||
- 若时间步过大,粒子轨迹会在拓扑上都出错,而不仅是位置略偏 [Dar96]
|
||||
|
||||
对当前项目,最简单的工程准则是:
|
||||
|
||||
\[
|
||||
\Delta t_{trace} \le \min \bigl(\alpha_t \, \Delta t_{save},\; \alpha_x \, \frac{\Delta x}{\max |u|} \bigr)
|
||||
\]
|
||||
|
||||
其中 \(\Delta t_{save}\) 是两个保存快照之间的时间间隔,\(\Delta x\) 是网格尺度。第一版可取:
|
||||
|
||||
- \(\alpha_t = 0.1 \sim 0.25\)
|
||||
- \(\alpha_x = 0.25 \sim 0.5\)
|
||||
|
||||
这不是文献中的严格上界,而是结合 [Dar96] 的结论给出的实现准则:粒子推进子步既要显著小于保存间隔,也不要一子步跨过太多网格。
|
||||
|
||||
[Ken96] 还给了一个很实用的自适应思路:根据相邻速度方向夹角调节步长。如果速度方向变化太快就减半,变化很小就加倍 [Ken96]。这很适合后续增强版,但不属于第一版必需项。
|
||||
|
||||
## Base streakline algorithm
|
||||
|
||||
### Release strategy
|
||||
|
||||
最符合染色实验的是连续释粒 [Lan96]。第一版可用两种释放方式:
|
||||
|
||||
| 方式 | 适用场景 | 建议 |
|
||||
|---|---|---|
|
||||
| 单点释放 | 针头式染料入口 | 最简单 |
|
||||
| 短线段释放 | 更像细缝或细带注入 | 更稳健 |
|
||||
|
||||
如果实验是在圆柱上游某一点持续释放染色液,第一版就直接使用单点释放。
|
||||
|
||||
### Particle state
|
||||
|
||||
每个粒子只需保存:
|
||||
|
||||
| 字段 | 含义 |
|
||||
|---|---|
|
||||
| `x, y` | 当前坐标 |
|
||||
| `t_birth` | 释放时刻 |
|
||||
| `age` | 当前年龄 |
|
||||
| `alive` | 是否仍在域内 |
|
||||
|
||||
第一版不需要保存整条历史轨迹。因为你要的是当前时刻的 streakline 图,而不是每个粒子的 pathline 曲线。
|
||||
|
||||
**常见误区(务必区分)**
|
||||
|
||||
| 概念 | 画什么 | 是否等于水洞染色迹线 |
|
||||
|---|---|---|
|
||||
| **Streakline(迹线)** | 固定源点**持续释粒**,在观察时刻 \(t_n\) 画出**所有仍存活粒子的当前位置**(可带年龄衰减权重) | 是 |
|
||||
| **Pathline(迹线/轨道)** | 单个粒子从释放到当前的**整条历史轨迹** | 否 |
|
||||
| **错误实现** | 每隔一段时间放一个粒子,再把**所有粒子走过的路径段**全部叠加到图上 | 否(这是 pathline 叠加,不是 streakline) |
|
||||
|
||||
水洞实验:针头在固定点连续注 dye → 某一时刻拍照 → 看到的是“此刻染料粒子在流场里的分布”,一条下游色带由**不同释放时刻、当前仍在本流场中的粒子**共同构成,而不是把每个粒子从出生到现在的轨迹都画出来。
|
||||
|
||||
### Main loop pseudocode
|
||||
|
||||
```text
|
||||
given velocity snapshots U[k] = {ux[k], uy[k]} at times t[k]
|
||||
given seeding point or seeding segment S
|
||||
initialize empty particle list P
|
||||
|
||||
for k = 0 to N-2:
|
||||
|
||||
inject new particles at source S at time t[k]
|
||||
|
||||
set t_local = t[k]
|
||||
while t_local < t[k+1]:
|
||||
dt = min(dt_trace, t[k+1] - t_local)
|
||||
|
||||
for each particle p in P with p.alive:
|
||||
v = interpolate_velocity(p.position, t_local)
|
||||
advance p by one integration step using RK2 or RK4
|
||||
update p.age
|
||||
if p leaves domain:
|
||||
p.alive = false
|
||||
if p enters solid body:
|
||||
p.alive = false
|
||||
|
||||
t_local = t_local + dt
|
||||
|
||||
optionally remove very old particles
|
||||
optionally render current particle cloud
|
||||
```
|
||||
|
||||
这个结构与 [Lan96] 的离散 streakline 算法一致,只是把“从 `t_k` 到 `t_{k+1}` 的一次推进”细化成多个更小的粒子子步,以满足 [Dar96] 对精度的要求。
|
||||
|
||||
### Velocity query pseudocode
|
||||
|
||||
```text
|
||||
function interpolate_velocity(position x, time t):
|
||||
find k such that t[k] <= t <= t[k+1]
|
||||
compute delta = (t - t[k]) / (t[k+1] - t[k])
|
||||
|
||||
u_k = bilinear_interpolation(U[k], x)
|
||||
u_k1 = bilinear_interpolation(U[k+1], x)
|
||||
|
||||
return (1 - delta) * u_k + delta * u_k1
|
||||
```
|
||||
|
||||
这是第一版最核心的数值部件。只要这部分实现正确,streakline 程序主体就很直接。
|
||||
|
||||
## Small diffusion particle model
|
||||
|
||||
当纯 streakline 太细、太锐利、不像染色液图像时,可以给每个粒子加一个很小的随机扩散项。这不是严格的被动标量求解,但能以很低代价增加染色带宽度。
|
||||
|
||||
### Guiding idea
|
||||
|
||||
[Kim04] 表明,染料图像更接近一个被动标量浓度场,其基本控制方程是对流扩散方程:
|
||||
|
||||
\[
|
||||
\frac{\partial c}{\partial t} + \boldsymbol{u} \cdot \nabla c = D \nabla^2 c
|
||||
\]
|
||||
|
||||
其中 \(c\) 是染料浓度,\(D\) 是扩散系数。对第一版粒子法,一个常见近似是将每个粒子的位置更新写成“对流加随机扩散”:
|
||||
|
||||
\[
|
||||
\boldsymbol{x}_{n+1} = \boldsymbol{x}_n + \Delta \boldsymbol{x}_{adv} + \Delta \boldsymbol{x}_{diff}
|
||||
\]
|
||||
|
||||
其中 \(\Delta \boldsymbol{x}_{adv}\) 由 RK2 或 RK4 给出,扩散项取二维各向同性随机增量:
|
||||
|
||||
\[
|
||||
\Delta \boldsymbol{x}_{diff} = \sqrt{2 D \Delta t}
|
||||
\begin{bmatrix}
|
||||
\eta_x \\
|
||||
\eta_y
|
||||
\end{bmatrix}
|
||||
\]
|
||||
|
||||
这里 \(\eta_x, \eta_y \sim \mathcal{N}(0,1)\)。
|
||||
|
||||
这个形式本身是对扩散过程的标准随机游走近似。搜索结果提醒,随机游走模型如果处理不当会产生假漂移与错误浓度偏置 [Mac92]。因此第一版的使用原则应当很克制:
|
||||
|
||||
- 只用于加入少量模糊和厚度
|
||||
- 不把粒子密度当成严格浓度
|
||||
- 不在强近壁统计上过度解读结果
|
||||
|
||||
### Diffusive particle update pseudocode
|
||||
|
||||
```text
|
||||
for each particle p in P with p.alive:
|
||||
x_adv = RK4_step(p.position, t_local, dt)
|
||||
|
||||
sigma = sqrt(2 * D * dt)
|
||||
dx_rand = sigma * normal(0, 1)
|
||||
dy_rand = sigma * normal(0, 1)
|
||||
|
||||
x_new = x_adv + [dx_rand, dy_rand]
|
||||
|
||||
if x_new leaves domain:
|
||||
p.alive = false
|
||||
else if x_new enters solid:
|
||||
p.alive = false
|
||||
else:
|
||||
p.position = x_new
|
||||
p.age += dt
|
||||
```
|
||||
|
||||
### Choosing the diffusion level
|
||||
|
||||
第一版不必试图从真实染料物性严格标定 \(D\)。更实用的做法是把 \(D\) 当作视觉匹配参数,并保持它足够小,使图像结构仍主要由对流控制。
|
||||
|
||||
[Kim04] 用 Schmidt 数控制扩散强弱。若已有参考速度 \(U\) 和长度尺度 \(L\),则
|
||||
|
||||
\[
|
||||
Sc = \frac{\nu}{D}
|
||||
\]
|
||||
|
||||
也可写成
|
||||
|
||||
\[
|
||||
D = \frac{\nu}{Sc}
|
||||
\]
|
||||
|
||||
对第一版,可以用下面的思路选扩散强度:
|
||||
|
||||
| 目标效果 | 建议 |
|
||||
|---|---|
|
||||
| 只想让线条略微变厚 | 取较大 `Sc`,即很小的 `D` |
|
||||
| 想模拟明显洗开和模糊 | 取较小 `Sc`,即较大的 `D` |
|
||||
| 不确定 | 先从几乎看不出的弱扩散开始 |
|
||||
|
||||
因为当前目标是“少量扩散”,所以推荐先把扩散当成弱修饰,而不是主导机制。
|
||||
|
||||
## Rendering logic
|
||||
|
||||
最终图像不需要把每个粒子的完整轨迹都画出来。更像实验染色图的做法是把当前存活粒子投影到图像网格上,生成粒子密度图或带年龄权重的强度图。
|
||||
|
||||
### Minimal rendering choices
|
||||
|
||||
| 方法 | 图像风格 | 实现难度 |
|
||||
|---|---|---:|
|
||||
| 直接散点 | 最简陋 | 很低 |
|
||||
| 网格计数直方图 | 像浓度图 | 低 |
|
||||
| 高斯核累积 | 更平滑 | 低到中 |
|
||||
|
||||
第一版推荐:
|
||||
|
||||
- 把每个粒子投到像素网格
|
||||
- 对像素做计数或加权累积
|
||||
- 最后做一次轻微 Gaussian blur
|
||||
|
||||
这与先做完整被动标量相比便宜很多,但视觉上已经会很接近实验染色图。
|
||||
|
||||
### Optional particle weighting
|
||||
|
||||
可以给粒子一个简单权重:
|
||||
|
||||
\[
|
||||
I = \sum_p w_p K(\boldsymbol{x} - \boldsymbol{x}_p)
|
||||
\]
|
||||
|
||||
其中 \(K\) 是像素核或 Gaussian 核。第一版里,权重 \(w_p\) 可直接取 1,也可对年龄做衰减,例如:
|
||||
|
||||
\[
|
||||
w_p = \exp\left(- \frac{\mathrm{age}_p}{\tau_f} \right)
|
||||
\]
|
||||
|
||||
这样旧粒子会逐渐淡出,图像不会无限堆积。
|
||||
|
||||
## Boundary handling
|
||||
|
||||
这部分先按最小原则处理即可。
|
||||
|
||||
| 情况 | 第一版处理 |
|
||||
|---|---|
|
||||
| 粒子出计算域 | 直接删除 |
|
||||
| 粒子进入圆柱内部 | 直接删除 |
|
||||
| 粒子贴近边界滑动 | 暂不专门处理 |
|
||||
| 扩散后跨入固体 | 直接删除 |
|
||||
|
||||
这样做的优点是简单稳妥。后续若发现近壁 streakline 误差明显,再考虑反射、投影或更物理的壁面处理。
|
||||
|
||||
## Minimal implementation plan
|
||||
|
||||
### Version 1
|
||||
|
||||
目标是尽快得到可信的 streakline 图:
|
||||
|
||||
- 读取 `ux, uy, t`
|
||||
- 单点连续释粒
|
||||
- 双线性空间插值
|
||||
- 线性时间插值
|
||||
- RK4 粒子推进
|
||||
- 出域删除与入固体删除
|
||||
- 粒子计数成图
|
||||
|
||||
### Version 2
|
||||
|
||||
在不改变主体架构的前提下增强视觉效果:
|
||||
|
||||
- 增加短线段释放
|
||||
- 增加年龄衰减
|
||||
- 增加弱随机扩散
|
||||
- 用 Gaussian 核代替简单计数
|
||||
|
||||
### Version 3
|
||||
|
||||
若后续发现实验图像明显受扩散与混合主导,再转向更重的模型:
|
||||
|
||||
- 被动标量对流扩散
|
||||
- 用 \(Sc\) 或 \(D\) 做参数标定 [Kim04]
|
||||
|
||||
## Design decisions that are already justified by the literature
|
||||
|
||||
下面这些设计已经有足够文献支撑,可以直接采用:
|
||||
|
||||
- 用 streakline 而不是 streamline 对应持续染色实验 [Lan96]
|
||||
- 用连续释放粒子离线重构 streakline [Lan96]
|
||||
- 用时空插值从离散速度快照查询粒子速度 [Ken96]
|
||||
- 用 RK4 作为默认推进器 [Lan96, Ken96]
|
||||
- 把步长取得明显小于保存时间间隔,并避免一次跨过太多网格 [Dar96]
|
||||
- 若需要更像染料图,可以加入弱扩散,或后续上升到被动标量 [Kim04]
|
||||
|
||||
## Recommended default choices
|
||||
|
||||
| 项目 | 默认选择 |
|
||||
|---|---|
|
||||
| 释放方式 | 单点连续释粒 |
|
||||
| 空间插值 | 双线性 |
|
||||
| 时间插值 | 线性 |
|
||||
| 积分器 | RK4 |
|
||||
| 粒子子步 | 保存步长的 0.1 到 0.25 |
|
||||
| 固体处理 | 入固体即删除 |
|
||||
| 输出图像 | 粒子密度图加轻微模糊 |
|
||||
| 扩散 | 默认关闭,作为第二步 |
|
||||
|
||||
## Bottom line
|
||||
|
||||
对当前项目,最简洁且足够准确的程序逻辑不是去解新的染料场,而是先做一个离线连续释粒 streakline 后处理器。它只依赖时间序列速度场,程序结构清楚,数值风险也集中在可控的几个环节:时空插值、积分步长和边界删除 [Lan96, Dar96, Ken96]。在此基础上,再增加一个弱随机扩散项,就能以很小代价把图像从“几何上正确的粒子线”推进到“更像实验染色照片”的粒子云 [Kim04]。
|
||||
|
||||
## CelerisLab implementation mapping
|
||||
|
||||
Current implementation lives in:
|
||||
|
||||
- library: `src/CelerisLab/common/streakline.py`
|
||||
- Kan99b demo CLI: `tests/run_kan99b_streakline.py`
|
||||
- experiment notebook: `tests/experiment.ipynb` (CLEAN 5/6)
|
||||
|
||||
Available runtime modes:
|
||||
|
||||
- `online`: sample `Simulation.get_macroscopic()` directly in memory (no velocity snapshot files).
|
||||
- `offline`: replay from an existing snapshot directory and run the same streakline integrator.
|
||||
|
||||
Dense release support:
|
||||
|
||||
- base upstream points are expanded by `release_mode` (`point|line|strip`).
|
||||
- `strip` mode densifies both cross-stream (`line_count`, `line_span`) and downstream (`downstream_count`, `downstream_spacing`) directions.
|
||||
|
||||
### Performance notes (why it can feel slow)
|
||||
|
||||
Streakline post-processing is **CPU-side** in the current stack:
|
||||
|
||||
1. **GPU→host velocity copies** dominate for large grids (`nx=6000, ny=1200`). Each `get_macroscopic()` pulls full `ux/uy` arrays.
|
||||
2. Particle RK4 + bilinear interpolation runs in NumPy on CPU (vectorized over particles, not GPU).
|
||||
3. Rendering accumulates polylines into an image (optionally multi-threaded via `ThreadPoolExecutor`).
|
||||
|
||||
Practical tuning:
|
||||
|
||||
| knob | effect |
|
||||
|---|---|
|
||||
| `sample_every` | larger → fewer host copies, faster, coarser streaks |
|
||||
| `max_particle_age` | `None` → no hard cutoff; trails survive until boundary/solid |
|
||||
| `num_threads` | `0` = auto; sets OpenBLAS/OMP threads for blur/host ops |
|
||||
| `blur_sigma` | `0` disables Gaussian blur pass |
|
||||
|
||||
For `experiment.ipynb` triangle case, use **`render_streakline_density(..., minimal_axes=True)`** on the **final alive particle cloud** (`positions`, `ages`). Do **not** accumulate and draw full path history (`render_snapshot_trails` is pathline-style debug only).
|
||||
|
||||
### Clean render style (experiment)
|
||||
|
||||
`render_snapshot_trails` defaults:
|
||||
|
||||
- white background
|
||||
- red streaks, brighter toward the downstream end (`fade_along_trail=True`)
|
||||
- black filled cylinders
|
||||
- no axes, labels, colorbar, or release-point markers
|
||||
|
||||
Example commands:
|
||||
|
||||
```bash
|
||||
# Online in-memory streakline (no snapshot write)
|
||||
conda run -n pycuda_3_10 python tests/run_kan99b_streakline.py \
|
||||
--mode online --domain M --re 100 --alpha 1.0 \
|
||||
--sample-every 300 --n-snapshots 20 \
|
||||
--release-mode strip --line-count 7 --downstream-count 6
|
||||
|
||||
# Offline replay from existing velocity snapshots
|
||||
conda run -n pycuda_3_10 python tests/run_kan99b_streakline.py \
|
||||
--mode offline \
|
||||
--snapshot-dir tests/output/final_validation_round/streakline_kan99b_k2/velocity_snapshots \
|
||||
--release-mode strip --line-count 7 --downstream-count 6
|
||||
```
|
||||
@@ -0,0 +1,123 @@
|
||||
"""Public API demo: fixed 2:1 patch with a stationary, optionally actuated circle.
|
||||
|
||||
From this checkout, after checking the selected physical GPU is idle:
|
||||
PYTHONPATH="$PWD/src" CUDA_VISIBLE_DEVICES=0 python examples/fixed_patch_circle.py
|
||||
... --speed -0.002 --mode slot_reservoir
|
||||
Both levels use blocked storage (--base-block, --fine-block tiles).
|
||||
|
||||
A short smoke run (default 128 coarse steps): it shows setup, stepping and
|
||||
fluid-only diagnostics, not a developed flow, accuracy or long-time stability.
|
||||
Normal blowing/suction injects/extracts mass, so leaf mass is expected to change.
|
||||
No files, plots or checkpoints are written.
|
||||
"""
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
|
||||
import CelerisLab
|
||||
from CelerisLab.body.geometry.circle import CircleGeometry
|
||||
from CelerisLab.body.objects import SimObject, SurfaceActuation
|
||||
from CelerisLab.config import LBMConfig
|
||||
from CelerisLab.cuda.context import CudaContext
|
||||
from CelerisLab.lbm.descriptors import D2Q9_EX, D2Q9_EY, SOLID
|
||||
from CelerisLab.lbm.equilibrium import compute_feq_d2q9
|
||||
from CelerisLab.lbm.refinement import ACTIVE
|
||||
from CelerisLab.lbm.refinement_stepper import FixedPatchStepper
|
||||
|
||||
NX, NY, BOUNDS = 32, 24, (8, 6, 24, 18) # coarse cells; patch is half-open (x0, y0, x1, y1)
|
||||
CENTER, RADIUS = (16.0, 12.0), 2.15 # coarse CELL-EDGE frame: cell I spans [I, I+1)
|
||||
|
||||
|
||||
def config(mode):
|
||||
if mode == "periodic": # x and y periodic coarse level
|
||||
return LBMConfig(nx=NX, ny=NY, viscosity=.1)
|
||||
# Bottom on-site velocity slot, top fixed-density reservoir, x periodic.
|
||||
return LBMConfig(nx=NX, ny=NY, viscosity=.1, velocity=0, wall_normal_velocity=.001,
|
||||
wall_slot_width=8, y_wall_bc="on_site_velocity", top_wall_bc="reservoir")
|
||||
|
||||
|
||||
def leaf_masks(run, mode):
|
||||
"""Known fluid leaves: uncovered coarse cells (minus wall rows in slot mode)
|
||||
and fine ACTIVE cells outside the body."""
|
||||
p = run.hierarchy.pairs[0]
|
||||
x0, y0, x1, y1 = p.bounds
|
||||
coarse = np.ones(p.coarse_shape, bool)
|
||||
coarse[y0:y1, x0:x1] = False
|
||||
if mode == "slot_reservoir":
|
||||
coarse[[0, -1]] = False
|
||||
solid = (run.boundaries[1].flags.reshape(p.fine_shape) & SOLID) != 0
|
||||
return coarse, (p.fine_kind == ACTIVE) & ~solid
|
||||
|
||||
|
||||
def leaf_diagnostics(coarse, fine, masks):
|
||||
"""Fluid leaves only; a non-finite population or rho <= 0 there is an error.
|
||||
|
||||
Mass counts a fine cell as 1/4 of a coarse cell (2D, 2:1)."""
|
||||
out = {}
|
||||
for name, g, leaf, area in (("coarse", coarse, masks[0], 1.0), ("fine", fine, masks[1], .25)):
|
||||
f = g[:, leaf].astype(np.float64)
|
||||
rho = f.sum(axis=0)
|
||||
if not np.isfinite(f).all() or (rho <= 0).any():
|
||||
raise RuntimeError(f"non-finite population or non-positive density on a {name} fluid leaf")
|
||||
ux = (np.array(D2Q9_EX)[:, None] * f).sum(axis=0) / rho
|
||||
uy = (np.array(D2Q9_EY)[:, None] * f).sum(axis=0) / rho
|
||||
out[name] = (area * rho.sum(), rho.min(), rho.max(), np.hypot(ux, uy).max())
|
||||
return out
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
parser.add_argument("--mode", choices=("periodic", "slot_reservoir"), default="periodic")
|
||||
parser.add_argument("--speed", type=float, default=.002,
|
||||
help="normal surface velocity, coarse lattice units (+ blows, - sucks, 0 passive)")
|
||||
parser.add_argument("--base-block", type=int, nargs=2, metavar=("BY", "BX"), default=(12, 8),
|
||||
help="root tile; must divide the 24 x 32 root")
|
||||
parser.add_argument("--fine-block", type=int, nargs=2, metavar=("BY", "BX"), default=(16, 20),
|
||||
help="fine tile; must divide the whole fine allocation (32 x 40 here)")
|
||||
parser.add_argument("--steps", type=int, default=128)
|
||||
args = parser.parse_args()
|
||||
if args.steps < 0:
|
||||
parser.error("--steps must be nonnegative")
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
if Path(CelerisLab.__file__).resolve() != root / "src/CelerisLab/__init__.py":
|
||||
raise RuntimeError(f"Set PYTHONPATH to {root / 'src'}")
|
||||
|
||||
# Aperture centred at angle 0.7 rad, half-width 0.85 rad (the tested fixture).
|
||||
spec = SurfaceActuation(0.7, 0.85, args.speed) if args.speed else None
|
||||
body = SimObject(0, geometry=CircleGeometry(*CENTER, RADIUS), center=CENTER, radius=RADIUS,
|
||||
surface_actuation=spec)
|
||||
cfg = config(args.mode)
|
||||
# The caller owns the CUDA context; the stepper must be closed first (the
|
||||
# nested with-statement does that).
|
||||
with CudaContext(0) as context, FixedPatchStepper(
|
||||
cfg, context=context, coarse_boundary=args.mode, refinements=[BOUNDS],
|
||||
level_blocks=[tuple(args.base_block), tuple(args.fine_block)],
|
||||
level_objects=[(), (body,)]) as run:
|
||||
p = run.hierarchy.pairs[0]
|
||||
# Rest equilibrium is already postcollision G, so no initial collision is
|
||||
# needed. Non-leaf entries (covered, ghost, solid) are discarded by initialize.
|
||||
rest = np.asarray(compute_feq_d2q9(1.0, 0.0, 0.0), np.float32)[:, None, None]
|
||||
run.initialize(np.broadcast_to(rest, (9, *p.coarse_shape)),
|
||||
np.broadcast_to(rest, (9, *p.fine_shape)))
|
||||
storage = f"blocked root {tuple(args.base_block)} fine {tuple(args.fine_block)}"
|
||||
print(f"mode={args.mode} storage={storage} speed={args.speed:+g} "
|
||||
f"(fine allocation {p.fine_shape[0]}x{p.fine_shape[1]}, fine origin {p.fine_origin})")
|
||||
masks = leaf_masks(run, args.mode)
|
||||
start = leaf_diagnostics(*run.download(), masks)
|
||||
for _ in range(0, args.steps, 32):
|
||||
run.step(min(32, args.steps - run.step_count))
|
||||
coarse, fine = run.download() # synchronized postcollision G, NaN on non-leaves
|
||||
d = leaf_diagnostics(coarse, fine, masks)
|
||||
mass = d["coarse"][0] + d["fine"][0]
|
||||
rho_lo = min(d["coarse"][1], d["fine"][1])
|
||||
rho_hi = max(d["coarse"][2], d["fine"][2])
|
||||
speed = max(d["coarse"][3], d["fine"][3])
|
||||
print(f"coarse step {run.step_count:4d}: leaf mass {mass:.9f} "
|
||||
f"(change {mass - start['coarse'][0] - start['fine'][0]:+.3e}) "
|
||||
f"rho [{rho_lo:.6f}, {rho_hi:.6f}] max |u| {speed:.3e}")
|
||||
print("smoke run only: storage/stepping demonstration, not accuracy or stability evidence")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,206 @@
|
||||
"""Low-Re startup flow in an x-periodic confined domain; nozzle remains coarse.
|
||||
|
||||
From this checkout, after checking the selected physical GPU is idle:
|
||||
PYTHONPATH="$PWD/src" CUDA_VISIBLE_DEVICES=0 python examples/fixed_patch_jet.py --output /tmp/patch-jet
|
||||
|
||||
The fixed-amplitude start includes acoustic transients, not a developed jet.
|
||||
Only native leaf cells are plotted. No interpolation, restart or flow oracle.
|
||||
Scale estimates use the continuous peak A=.02, not inlet mean speed: W/A=600,
|
||||
H/A=2250, W**2/nu=1440, H**2/nu=20250, where H=NY-3=45 between on-site planes.
|
||||
An acoustic crossing (~78 steps) does not imply that transients have disappeared.
|
||||
Mach is sampled over all leaves every 50 steps and is usually inlet dominated;
|
||||
the discrete inlet peak is slightly below continuous A. This is not an accuracy test.
|
||||
The 120s checks are cooperative, not an exact interruption deadline. main elapsed
|
||||
includes construction, advancement and plotting; it is not pure CFD timing.
|
||||
"""
|
||||
import argparse
|
||||
from dataclasses import replace
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
import numpy as np
|
||||
|
||||
import CelerisLab
|
||||
from CelerisLab.config import load_lbm_config
|
||||
from CelerisLab.cuda.context import CudaContext
|
||||
from CelerisLab.lbm.equilibrium import compute_feq_d2q9, compute_macro_from_ddf
|
||||
from CelerisLab.lbm.refinement import ACTIVE
|
||||
from CelerisLab.lbm.refinement_stepper import FixedPatchStepper
|
||||
|
||||
BOUNDS, AMPLITUDE, WIDTH = (16, 4, 32, 28), .02, 12
|
||||
LEVEL_BLOCKS = [(12, 8), (8, 8)] # blocked storage: 48x48 root, 56x40 fine window
|
||||
TIMES, MAX_MACH, MAX_SECONDS = (0, 300, 1200), .1, 120
|
||||
|
||||
|
||||
def measure(arrays, masks, centers, initial_mass):
|
||||
fields = []
|
||||
for array, mask in zip(arrays, masks):
|
||||
if not np.isfinite(array[:, mask]).all():
|
||||
raise RuntimeError("Nonfinite leaf populations")
|
||||
field = np.full((*mask.shape, 3), np.nan)
|
||||
field[mask] = [compute_macro_from_ddf(f) for f in array[:, mask].T]
|
||||
fields.append(field)
|
||||
leaves = np.concatenate([f[m] for f, m in zip(fields, masks)])
|
||||
speed = np.hypot(leaves[:, 1], leaves[:, 2])
|
||||
mass = sum(area*a[:, m].sum(dtype=np.float64)
|
||||
for area, a, m in zip((1, .25), arrays, masks))
|
||||
record = dict(finite=bool(np.isfinite(leaves).all()), rho_min=float(leaves[:, 0].min()),
|
||||
rho_max=float(leaves[:, 0].max()), speed_max=float(speed.max()),
|
||||
sampled_max_Mach=float(speed.max()*np.sqrt(3)),
|
||||
density_deviation=float(np.abs(leaves[:, 0]-1).max()),
|
||||
discrete_leaf_mass=float(mass), mass_change=float(mass-initial_mass))
|
||||
if not record['finite'] or record['rho_min'] <= 0 or record['sampled_max_Mach'] > MAX_MACH:
|
||||
raise RuntimeError(f"Finite/positive-density/Ma<={MAX_MACH} guard failed: {record}")
|
||||
walls = fields[0][[1, -2]]
|
||||
record['macro_sum_rho_v'] = dict(zip(('Q_in', 'Q_out'),
|
||||
(walls[:, :, 0]*walls[:, :, 2]).sum(axis=1).tolist()))
|
||||
record['centerline'] = []
|
||||
for level, y in ((1, 16.25), (0, 32.5)):
|
||||
xs, ys = centers[level]
|
||||
columns = np.argsort(np.abs(xs-24))[:2]
|
||||
row = int(np.flatnonzero(ys == y)[0])
|
||||
values = fields[level][row, columns].mean(axis=0)
|
||||
record['centerline'].append(dict(level=level, x=24, y=y,
|
||||
sampled_x=sorted(xs[columns].tolist()), rule='arithmetic mean of two neighboring native columns',
|
||||
rho_ux_uy=values.tolist()))
|
||||
return fields, record
|
||||
|
||||
|
||||
def draw(out, snapshots, masks, centers):
|
||||
import matplotlib
|
||||
matplotlib.use('Agg')
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.collections import PolyCollection
|
||||
|
||||
def decorate(ax):
|
||||
ax.set(xlim=(0, 48), ylim=(1.5, 46.5), aspect='equal', xlabel='X', ylabel='Y')
|
||||
ax.plot([16, 32, 32, 16, 16], [4, 4, 28, 28, 4], color='tab:red', lw=1)
|
||||
ax.axhline(1.5, color='black', lw=1)
|
||||
ax.axhline(46.5, color='black', lw=1, ls='--')
|
||||
ax.plot([18, 30], [1.5, 1.5], color='tab:orange', lw=4, clip_on=False)
|
||||
|
||||
fig, ax = plt.subplots(figsize=(6, 6), constrained_layout=True)
|
||||
for mask, (xs, ys), dx in zip(masks, centers, (1, .5)):
|
||||
yy, xx = np.meshgrid(ys, xs, indexing='ij')
|
||||
cells = np.stack((xx[mask], yy[mask]), axis=-1)
|
||||
vertices = cells[:, None, :] + dx*np.array([[-.5, -.5], [.5, -.5], [.5, .5], [-.5, .5]])
|
||||
ax.add_collection(PolyCollection(vertices, facecolors='none', edgecolors='0.55', linewidths=.3))
|
||||
decorate(ax)
|
||||
ax.set_title('Native leaf grid: coarse dx=1, fine dx=0.5\n'
|
||||
'Red: internal patch; orange: coarse slot; dashed: reservoir\n'
|
||||
'Flow may cross patch sides; patch does not contain all startup flow', fontsize=10)
|
||||
fig.savefig(out/'layout.png', dpi=150, bbox_inches='tight', pad_inches=.15)
|
||||
plt.close(fig)
|
||||
vmax = max(1., *(np.nanmax(np.hypot(f[..., 1], f[..., 2]))/AMPLITUDE
|
||||
for fields in snapshots for f in fields))
|
||||
fig, axes = plt.subplots(1, 3, figsize=(12, 4.8), constrained_layout=True)
|
||||
for ax, step, fields in zip(axes, TIMES, snapshots):
|
||||
for field, mask, (xs, ys), dx in zip(fields, masks, centers, (1, .5)):
|
||||
speed = np.ma.masked_where(~mask, np.hypot(field[..., 1], field[..., 2])/AMPLITUDE)
|
||||
image = ax.pcolormesh(np.r_[xs-dx/2, xs[-1]+dx/2],
|
||||
np.r_[ys-dx/2, ys[-1]+dx/2], speed,
|
||||
shading='flat', cmap='viridis', vmin=0, vmax=vmax, rasterized=True)
|
||||
stride = int(4/dx)
|
||||
yy, xx = np.meshgrid(ys, xs, indexing='ij')
|
||||
selection = np.zeros_like(mask)
|
||||
selection[::stride, ::stride] = mask[::stride, ::stride]
|
||||
ax.quiver(xx[selection], yy[selection], field[..., 1][selection], field[..., 2][selection],
|
||||
angles='xy', scale_units='xy', scale=AMPLITUDE/3, width=.005, color='white')
|
||||
decorate(ax)
|
||||
ax.set_title(f'coarse t={step}, fine steps={2*step}')
|
||||
fig.colorbar(image, ax=axes, label='speed / imposed amplitude')
|
||||
fig.suptitle('Low-Re startup flow in an x-periodic confined domain\n'
|
||||
'Fixed-amplitude start includes acoustic transients; not steady/developed\n'
|
||||
'Nozzle remains coarse; flow may cross patch sides (not fully enclosed)', fontsize=11)
|
||||
fig.savefig(out/'velocity.png', dpi=150)
|
||||
plt.close(fig)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--output', type=Path, required=True)
|
||||
out = parser.parse_args().output.resolve()
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
if Path(CelerisLab.__file__).resolve() != root/'src/CelerisLab/__init__.py':
|
||||
raise RuntimeError(f'Set PYTHONPATH to {root / "src"}')
|
||||
out.mkdir(parents=True, exist_ok=False)
|
||||
cfg = replace(load_lbm_config(str(root/'src/CelerisLab/configs/config_lbm.json')),
|
||||
nx=48, ny=48, viscosity=.1, velocity=0., rho=1., wall_slot_width=WIDTH,
|
||||
wall_normal_velocity=AMPLITUDE, y_wall_bc='on_site_velocity', top_wall_bc='reservoir',
|
||||
lattice_model='D2Q9', collision='SRT', streaming='double_buffer',
|
||||
store_precision='FP32', ddf_shifting=False, les_enabled=False)
|
||||
report = dict(config=dict(nx=48, ny=48, bounds=BOUNDS, W=WIDTH, A=AMPLITUDE, nu=.1,
|
||||
rho=1, tau_coarse=.8, tau_fine=1.1, coarse_boundary='slot_reservoir',
|
||||
level_blocks=LEVEL_BLOCKS),
|
||||
guards=dict(check_every=50, positive_density=True, finite=True,
|
||||
max_Mach=MAX_MACH, max_seconds=MAX_SECONDS,
|
||||
timing='cooperative checks, not an exact interruption deadline'),
|
||||
scale_estimates=dict(velocity_basis='continuous peak A, not inlet mean', H=cfg.ny-3,
|
||||
W_over_A=WIDTH/AMPLITUDE, H_over_A=(cfg.ny-3)/AMPLITUDE,
|
||||
W_squared_over_nu=WIDTH**2/cfg.viscosity,
|
||||
H_squared_over_nu=(cfg.ny-3)**2/cfg.viscosity,
|
||||
acoustic_crossing=(cfg.ny-3)*np.sqrt(3)),
|
||||
notes='Node mass uses areas 1 and 1/4, not an exact physical volume integral. '
|
||||
'Q_in/Q_out are bottom/top macro sum(rho*vy), not a closed population budget. '
|
||||
'Mach maxima are sampled every 50 steps, not every-step peaks. '
|
||||
'One acoustic crossing does not imply transient decay; no steady-state claim.',
|
||||
samples=[], status='running', last_synchronized_coarse_step=0)
|
||||
start, run = time.monotonic(), None
|
||||
try:
|
||||
with CudaContext(0) as context, FixedPatchStepper(cfg, context=context,
|
||||
coarse_boundary='slot_reservoir', refinements=[BOUNDS],
|
||||
level_blocks=LEVEL_BLOCKS) as run:
|
||||
p = run.hierarchy.pairs[0]
|
||||
masks = [np.ones(p.coarse_shape, bool), p.fine_kind == ACTIVE]
|
||||
masks[0][[0, -1]] = False
|
||||
masks[0][4:28, 16:32] = False
|
||||
centers = [(origin[0]+dx*(np.arange(shape[1])+.5),
|
||||
origin[1]+dx*(np.arange(shape[0])+.5))
|
||||
for shape, origin, dx in ((p.coarse_shape, (0, 0), 1),
|
||||
(p.fine_shape, p.fine_origin, .5))]
|
||||
initial = [np.broadcast_to(compute_feq_d2q9(1., 0., 0.)[:, None, None], (9, *m.shape)).copy()
|
||||
for m in masks]
|
||||
for x in range(cfg.nx):
|
||||
v = AMPLITUDE*max(0., 1-((2*x-(cfg.nx-1))/WIDTH)**2)**2
|
||||
initial[0][:, 1, x] = compute_feq_d2q9(1., 0., v)
|
||||
run.initialize(*initial)
|
||||
mass0 = sum(area*a[:, m].sum(dtype=np.float64)
|
||||
for area, a, m in zip((1, .25), initial, masks))
|
||||
snapshots = []
|
||||
for step in range(0, TIMES[-1]+1, 50):
|
||||
if time.monotonic()-start > MAX_SECONDS:
|
||||
raise TimeoutError('120 second demonstration limit reached')
|
||||
if step:
|
||||
run.step(50)
|
||||
report['last_synchronized_coarse_step'] = run.step_count
|
||||
if time.monotonic()-start > MAX_SECONDS:
|
||||
raise TimeoutError('120 second demonstration limit reached after chunk')
|
||||
fields, sample = measure(run.download(), masks, centers, mass0)
|
||||
sample.update(t=step, coarse_steps=step, fine_steps=2*step)
|
||||
report['samples'].append(sample)
|
||||
print(json.dumps(sample), flush=True)
|
||||
if step in TIMES:
|
||||
snapshots.append(fields)
|
||||
with tempfile.TemporaryDirectory(prefix='.plot-', dir=out) as cache:
|
||||
os.environ['MPLCONFIGDIR'] = cache
|
||||
draw(out, snapshots, masks, centers)
|
||||
if time.monotonic()-start > MAX_SECONDS:
|
||||
raise TimeoutError('120 second demonstration limit reached after plotting')
|
||||
report['status'] = 'complete'
|
||||
except BaseException as exc:
|
||||
report.update(status='failed', error=f'{type(exc).__name__}: {exc}',
|
||||
last_synchronized_coarse_step=run.step_count if run is not None else 0)
|
||||
raise
|
||||
finally:
|
||||
report['elapsed_seconds'] = time.monotonic()-start
|
||||
report['elapsed_scope'] = 'main construction, advancement and plotting; not pure CFD time'
|
||||
(out/'summary.json').write_text(json.dumps(report, indent=2)+'\n')
|
||||
print(f'{report["status"]}: last synchronized coarse step '
|
||||
f'{report["last_synchronized_coarse_step"]}; output={out}', flush=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,77 @@
|
||||
"""Public API demo: small periodic shear, one fixed 2:1 patch, eight coarse steps.
|
||||
|
||||
From this checkout, after checking the selected physical GPU is idle:
|
||||
PYTHONPATH="$PWD/src" CUDA_VISIBLE_DEVICES=0 python examples/fixed_periodic_patch.py
|
||||
|
||||
This demonstrates initialization/stepping/leaf output, not interface accuracy.
|
||||
There are no walls, objects, forces, checkpoint files or plots.
|
||||
"""
|
||||
from dataclasses import replace
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
|
||||
import CelerisLab
|
||||
from CelerisLab.config import load_lbm_config
|
||||
from CelerisLab.cuda.context import CudaContext
|
||||
from CelerisLab.lbm.equilibrium import compute_feq_d2q9, compute_macro_from_ddf
|
||||
from CelerisLab.lbm.refinement import ACTIVE
|
||||
from CelerisLab.lbm.refinement_stepper import FixedPatchStepper
|
||||
|
||||
|
||||
def shear_equilibrium(shape, origin, dx, period):
|
||||
"""Sample ux(y)=1e-3*sin(2*pi*y/period) at physical cell centers.
|
||||
|
||||
Centers are origin + dx*(index+.5); this shear is independent of x.
|
||||
Fine origin includes patch offset AND the four-cell halo, with dx=.5.
|
||||
Equilibrium is already postcollision G, so no initial collision is needed.
|
||||
"""
|
||||
y = origin[1] + dx * (np.arange(shape[0]) + .5)
|
||||
ux = 1e-3 * np.sin(2*np.pi*y/period)
|
||||
rows = np.stack([compute_feq_d2q9(1.0, float(u), 0.0) for u in ux], axis=1)
|
||||
return np.repeat(rows[:, :, None], shape[1], axis=2)
|
||||
|
||||
|
||||
def leaf_summary(coarse, fine, coarse_leaf, fine_leaf):
|
||||
"""Use the same leaf masks/areas for initial and final mass."""
|
||||
c, f = coarse[:, coarse_leaf], fine[:, fine_leaf]
|
||||
mass = c.sum(dtype=np.float64) + .25*f.sum(dtype=np.float64)
|
||||
macros = np.array([compute_macro_from_ddf(v) for v in np.concatenate((c, f), axis=1).T])
|
||||
return mass, macros.min(axis=0), macros.max(axis=0)
|
||||
|
||||
|
||||
def main():
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
if Path(CelerisLab.__file__).resolve() != root / "src/CelerisLab/__init__.py":
|
||||
raise RuntimeError(f"Set PYTHONPATH to {root / 'src'}")
|
||||
cfg = replace(load_lbm_config(str(root / "src/CelerisLab/configs/config_lbm.json")),
|
||||
nx=16, ny=16, viscosity=.1, velocity=1e-3, rho=1.0,
|
||||
lattice_model="D2Q9", collision="SRT", streaming="double_buffer",
|
||||
store_precision="FP32", ddf_shifting=False, les_enabled=False)
|
||||
with CudaContext(0) as context, FixedPatchStepper(cfg, context=context, refinements=[(4, 4, 12, 12)],
|
||||
level_blocks=[(16, 16), (24, 24)]) as run:
|
||||
p = run.hierarchy.pairs[0]
|
||||
coarse = shear_equilibrium(p.coarse_shape, (0, 0), 1.0, cfg.ny)
|
||||
fine = shear_equilibrium(p.fine_shape, p.fine_origin, .5, cfg.ny)
|
||||
coarse_leaf = np.ones(p.coarse_shape, dtype=bool)
|
||||
x0, y0, x1, y1 = p.bounds
|
||||
coarse_leaf[y0:y1, x0:x1] = False
|
||||
fine_leaf = p.fine_kind == ACTIVE
|
||||
coarse[:, ~coarse_leaf] = np.nan
|
||||
fine[:, ~fine_leaf] = np.nan
|
||||
run.initialize(coarse, fine)
|
||||
initial_mass, _, _ = leaf_summary(*run.download(), coarse_leaf, fine_leaf)
|
||||
run.step(8)
|
||||
coarse, fine = run.download() # Both levels synchronized, stored postcollision G.
|
||||
assert np.isnan(coarse[:, ~coarse_leaf]).all() and np.isnan(fine[:, ~fine_leaf]).all()
|
||||
assert np.isfinite(coarse[:, coarse_leaf]).all() and np.isfinite(fine[:, fine_leaf]).all()
|
||||
mass, low, high = leaf_summary(coarse, fine, coarse_leaf, fine_leaf)
|
||||
print(f"periodic patch API demo: synchronized coarse_steps={run.step_count}, fine_steps={2*run.step_count}")
|
||||
print(f"leaf mass: initial={initial_mass:.12g} final={mass:.12g} drift={mass-initial_mass:+.6e}")
|
||||
for name, lo, hi in zip(("rho", "ux", "uy"), low, high):
|
||||
print(f"leaf {name}: [{lo:.9g}, {hi:.9g}]")
|
||||
print("covered coarse / fine halo: NaN; functional demonstration only")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,78 @@
|
||||
# Round 3: FP16S and ddf_shifting compatibility
|
||||
|
||||
Date: 2026-06-03
|
||||
Duration: 8+ hours of code + testing
|
||||
|
||||
## Summary of work
|
||||
|
||||
This round added and verified FP16S store precision and ddf_shifting mode compatibility across the body module, curved boundary, and diagnostics pipeline.
|
||||
|
||||
## Primary achievements
|
||||
|
||||
### 1. MRT shifting fix (critical)
|
||||
|
||||
**Problem discovered:** D2Q9 MRT is NOT shift-invariant in moment space because M(w) produces non-zero entries in m[1] (energy) and m[2] (energy^2). Previous assumption that "f - feq cancels weights pairwise" only holds for SRT/TRT (per-direction collision), not for MRT (moment-space collision).
|
||||
|
||||
**Fix applied:** When `USE_DDF_SHIFTING=1`, `collide_mrt` now:
|
||||
1. Unshifts `g[i] += w[i]` at entry (physical space)
|
||||
2. Performs full MRT collision in physical space
|
||||
3. Reshifts `g[i] -= w[i]` at exit
|
||||
|
||||
**Verified:** `MRT + ddf_shifting + zou_he_local` produces K2 results with `amp_CL` recovering from 0.007 to 0.476.
|
||||
|
||||
**Note on D3Q19:** Has a `compute_feq` inconsistency (shifted feq applied to unshifted g) that needs fixing before D3Q19 shifting is usable.
|
||||
|
||||
### 2. ddf_shifting code fixes
|
||||
|
||||
| Fix | File | Status |
|
||||
|-----|------|--------|
|
||||
| Inlet west_velocity_rho_closure +5/6 correction | `inlet/common.cuh` | Verified, both D2Q9 and D3Q19 |
|
||||
| Curved force/torque +2*w_i correction | `curved_boundary.cuh`, `aux_kernels.cu` | Verified |
|
||||
| Host upload_ddf() asymmetry (subtract weights before upload) | `field.py` | Verified |
|
||||
| Checkpoint streaming and ddf_shifting match check | `checkpoint.py` | Implemented |
|
||||
|
||||
### 3. Inlet knowns repair generalization (partial)
|
||||
|
||||
The `repair_zou_he_west_knowns_d2q9` function was moved from Zou-He-only to all west inlet schemes in `inlet_outlet.cuh`. This fixes free-slip y-wall contamination of ghost-node populations. However, this alone was insufficient to fix the regularized+shifting issue.
|
||||
|
||||
### 4. EsoPull curved boundary (from Round 2, documented here for posterity)
|
||||
|
||||
Verified against Kan99b K2: **bit-identical metrics** between double_buffer and esopull streaming.
|
||||
|
||||
Key architectural decisions:
|
||||
- `streaming/esopull_semantic_helpers.cuh` -- single source of truth for physical-value semantics
|
||||
- `MacroscopicEsoPullKernel` -- GPU-side diagnostics (not host raw decode)
|
||||
- `Prepare + Apply` two-phase curved boundary
|
||||
|
||||
## Current compatibility matrix
|
||||
|
||||
### Verified (passes K2/Sah04 benchmarks)
|
||||
|
||||
| Config | Details |
|
||||
|--------|---------|
|
||||
| FP32 + MRT + double_buffer | Full validation (all Kan99b, Sah04) |
|
||||
| FP32 + MRT + esopull | K2 bit-identical to double_buffer |
|
||||
| FP16S + MRT + double_buffer | Sah04 S2 passes |
|
||||
| ddf_shifting + MRT + zou_he_local | K2 amp_CL recovered, full validation pending |
|
||||
|
||||
### Known limitations
|
||||
|
||||
| Issue | Severity | Status |
|
||||
|-------|----------|--------|
|
||||
| FP16S K2 St deviation (0.170 vs 0.142) | Medium -- quantization noise in curved region | Documented, acceptable for low-Re research |
|
||||
| FP16S S4 divergence at step 71420 | Medium -- high-blockage quantization + wall-gap | Use FP32 for high-blockage |
|
||||
| ddf_shifting + regularized inlet + MRT | High -- suppressed shedding even after inlet repair | Regularized in shifting needs root cause. Use zou_he_local for now. |
|
||||
| D3Q19 MRT shifting patch incomplete | Medium -- shifted feq applied to unshifted g | Not in 2D scope, TODO noted in code |
|
||||
| ddf_shifting + esopull combined | Not verified | Both paths validated separately but not together |
|
||||
|
||||
## Key lessons recorded
|
||||
|
||||
1. **SRT/TRT are shift-invariant; MRT is NOT.** The weight vector w has non-zero moment space projection. Always shift/unshift around MRT.
|
||||
|
||||
2. **Repair_zou_he_west_knowns is NOT Zou-He-specific.** Every west inlet scheme using `west_velocity_rho_closure_d2q9()` needs it under free-slip y-walls.
|
||||
|
||||
3. **FP16S failure modes are specific:** Low-blockage (S2) is fine; rotating cylinder (K2) shows quantization sensitivity; high-blockage (S4) can diverge. Test all three regimes before claiming FP16S works.
|
||||
|
||||
4. **`compute_feq` in shifting mode returns `feq - w`, not `feq`.** This is correct for SRT/TRT (NEQ terms cancel w), but causes a bias when paired with an unshifted `g` (D3Q19 MRT case).
|
||||
|
||||
5. **Host DDF path is not symmetric under shifting.** `download_ddf()` adds back w; `upload_ddf()` (before fix) did not subtract w. This breaks host-side initialization, snapshot/restore, and add_vortex under shifting.
|
||||
@@ -0,0 +1,43 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=61.0", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "CelerisLab"
|
||||
version = "0.5.1"
|
||||
description = "GPU-accelerated Lattice Boltzmann Method (LBM) CFD solver using CUDA"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
license = {text = "MIT"}
|
||||
authors = [
|
||||
{name = "Frank14f"}
|
||||
]
|
||||
keywords = ["cfd", "lattice-boltzmann", "cuda", "gpu", "fluid-dynamics", "lbm"]
|
||||
classifiers = [
|
||||
"Development Status :: 3 - Alpha",
|
||||
"Intended Audience :: Science/Research",
|
||||
"Topic :: Scientific/Engineering :: Physics",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
]
|
||||
|
||||
dependencies = [
|
||||
"pycuda>=2020.1",
|
||||
"numpy>=1.19.0",
|
||||
"scipy>=1.5.0",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/frank14f/CelerisLab"
|
||||
Repository = "https://github.com/frank14f/CelerisLab.git"
|
||||
|
||||
[tool.setuptools]
|
||||
package-dir = {"" = "src"}
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["src"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
"CelerisLab" = ["lbm/kernels/**/*.cu", "lbm/kernels/**/*.cuh", "lbm/kernels/**/*.h", "configs/*.json"]
|
||||
@@ -0,0 +1,220 @@
|
||||
"""Sparse scientific frames and the approved new-reproduce presentation idiom.
|
||||
|
||||
Frame gears/UI colors/rotation sectors derive from DynamisLab continuous_video.py
|
||||
(read-only SHA in docs). Modern velocity decoding and moving coordinates are used.
|
||||
All camera limits, vorticity limits, and motion scale are fixed, never following y.
|
||||
"""
|
||||
from functools import lru_cache
|
||||
import json
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
import numpy as np
|
||||
|
||||
D,U,CY=40.,.005,510.5
|
||||
SIZE=(1280,800)
|
||||
CW,CCW='#8854B8','#138F78'
|
||||
MAIN=(0,120,1280,440)
|
||||
INSET=(960,492,1240,772)
|
||||
MAIN_LIMITS=(6.4,57.6,-6.4,6.4)
|
||||
INSET_LIMITS=(28.75,33.75,-2.5,2.5)
|
||||
|
||||
|
||||
def frame_schedule(steps,base_interval,accelerated=False):
|
||||
"""Original 15-frame gear holds; only readback cadence changes."""
|
||||
if accelerated:
|
||||
ramp=15*(1+2+5)*base_interval
|
||||
if steps<=2*ramp:
|
||||
raise ValueError('too short for both display ramps')
|
||||
blocks=[(s,15*s*base_interval) for s in (1,2,5)]
|
||||
blocks += [(10,steps-2*ramp)]
|
||||
blocks += [(s,15*s*base_interval) for s in (5,2,1)]
|
||||
else:
|
||||
blocks=[(1,steps)]
|
||||
result,done=[],0
|
||||
for speed,duration in blocks:
|
||||
end=done+duration
|
||||
while done<end:
|
||||
done=min(done+speed*base_interval,end)
|
||||
result.append((done,speed))
|
||||
return result
|
||||
|
||||
|
||||
def video_schedule(phase_steps,smoke=False):
|
||||
if smoke:
|
||||
phase=frame_schedule(phase_steps,8)
|
||||
else:
|
||||
# First 80 D/U of each phase is fast display; last 80 is normal.
|
||||
half=phase_steps//2
|
||||
phase=frame_schedule(half,800,True)
|
||||
phase += [(half+n,s) for n,s in frame_schedule(phase_steps-half,800)]
|
||||
return {p*phase_steps+n:s for p in range(3) for n,s in phase}
|
||||
|
||||
|
||||
def vorticity(ux,uy,flags):
|
||||
"""Centered dx=1 curl; mask every stencil touching nonfluid, no filling."""
|
||||
ux,uy=np.asarray(ux,dtype=float),np.asarray(uy,dtype=float)
|
||||
fluid=(flags&1)!=0
|
||||
valid=(fluid[1:-1,1:-1]&fluid[1:-1,:-2]&fluid[1:-1,2:]&
|
||||
fluid[:-2,1:-1]&fluid[2:,1:-1])
|
||||
curl=((uy[1:-1,2:]-uy[1:-1,:-2])-(ux[2:,1:-1]-ux[:-2,1:-1]))/2
|
||||
result=np.full(ux.shape,np.nan)
|
||||
result[1:-1,1:-1]=np.where(valid,curl*D/U,np.nan)
|
||||
return result
|
||||
|
||||
|
||||
def pixel(x,y,box,limits):
|
||||
left,top,right,bottom=box
|
||||
x0,x1,y0,y1=limits
|
||||
return left+(x-x0)/(x1-x0)*(right-left),bottom-(y-y0)/(y1-y0)*(bottom-top)
|
||||
|
||||
|
||||
@lru_cache(maxsize=12)
|
||||
def font(size,bold=False):
|
||||
from PIL import ImageFont
|
||||
name='DejaVuSans-Bold.ttf' if bold else 'DejaVuSans.ttf'
|
||||
return ImageFont.truetype('/usr/share/fonts/truetype/dejavu/'+name,size)
|
||||
|
||||
|
||||
def draw_circle(draw,x,y,r,wall_speed,box,limits):
|
||||
cx,cy=pixel(x,y,box,limits)
|
||||
radius=r*(box[2]-box[0])/(limits[1]-limits[0])
|
||||
rect=(cx-radius,cy-radius,cx+radius,cy+radius)
|
||||
draw.ellipse(rect,fill='white',outline='#263D4B',width=2)
|
||||
if wall_speed is None:
|
||||
return
|
||||
fraction=abs(wall_speed)/(12*U)
|
||||
if not np.isfinite(fraction) or fraction>1.00001:
|
||||
raise RuntimeError('applied rotation exceeds fixed display reference')
|
||||
r2=radius*.72
|
||||
inner=(cx-r2,cy-r2,cx+r2,cy+r2)
|
||||
draw.ellipse(inner,fill='#E4E9ED')
|
||||
angle=min(fraction,1)*360
|
||||
start,end=(-90,-90+angle) if wall_speed<0 else (-90-angle,-90)
|
||||
if angle>0:
|
||||
draw.pieslice(inner,start,end,fill=CW if wall_speed<0 else CCW)
|
||||
|
||||
|
||||
class Video:
|
||||
def __init__(self,out,scene,bodies,phase_steps,smoke=False,source='unknown'):
|
||||
from PIL import Image
|
||||
from matplotlib import colormaps
|
||||
self.out,self.scene,self.bodies=out,scene,bodies
|
||||
self.schedule=video_schedule(phase_steps,smoke)
|
||||
self.phase_steps=phase_steps
|
||||
self.source=source
|
||||
self.records=[]
|
||||
self.palette=np.rint(colormaps['RdBu_r'](np.linspace(0,1,21))[:,:3]*255).astype('uint8')
|
||||
self.log=open(out/'ffmpeg.log','wb')
|
||||
self.proc=subprocess.Popen(['ffmpeg','-hide_banner','-loglevel','warning','-n',
|
||||
'-f','rawvideo','-pix_fmt','rgb24','-s','1280x800','-r','30','-i','pipe:0',
|
||||
'-an','-c:v','libx264','-threads','4','-preset','fast','-crf','18',
|
||||
'-pix_fmt','yuv420p','-movflags','+faststart',str(out/'continuous_viv.mp4')],
|
||||
stdin=subprocess.PIPE,stderr=self.log)
|
||||
self.closed=False
|
||||
self.seconds=0.
|
||||
|
||||
def capture(self,sim,step,phase,eff,rows):
|
||||
speed=self.schedule.get(step)
|
||||
if speed is None:
|
||||
return
|
||||
from PIL import Image,ImageDraw
|
||||
start=time.monotonic()
|
||||
macro=sim.get_macroscopic()
|
||||
flags=sim.get_flags().reshape(sim.field.ny,sim.field.nx)
|
||||
fluid=(flags&1)!=0
|
||||
if any(not np.isfinite(macro[k][fluid]).all() for k in ('rho','ux','uy')):
|
||||
raise RuntimeError('nonfinite fluid field at video sample')
|
||||
omega=vorticity(macro['ux'],macro['uy'],flags)
|
||||
finite=np.isfinite(omega)
|
||||
index=np.floor((np.clip(np.nan_to_num(omega),-3,3)+3)/6*21).astype(int).clip(0,20)
|
||||
rgb=self.palette[index]
|
||||
rgb[~finite]=[232,235,237]
|
||||
field=Image.fromarray(rgb[::-1])
|
||||
canvas=Image.new('RGB',SIZE,'white')
|
||||
draw=ImageDraw.Draw(canvas)
|
||||
for box,limits in ((MAIN,MAIN_LIMITS),(INSET,INSET_LIMITS)):
|
||||
x0,x1,y0,y1=limits
|
||||
# Lattice cell-centre coordinates -> image pixel-edge coordinates.
|
||||
crop=(x0*D+.5,sim.field.ny-(CY+y1*D+.5),
|
||||
x1*D+.5,sim.field.ny-(CY+y0*D+.5))
|
||||
picture=field.crop(crop).resize((box[2]-box[0],box[3]-box[1]),Image.Resampling.BOX)
|
||||
canvas.paste(picture,box[:2])
|
||||
if box==INSET:
|
||||
_,eq=pixel(30,0,box,limits)
|
||||
for x in range(box[0],box[2],10):
|
||||
draw.line((x,eq,min(x+5,box[2]),eq),fill='#657887',width=1)
|
||||
if self.scene=='karman':
|
||||
draw_circle(draw,10,0,1,None,box,limits) if box==MAIN else None
|
||||
for bid,w in zip(self.bodies,eff):
|
||||
obj=sim.bodies.objects[bid]
|
||||
x,y=obj.motion.centre(obj.motion.applied)
|
||||
draw_circle(draw,x/D,(y-CY)/D,obj.radius/D,float(w),box,limits)
|
||||
x0,y0=pixel(INSET_LIMITS[0],INSET_LIMITS[2],MAIN,MAIN_LIMITS)
|
||||
x1,y1=pixel(INSET_LIMITS[1],INSET_LIMITS[3],MAIN,MAIN_LIMITS)
|
||||
draw.rectangle((x0,y1,x1,y0),outline='#647C8C',width=1)
|
||||
draw.rectangle(INSET,outline='#647C8C',width=1)
|
||||
def text(x,y,value,size=16,color='#263D4B',bold=False):
|
||||
draw.text((x,y),value,font=font(size,bold),fill=color)
|
||||
on=phase=='on'
|
||||
text(28,15,'INCOMING FLOW',12,'#667887',True)
|
||||
text(28,39,'Steady inflow' if self.scene=='steady' else 'Periodic cylinder wake',29,bold=True)
|
||||
text(28,83,'One continuous flow and oscillator trajectory | Re_D = 50 | zero structural damping',15)
|
||||
text(850,18,'CYLINDER ROTATION',12,bold=True)
|
||||
text(850,43,'Clockwise',14,CW);text(1020,43,'Counterclockwise',14,CCW)
|
||||
text(850,70,'Sector angle = actual surface speed',13,'#667887')
|
||||
text(850,90,'Full circle = 12 x reference inflow speed',13,'#667887')
|
||||
draw.line((24,453,1256,453),fill='#E5EBEF')
|
||||
text(28,465,'CLOAKING CONTROL',12,'#667887',True)
|
||||
draw.rounded_rectangle((28,490,92,524),radius=17,fill='#137F73' if on else '#A8B4BC')
|
||||
cx=75 if on else 45
|
||||
draw.ellipse((cx-12,495,cx+12,519),fill='white')
|
||||
text(108,491,'ON' if on else 'OFF',22,'#137F73' if on else '#667887',True)
|
||||
text(195,493,('Fixed rotations' if self.scene=='steady' else 'Frozen PPO') if on else 'Zero rotation',18)
|
||||
text(570,467,f't U/D = {step*U/D:.2f}',18,bold=True)
|
||||
local=(step-1)%self.phase_steps+1
|
||||
transition=(phase!='off_before' and local*U/D<=1.)
|
||||
text(570,495,f'Playback {speed}x | '+('switch transient' if transition else phase.replace('_',' ')),16)
|
||||
text(960,467,f'Fixed lab-frame inset | y/D={rows[-1,1]/D:+.3f}',13,bold=True)
|
||||
# Motion trace: fixed +/-D limits, a fixed 60 D/U trailing time span.
|
||||
box=(55,560,895,732)
|
||||
draw.rectangle(box,outline='#CCD6DD')
|
||||
middle=(box[1]+box[3])/2
|
||||
draw.line((box[0],middle,box[2],middle),fill='#A8B4BC')
|
||||
t=step*U/D
|
||||
left=max(0.,t-60)
|
||||
first=max(0,int(left*D/U))
|
||||
sample=rows[first::max(1,(len(rows)-first)//1200)]
|
||||
xy=[(box[0]+(r[0]*U/D-left)/60*(box[2]-box[0]),middle-r[1]/D*(box[3]-box[1])/2) for r in sample]
|
||||
if len(xy)>1:draw.line(xy,fill='#263D4B',width=2)
|
||||
text(28,535,'Transverse displacement y/D (fixed scale; dashed inset line = equilibrium)',14)
|
||||
text(24,554,'+1',12);text(25,642,'0',12);text(24,722,'-1',12)
|
||||
text(55,739,f'{left:.1f}',12);text(835,739,f'{left+60:.1f}',12)
|
||||
text(350,739,'response time t U/D',12)
|
||||
text(28,774,f'Vorticity D/U: fixed [-3, +3] | exploratory, not convergence proof | source {self.source[:8]}',12)
|
||||
self.proc.stdin.write(canvas.tobytes())
|
||||
local=step%self.phase_steps
|
||||
if not self.records or local in (0,self.phase_steps//2) or self.records[-1]['phase']!=phase:
|
||||
canvas.save(self.out/f'keyframe-{step:09d}.png')
|
||||
elapsed=time.monotonic()-start
|
||||
self.seconds+=elapsed
|
||||
self.records.append(dict(frame=len(self.records),step=step,absolute_clock=sim.stepper.step_count,
|
||||
tU_D=t,phase=phase,playback_speed=speed,y_D=float(rows[-1,1]/D),
|
||||
surface_speeds=eff.tolist(),render_s=elapsed,
|
||||
fraction_finite_outside_color_limits=float(np.mean(np.abs(omega[finite])>3))))
|
||||
|
||||
def close(self):
|
||||
if self.closed:return
|
||||
self.closed=True
|
||||
self.proc.stdin.close()
|
||||
code=self.proc.wait(timeout=60)
|
||||
self.log.close()
|
||||
receipt=dict(frames=self.records,frame_count=len(self.records),fps=30,size=SIZE,
|
||||
duration_s=len(self.records)/30,render_total_s=self.seconds,ffmpeg_exit=code,
|
||||
normalization='centered dx=1 vorticity D/U, all 5 stencil cells fluid',
|
||||
color_limits=[-3,3],color_bins=21,main_limits_D=MAIN_LIMITS,inset_limits_D=INSET_LIMITS,
|
||||
y_origin_lattice=CY,trace_limits_D=[-1,1],inset_camera='fixed lab frame',
|
||||
acceleration='frame cadence only; native solver and SI unchanged')
|
||||
(self.out/'video.json').write_text(json.dumps(receipt,indent=2)+'\n')
|
||||
if code:raise RuntimeError(f'ffmpeg exit {code}')
|
||||
@@ -0,0 +1,222 @@
|
||||
"""Continuous OFF -> ON -> OFF VIV illustration; docs/continuous_viv_video.md.
|
||||
|
||||
Each invocation owns ONE Simulation and ONE oscillator. Rendering never advances
|
||||
the solver or changes the policy clock. No topology changes or moving restart.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
import numpy as np
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(ROOT))
|
||||
from research.karman_viv import run as base
|
||||
from research.continuous_viv.render import Video, frame_schedule
|
||||
|
||||
D, U, SCALE, SI = 40., .005, 2., 3200
|
||||
PHASES = ('off_before', 'on', 'off_after')
|
||||
STEADY_WALL = np.array([0., -5.1, 5.1]) * U
|
||||
|
||||
|
||||
def timing(scene, smoke):
|
||||
if smoke:
|
||||
return 1,32,32
|
||||
# Prior video's steady interval was 1000 at D20; diffusive D40 uses 4000.
|
||||
return (320,4000,2048000) if scene=='steady' else (400,SI,2048000)
|
||||
|
||||
|
||||
def command(scene, phase, obs, model):
|
||||
"""Physical surface speeds; OFF is not a zero normalized PPO action."""
|
||||
if phase != 'on':
|
||||
return np.zeros(3), np.array([0., .5, -.5])
|
||||
if scene == 'steady':
|
||||
return STEADY_WALL.copy(), np.full(3, np.nan)
|
||||
action = np.asarray(model.predict(obs, deterministic=True)[0], np.float32)
|
||||
if action.shape != (3,) or not np.isfinite(action).all() or (np.abs(action)>1).any():
|
||||
raise RuntimeError('invalid PPO action')
|
||||
return base.wall_target(action, SCALE), action
|
||||
|
||||
|
||||
def add_scene(sim, scene):
|
||||
if scene == 'karman':
|
||||
return base.add_scene(sim, SCALE, moving=True)
|
||||
from CelerisLab.body.motion import Translation
|
||||
probes = [sim.add_body('sensor', c, 10.) for c in base.scaled_points(base.PROBES, SCALE)]
|
||||
envelope = Translation((0., 0., -D, D), .025, shared=True)
|
||||
bodies = [sim.add_body('circle', c, D/2, translation=envelope)
|
||||
for c in base.scaled_points(base.CENTRES, SCALE)]
|
||||
return probes, bodies
|
||||
|
||||
|
||||
def evolve(sim, probes, bodies, structure, force, *, scene, model, norm,
|
||||
intervals, si, out, render, start, wall_cap):
|
||||
"""One native-step loop across all phases; completed SI feeds the next SI."""
|
||||
from CelerisLab.body.motion import MovingTables
|
||||
cols = {k:i for i,k in enumerate(MovingTables.DIAG)}
|
||||
count = len(PHASES)*intervals*si
|
||||
rows = np.lib.format.open_memmap(out/'steps.npy', mode='w+', dtype=np.float64,
|
||||
shape=(count, len(base.STEP_COLUMNS)))
|
||||
# The completed count is authoritative after any interrupted run.
|
||||
completed = 0
|
||||
obs = np.zeros(12, np.float32)
|
||||
signals, switches = [], []
|
||||
origin_clock = sim.stepper.step_count
|
||||
status = 'running'
|
||||
try:
|
||||
for phase in PHASES:
|
||||
switches.append(dict(phase=phase, step=completed, absolute_clock=sim.stepper.step_count,
|
||||
y=structure.y, v=structure.v, previous_rhs=force,
|
||||
input_observation=obs.tolist()))
|
||||
for i in range(intervals):
|
||||
target, action = command(scene, phase, obs, model)
|
||||
# Match the frozen inference contract: reset the EMA every SI.
|
||||
eff = np.zeros(3)
|
||||
sensor_sum, force_sum = np.zeros(6), np.zeros(6)
|
||||
for k in range(si):
|
||||
if k % 1000 == 0:
|
||||
base.check_time(start, wall_cap)
|
||||
y1, v1 = structure.candidate(force)
|
||||
if not np.isfinite([y1,v1]).all() or abs(y1)>D:
|
||||
raise RuntimeError('nonfinite structure or |y| > D; no retuning')
|
||||
eff = base.ema(eff, target, SCALE)
|
||||
omega = eff/(D/2)
|
||||
for bid,w in zip(bodies,omega):
|
||||
sim.set_body(bid, omega=float(w), offset=(0.,y1), vy=y1-structure.y)
|
||||
sim.run(1, zero_obs=True, sync_obs=True)
|
||||
d = sim.moving_diagnostics()
|
||||
cme,wen = d[:,cols['cme_y']], d[:,cols['wen_y']]
|
||||
node = d[:,cols['cover_jy']]-d[:,cols['uncover_jy']]
|
||||
row = (completed+1,y1,v1,*cme,*wen,*node,
|
||||
d[:,cols['eq_only']].sum(),d[:,cols['no_donor']].sum(),
|
||||
d[:,cols['crossings']].sum(),*omega)
|
||||
if not np.isfinite(row).all() or row[13] != 0:
|
||||
raise RuntimeError('nonfinite moving diagnostic or no_donor')
|
||||
f=np.array([v for p in bodies for v in sim.read_force(p)[:2]])
|
||||
s=np.array([v for p in probes for v in sim.read_sensor(p)[:2]])
|
||||
if not np.isfinite([f,s]).all():
|
||||
raise RuntimeError('nonfinite force/sensor observation')
|
||||
sensor_sum += s
|
||||
force_sum += f
|
||||
force=float(cme.sum(dtype=np.float64)+wen.sum(dtype=np.float64))
|
||||
rows[completed]=row
|
||||
completed += 1
|
||||
structure.y,structure.v=y1,v1
|
||||
if sim.stepper.step_count != origin_clock+completed:
|
||||
raise RuntimeError('noncontinuous solver clock')
|
||||
render(sim, completed, phase, eff, rows[:completed])
|
||||
if scene == 'karman':
|
||||
raw, obs, clipped = base.observation(sensor_sum/si,force_sum/si,SCALE,norm)
|
||||
else:
|
||||
# Steady uses prescribed rotations, not a model or borrowed norm.
|
||||
raw=np.r_[sensor_sum/si,force_sum/si]
|
||||
clipped=0
|
||||
signals.append(dict(phase=phase, step=completed, raw=raw.tolist(),
|
||||
observation=obs.tolist(), clipped=clipped,
|
||||
action=action.tolist() if np.isfinite(action).all() else None,
|
||||
target_surface_speed=target.tolist()))
|
||||
if (i+1)%10==0 or i+1==intervals:
|
||||
rows.flush()
|
||||
progress=dict(phase=phase, interval=i+1, completed_steps=completed,
|
||||
tU_D=completed*U/D, y_D=structure.y/D,
|
||||
elapsed_s=time.monotonic()-start)
|
||||
(out/'progress.json').write_text(json.dumps(progress)+'\n')
|
||||
print(json.dumps(progress),flush=True)
|
||||
status='duration_completed_not_physics_qualified'
|
||||
except BaseException as exc:
|
||||
status=f'error: {type(exc).__name__}: {exc}'
|
||||
raise
|
||||
finally:
|
||||
rows.flush()
|
||||
(out/'signals.json').write_text(json.dumps(signals,allow_nan=False)+'\n')
|
||||
report=dict(status=status,completed_steps=completed,origin_clock=origin_clock,
|
||||
final_clock=sim.stepper.step_count,switches=switches,
|
||||
elapsed_s=time.monotonic()-start,columns=base.STEP_COLUMNS,
|
||||
M=structure.mass,K=structure.stiffness,fn=structure.frequency,damping=0.,
|
||||
max_abs_y_D=float(np.abs(rows[:completed,1]).max()/D) if completed else None)
|
||||
(out/'report.json').write_text(json.dumps(report,indent=2,allow_nan=False)+'\n')
|
||||
|
||||
|
||||
def main():
|
||||
ap=argparse.ArgumentParser(description=__doc__)
|
||||
ap.add_argument('--scene',choices=('steady','karman'),required=True)
|
||||
ap.add_argument('--out',type=Path,required=True)
|
||||
ap.add_argument('--model',type=Path)
|
||||
ap.add_argument('--norm',type=Path)
|
||||
ap.add_argument('--release-dir',type=Path)
|
||||
ap.add_argument('--smoke',action='store_true',help='3 x 32 steps, all switches, no physical result')
|
||||
ap.add_argument('--wall-seconds',type=float,default=10800.)
|
||||
args=ap.parse_args()
|
||||
if not np.isfinite(args.wall_seconds) or args.wall_seconds<=0:
|
||||
ap.error('finite positive wall cap required')
|
||||
if args.scene=='karman':
|
||||
if args.model is None or args.norm is None:
|
||||
ap.error('Karman requires the frozen model and norm')
|
||||
if base.sha(args.model)!=base.MODEL_SHA or base.sha(args.norm)!=base.NORM_SHA:
|
||||
ap.error('frozen Karman model/normalizer hash mismatch')
|
||||
if not args.smoke and args.release_dir is None:
|
||||
ap.error('physical Karman requires its verified static release')
|
||||
elif any(p is not None for p in (args.model,args.norm,args.release_dir)):
|
||||
ap.error('steady uses constant control and its own warmup, no borrowed policy or release')
|
||||
out=args.out.resolve()
|
||||
if out==ROOT or ROOT in out.parents:
|
||||
ap.error('output must be outside checkout')
|
||||
out.mkdir(parents=True,exist_ok=False)
|
||||
intervals,si,warm=timing(args.scene,args.smoke)
|
||||
cfgpath=out/'config.json'
|
||||
cfgpath.write_text(json.dumps(base.config(40),indent=2)+'\n')
|
||||
source=subprocess.check_output(['git','-C',str(ROOT),'rev-parse','HEAD'],text=True).strip()
|
||||
case=dict(source=source,scene=args.scene,smoke=args.smoke,D=D,U=U,nu=.004,
|
||||
phases=PHASES,SI=si,intervals_per_phase=intervals,
|
||||
phase_duration_tU_D=intervals*si*U/D, mass_ratio=4.,fn_D_U=.2,zeta=0.,
|
||||
first_ppo_observation='previous complete OFF interval; no reset at switches',
|
||||
rhs='previous native step CME_y+Wen_y; no filtering; policy uses SI-mean CME',
|
||||
control='fixed (0,-5.1,+5.1)U' if args.scene=='steady' else 'frozen karman_re100 PPO; actual Re_D50',
|
||||
model_sha256=base.sha(args.model) if args.model else None,
|
||||
norm_sha256=base.sha(args.norm) if args.norm else None,
|
||||
config_sha256=base.sha(cfgpath),render='sparse post-step snapshots only; no step skipping')
|
||||
model=base.load_policy(args.model) if args.model else None
|
||||
norm=json.loads(args.norm.read_text()) if args.norm else None
|
||||
seed=None
|
||||
if args.scene=='karman' and not args.smoke:
|
||||
seed,force=base.saved_release(args.release_dir)
|
||||
case['release_sha256']=base.sha(args.release_dir/'release.npz')
|
||||
(out/'case.json').write_text(json.dumps(case,indent=2)+'\n')
|
||||
from CelerisLab import Simulation
|
||||
from CelerisLab.body.motion import MovingTables
|
||||
started=time.monotonic()
|
||||
structure=base.Structure(4.,2.5e-5,0.,D)
|
||||
video=None
|
||||
try:
|
||||
with Simulation(str(cfgpath)) as sim:
|
||||
probes,bodies=add_scene(sim,args.scene)
|
||||
sim.initialize()
|
||||
if seed is not None:
|
||||
case['release_transfer']=base.install_seed(sim,seed)
|
||||
del seed
|
||||
else:
|
||||
base.warmup(sim,warm-1,started,args.wall_seconds)
|
||||
sim.run(1)
|
||||
d=sim.moving_diagnostics()
|
||||
force=float(d[:,MovingTables.DIAG.index('cme_y')].sum(dtype=np.float64)
|
||||
+d[:,MovingTables.DIAG.index('wen_y')].sum(dtype=np.float64))
|
||||
case.update(warmup_executed=0 if 'release_transfer' in case else warm,
|
||||
origin_clock=sim.stepper.step_count)
|
||||
(out/'case.json').write_text(json.dumps(case,indent=2)+'\n')
|
||||
phase_steps=intervals*si
|
||||
video=Video(out,args.scene,bodies,phase_steps,smoke=args.smoke,source=source)
|
||||
evolve(sim,probes,bodies,structure,force,scene=args.scene,model=model,norm=norm,
|
||||
intervals=intervals,si=si,out=out,render=video.capture,
|
||||
start=started,wall_cap=args.wall_seconds)
|
||||
finally:
|
||||
if video is not None:
|
||||
video.close()
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
main()
|
||||
@@ -0,0 +1,224 @@
|
||||
"""Ledger, settling, common window and Morison fits for Dütsch cases (numpy only).
|
||||
|
||||
python analyze.py CASE_DIR [CASE_DIR ...] # cases of one comparison
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
|
||||
import protocol as p
|
||||
|
||||
|
||||
def load(path):
|
||||
with open(os.path.join(path, "case.json")) as fh:
|
||||
case = json.load(fh)
|
||||
raw = np.load(os.path.join(path, "raw.npz"))
|
||||
case.update(force=raw["force"], diag=raw["diag"], samples=raw["samples"], path=path)
|
||||
return case
|
||||
|
||||
|
||||
def cycle_slices(case):
|
||||
"""{k: slice of step indices m whose interval [m, m+1] lies in paper cycle k}."""
|
||||
T, q = case["T"], case["T"] // 4
|
||||
return {k: slice(q + (k - 1) * T, q + k * T)
|
||||
for k in range(1, case["cycles"] + 1) if q + k * T <= len(case["force"])}
|
||||
|
||||
|
||||
def coarse_wave(case, k, r=1):
|
||||
"""Normalized per-step Fx of cycle k, averaged over r native steps per sample."""
|
||||
f = case["force"][cycle_slices(case)[k], 0] / case["F_ref"]
|
||||
return f.reshape(-1, r).mean(axis=1)
|
||||
|
||||
|
||||
def profiles(case, k):
|
||||
"""{(phase, station, x2): (u, v)} of cycle k, time-averaged over the bin steps
|
||||
(equal weights per step) from valid samples only."""
|
||||
s = case["samples"]
|
||||
acc = {}
|
||||
for _, _, ph, xs, x2, u, v, _ in s[s[:, 1] == k]:
|
||||
if not (math.isnan(u) or math.isnan(v)):
|
||||
acc.setdefault((ph, xs, x2), []).append((u, v))
|
||||
return {key: tuple(np.mean(vals, axis=0)) for key, vals in acc.items()}
|
||||
|
||||
|
||||
def coverage(case, k):
|
||||
s = case["samples"]
|
||||
rows = s[s[:, 1] == k]
|
||||
missing = int(np.isnan(rows[:, 5]).sum())
|
||||
return dict(samples=len(rows), missing=missing, bin_steps=len(set(rows[:, 0])),
|
||||
min_fluid_weight=float(np.nanmin(np.where(rows[:, 7] > 0, rows[:, 7], np.nan)))
|
||||
if len(rows) else math.nan)
|
||||
|
||||
|
||||
def common_points(dicts):
|
||||
keys = set(dicts[0])
|
||||
for d in dicts[1:]:
|
||||
keys &= set(d)
|
||||
return sorted(keys)
|
||||
|
||||
|
||||
def candidates(case):
|
||||
"""Per-step Fx of each reported force candidate (none is selected as an RHS)."""
|
||||
d = case["diag"]
|
||||
return {"cme": d[:, 0], "cme_wen": d[:, 0] + d[:, 2], "cme_node": d[:, 0] + d[:, 6] - d[:, 9]}
|
||||
|
||||
|
||||
def cycle_morison(case, ks, fx=None):
|
||||
T = case["T"]
|
||||
fx = case["force"][:, 0] if fx is None else fx
|
||||
idx = np.concatenate([np.arange(len(fx))[cycle_slices(case)[k]] for k in ks])
|
||||
b = np.array([p.interval_bases(int(m), T) for m in idx])
|
||||
return p.morison_fit(fx[idx] / case["F_ref"], b[:, 0], b[:, 1])
|
||||
|
||||
|
||||
def pair_metrics(case, k):
|
||||
a, b = coarse_wave(case, k - 1), coarse_wave(case, k)
|
||||
pa, pb = profiles(case, k - 1), profiles(case, k)
|
||||
common = common_points([pa, pb]) # empty set -> inf -> pair fails (FAIL-CLOSED)
|
||||
prof = max((max(abs(pa[c][0] - pb[c][0]), abs(pa[c][1] - pb[c][1])) for c in common),
|
||||
default=math.inf) / case["u_max"]
|
||||
(cd0, ci0), (cd1, ci1) = cycle_morison(case, [k - 1]), cycle_morison(case, [k])
|
||||
m = dict(wave=float(np.sqrt(np.mean((b - a) ** 2))),
|
||||
scalar=float(max(abs(b.mean() - a.mean()), abs(np.sqrt(np.mean(b * b)) - np.sqrt(np.mean(a * a))),
|
||||
abs(np.abs(b).max() - np.abs(a).max()))),
|
||||
profile=float(prof), morison=float(max(abs(cd1 - cd0), abs(ci1 - ci0))),
|
||||
profile_points=len(common))
|
||||
m["pass"] = all(m[key] <= tol for key, tol in p.SETTLE.items())
|
||||
return m
|
||||
|
||||
|
||||
def hf_component(case, ks):
|
||||
"""Unqualified phase-locked high-frequency force component (reported, not checked):
|
||||
mean CME waveform over cycles ks minus its two-basis Morison reconstruction,
|
||||
split at 20/T; cycle differencing does not remove it."""
|
||||
T = case["T"]
|
||||
if not ks:
|
||||
return dict(label="unqualified phase-locked HF force component, not checked", cycles=[])
|
||||
mean = np.mean([coarse_wave(case, k) for k in ks], axis=0)
|
||||
c_d, c_i = cycle_morison(case, ks)
|
||||
q = T // 4
|
||||
b = np.array([p.interval_bases(q + m, T) for m in range(T)])
|
||||
resid = mean - (c_d * b[:, 0] - (np.pi ** 2 * c_i / p.KC) * b[:, 1])
|
||||
spec = np.fft.rfft(resid)
|
||||
high = spec.copy()
|
||||
high[:21] = 0.0
|
||||
energy = one_sided_energy(spec, T)
|
||||
return dict(label="unqualified phase-locked HF force component, not checked",
|
||||
cycles=list(ks), hf_rms_over_F_ref=float(np.sqrt(np.mean(np.fft.irfft(high, T) ** 2))),
|
||||
hf_energy_fraction=float(energy[21:].sum() / max(energy.sum(), 1e-300)),
|
||||
top_harmonics=[int(j) for j in np.argsort(energy[21:])[::-1][:5] + 21])
|
||||
|
||||
|
||||
def one_sided_energy(spec, n):
|
||||
"""Parseval-consistent energy per rfft bin: interior bins count twice, DC and
|
||||
(for even n) Nyquist once."""
|
||||
w = np.full(len(spec), 2.0)
|
||||
w[0] = 1.0
|
||||
if n % 2 == 0:
|
||||
w[-1] = 1.0
|
||||
return w * np.abs(spec) ** 2
|
||||
|
||||
|
||||
def ledger(case, horizon=p.LAST_SCORED):
|
||||
ks = [k for k in sorted(cycle_slices(case)) if k <= horizon]
|
||||
pairs = {k: pair_metrics(case, k) for k in ks if k - 1 > p.DISCARD}
|
||||
return pairs, p.settled_start({k: v["pass"] for k, v in pairs.items()})
|
||||
|
||||
|
||||
def main(argv):
|
||||
"""argv: CASE_DIR ... [--reference CASE_DIR]; the reference defaults to the
|
||||
largest D (resolution ladder); domain runs name the 60 D case explicitly."""
|
||||
ref_path = None
|
||||
if "--reference" in argv:
|
||||
i = argv.index("--reference")
|
||||
ref_path, argv = argv[i + 1], argv[:i] + argv[i + 2:]
|
||||
horizon, explicit = p.LAST_SCORED, "--horizon" in argv # default: original scoring
|
||||
if explicit:
|
||||
i = argv.index("--horizon")
|
||||
horizon, argv = int(argv[i + 1]), argv[:i] + argv[i + 2:]
|
||||
paths = argv if ref_path is None or ref_path in argv else argv + [ref_path]
|
||||
cases = [load(path) for path in paths]
|
||||
for c in cases if explicit else (): # complete cycles 1..N; never pad or shift
|
||||
if c["cycles"] < horizon or len(c["force"]) < round((0.25 + horizon) * c["T"]):
|
||||
raise SystemExit(f"{c['path']}: run does not contain complete cycles 1..{horizon}")
|
||||
ledgers = [ledger(c, horizon) for c in cases]
|
||||
window = p.common_window([k for _, k in ledgers],
|
||||
[{k: v["pass"] for k, v in pairs.items()} for pairs, _ in ledgers],
|
||||
last_scored=horizon)
|
||||
report = dict(window=window, horizon=horizon, cases=[],
|
||||
horizon_mode="default-cap" if horizon == p.LAST_SCORED else
|
||||
"extended duration diagnostic (declared amendment, D40/60D only)")
|
||||
for case, (pairs, k_case) in zip(cases, ledgers):
|
||||
limit = round((0.25 + horizon) * case["T"]) # events inside the horizon only
|
||||
entry = {key: case[key] for key in ("path", "D", "T", "box", "n", "u_max", "nu", "tau", "A",
|
||||
"steps", "cycles", "F_ref")}
|
||||
entry.update(duration_T=case["steps"] / case["T"], K_case=k_case, pairs=pairs,
|
||||
coverage={k: coverage(case, k) for k in sorted(cycle_slices(case))
|
||||
if p.DISCARD < k <= horizon},
|
||||
no_donor=float(case["diag"][:limit, 13].sum()),
|
||||
eq_only=float(case["diag"][:limit, 12].sum()),
|
||||
hf_component=hf_component(case, window or tuple(
|
||||
[k for k in sorted(cycle_slices(case)) if p.DISCARD < k <= horizon][-3:])))
|
||||
if window: # residual drift inside the scored window (pairs K..K+2)
|
||||
entry["window_drift"] = {key: max(pairs[k][key] for k in window)
|
||||
for key in ("wave", "profile", "morison")}
|
||||
entry["morison_obs"] = cycle_morison(case, window)
|
||||
entry["morison"] = {name: cycle_morison(case, window, fx)
|
||||
for name, fx in candidates(case).items()}
|
||||
entry["fy_mean"] = float(np.mean(np.concatenate(
|
||||
[case["force"][cycle_slices(case)[k], 1] for k in window])) / case["F_ref"])
|
||||
report["cases"].append(entry)
|
||||
if window and len(cases) > 1: # cross-resolution waveform against the finest case
|
||||
fine = (next(c for c in cases if c["path"] == ref_path) if ref_path
|
||||
else max(cases, key=lambda c: c["D"]))
|
||||
report["reference"] = fine["path"]
|
||||
ref = np.concatenate([coarse_wave(fine, k) for k in window])
|
||||
for case, entry in zip(cases, report["cases"]):
|
||||
r = fine["T"] // case["T"] # 1 for equal-D domain runs
|
||||
ref_c = ref.reshape(-1, r).mean(axis=1)
|
||||
own = np.concatenate([coarse_wave(case, k) for k in window])
|
||||
entry["wave_rms_vs_finest"] = float(np.sqrt(np.mean((own - ref_c) ** 2)))
|
||||
for k in window: # profiles on the common valid point set of all compared cases
|
||||
per_case = [profiles(c, k) for c in cases]
|
||||
keys = common_points(per_case)
|
||||
report.setdefault("common_profile_points", {})[k] = len(keys)
|
||||
if not keys:
|
||||
report["verdict"] = "FAIL-CLOSED: empty common profile set"
|
||||
continue
|
||||
fine_p = per_case[cases.index(fine)]
|
||||
for case, entry, prof in zip(cases, report["cases"], per_case):
|
||||
d = max(max(abs(prof[key][0] - fine_p[key][0]), abs(prof[key][1] - fine_p[key][1]))
|
||||
for key in keys) / case["u_max"]
|
||||
entry.setdefault("profile_max_vs_finest", {})[k] = float(d)
|
||||
ref_entry = report["cases"][cases.index(fine)]
|
||||
for entry in report["cases"]: # conservative: difference + both drifts
|
||||
if entry is ref_entry:
|
||||
continue
|
||||
drift = {key: entry["window_drift"][key] + ref_entry["window_drift"][key]
|
||||
for key in ("wave", "profile", "morison")}
|
||||
dm = max(abs(entry["morison"]["cme"][0] - ref_entry["morison"]["cme"][0]),
|
||||
abs(entry["morison"]["cme"][1] - ref_entry["morison"]["cme"][1]))
|
||||
entry["conservative"] = dict(
|
||||
wave=entry["wave_rms_vs_finest"] + drift["wave"],
|
||||
profile=max(entry.get("profile_max_vs_finest", {}).values(), default=math.inf)
|
||||
+ drift["profile"],
|
||||
morison_cme=dm + drift["morison"])
|
||||
bands = p.DOMAIN if ref_path else p.CROSS # domain runs name the 60 D reference
|
||||
c = entry["conservative"]
|
||||
entry["pass_scope"] = (
|
||||
("wave+profile+morison_cme" if "morison" in bands else "wave+profile")
|
||||
+ ": conservative (|diff| + both window drifts) on the obs/CME Fx waveform and "
|
||||
"simulation-to-simulation profiles; CME+Wen and CME+node reported, not checked; "
|
||||
"no Fig. 8 / literature verdict")
|
||||
entry["pass"] = (c["wave"] <= bands["wave"] and c["profile"] <= bands["profile"]
|
||||
and ("morison" not in bands or c["morison_cme"] <= bands["morison"]))
|
||||
print(json.dumps(report, indent=1, default=float))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
@@ -0,0 +1,52 @@
|
||||
"""Research-only field capture helpers for the Dütsch driver (numpy only).
|
||||
|
||||
Snapshots are taken at the first step of the scored phase bins in declared
|
||||
cycles: a near-body crop at full resolution and a fluid-weighted block-mean
|
||||
downsample of the whole domain; plus scalar trends at every bin read.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import numpy as np
|
||||
|
||||
CROP_X, CROP_Y, DOWN = 8.0, 6.0, 8 # crop half-widths in D; downsample factor
|
||||
STRIP = 2.0 # inlet/outlet strip width in D
|
||||
|
||||
|
||||
def crop_box(xm, ym, D, n, body_extent):
|
||||
"""Inclusive integer crop (x0, x1, y0, y1); fail closed if it leaves the domain
|
||||
interior or does not contain the body's swept extent (x_lo, x_hi, y_lo, y_hi)."""
|
||||
x0, x1 = int(round(xm - CROP_X * D)), int(round(xm + CROP_X * D))
|
||||
y0, y1 = int(round(ym - CROP_Y * D)), int(round(ym + CROP_Y * D))
|
||||
if x0 < 1 or y0 < 1 or x1 > n - 2 or y1 > n - 2:
|
||||
raise ValueError("capture crop leaves the domain interior")
|
||||
bx0, bx1, by0, by1 = body_extent
|
||||
if not (x0 <= bx0 and bx1 <= x1 and y0 <= by0 and by1 <= y1):
|
||||
raise ValueError("capture crop clips the body's swept extent")
|
||||
return x0, x1, y0, y1
|
||||
|
||||
|
||||
def downsample(field, fluid, f=DOWN):
|
||||
"""Fluid-weighted f x f block means; NaN where a block has no fluid cell."""
|
||||
ny, nx = field.shape
|
||||
h, w = ny // f, nx // f
|
||||
v = np.where(fluid, field, 0.0)[:h * f, :w * f].reshape(h, f, w, f).sum(axis=(1, 3))
|
||||
c = fluid[:h * f, :w * f].reshape(h, f, w, f).sum(axis=(1, 3))
|
||||
with np.errstate(invalid="ignore", divide="ignore"):
|
||||
return np.where(c > 0, v / np.maximum(c, 1), np.nan).astype(np.float32)
|
||||
|
||||
|
||||
def fluid_mean(field, fluid, xs=slice(None), ys=slice(None)):
|
||||
m = fluid[ys, xs]
|
||||
return float(field[ys, xs][m].mean()) if m.any() else float("nan")
|
||||
|
||||
|
||||
def trend_row(s, k, ph, rho, ux, uy, fluid, D, n, crop):
|
||||
"""(s, cycle, phase, <rho>, <ux>, <uy>, <rho>_crop, inlet <rho>, <ux>, outlet <rho>, <ux>)."""
|
||||
w = max(1, int(round(STRIP * D)))
|
||||
x0, x1, y0, y1 = crop
|
||||
cx, cy = slice(x0, x1 + 1), slice(y0, y1 + 1)
|
||||
inlet, outlet, inner = slice(1, 1 + w), slice(n - 1 - w, n - 1), slice(1, n - 1)
|
||||
return (s, k, ph, fluid_mean(rho, fluid), fluid_mean(ux, fluid), fluid_mean(uy, fluid),
|
||||
fluid_mean(rho, fluid, cx, cy),
|
||||
fluid_mean(rho, fluid, inlet, inner), fluid_mean(ux, fluid, inlet, inner),
|
||||
fluid_mean(rho, fluid, outlet, inner), fluid_mean(ux, fluid, outlet, inner))
|
||||
@@ -0,0 +1,136 @@
|
||||
"""Pure arithmetic of the Dütsch Re 100 / KC 5 protocol (numpy only, no CUDA).
|
||||
|
||||
docs/validation/duetsch_re100_kc5_protocol.md is the contract: elapsed time s
|
||||
in native steps from the right turning point, paper phase
|
||||
phi = (360 s / T - 90) mod 360, paper cycle k >= 1 spans
|
||||
s/T in [0.25 + (k-1), 0.25 + k); cycle 0 is the startup quarter.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
from functools import lru_cache
|
||||
|
||||
import numpy as np
|
||||
|
||||
KC, RE = 5.0, 100.0
|
||||
STATIONS = (-0.6, 0.0, 0.6, 1.2) # lab-fixed x/D from the mean position
|
||||
PHASES = (180.0, 210.0, 330.0) # degrees; bins [p, p + 1)
|
||||
X2 = tuple(np.round(np.arange(-1.5, 1.5001, 0.05), 10)) # declared x2/D points
|
||||
DISCARD, LAST_SCORED, N_PAIRS = 2, 11, 3 # cycles 0..2 discarded, cap 12 T
|
||||
# A-priori bands. Settling is one fifth of the tightest comparison band of the
|
||||
# same observable, and comparisons add both cases' residual window drift
|
||||
# (conservative: |difference| + drift_a + drift_b <= band).
|
||||
DOMAIN = dict(wave=.01, morison=.02, profile=.02) # vs the 60 D reference at D = 40
|
||||
CROSS = dict(wave=.02, profile=.02) # D40 vs D80
|
||||
SETTLE = dict(wave=.002, scalar=.002, profile=.004, morison=.004)
|
||||
|
||||
|
||||
def amplitude(D):
|
||||
return KC * D / (2.0 * math.pi)
|
||||
|
||||
|
||||
def position(s, T, A):
|
||||
"""Centre position relative to the mean: x = A cos(2 pi s / T), evaluated from the
|
||||
native step modulo T so every cycle repeats the same geometry bit for bit."""
|
||||
return A * math.cos(2.0 * math.pi * (int(s) % T) / T)
|
||||
|
||||
|
||||
def phase(s, T):
|
||||
"""Paper phase in degrees from the native step modulo T (the unwrapped cycle
|
||||
index is kept separately by ``cycle``)."""
|
||||
return (360.0 * (int(s) % T) / T - 90.0) % 360.0
|
||||
|
||||
|
||||
def cycle(s, T):
|
||||
return 0 if s < 0.25 * T else int(math.floor(s / T - 0.25)) + 1
|
||||
|
||||
|
||||
def bin_phase(s, T):
|
||||
"""Scored phase whose 1-degree bin [p, p + 1) contains time s, else None."""
|
||||
phi = phase(s, T)
|
||||
for p in PHASES:
|
||||
if p <= phi < p + 1.0:
|
||||
return p
|
||||
return None
|
||||
|
||||
|
||||
@lru_cache(maxsize=8)
|
||||
def _quadrature_rule(points):
|
||||
"""Reuse the nodes and weights, which depend only on quadrature order."""
|
||||
return np.polynomial.legendre.leggauss(points)
|
||||
|
||||
|
||||
def interval_bases(n, T, points=16):
|
||||
"""Single-step interval averages over [n, n + 1] of cos phi |cos phi| and sin phi
|
||||
(phi in radians = 2 pi s / T - pi / 2), Gauss-Legendre quadrature."""
|
||||
x, w = _quadrature_rule(points)
|
||||
s = int(n) % T + 0.5 * (x + 1.0) # periodic: identical bases in every cycle
|
||||
phi = 2.0 * np.pi * s / T - 0.5 * np.pi
|
||||
c = np.cos(phi)
|
||||
return 0.5 * float(np.sum(w * c * np.abs(c))), 0.5 * float(np.sum(w * np.sin(phi)))
|
||||
|
||||
|
||||
def morison_fit(f_norm, b1, b2):
|
||||
"""Least squares of f_norm = c_d b1 - (pi^2 c_i / KC) b2 (paper phase, no shift)."""
|
||||
a = np.column_stack([b1, -(math.pi ** 2 / KC) * np.asarray(b2)])
|
||||
(c_d, c_i), *_ = np.linalg.lstsq(a, np.asarray(f_norm), rcond=None)
|
||||
return float(c_d), float(c_i)
|
||||
|
||||
|
||||
def inside_circle(x, y, centre, radius):
|
||||
return (x - centre[0]) ** 2 + (y - centre[1]) ** 2 < radius * radius
|
||||
|
||||
|
||||
def sample(field, fluid, x, y, centre, radius):
|
||||
"""Profile sample: MISSING if the exact point is inside the body (checked before
|
||||
any corner interpolation), else ``bilinear_fluid``."""
|
||||
if inside_circle(x, y, centre, radius):
|
||||
return None, (), 0.0
|
||||
return bilinear_fluid(field, fluid, x, y)
|
||||
|
||||
|
||||
def bilinear_fluid(field, fluid, x, y):
|
||||
"""Bilinear value at (x, y) in cell coordinates from fluid cells only.
|
||||
|
||||
Returns (value, ((ix, iy, weight), ...), fluid_weight_sum) with weights
|
||||
renormalized over the fluid corners and the original sum of their bilinear
|
||||
weights, or (None, (), 0.0) when no corner is fluid (MISSING, never zero).
|
||||
"""
|
||||
x0, y0 = int(math.floor(x)), int(math.floor(y))
|
||||
fx, fy = x - x0, y - y0
|
||||
corners = ((x0, y0, (1 - fx) * (1 - fy)), (x0 + 1, y0, fx * (1 - fy)),
|
||||
(x0, y0 + 1, (1 - fx) * fy), (x0 + 1, y0 + 1, fx * fy))
|
||||
used = [(i, j, w) for i, j, w in corners if w > 0.0 and fluid[j, i]]
|
||||
total = sum(w for _, _, w in used)
|
||||
if total == 0.0:
|
||||
return None, (), 0.0
|
||||
used = tuple((i, j, w / total) for i, j, w in used)
|
||||
return float(sum(w * field[j, i] for i, j, w in used)), used, float(total)
|
||||
|
||||
|
||||
def settled_start(pairs_pass):
|
||||
"""K_case from {k: pass of pair (k-1 -> k)}: first cycle after three consecutive
|
||||
passing pairs among cycles > DISCARD, or None."""
|
||||
run = 0
|
||||
for k in sorted(pairs_pass):
|
||||
if k - 1 <= DISCARD:
|
||||
continue
|
||||
run = run + 1 if pairs_pass[k] else 0
|
||||
if run == N_PAIRS:
|
||||
return k + 1
|
||||
return None
|
||||
|
||||
|
||||
def common_window(k_cases, pairs_pass_by_case, last_scored=LAST_SCORED):
|
||||
"""Common scored cycles K..K+2 with K = max K_case, or None (FAIL-CLOSED) when a
|
||||
case never settled, K + 2 exceeds the cap, or a case fails any pair p_j for
|
||||
j = its own K_case .. K + 2 (continuous settling, including the wait for K)."""
|
||||
if any(k is None for k in k_cases):
|
||||
return None
|
||||
K = max(k_cases)
|
||||
if K + 2 > last_scored:
|
||||
return None
|
||||
for k_case, pairs in zip(k_cases, pairs_pass_by_case):
|
||||
if not all(pairs.get(j, False) for j in range(k_case, K + 3)):
|
||||
return None
|
||||
return K, K + 1, K + 2
|
||||
@@ -0,0 +1,133 @@
|
||||
"""One-shot Dütsch Re 100 / KC 5 prescribed in-line oscillation driver.
|
||||
|
||||
Protocol: docs/validation/duetsch_re100_kc5_protocol.md. Native dense channel
|
||||
(zero-velocity inlet, pressure-NEQ outlet, bounce-back y walls), MRT, lab frame.
|
||||
Writes raw per-step force/diagnostics and phase-bin profile samples to --out
|
||||
(outside the checkout); analysis is in analyze.py. No production change.
|
||||
|
||||
python run.py --D 40 --box 40 --cycles 11 --out /path/outside/checkout
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
import numpy as np
|
||||
|
||||
import protocol as p
|
||||
|
||||
|
||||
TEMPLATE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "src",
|
||||
"CelerisLab", "configs", "config_lbm.json")
|
||||
|
||||
|
||||
def config(D, box, T):
|
||||
"""Shipped config_lbm.json (full parser schema) with only the case fields
|
||||
overridden: grid, still fluid (velocity 0), nu from Re, MRT, uniform inlet
|
||||
profile, bounce-back y walls. Inlet scheme and outlet mode stay the
|
||||
template's (zou_he_local, neq_extrap) and are recorded in case.json."""
|
||||
u = p.KC * D / T
|
||||
n = int(round(box * D))
|
||||
with open(TEMPLATE) as fh:
|
||||
cfg = json.load(fh)
|
||||
cfg["grid"].update(lattice_model="D2Q9", nx=n, ny=n, nz=1)
|
||||
cfg["physics"].update(data_type="FP32", viscosity=u * D / p.RE, velocity=0.0, rho=1.0)
|
||||
cfg["method"].update(collision="MRT", streaming="double_buffer", store_precision="FP32",
|
||||
ddf_shifting=False, y_wall_bc="bounce_back")
|
||||
cfg["method"]["les"]["enabled"] = False
|
||||
cfg["method"]["inlet"]["profile"] = "uniform"
|
||||
return cfg, u, n
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--D", type=int, required=True)
|
||||
ap.add_argument("--box", type=float, default=40.0, help="box side in D")
|
||||
ap.add_argument("--T", type=int, default=None, help="period in steps (multiple of 360)")
|
||||
ap.add_argument("--cycles", type=int, default=p.LAST_SCORED, help="run to the end of this cycle")
|
||||
ap.add_argument("--out", required=True)
|
||||
ap.add_argument("--dump-fields", default="",
|
||||
help="research capture: comma-separated paper cycles, e.g. 11,21,30,31")
|
||||
args = ap.parse_args()
|
||||
D, T = args.D, args.T or 126 * args.D
|
||||
if T % 360:
|
||||
raise SystemExit("T must be a multiple of 360 steps")
|
||||
if os.path.realpath(args.out).startswith(os.path.realpath(os.path.join(os.path.dirname(__file__), "..", ".."))):
|
||||
raise SystemExit("--out must be outside the checkout")
|
||||
cfg, u_max, n = config(D, args.box, T)
|
||||
A, R = p.amplitude(D), 0.5 * D
|
||||
xm = ym = 0.5 * (n - 1)
|
||||
os.makedirs(args.out, exist_ok=True)
|
||||
|
||||
from CelerisLab.body.motion import Translation
|
||||
from CelerisLab.simulation import Simulation
|
||||
with tempfile.NamedTemporaryFile("w", suffix=".json", delete=False) as fh:
|
||||
json.dump(cfg, fh)
|
||||
sim = Simulation(fh.name)
|
||||
try:
|
||||
body = sim.add_body("circle", (xm + A, ym), R,
|
||||
translation=Translation((-2.0 * A, 0.0, 0.0, 0.0), 1.01 * u_max))
|
||||
sim.initialize()
|
||||
dump = {int(c) for c in args.dump_fields.split(",") if c}
|
||||
if dump:
|
||||
import capture
|
||||
if max(dump) > args.cycles or min(dump) <= p.DISCARD:
|
||||
raise SystemExit("--dump-fields cycles must lie in the scored range of this run")
|
||||
crop = capture.crop_box(xm, ym, D, n, (xm - A - R, xm + A + R, ym - R, ym + R))
|
||||
trend = []
|
||||
steps = int(round((0.25 + args.cycles) * T))
|
||||
force = np.zeros((steps, 2)); diag = []; samples = []
|
||||
for m in range(steps):
|
||||
x0, x1 = p.position(m, T, A), p.position(m + 1, T, A)
|
||||
sim.set_body(body, offset=(max(x1 - A, -2.0 * A), 0.0), vx=x1 - x0)
|
||||
sim.run(1)
|
||||
force[m] = sim.read_force(body)[:2]
|
||||
diag.append(sim.moving_diagnostics()[0])
|
||||
s = m + 1 # state after the step
|
||||
ph = p.bin_phase(s, T)
|
||||
if ph is not None and p.cycle(s, T) > p.DISCARD:
|
||||
fields = sim.get_macroscopic()
|
||||
fluid = (sim.get_flags().reshape(n, n) & 1) != 0
|
||||
ux, uy = (np.asarray(fields[k]).reshape(n, n) for k in ("ux", "uy"))
|
||||
if dump: # research capture only; the default path is unchanged
|
||||
rho = np.asarray(fields["rho"]).reshape(n, n)
|
||||
trend.append(capture.trend_row(s, p.cycle(s, T), ph, rho, ux, uy, fluid, D, n, crop))
|
||||
if p.cycle(s, T) in dump and p.phase(s, T) == ph: # first step of the bin
|
||||
x0c, x1c, y0c, y1c = crop
|
||||
cy_, cx_ = slice(y0c, y1c + 1), slice(x0c, x1c + 1)
|
||||
np.savez_compressed(
|
||||
os.path.join(args.out, f"fields_c{p.cycle(s, T)}_p{int(ph)}.npz"),
|
||||
s=s, cycle=p.cycle(s, T), phase=ph, crop=np.asarray(crop),
|
||||
force=force[m], centre=np.asarray((xm + p.position(s, T, A), ym)),
|
||||
ux=ux[cy_, cx_].astype(np.float32), uy=uy[cy_, cx_].astype(np.float32),
|
||||
rho=rho[cy_, cx_].astype(np.float32), fluid=fluid[cy_, cx_].astype(np.uint8),
|
||||
down_ux=capture.downsample(ux, fluid), down_uy=capture.downsample(uy, fluid),
|
||||
down_rho=capture.downsample(rho, fluid))
|
||||
centre = (xm + p.position(s, T, A), ym) # analytic centre after the step
|
||||
for xs in p.STATIONS:
|
||||
for x2 in p.X2:
|
||||
x, y = xm + xs * D, ym + x2 * D
|
||||
u, wu, wsum = p.sample(ux, fluid, x, y, centre, R)
|
||||
v, _, _ = p.sample(uy, fluid, x, y, centre, R)
|
||||
samples.append((s, p.cycle(s, T), ph, xs, x2,
|
||||
math.nan if u is None else u, math.nan if v is None else v,
|
||||
wsum, json.dumps(wu)))
|
||||
if dump:
|
||||
np.save(os.path.join(args.out, "trend.npy"), np.asarray(trend, float))
|
||||
np.savez(os.path.join(args.out, "raw.npz"), force=force, diag=np.asarray(diag),
|
||||
samples=np.asarray([r[:8] for r in samples], float))
|
||||
with open(os.path.join(args.out, "case.json"), "w") as fh:
|
||||
json.dump(dict(D=D, T=T, box=args.box, n=n, u_max=u_max, nu=cfg["physics"]["viscosity"],
|
||||
tau=3 * cfg["physics"]["viscosity"] + 0.5, A=A, steps=steps,
|
||||
cycles=args.cycles, F_ref=0.5 * u_max ** 2 * D,
|
||||
inlet=cfg["method"]["inlet"], outlet=cfg["method"]["outlet"],
|
||||
weights=[r[8] for r in samples]), fh)
|
||||
finally:
|
||||
sim.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,130 @@
|
||||
"""Offline Fig2 estimands; preserve raw same-clock errors beside registration.
|
||||
|
||||
No thresholds are fitted here. Probe DTW is the actual Legacy helper, not a
|
||||
field metric; independent wake phase is a diagnostic, not a time correction.
|
||||
"""
|
||||
import argparse
|
||||
import gc
|
||||
import importlib.util
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import types
|
||||
|
||||
import numpy as np
|
||||
|
||||
ROOT=Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0,str(ROOT))
|
||||
from research.fig2_collection import run
|
||||
from research.fig2_materials.metrics import field_error, motion_summary
|
||||
|
||||
|
||||
def frequency(signal,dt):
|
||||
"""Largest non-DC rectangular-window FFT bin, descriptive resolution only."""
|
||||
a=np.asarray(signal,float);a=a-a.mean()
|
||||
if len(a)<3 or np.max(np.abs(a))<1e-12:return None
|
||||
power=np.abs(np.fft.rfft(a))**2
|
||||
i=1+int(np.argmax(power[1:]))
|
||||
return dict(f_D_U=float(np.fft.rfftfreq(len(a),dt)[i]),bin_width_D_U=1/(len(a)*dt),
|
||||
method='demeaned rectangular window; dominant non-DC bin; not a confidence interval')
|
||||
|
||||
|
||||
def native_summary(rows,scene):
|
||||
start=max(0,len(rows)-640000) if scene!='taylor' else 0
|
||||
a=rows[start:]
|
||||
y=a[:,1]/40.;cy=a[:,3:9].sum(axis=1)/(.5*.005**2*40)
|
||||
return dict(window_D_U=[start*.005/40,len(rows)*.005/40],
|
||||
motion=motion_summary(y),motion_frequency=frequency(y,.005/40),
|
||||
structural_RHS_Cy_RMS=float(np.sqrt(np.mean(cy**2))),
|
||||
structural_RHS_Cy_mean=float(cy.mean()),
|
||||
max_native_delta_Cy=float(np.abs(np.diff(cy)).max()) if len(cy)>1 else None,
|
||||
force_frequency=frequency(cy,.005/40),
|
||||
no_donor=float(rows[:,13].sum()),eq_only=float(rows[:,12].sum()),
|
||||
crossings=float(rows[:,14].sum()),
|
||||
force_convention='body force, sum pinball CME_y+Wen_y; native previous-step RHS, no filtering')
|
||||
|
||||
|
||||
def compare_selected(target,current,u0=.005):
|
||||
"""Fixed lab ROI; all actual compared roles must be fluid and finite here."""
|
||||
ys,xs=slice(311,711),slice(1360,2161)
|
||||
t,c=target['ux'][:,ys,xs],current['ux'][:,ys,xs]
|
||||
tv,cv=target['uy'][:,ys,xs],current['uy'][:,ys,xs]
|
||||
if t.shape!=c.shape or tv.shape!=cv.shape:raise ValueError('selected shape mismatch')
|
||||
for fields in (target,current):
|
||||
if not np.all((fields['flags'][:,ys,xs]&1)!=0):raise ValueError('nonfluid selected ROI')
|
||||
if not all(np.isfinite(a).all() for a in (t,c,tv,cv)):raise ValueError('nonfinite selected ROI')
|
||||
e2=((c.astype(float)-t)/u0)**2+((cv.astype(float)-tv)/u0)**2
|
||||
return dict(per_slot_E=np.sqrt(e2.mean(axis=(1,2))),aggregate_E=float(np.sqrt(e2.mean())))
|
||||
|
||||
|
||||
def main():
|
||||
ap=argparse.ArgumentParser(description=__doc__);ap.add_argument('directory',type=Path)
|
||||
args=ap.parse_args();p=args.directory
|
||||
case=json.loads((p/'case.json').read_text());term=json.loads((p/'terminal.json').read_text())
|
||||
if case['plan']['smoke'] or term['status']!='three_roles_completed_not_qualified':
|
||||
raise ValueError('physical analysis requires all three complete roles; smoke/partial is unscored')
|
||||
helpers=run.load_helpers()
|
||||
# Reuse the canonical pure module under the same isolated read-only package.
|
||||
native=run.load_file('_fig2_readonly_drl.legacy_test.metrics',
|
||||
run.ACQUISITION.parent/'legacy_test/metrics.py')
|
||||
reports={k:json.loads((p/k/'report.json').read_text()) for k in ('target','zero','controlled')}
|
||||
sig={}
|
||||
result=dict(scene=case['scene'],source=case['source'],Re_D=50.,roles={},
|
||||
primary='unaligned same-clock/event U-normalized vector errors; common lab ROI',
|
||||
periodic_phase='independently registered centre-uy phase diagnostic, not a shared-clock comparison',
|
||||
notes=['Modern moving-plant data; no Legacy numerical equivalence or physical qualification',
|
||||
'Motion, native structural force, policy SI means and probe DTW are different estimands'])
|
||||
for role in ('target','zero','controlled'):
|
||||
with np.load(p/role/'signals.npz') as z:sig[role]={k:z[k] for k in z.files}
|
||||
if role!='target':
|
||||
with np.load(p/role/'native.npz') as z:
|
||||
result['roles'][role]=native_summary(z['rows'],case['scene'])
|
||||
t=sig['target']['sensors']
|
||||
for role in ('zero','controlled'):
|
||||
s=sig[role]['sensors']
|
||||
if not np.array_equal(sig[role]['absolute_steps'],sig['target']['absolute_steps']):
|
||||
raise ValueError('probe absolute clocks mismatch')
|
||||
result['roles'][role]['unaligned_probe_area_velocity_RMS_over_U']=float(np.sqrt(np.mean(((s/156-t/156)/.005)**2)))
|
||||
result['roles'][role]['probe_channel_correlations']=native.channel_correlations(t,s)
|
||||
if case['scene']=='taylor':
|
||||
spec=types.SimpleNamespace(scene='vortex',conv_len=30)
|
||||
dtw=native.native_similarity(spec,t,s,len(s)-1)
|
||||
result['roles'][role]['native_probe_DTW']=dict(similarity=dtw,definition='source vortex training-window roll; supplementary, not event field recovery',conv_len=30)
|
||||
own=helpers.select_vortex_event(s,'vortex_taylor')
|
||||
target_event=helpers.select_vortex_event(t,'vortex_taylor')
|
||||
result['roles'][role]['own_event_peak']=int(own['peak_index'])
|
||||
result['roles'][role]['event_peak_delay_D_U']=(int(own['peak_index'])-int(target_event['peak_index']))*.4
|
||||
else:
|
||||
result['roles'][role]['native_probe_DTW']=native.cycle_similarity(t,s,30)
|
||||
result['roles'][role]['native_probe_DTW'].update(definition='canonical six-channel legacy cycle DTW, training D20 units',
|
||||
lag_column=1,target_template_indices=[30,60],state_window_indices=[len(s)-30,len(s)],
|
||||
registration_only=True,lag_identifiable=bool(case['scene']=='karman' and np.std(t[:,1])>1e-10))
|
||||
data={}
|
||||
for role in ('target','zero','controlled'):
|
||||
with np.load(p/role/'fields.npz') as z:data[role]={k:z[k] for k in z.files}
|
||||
for role in ('zero','controlled'):
|
||||
name={'karman':'independent_phase8_diagnostic','steady':'late_snapshot','taylor':'common_event8'}[case['scene']]
|
||||
if case['scene']!='karman' or all(len(data[k]['ux'])==8 for k in (role,'target')):
|
||||
result['roles'][role][name]=compare_selected(data['target'],data[role])
|
||||
else:
|
||||
result['roles'][role][name]=dict(status='unavailable_insufficient_periodic_crossings')
|
||||
result['roles'][role]['selection_metadata']=reports[role]['selection']
|
||||
result['roles'][role]['field_window_tU_D']=reports[role]['field_window_tU_D']
|
||||
if case['scene']=='karman' and all('cycle_mean_ux' in data[k] for k in (role,'target')):
|
||||
support=np.zeros(data[role]['cycle_mean_ux'].shape,bool);support[311:711,1360:2161]=True
|
||||
result['roles'][role]['E_complete_cycle_mean']=field_error(
|
||||
data[role]['cycle_mean_ux'],data[role]['cycle_mean_uy'],
|
||||
data['target']['cycle_mean_ux'],data['target']['cycle_mean_uy'],.005,support)
|
||||
if case['scene']=='taylor':
|
||||
clocks=[data[k]['absolute_steps'] for k in data]
|
||||
if not all(np.array_equal(clocks[0],v) for v in clocks[1:]):raise ValueError('event snapshot clocks differ')
|
||||
result['Taylor_injection']=dict(operator='all interior equilibrium rewrite; both buffers, identical event clock',
|
||||
strength=.000075,center=[600.,510.5],radius=80.,impulse_window='first two SI; retained native history',
|
||||
source_offsets=list(helpers.VORTEX_EVENT_OFFSETS))
|
||||
result['same_clock_field_errors']=json.loads((p/'same_clock_errors.json').read_text())
|
||||
run.write_json(p/'statistics.json',result)
|
||||
del data;gc.collect()
|
||||
print(json.dumps(dict(scene=case['scene'],statistics=str(p/'statistics.json'))))
|
||||
|
||||
|
||||
if __name__=='__main__':main()
|
||||
@@ -0,0 +1,93 @@
|
||||
"""Shared scientific plots of retained fields; no solver or synthetic fields."""
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
import matplotlib
|
||||
matplotlib.use('Agg')
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.colors import BoundaryNorm
|
||||
from matplotlib.patches import Circle,Rectangle
|
||||
|
||||
ROOT=Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0,str(ROOT))
|
||||
from research.continuous_viv.render import vorticity
|
||||
|
||||
|
||||
def decorate(ax,scene,role,y,*,mean=False):
|
||||
if not mean:
|
||||
if scene=='karman':ax.add_patch(Circle((-20,0),1,facecolor='white',edgecolor='#253544',lw=.7))
|
||||
if role!='target':
|
||||
for x,dy in ((0,0),(1.3,.75),(1.3,-.75)):
|
||||
ax.add_patch(Circle((x,dy+y),.5,facecolor='white',edgecolor='#253544',lw=.7))
|
||||
ax.add_patch(Rectangle((4,-5),20,10,fill=False,ls='--',lw=.6,edgecolor='#555'))
|
||||
ax.set_xlim(-23.6,27.6);ax.set_ylim(-6.4,6.4)
|
||||
ax.set_xlabel('(x - pinball-front equilibrium centre) / D',fontsize=8)
|
||||
ax.set_ylabel('(y - channel centre) / D',fontsize=8)
|
||||
ax.tick_params(labelsize=8)
|
||||
|
||||
|
||||
def main():
|
||||
ap=argparse.ArgumentParser(description=__doc__);ap.add_argument('directory',type=Path)
|
||||
args=ap.parse_args();p=args.directory
|
||||
case=json.loads((p/'case.json').read_text());scene=case['scene']
|
||||
cmap=plt.get_cmap('RdBu_r',21).copy();cmap.set_bad('#DDE2E5')
|
||||
norm=BoundaryNorm(np.linspace(-3,3,22),21,clip=True)
|
||||
prefix='SMOKE — plumbing only | ' if case['plan']['smoke'] else ''
|
||||
roles=('target','zero','controlled')
|
||||
data={};motion={}
|
||||
for role in roles:
|
||||
with np.load(p/role/'fields.npz') as z:data[role]={k:z[k] for k in z.files}
|
||||
with np.load(p/role/'native.npz') as z:
|
||||
motion[role]=z['rows'][:,1].copy()/40.
|
||||
shape=data['target']['ux'].shape[-2:]
|
||||
extent=((-0.5-1200)/40,(shape[1]-.5-1200)/40,
|
||||
(-.5-510.5)/40,(shape[0]-.5-510.5)/40)
|
||||
fig,axs=plt.subplots(3,1,figsize=(13,10),constrained_layout=True)
|
||||
for ax,role in zip(axs,roles):
|
||||
d=data[role];flags=d['common_fluid_all_boundaries'].astype(np.uint16)
|
||||
w=vorticity(d['fixed_window_mean_ux'],d['fixed_window_mean_uy'],flags)
|
||||
image=ax.imshow(w,origin='lower',extent=extent,cmap=cmap,norm=norm,interpolation='nearest')
|
||||
decorate(ax,scene,role,0,mean=True)
|
||||
label='no pinball reference' if role=='target' else ('zero rotation' if role=='zero' else ('constant rotations' if scene=='steady' else 'frozen PPO'))
|
||||
ax.set_title(f'{role}: {label} | arithmetic fixed-window mean',fontsize=10)
|
||||
fig.suptitle(prefix+f'{scene}: modern Re_D=50, m*=4, zero structural damping\n'
|
||||
'Gray: cells outside the common fluid support; mean fields are not instantaneous geometry',fontsize=12)
|
||||
fig.colorbar(image,ax=list(axs),shrink=.65,label='vorticity D/U, fixed limits [-3,3]')
|
||||
fig.savefig(p/'mean-flow.png',dpi=160);plt.close(fig)
|
||||
slots=max(len(data[r]['ux']) for r in roles)
|
||||
fig,axs=plt.subplots(3,slots,figsize=(max(8,3*slots),7),squeeze=False,constrained_layout=True)
|
||||
for row,role in enumerate(roles):
|
||||
d=data[role]
|
||||
for col,ax in enumerate(axs[row]):
|
||||
if col>=len(d['ux']):ax.axis('off');continue
|
||||
w=vorticity(d['ux'][col],d['uy'][col],d['flags'][col])
|
||||
image=ax.imshow(w,origin='lower',extent=extent,cmap=cmap,norm=norm,interpolation='nearest')
|
||||
step=int(d['selected_response_steps'][col]);y=float(motion[role][step-1])
|
||||
decorate(ax,scene,role,y)
|
||||
ax.set_xlim(-3,14);ax.set_ylim(-3,3)
|
||||
ax.set_xlabel('x/D relative to equilibrium front',fontsize=7)
|
||||
ax.set_title(f'{role} | slot {col+1}\ntU/D={step*.005/40:.2f}',fontsize=8)
|
||||
family={'karman':'independently phased diagnostic snapshots (different real times)',
|
||||
'steady':'late snapshots at matching real times',
|
||||
'taylor':'common event-relative snapshots at matching real times'}[scene]
|
||||
fig.suptitle(prefix+f'{scene}: {family}\nFixed lab coordinates; same vorticity normalization/limits; source '+case['source'][:8],fontsize=12)
|
||||
fig.colorbar(image,ax=list(axs.ravel()),shrink=.7,label='vorticity D/U [-3,3]')
|
||||
fig.savefig(p/'selected-flow.png',dpi=160);plt.close(fig)
|
||||
fig,ax=plt.subplots(figsize=(11,3.5),constrained_layout=True)
|
||||
for role,color in (('zero','#5A6570'),('controlled','#147D73')):
|
||||
y=motion[role];stride=max(1,len(y)//12000)
|
||||
time=(np.arange(len(y))+1)*.005/40
|
||||
ax.plot(time[::stride],y[::stride],lw=.8,label=role,color=color)
|
||||
ax.set(xlabel='response time tU/D',ylabel='transverse y/D',ylim=(-1,1))
|
||||
ax.legend();ax.grid(alpha=.2)
|
||||
ax.set_title(prefix+scene+': independent paired releases; full retained duration')
|
||||
fig.savefig(p/'motion.png',dpi=160);plt.close(fig)
|
||||
print(json.dumps(dict(scene=scene,plots=['mean-flow.png','selected-flow.png','motion.png'],
|
||||
vorticity_limits=[-3,3],normalization='curl(u) D/U; five-node fluid stencil',
|
||||
mean_mask='intersection over collected boundary fields',display_interpolation='nearest')))
|
||||
|
||||
|
||||
if __name__=='__main__':main()
|
||||
@@ -0,0 +1,557 @@
|
||||
"""Research-only Fig. 2 acquisition on the modern moving plant.
|
||||
|
||||
These paired releases are new experiments, not Legacy numerical reproductions.
|
||||
Nothing here qualifies a steady state or automatically extends/retunes a run.
|
||||
GPU dependencies are lazy so the collection contracts can be checked on CPU.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import ast
|
||||
import gc
|
||||
import hashlib
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import types
|
||||
|
||||
import numpy as np
|
||||
|
||||
sys.dont_write_bytecode = True
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
D, U, NU, SI = 40., .005, .004, 3200
|
||||
BASELINE = '76873d911c4e2caba1bacc25aaa1495ea768453f'
|
||||
CENTRES = ((1200., 510.5), (1252., 540.5), (1252., 480.5))
|
||||
PROBES = ((1600., 590.5), (1600., 510.5), (1600., 430.5))
|
||||
BIAS = np.array([0., -4., 4.])
|
||||
STEADY_SURFACE = np.array([0., -5.1, 5.1])*U
|
||||
MIN_AVAILABLE = 16*1024**3
|
||||
ACQUISITION = Path('/home/frank14f/DynamisLab/src/drl_pinball/acquisition.py')
|
||||
K_RELEASE = Path('/tmp/celeris-results-karman-viv-516975e/pair')
|
||||
ASSETS = {
|
||||
'karman': (Path('/tmp/celeris-karman-viv-assets/model.zip'),
|
||||
'148240c1dcb8b11d8e5a0a9e991f6874c4e799c9744707bf0fb32a8efeb0468d',
|
||||
Path('/tmp/celeris-karman-viv-assets/norm.json'),
|
||||
'534fda818c030a56960e95d0f3ac1e350d887d03db7f80f1d6453195a502b7f0'),
|
||||
'taylor': (Path('/home/frank14f/DynamisLab/models/old/vortex_taylor.zip'),
|
||||
'58882721900f1eb0779f64aea0a2e233d307a94b640b9aaf33efa036db3c79e3',
|
||||
Path('/home/frank14f/DynamisLab/src/SR_analysis/data/vortex/vortex_taylor/norm.json'),
|
||||
'bd38b4cf2b6da56b5cf378e646d673b97a606531c68163460313b330c9957b86'),
|
||||
}
|
||||
NATIVE_COLUMNS = ('response_step', 'y', 'v', 'cme_F', 'cme_U', 'cme_L',
|
||||
'wen_F', 'wen_U', 'wen_L', 'node_F', 'node_U', 'node_L',
|
||||
'eq_only', 'no_donor', 'crossings', 'omega_F', 'omega_U', 'omega_L')
|
||||
|
||||
|
||||
def sha(path):
|
||||
digest = hashlib.sha256()
|
||||
with Path(path).open('rb') as stream:
|
||||
for block in iter(lambda: stream.read(1024*1024), b''):
|
||||
digest.update(block)
|
||||
return digest.hexdigest()
|
||||
|
||||
|
||||
def json_value(value):
|
||||
if isinstance(value, dict):
|
||||
return {str(k): json_value(v) for k, v in value.items()}
|
||||
if isinstance(value, (tuple, list)):
|
||||
return [json_value(v) for v in value]
|
||||
if isinstance(value, np.ndarray):
|
||||
return json_value(value.tolist())
|
||||
if isinstance(value, np.generic):
|
||||
return value.item()
|
||||
if isinstance(value, Path):
|
||||
return str(value.resolve())
|
||||
return value
|
||||
|
||||
|
||||
def write_json(path, value):
|
||||
Path(path).write_text(json.dumps(json_value(value), indent=2, allow_nan=False)+'\n')
|
||||
|
||||
|
||||
def load_file(name, path):
|
||||
spec = importlib.util.spec_from_file_location(name, path)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
sys.modules[name] = module
|
||||
spec.loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
def load_helpers(path=ACQUISITION):
|
||||
"""Load read-only CPU helpers under an isolated package; no original imports.
|
||||
|
||||
Empty namespace packages avoid executing application __init__ modules. The
|
||||
acquisition module and its pure DTW dependency execute directly from source.
|
||||
Event functions are AST-selected verbatim to avoid acquire.py's heavy imports;
|
||||
offsets come from that acquisition module, never a copied/fabricated selector.
|
||||
"""
|
||||
path = Path(path)
|
||||
package = '_fig2_readonly_drl'
|
||||
for suffix, directory in (('', path.parent), ('.legacy_test', path.parent/'legacy_test'),
|
||||
('.legacy_test.core', path.parent/'legacy_test/core')):
|
||||
module = types.ModuleType(package+suffix)
|
||||
module.__path__ = [str(directory)]
|
||||
sys.modules[package+suffix] = module
|
||||
acquisition = load_file(package+'.acquisition', path)
|
||||
event_path = path.parent/'legacy_test/acquire.py'
|
||||
source = ast.parse(event_path.read_text(), filename=str(event_path))
|
||||
names = {'_vortex_event_channel', '_select_vortex_event'}
|
||||
nodes = [node for node in source.body if isinstance(node, ast.FunctionDef) and node.name in names]
|
||||
if {node.name for node in nodes} != names:
|
||||
raise ValueError('authoritative event selector functions missing')
|
||||
namespace = dict(np=np, VORTEX_EVENT_OFFSETS=acquisition.VORTEX_EVENT_OFFSETS)
|
||||
exec(compile(ast.Module(body=nodes, type_ignores=[]), str(event_path), 'exec'), namespace)
|
||||
acquisition.select_vortex_event = namespace['_select_vortex_event']
|
||||
return acquisition
|
||||
|
||||
|
||||
def schedule(scene, smoke=False):
|
||||
if scene not in ('karman', 'steady', 'taylor'):
|
||||
raise ValueError('unknown scene')
|
||||
intervals = 150 if scene == 'taylor' else 400
|
||||
release = {'karman': 4576000, 'steady': 2048000, 'taylor': 1024000}[scene]
|
||||
return dict(si=32 if smoke else SI, intervals=3 if smoke else intervals,
|
||||
field_start=0 if smoke or scene == 'taylor' else 240,
|
||||
release_clock=(64 if scene == 'taylor' else 32) if smoke else release,
|
||||
smoke=bool(smoke))
|
||||
|
||||
|
||||
def available_memory(path=Path('/proc/meminfo')):
|
||||
for line in Path(path).read_text().splitlines():
|
||||
if line.startswith('MemAvailable:'):
|
||||
return int(line.split()[1])*1024
|
||||
raise RuntimeError('MemAvailable unavailable; RAM admission cannot be verified')
|
||||
|
||||
|
||||
def admit_memory(smoke=False):
|
||||
if smoke:
|
||||
return None
|
||||
available = available_memory()
|
||||
if available < MIN_AVAILABLE:
|
||||
raise MemoryError(f'MemAvailable {available} < required {MIN_AVAILABLE}')
|
||||
return available
|
||||
|
||||
|
||||
def wall_surface(scene, role, action=None):
|
||||
if role == 'target' or role == 'zero':
|
||||
return np.zeros(3, np.float64) # exactly zero physical rotation
|
||||
if scene == 'steady':
|
||||
return STEADY_SURFACE.copy()
|
||||
action = np.asarray(action)
|
||||
if action.shape != (3,) or not np.isfinite(action).all() or (np.abs(action) > 1).any():
|
||||
raise ValueError('invalid deterministic policy action')
|
||||
return ((8. if scene == 'karman' else 4.)*action+BIAS)*U
|
||||
|
||||
|
||||
def check_structure(y, v, previous_y):
|
||||
if not np.isfinite([y, v]).all() or abs(y) > D or abs(v) > .025 or abs(y-previous_y) > .025:
|
||||
raise RuntimeError('nonfinite structure, travel > D or speed > .025; no retuning')
|
||||
|
||||
|
||||
def check_clock(stepper, release_clock, completed):
|
||||
if stepper.step_count != release_clock+completed:
|
||||
raise RuntimeError('observed solver clock differs from recorded response clock')
|
||||
|
||||
|
||||
def clean_field(fields, flags):
|
||||
"""Canonical modern bit-0 fluid mask; hard-fail before nonfluid zero fill."""
|
||||
ux, uy = np.asarray(fields['ux']), np.asarray(fields['uy'])
|
||||
rho = np.asarray(fields['rho'])
|
||||
if ux.ndim != 2 or uy.shape != ux.shape or rho.shape != ux.shape:
|
||||
raise ValueError('canonical shared (ny,nx) macroscopic arrays required')
|
||||
flags = np.asarray(flags)
|
||||
if flags.size != ux.size or flags.dtype != np.uint16:
|
||||
raise ValueError('modern uint16 flags matching field required')
|
||||
flags = flags.reshape(ux.shape)
|
||||
fluid = (flags & 1) != 0
|
||||
if any(not np.isfinite(value[fluid]).all() for value in (rho, ux, uy)):
|
||||
raise RuntimeError('nonfinite FLUID macroscopic field')
|
||||
result = np.zeros((2, *ux.shape), np.float32)
|
||||
result[0, fluid], result[1, fluid] = ux[fluid], uy[fluid]
|
||||
return result, flags.copy(), fluid
|
||||
|
||||
|
||||
def select_fields(scene, plan, helpers, times, sensors, cache, event=None):
|
||||
"""Fixed-window means remain separate from independently phased diagnostics."""
|
||||
mean = helpers.accumulate_mean_fields(cache[:, 0], cache[:, 1], np.arange(len(cache)))
|
||||
result = dict(fixed_window_mean_ux=mean['mean_ux'], fixed_window_mean_uy=mean['mean_uy'])
|
||||
metadata = dict(fixed_window_count=len(cache), periodic_phase_status='not_requested')
|
||||
indices = np.array([len(cache)-1], np.int64)
|
||||
if plan['smoke']:
|
||||
metadata['selection'] = 'smoke_last_snapshot_not_physical'
|
||||
elif scene == 'taylor':
|
||||
if event is None:
|
||||
event = helpers.select_vortex_event(sensors, 'vortex_taylor')
|
||||
indices = np.asarray(event['field_indices'], np.int64)
|
||||
if (indices < 0).any() or (indices >= len(cache)).any():
|
||||
raise ValueError('authoritative event offsets exceed collected fields')
|
||||
metadata.update(selection='source_vortex_event', event=event)
|
||||
elif scene == 'karman':
|
||||
try:
|
||||
phase = helpers.assign_periodic_phase(times, sensors, minimum_crossing_interval=.5*30*SI)
|
||||
complete = helpers.complete_cycle_field_indices(times, phase['crossing_times'])
|
||||
chosen = helpers.select_phase_fields(times, phase['crossing_times'])
|
||||
cycle_mean = helpers.accumulate_mean_fields(cache[:, 0], cache[:, 1], complete['field_indices'])
|
||||
result.update(cycle_mean_ux=cycle_mean['mean_ux'], cycle_mean_uy=cycle_mean['mean_uy'])
|
||||
indices = chosen['field_indices']
|
||||
metadata.update(periodic_phase_status='available_diagnostic_only', phase_selection=chosen,
|
||||
complete_cycles=complete, crossing_times=phase['crossing_times'],
|
||||
rejected_crossing_times=phase['rejected_crossing_times'])
|
||||
except ValueError as exc:
|
||||
metadata.update(periodic_phase_status='insufficient_crossings', phase_reason=str(exc))
|
||||
metadata['selection'] = 'independent_center_probe_uy_diagnostic'
|
||||
else:
|
||||
metadata.update(selection='last_snapshot', periodic_phase_status='not_assumed_steady')
|
||||
result.update(ux=cache[indices, 0], uy=cache[indices, 1], selected_index=indices,
|
||||
selected_response_steps=times[indices])
|
||||
return result, metadata, event
|
||||
|
||||
|
||||
def add_scene(sim, scene, *, moving=False, pinball=True):
|
||||
from CelerisLab.body.motion import Translation
|
||||
if scene == 'karman':
|
||||
sim.add_body('circle', (400., 510.5), 40.)
|
||||
probes = [sim.add_body('sensor', point, 10.) for point in PROBES]
|
||||
envelope = Translation((0., 0., -D, D), .025, shared=True) if moving else None
|
||||
bodies = [sim.add_body('circle', point, 20., translation=envelope) for point in CENTRES] if pinball else []
|
||||
return probes, bodies
|
||||
|
||||
|
||||
def inject_taylor(sim):
|
||||
from CelerisLab.lbm.initializers import add_vortex
|
||||
clock = int(sim.stepper.step_count)
|
||||
with sim.ctx.activate():
|
||||
sim.stream.synchronize()
|
||||
add_vortex(sim.field, (600., 510.5), 80., .000075, 'taylor')
|
||||
sim.stream.synchronize()
|
||||
if sim.stepper.step_count != clock:
|
||||
raise RuntimeError('vortex initializer advanced response clock')
|
||||
return dict(absolute_clock=clock, response_clock=0, center=[600., 510.5], radius=80.,
|
||||
strength=.000075, type='taylor', count=1,
|
||||
operator='unmodified add_vortex: all interior reset to equilibrium; both buffers uploaded',
|
||||
impulse='full equilibrium reset discards pre-existing non-equilibrium on all interior cells')
|
||||
|
||||
|
||||
def make_release(scene, plan, cfgpath, base, out, started, cap, release_dir):
|
||||
from CelerisLab import Simulation
|
||||
if scene == 'karman' and not plan['smoke']:
|
||||
seed, force = base.saved_release(release_dir)
|
||||
return seed, force, dict(kind='verified_saved_static_release', path=release_dir,
|
||||
release_npz_sha256=sha(release_dir/'release.npz'))
|
||||
with Simulation(str(cfgpath)) as sim:
|
||||
_, bodies = add_scene(sim, scene, pinball=scene != 'taylor')
|
||||
sim.initialize()
|
||||
warm = 32 if plan['smoke'] else (512000 if scene == 'taylor' else 2048000)
|
||||
if scene == 'taylor':
|
||||
base.warmup(sim, warm, started, cap)
|
||||
first = sim.bodies.count
|
||||
for point in CENTRES:
|
||||
sim.add_body('circle', point, 20.) # runtime additions return staged ID -1
|
||||
sim.sync_bodies()
|
||||
bodies = list(range(first, first+len(CENTRES)))
|
||||
base.warmup(sim, warm-1, started, cap)
|
||||
sim.run(1, zero_obs=True, sync_obs=True)
|
||||
force = sum(float(sim.read_force(body)[1]) for body in bodies)
|
||||
seed = base.capture_seed(sim)
|
||||
if seed[3] != plan['release_clock'] or not np.isfinite(force):
|
||||
raise RuntimeError('unexpected static release clock/force')
|
||||
np.savez_compressed(out/'release.npz', current=seed[0], spare=seed[1], flags=seed[2],
|
||||
clock=seed[3], force=force)
|
||||
return seed, force, dict(kind='fresh_static_full_two_buffer_release',
|
||||
release_npz_sha256=sha(out/'release.npz'))
|
||||
|
||||
|
||||
def compress_native(path, rows, completed):
|
||||
"""Bounded disk memmap; preserve raw file until parent elects removal."""
|
||||
rows.flush()
|
||||
compressed = path.with_suffix('.npz')
|
||||
np.savez_compressed(compressed, rows=rows[:completed])
|
||||
with np.load(compressed) as data:
|
||||
retained = data['rows']
|
||||
if retained.shape != (completed, len(NATIVE_COLUMNS)):
|
||||
raise RuntimeError('compressed native shape mismatch')
|
||||
for start in range(0, completed, 10000):
|
||||
end = min(start+10000, completed)
|
||||
if not np.array_equal(retained[start:end], rows[start:end]):
|
||||
raise RuntimeError('compressed native verification failed')
|
||||
return dict(raw_path=path.name, compressed_path=compressed.name, verified=True,
|
||||
compressed_sha256=sha(compressed), raw_preserved_for_parent_cleanup=True)
|
||||
|
||||
|
||||
def run_role(scene, role, plan, cfgpath, base, helpers, metrics, seed, initial_force,
|
||||
model, norm, out, started, cap, event):
|
||||
from CelerisLab import Simulation
|
||||
from CelerisLab.body.motion import MovingTables
|
||||
directory = out/role
|
||||
directory.mkdir()
|
||||
steps = plan['si']*plan['intervals']
|
||||
rows = np.lib.format.open_memmap(directory/'native.npy', mode='w+', dtype=np.float64,
|
||||
shape=(steps, len(NATIVE_COLUMNS)))
|
||||
signals = {key: np.zeros((plan['intervals'], width), np.float32) for key, width in
|
||||
[('sensor_area_mean', 6), ('sensors', 6), ('forces', 6), ('actions', 3),
|
||||
('observations', 12), ('policy_input', 12), ('raw_observation', 12)]}
|
||||
structure = base.Structure(4., 2.5e-5, 0., D)
|
||||
columns = {name: i for i, name in enumerate(MovingTables.DIAG)}
|
||||
completed = completed_si = 0
|
||||
duration = steps*U/D
|
||||
report = dict(status='running', role=role, target_is_free_body=False if role == 'target' else None,
|
||||
columns=NATIVE_COLUMNS,
|
||||
motion_window=dict(start_tU_D=max(0., duration-80.), end_tU_D=duration,
|
||||
interpretation='smoke_short_not_physical' if plan['smoke'] else
|
||||
('entire_60DU_event_not_settled' if scene == 'taylor' else 'declared_last_80DU')),
|
||||
structure=None if role == 'target' else dict(mass=structure.mass, fn=structure.frequency,
|
||||
mass_ratio=4., zeta=0., y0=0., v0=0.))
|
||||
cache, common_fluid, selected_flags, roi_cache = None, None, {}, None
|
||||
obs, force = np.zeros(12, np.float32), initial_force
|
||||
try:
|
||||
report['MemAvailable_admission_bytes'] = admit_memory(plan['smoke'])
|
||||
with Simulation(str(cfgpath)) as sim:
|
||||
probes, bodies = add_scene(sim, scene, moving=role != 'target', pinball=role != 'target')
|
||||
sim.initialize()
|
||||
if role == 'target':
|
||||
base.warmup(sim, plan['release_clock'], started, cap)
|
||||
report['initialization'] = 'own no-pinball initialization at matching absolute clock'
|
||||
else:
|
||||
report['release_transfer'] = base.install_seed(sim, seed)
|
||||
if sim.stepper.step_count != plan['release_clock']:
|
||||
raise RuntimeError('role release clocks differ')
|
||||
if scene == 'taylor':
|
||||
report['injection'] = inject_taylor(sim)
|
||||
count = plan['intervals']-plan['field_start']
|
||||
shape = (sim.field.ny, sim.field.nx)
|
||||
cache = np.empty((count, 2, *shape), np.float32)
|
||||
common_fluid = np.ones(shape, bool)
|
||||
roi = metrics.roi_slices(shape, D=D, xs=1600., y0=510.5,
|
||||
downstream_solid_extent=1272.)
|
||||
# Only compact ROI histories survive a role; full-grid histories never reach disk.
|
||||
roi_shape = cache[(slice(None), slice(None), *roi)].shape
|
||||
roi_cache = np.empty(roi_shape, np.float32)
|
||||
retain = set(event['field_indices'].tolist()) if event is not None else set()
|
||||
if scene == 'taylor' and event is None and not plan['smoke']:
|
||||
# Authoritative selector searches 38..87; any imported offset can be selected.
|
||||
retain = {i+int(offset) for i in range(38, 88) for offset in helpers.VORTEX_EVENT_OFFSETS}
|
||||
# K phase unknown until the final signal: retain flags for every boundary in RAM.
|
||||
flag_cache = np.empty((count, *shape), np.uint16) if scene == 'karman' else None
|
||||
for interval in range(plan['intervals']):
|
||||
base.check_time(started, cap)
|
||||
action = np.zeros(3, np.float32)
|
||||
signals['policy_input'][interval] = obs
|
||||
if role == 'controlled' and scene != 'steady':
|
||||
action = np.asarray(model.predict(obs, deterministic=True)[0], np.float32)
|
||||
target, effective = wall_surface(scene, role, action), np.zeros(3)
|
||||
sensor_sum, force_sum = np.zeros(6), np.zeros(6)
|
||||
for native in range(plan['si']):
|
||||
if native % 1000 == 0:
|
||||
base.check_time(started, cap)
|
||||
y, v = (0., 0.) if role == 'target' else structure.candidate(force)
|
||||
check_structure(y, v, structure.y)
|
||||
effective = .9**.25*effective + (1.-.9**.25)*target
|
||||
omega = effective/20.
|
||||
for body, w in zip(bodies, omega):
|
||||
sim.set_body(body, omega=float(w), offset=(0., y), vy=y-structure.y)
|
||||
sim.run(1, zero_obs=True, sync_obs=True)
|
||||
if bodies:
|
||||
diag = sim.moving_diagnostics()
|
||||
cme, wen = diag[:, columns['cme_y']], diag[:, columns['wen_y']]
|
||||
node = diag[:, columns['cover_jy']]-diag[:, columns['uncover_jy']]
|
||||
counters = [diag[:, columns[key]].sum() for key in ('eq_only', 'no_donor', 'crossings')]
|
||||
packed = np.array([value for body in bodies for value in sim.read_force(body)[:2]])
|
||||
else:
|
||||
cme, wen, node, counters, packed = np.zeros(3), np.zeros(3), np.zeros(3), [0., 0., 0.], np.zeros(6)
|
||||
sensors = np.array([value for probe in probes for value in sim.read_sensor(probe)[:2]])
|
||||
row = np.array([completed+1, y, v, *cme, *wen, *node, *counters, *omega])
|
||||
if not np.isfinite(row).all() or counters[1] != 0 or not np.isfinite([packed, sensors]).all():
|
||||
raise RuntimeError('nonfinite native diagnostics/observations or no_donor')
|
||||
rows[completed] = row
|
||||
completed += 1
|
||||
structure.y, structure.v = y, v
|
||||
force = float(cme.sum(dtype=np.float64)+wen.sum(dtype=np.float64))
|
||||
sensor_sum += sensors
|
||||
force_sum += packed
|
||||
check_clock(sim.stepper, plan['release_clock'], completed)
|
||||
sensors, packed = sensor_sum/plan['si'], force_sum/plan['si']
|
||||
raw = np.r_[sensors*156., packed*2.].astype(np.float32)
|
||||
if norm is not None:
|
||||
raw, obs, clipped = base.observation(sensors, packed, 2., norm)
|
||||
report['clipped_channels'] = report.get('clipped_channels', 0)+clipped
|
||||
for key, value in [('sensor_area_mean', sensors), ('sensors', sensors*156.),
|
||||
('forces', packed*2.), ('actions', action), ('observations', obs),
|
||||
('raw_observation', raw)]:
|
||||
signals[key][interval] = value
|
||||
if interval >= plan['field_start']:
|
||||
index = interval-plan['field_start']
|
||||
clean, flags, fluid = clean_field(sim.get_macroscopic(), sim.get_flags())
|
||||
if not fluid[roi].all():
|
||||
raise RuntimeError('prescribed downstream ROI contains nonfluid cells')
|
||||
cache[index] = clean
|
||||
common_fluid &= fluid
|
||||
roi_cache[index] = clean[(slice(None), *roi)]
|
||||
if flag_cache is not None:
|
||||
flag_cache[index] = flags
|
||||
elif index in retain or index == count-1:
|
||||
selected_flags[index] = flags
|
||||
completed_si += 1
|
||||
if completed_si % 10 == 0 or completed_si == plan['intervals']:
|
||||
rows.flush()
|
||||
print(json.dumps(dict(event='progress', scene=scene, role=role, interval=completed_si,
|
||||
absolute_clock=sim.stepper.step_count, y_D=y/D)), flush=True)
|
||||
times = np.arange(plan['field_start']+1, plan['intervals']+1, dtype=np.int64)*plan['si']
|
||||
selected, selection, event = select_fields(scene, plan, helpers, times,
|
||||
signals['sensors'][plan['field_start']:], cache, event)
|
||||
indices = selected['selected_index']
|
||||
selected['flags'] = flag_cache[indices] if flag_cache is not None else np.stack([selected_flags[int(i)] for i in indices])
|
||||
selected['common_fluid_all_boundaries'] = common_fluid
|
||||
selected['absolute_steps'] = selected['selected_response_steps']+plan['release_clock']
|
||||
np.savez_compressed(directory/'fields.npz', **selected)
|
||||
report.update(selection=selection, field_response_steps=times,
|
||||
field_absolute_steps=times+plan['release_clock'],
|
||||
field_window_tU_D=[int(times[0])*U/D, int(times[-1])*U/D],
|
||||
status='smoke_completed_not_physical' if plan['smoke'] else 'duration_completed_not_qualified')
|
||||
roi_mask = common_fluid[roi].copy()
|
||||
report['motion_summary'] = metrics.motion_summary(rows[max(0, completed-640000):completed, 1]/D)
|
||||
return dict(roi=roi_cache, mask=roi_mask, times=times, event=event)
|
||||
except BaseException as exc:
|
||||
report['status'] = f'error: {type(exc).__name__}: {exc}'
|
||||
raise
|
||||
finally:
|
||||
report.update(completed_native_steps=completed, completed_intervals=completed_si)
|
||||
np.savez_compressed(directory/'signals.npz', response_steps=np.arange(1, completed_si+1)*plan['si'],
|
||||
absolute_steps=plan['release_clock']+np.arange(1, completed_si+1)*plan['si'],
|
||||
**{key: value[:completed_si] for key, value in signals.items()})
|
||||
if completed:
|
||||
report['native_archive'] = compress_native(directory/'native.npy', rows, completed)
|
||||
write_json(directory/'report.json', report)
|
||||
del cache, rows
|
||||
gc.collect()
|
||||
|
||||
|
||||
def score_roles(roles, metrics):
|
||||
target = roles['target']
|
||||
common = np.logical_and.reduce([role['mask'] for role in roles.values()])
|
||||
if not common.all():
|
||||
raise ValueError('prescribed downstream ROI must be entirely common fluid')
|
||||
result = dict(definition='sqrt(mean common ROI (dux^2+duy^2)/U^2)',
|
||||
alignment='same absolute native clock; no lag/phase alignment',
|
||||
roi_xy_inclusive=[1360, 2160, 311, 710], support_cells=int(common.sum()),
|
||||
support_coverage_fraction=1.)
|
||||
for name in ('zero', 'controlled'):
|
||||
role = roles[name]
|
||||
if not np.array_equal(role['times'], target['times']):
|
||||
raise ValueError('unmatched response clocks')
|
||||
errors = np.array([metrics.field_error(*a, *b, U, common) for a, b in zip(role['roi'], target['roi'])])
|
||||
# FP64 reduction without duplicating entire history.
|
||||
mean = [a.mean(axis=0, dtype=np.float64) for a in (role['roi'], target['roi'])]
|
||||
result[name] = dict(same_clock_instantaneous_E=errors,
|
||||
mean_instantaneous_E=float(errors.mean()),
|
||||
E_of_fixed_window_mean=metrics.field_error(*mean[0], *mean[1], U, common))
|
||||
return result, common
|
||||
|
||||
|
||||
def source_manifest(base, helpers):
|
||||
files = [Path(__file__), ROOT/'research/fig2_materials/metrics.py', Path(base.__file__),
|
||||
ROOT/'research/steady_pinball/run.py', ROOT/'research/steady_pinball/config.json',
|
||||
Path(helpers.__file__), Path(helpers.__file__).parent/'legacy_test/acquire.py',
|
||||
Path(helpers.__file__).parent/'legacy_test/core/dtw_metrics.py']
|
||||
files += sorted((ROOT/'src/CelerisLab').rglob('*.py'))
|
||||
for suffix in ('*.cu', '*.cuh', '*.h'):
|
||||
files += sorted((ROOT/'src/CelerisLab').rglob(suffix))
|
||||
return {str(path.resolve()): sha(path) for path in files}
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
ap = argparse.ArgumentParser(description=__doc__)
|
||||
ap.add_argument('--scene', choices=('karman', 'steady', 'taylor'), required=True)
|
||||
ap.add_argument('--out', type=Path, required=True)
|
||||
ap.add_argument('--smoke', action='store_true', help='32-step warmups; 3 SI of 32; no physical score')
|
||||
ap.add_argument('--D', type=int, choices=(40,), default=40)
|
||||
ap.add_argument('--model', type=Path)
|
||||
ap.add_argument('--norm', type=Path)
|
||||
ap.add_argument('--release-dir', type=Path, default=K_RELEASE)
|
||||
ap.add_argument('--acquisition', type=Path, default=ACQUISITION)
|
||||
ap.add_argument('--wall-seconds', type=float, default=43200.)
|
||||
args = ap.parse_args(argv)
|
||||
if not np.isfinite(args.wall_seconds) or args.wall_seconds <= 0:
|
||||
ap.error('positive finite wall cap required')
|
||||
if args.scene == 'steady' and (args.model or args.norm):
|
||||
ap.error('steady constant control has no PPO or normalizer')
|
||||
out = args.out.resolve()
|
||||
if out == ROOT or ROOT in out.parents:
|
||||
ap.error('fresh output must be outside checkout')
|
||||
sys.path.insert(0, str(ROOT))
|
||||
from research.karman_viv import run as base
|
||||
metrics = load_file('_fig2_metrics', ROOT/'research/fig2_materials/metrics.py')
|
||||
helpers = load_helpers(args.acquisition)
|
||||
model = norm = None
|
||||
inputs = {}
|
||||
if args.scene != 'steady':
|
||||
model_path, model_sha, norm_path, norm_sha = ASSETS[args.scene]
|
||||
model_path, norm_path = args.model or model_path, args.norm or norm_path
|
||||
if sha(model_path) != model_sha or sha(norm_path) != norm_sha:
|
||||
ap.error('model/normalizer hashes differ from frozen inputs')
|
||||
norm = json.loads(norm_path.read_text())
|
||||
inputs = dict(model_path=model_path, model_sha256=model_sha,
|
||||
norm_path=norm_path, norm_sha256=norm_sha)
|
||||
model = base.load_policy(model_path)
|
||||
sources = source_manifest(base, helpers)
|
||||
source = subprocess.check_output(['git', '-C', str(ROOT), 'rev-parse', 'HEAD'], text=True).strip()
|
||||
dirty = subprocess.check_output(['git', '-C', str(ROOT), 'status', '--porcelain'], text=True)
|
||||
plan = schedule(args.scene, args.smoke)
|
||||
admit_memory(args.smoke)
|
||||
out.mkdir(parents=True, exist_ok=False)
|
||||
cfgpath = out/'config.json'
|
||||
write_json(cfgpath, base.config(40))
|
||||
receipt = dict(scene=args.scene, plan=plan, D=D, U=U, nu=NU, actual_Re_D=50.,
|
||||
historical_case='karman_re100' if args.scene == 'karman' else args.scene,
|
||||
expected_baseline=BASELINE, source=source, git_dirty=bool(dirty), git_status=dirty,
|
||||
source_sha256=sources, inputs=inputs, centres=CENTRES, probes=PROBES,
|
||||
environment=dict(python=sys.version, platform=platform.platform(), numpy=np.__version__,
|
||||
conda_env=os.environ.get('CONDA_DEFAULT_ENV'),
|
||||
cuda_visible_devices=os.environ.get('CUDA_VISIBLE_DEVICES')),
|
||||
acquisition_event_offsets=list(helpers.VORTEX_EVENT_OFFSETS),
|
||||
event_selector='source _select_vortex_event AST verbatim; actual acquisition offsets',
|
||||
structure=dict(mass_ratio=4., fn_native=2.5e-5, fn_D_U=.2, zeta=0., travel_D=1., speed=.025),
|
||||
rhs='previous native-step sum CME_y+Wen_y; initial force last static native step',
|
||||
policy='SI mean packed CME *2; area-mean sensors *156; frozen norm; first input zeros',
|
||||
control='steady constant (0,-5.1,5.1)*U; K scale8 or Taylor scale4, bias(0,-4,4)*U',
|
||||
ema=dict(alpha=.9**.25, reset='every SI'),
|
||||
storage='one full-grid float32 RAM cache at a time; compact ROI histories in RAM; no full history field disk',
|
||||
limitation='Modern moving-plant experiment; no Legacy numerical equivalence or steady/convergence claim')
|
||||
write_json(out/'case.json', receipt)
|
||||
started, status = time.monotonic(), 'running'
|
||||
try:
|
||||
seed, force, release = make_release(args.scene, plan, cfgpath, base, out, started,
|
||||
args.wall_seconds, args.release_dir)
|
||||
receipt['release'] = release
|
||||
receipt['release'].update(clock=int(seed[3]), initial_force=force,
|
||||
current_sha256=base.array_sha(seed[0]),
|
||||
spare_sha256=base.array_sha(seed[1]), flags_sha256=base.array_sha(seed[2]))
|
||||
write_json(out/'case.json', receipt)
|
||||
roles, event = {}, None
|
||||
order = ('controlled', 'zero', 'target') if args.scene == 'taylor' else ('target', 'zero', 'controlled')
|
||||
for role in order:
|
||||
roles[role] = run_role(args.scene, role, plan, cfgpath, base, helpers, metrics,
|
||||
seed, force, model, norm, out, started, args.wall_seconds, event)
|
||||
if args.scene == 'taylor':
|
||||
event = roles[role]['event']
|
||||
if not args.smoke:
|
||||
scores, support = score_roles(roles, metrics)
|
||||
write_json(out/'same_clock_errors.json', scores)
|
||||
np.savez_compressed(out/'common_roi_support.npz', support=support)
|
||||
if source_manifest(base, helpers) != sources:
|
||||
raise RuntimeError('source files changed during collection')
|
||||
status = 'smoke_completed_not_physical' if args.smoke else 'three_roles_completed_not_qualified'
|
||||
except BaseException as exc:
|
||||
status = f'error: {type(exc).__name__}: {exc}'
|
||||
raise
|
||||
finally:
|
||||
write_json(out/'terminal.json', dict(status=status, elapsed_s=time.monotonic()-started,
|
||||
physical_score_claim=False if args.smoke else None))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,94 @@
|
||||
"""Pure NumPy Fig2 primitives; no solver, phase selection, or probe DTW.
|
||||
|
||||
Adapted formula and inclusive ROI bounds from DynamisLab
|
||||
src/drl_pinball/eval/wake_l2.py::mean_field_metric, roi_slices, inspected
|
||||
2026-11-02 at HEAD 609116ec26f19766f5e9ce2b0df427d4e24faae8
|
||||
(working-tree source, not asserted clean). The explicit common-fluid/finite
|
||||
mask and motion summaries are additions. legacy_test/metrics.py::cycle_similarity
|
||||
was inspected only: its six probe channels are not a field recovery metric.
|
||||
"""
|
||||
import math
|
||||
import numpy as np
|
||||
|
||||
|
||||
def roi_slices(shape, *, D, xs, y0=None, downstream_solid_extent):
|
||||
"""Lab-fixed ROI: sensor-relative x/D=-6..14, y/D=-5..5, inclusive.
|
||||
|
||||
Equivalent to pinball-front-relative x/D=4..24 when xs=front+10D.
|
||||
Supply actual geometry, e.g. D=40, xs=1600, y0=510.5.
|
||||
"""
|
||||
ny, nx = shape
|
||||
y0 = (ny - 1) / 2 if y0 is None else float(y0)
|
||||
if D <= 0 or not all(np.isfinite(v) for v in (D, xs, y0, downstream_solid_extent)):
|
||||
raise ValueError("invalid geometry")
|
||||
x0, x1 = math.ceil(xs - 6 * D), math.floor(xs + 14 * D)
|
||||
lo, hi = math.ceil(y0 - 5 * D), math.floor(y0 + 5 * D)
|
||||
if x0 < 0 or lo < 0 or x1 >= nx or hi >= ny:
|
||||
raise ValueError("ROI outside grid")
|
||||
if x0 <= downstream_solid_extent:
|
||||
raise ValueError("ROI not downstream of solid extent")
|
||||
return slice(lo, hi + 1), slice(x0, x1 + 1)
|
||||
|
||||
|
||||
def common_fluid_roi_mask(fluid_masks, fields, roi):
|
||||
"""Intersect explicit boolean fluid masks, ROI, and finite 2-D fields.
|
||||
|
||||
Pass every compared role/component/sample to freeze a common support over
|
||||
time. Zero velocity never implies solid. Masks must share the lab grid.
|
||||
"""
|
||||
fields = [np.asarray(a, dtype=float) for a in fields]
|
||||
masks = [np.asarray(a) for a in fluid_masks]
|
||||
if not fields or not masks:
|
||||
raise ValueError("fields and explicit fluid masks required")
|
||||
shape = fields[0].shape
|
||||
if len(shape) != 2 or any(a.shape != shape for a in fields + masks):
|
||||
raise ValueError("equal-shape 2-D arrays required")
|
||||
if any(a.dtype != np.dtype(bool) for a in masks):
|
||||
raise ValueError("fluid masks must be boolean")
|
||||
support = np.zeros(shape, dtype=bool)
|
||||
ys, xs = roi
|
||||
for s, n in zip((ys, xs), shape):
|
||||
if not isinstance(s, slice) or s.step not in (None, 1) or not 0 <= (s.start or 0) < (n if s.stop is None else s.stop) <= n:
|
||||
raise ValueError("invalid ROI slices")
|
||||
support[ys, xs] = True
|
||||
for a in masks:
|
||||
support &= a
|
||||
for a in fields:
|
||||
support &= np.isfinite(a)
|
||||
if not support.any():
|
||||
raise ValueError("empty common finite fluid ROI")
|
||||
return support
|
||||
|
||||
|
||||
def field_error(rux, ruy, tux, tuy, u0, support):
|
||||
"""Eq1: sqrt(mean_support((dux**2 + duy**2)/U0**2)).
|
||||
|
||||
For E(mean field), pass arithmetic mean fields from matched windows.
|
||||
Mean instantaneous E requires separate calls per snapshot and then a mean;
|
||||
these operations are not interchangeable. No target-energy denominator.
|
||||
"""
|
||||
a = [np.asarray(v, dtype=float) for v in (rux, ruy, tux, tuy)]
|
||||
support = np.asarray(support)
|
||||
if a[0].ndim != 2 or any(v.shape != a[0].shape for v in a) or support.shape != a[0].shape or support.dtype != np.dtype(bool):
|
||||
raise ValueError("equal-shape 2-D fields and boolean support required")
|
||||
if not np.isfinite(u0) or u0 <= 0 or not support.any():
|
||||
raise ValueError("positive finite U0 and nonempty support required")
|
||||
if any(not np.isfinite(v[support]).all() for v in a):
|
||||
raise ValueError("nonfinite field on fixed support")
|
||||
du = (a[0][support] - a[2][support]) / u0
|
||||
dv = (a[1][support] - a[3][support]) / u0
|
||||
return float(np.sqrt(np.mean(du * du + dv * dv)))
|
||||
|
||||
|
||||
def motion_summary(displacement):
|
||||
"""Arithmetic mean, centered RMS, half peak-to-peak along time axis 0.
|
||||
|
||||
Input is displacement in caller-declared units; no implicit D scaling.
|
||||
Use the same retained window as field evaluation. No sinusoid assumption.
|
||||
"""
|
||||
a = np.asarray(displacement, dtype=float)
|
||||
if a.ndim == 0 or a.shape[0] == 0 or not np.isfinite(a).all():
|
||||
raise ValueError("nonempty finite time samples required")
|
||||
mean = a.mean(axis=0)
|
||||
return {"mean": mean, "centered_rms": np.sqrt(np.mean((a - mean) ** 2, axis=0)),
|
||||
"half_range": (a.max(axis=0) - a.min(axis=0)) / 2}
|
||||
@@ -0,0 +1,389 @@
|
||||
{
|
||||
"head": "6e3756c587ec08ab6a55c4a1a5f4671822d3f0a0",
|
||||
"status": " M pyproject.toml\n M setup.py\n M src/CelerisLab/__init__.py\n M src/CelerisLab/body/__init__.py\n M src/CelerisLab/body/ddf_patch.py\n M src/CelerisLab/body/manager.py\n M src/CelerisLab/body/objects.py\n M src/CelerisLab/body/preprocess/flag_overlay.py\n M src/CelerisLab/common/__init__.py\n M src/CelerisLab/common/checkpoint.py\n M src/CelerisLab/config.py\n M src/CelerisLab/configs/CONFIG.md\n M src/CelerisLab/cuda/__init__.py\n M src/CelerisLab/cuda/compiler_v2.py\n M src/CelerisLab/cuda/context.py\n M src/CelerisLab/lbm/__init__.py\n M src/CelerisLab/lbm/curved_links.py\n M src/CelerisLab/lbm/field.py\n M src/CelerisLab/lbm/initializers.py\n M src/CelerisLab/lbm/kernels/boundary/bounce_back.cuh\n M src/CelerisLab/lbm/kernels/boundary/curved_boundary.cuh\n M src/CelerisLab/lbm/kernels/boundary/inlet/common.cuh\n M src/CelerisLab/lbm/kernels/boundary/inlet/zou_he_local.cuh\n M src/CelerisLab/lbm/kernels/boundary/inlet_outlet.cuh\n M src/CelerisLab/lbm/kernels/config/config_grid.h\n M src/CelerisLab/lbm/kernels/config/config_method.h\n M src/CelerisLab/lbm/kernels/config/config_objects.h\n M src/CelerisLab/lbm/kernels/config/config_physics.h\n M src/CelerisLab/lbm/kernels/kernel_v2.cu\n M src/CelerisLab/lbm/kernels/operators/collision_mrt.cuh\n M src/CelerisLab/lbm/kernels/operators/collision_trt.cuh\n M src/CelerisLab/lbm/kernels/operators/forcing_guo.cuh\n M src/CelerisLab/lbm/kernels/step/aux_kernels.cu\n M src/CelerisLab/lbm/kernels/step/esopull_sync.cu\n M src/CelerisLab/lbm/kernels/step/init_flow.cu\n M src/CelerisLab/lbm/kernels/step/one_step_double.cu\n M src/CelerisLab/lbm/kernels/step/one_step_esopull.cu\n M src/CelerisLab/lbm/kernels/streaming/esopull_semantic_helpers.cuh\n M src/CelerisLab/lbm/stepper.py\n M src/CelerisLab/simulation.py\n M tests/integration/test_body_sync_e2e.py\n M tests/integration/test_ddf_patch.py\n M tests/integration/test_sync_bodies_skeleton.py\n M tests/integration/test_unified_obs.py\n M tests/postproc/experiment.ipynb\n M tests/validation/run_kan99b_rotating_cylinder.py\n M tests/validation/run_sah04_st_matrix.py\n M tests/validation/test_sensor_accuracy.py\n?? docs/design/\n?? docs/multilevel_grid_architecture_analysis.md\n?? examples/\n?? research/\n?? src/CelerisLab/lbm/kernels/boundary/planar_velocity.cuh\n?? src/CelerisLab/lbm/kernels/refinement.cu\n?? src/CelerisLab/lbm/refinement.py\n?? src/CelerisLab/lbm/refinement_stepper.py\n?? \"tests/audit/body\\345\\210\\240\\345\\207\\217\\345\\212\\237\\350\\203\\275.md\"\n?? tests/integration/_cases.py\n?? tests/integration/test_numerical_gpu.py\n?? tests/integration/test_runtime_contracts_gpu.py\n?? tests/integration/test_state_gpu.py\n?? tests/integration/test_surface_actuation_gpu.py\n?? tests/unit/cpp/\n?? tests/unit/test_build_contracts.py\n?? tests/unit/test_context_ownership.py\n?? tests/unit/test_initializers.py\n?? tests/unit/test_numerical_operators.py\n?? tests/unit/test_planar_velocity.py\n?? tests/unit/test_refinement.py\n?? tests/unit/test_reservoir.py\n?? tests/unit/test_simulation_lifecycle.py\n?? tests/unit/test_slot_velocity.py\n?? tests/unit/test_state_regressions.py\n?? tests/unit/test_surface_actuation.py\n?? tests/validation/analyze_j3_saved_frames.py\n?? tests/validation/diagnose_j3_lags.py\n?? tests/validation/multigrid/\n?? tests/validation/run_j1.py\n?? tests/validation/run_j2_slot.py\n?? tests/validation/run_j3_coverage.py\n?? tests/validation/run_j3_reservoir.py\n?? tests/validation/run_poiseuille.py\n",
|
||||
"copy_dir": "/tmp/celeris-fine-surface-baseline-z98oi6ps",
|
||||
"hashes": {
|
||||
"src/CelerisLab.egg-info/PKG-INFO": "0b9a8a4e8d60bc531473688723ddef0aab02c7ccc4997e31c9b6a6c35011ca77",
|
||||
"src/CelerisLab.egg-info/top_level.txt": "cd51958ca03afabbaa9618c60b8280e486f8cc0b0359b839e10f886e7c3948f8",
|
||||
"src/CelerisLab.egg-info/dependency_links.txt": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
|
||||
"src/CelerisLab.egg-info/requires.txt": "36e1404178e5ea590b2fc04e8ba4d748ec9a82e7693136ccf0dfd204fe265c04",
|
||||
"src/CelerisLab.egg-info/SOURCES.txt": "f36b29c1b34c4bd6b2acc3ccdd21c24ee5077df7e2a20a652d9fae77eedb8e21",
|
||||
"src/CelerisLab/simulation.py": "c9d903f53fe356d7af281bea07943de1a62494127fb69848d7053fd46f7dec3e",
|
||||
"src/CelerisLab/config.py": "2f1bba7515f5bc08cb3a8d140bcafe7fa0689e01b3b06494697bb2956a71530e",
|
||||
"src/CelerisLab/__init__.py": "21cc469bd6e970a1f9ff5970c8eea4602065e41fc881854759ee565ee55c10c6",
|
||||
"src/CelerisLab/cuda/compiler_v2.py": "c4cc3ec4445c8d75e6a253dd87963877117a722bc73b9d4811806fc6045d08c1",
|
||||
"src/CelerisLab/cuda/obs_layout.py": "5ffb2c3aeeaaaaeb64f2cd8febfbcf4ad9919e5414020ad753cfade0683b21c2",
|
||||
"src/CelerisLab/cuda/context.py": "013dd4ec6d01d2fbd11afdfb103eac6a273bd9f798d663d761b851eeb27885e9",
|
||||
"src/CelerisLab/cuda/__init__.py": "0d01dff9f0399c8baba822aab5ca0122a135f011008ed8a499ebd9f7e5b06aea",
|
||||
"src/CelerisLab/lbm/refinement_stepper.py": "ad57a6a3887b007488b4954b24ff06cd8cde2b12674bdafb97bfda1961ae1da4",
|
||||
"src/CelerisLab/lbm/field.py": "0e727eacc3706add4d8d15c418e9b631050871f831698d3ac689dd5f2c701b9b",
|
||||
"src/CelerisLab/lbm/equilibrium.py": "2fb2f2bb7ff326d23abce80fc2a4c0907b17740ea3e29fe6ae079c5044783826",
|
||||
"src/CelerisLab/lbm/descriptors.py": "c9f025dfc14da43b989047b84cc22bd05d5cc92c9ec695c1da68fdfb788e3f2b",
|
||||
"src/CelerisLab/lbm/initializers.py": "dacf9586963e862d6d0a98ef1a066036be6f91e9d423720661d8ef2c1fb2df6a",
|
||||
"src/CelerisLab/lbm/curved_links.py": "00d9c29d660b41190f32dd737b12f60e10ce4214b6c9a6ab2a63438813faa594",
|
||||
"src/CelerisLab/lbm/stepper.py": "d2ef351aa2de441ec123deb55ce35603064130222f5490b154d41756b755cd73",
|
||||
"src/CelerisLab/lbm/__init__.py": "7f60fb3aaae81501b510d08c2fedff44fcb05657260eb10b6f5cc91e7204306b",
|
||||
"src/CelerisLab/lbm/refinement.py": "554735c5613129eb29f339c6aeeb4f3a3bbc5aba67558be51fbf7c2fb6ac442a",
|
||||
"src/CelerisLab/lbm/kernels/kernel_v2.cu": "c7bd3fb705b77261ba2441c52a24a7e6a7865c165cba088a1b75201c4d29c408",
|
||||
"src/CelerisLab/lbm/kernels/refinement.cu": "025c59dc9c207a831e78e1635cb3f14fe60b64c021004a0d66e5d01fda8554b5",
|
||||
"src/CelerisLab/lbm/kernels/config.h": "7d1124125e0b354558297934460e64c760fb68cdd7bf6d01a1238bb2eaab8c37",
|
||||
"src/CelerisLab/lbm/kernels/kernel_v2.ptx": "a599ee30ae66800f4d4220eb79dfed35ff32991661260f01ea58023ef780f0ca",
|
||||
"src/CelerisLab/lbm/kernels/operators/turbulence_smag.cuh": "ff7f000297ee0817e255ad9fcb6a13b647e3ddd5b206518d35f38d2895a9f501",
|
||||
"src/CelerisLab/lbm/kernels/operators/collision_mrt.cuh": "aee444eb60c47a3fd518dca975d1af05425a0818a0ec6c3fb3f6150f60c2cb44",
|
||||
"src/CelerisLab/lbm/kernels/operators/collision_trt.cuh": "9725b9840b9ad8b4ec7be61ff5d06d3151e86d1a87585c13f2fbf934d0d2c5f6",
|
||||
"src/CelerisLab/lbm/kernels/operators/collision_srt.cuh": "6b7ff842f392c8f853d2d1a97cc69bfe50f21283f73e659404da07cf6c95f5e1",
|
||||
"src/CelerisLab/lbm/kernels/operators/forcing_guo.cuh": "969a430c1af03f32e3bd0df95d805e64f56334717c44dd4ba208ba503062a24b",
|
||||
"src/CelerisLab/lbm/kernels/operators/macro.cuh": "e27c1c410dc857be98da4596568e405eeaf88701d291ac0e398aa9cd23dee740",
|
||||
"src/CelerisLab/lbm/kernels/operators/helpers.cuh": "0b3a4d95d7d19f5fec09e5423b8f4cc99f8a226b541967425967330da5a051ec",
|
||||
"src/CelerisLab/lbm/kernels/core/precision.cuh": "849df14b4cce50af52399e4b8f3e997196f3ae5f1163f68e28df3e6b2507a8c4",
|
||||
"src/CelerisLab/lbm/kernels/core/descriptors.cuh": "8440bc14857da9007982650f828a23608eec9f7cc4bf772e8c8dc1239cb45356",
|
||||
"src/CelerisLab/lbm/kernels/core/obs.cuh": "b742b77c9f61e1f020fe9922c3838ae9d855e17b381154958b58f10a22938922",
|
||||
"src/CelerisLab/lbm/kernels/core/params.cuh": "6e18bf730d936d940e3d85452f0714a2eaae31bf41002f9fd520ec5b372878dd",
|
||||
"src/CelerisLab/lbm/kernels/core/flags.cuh": "0025705f24710330d9d9195f713879bfb650a85a3449baef0e196b831af104ab",
|
||||
"src/CelerisLab/lbm/kernels/core/layout.cuh": "1fbd820021c89ac3efcde24145996cb0147769e607e498e61f308ed3e0b13706",
|
||||
"src/CelerisLab/lbm/kernels/boundary/ibm_kernels.cuh": "e6909b547dc8d64cdd8a76a90660243a8f5fee535caa161b52b4dd8b7c29934b",
|
||||
"src/CelerisLab/lbm/kernels/boundary/planar_velocity.cuh": "0b2f9e0bd483c199637e5672dc0ffc460bc383dd1804805befbeb4c5d8c708d1",
|
||||
"src/CelerisLab/lbm/kernels/boundary/inlet_outlet.cuh": "de8b213a6da42c2e5e9f8966199fc66ea4541b85144a90f3f5dbad3c6ab63b97",
|
||||
"src/CelerisLab/lbm/kernels/boundary/curved_boundary.cuh": "7bccf7e7091c012d7a3d4874a881d4d46699021faedd83d125933fbdaa562711",
|
||||
"src/CelerisLab/lbm/kernels/boundary/bounce_back.cuh": "aba3748c564ed91b161d268ef8b737b7c7be96a823063d201f3da684dd845233",
|
||||
"src/CelerisLab/lbm/kernels/boundary/esopull_curved_helpers.cuh": "b9b474bc4edaff05681c5443235472d04072d0d775fc0eb9c5967faef52b0258",
|
||||
"src/CelerisLab/lbm/kernels/boundary/inlet/equilibrium.cuh": "f0964c811b2c41a5aaa1c6d99c490b06e850c634eb8749f1f05ef61f93c2de1d",
|
||||
"src/CelerisLab/lbm/kernels/boundary/inlet/channel_stabilized.cuh": "efe077afcbb6b731256a987c2fd79a1dbc470c902f87070d60421ea6cb13d4e2",
|
||||
"src/CelerisLab/lbm/kernels/boundary/inlet/common.cuh": "f3cec54c8873c65b3dca4375605d2c89a8727765884d3954c235242fdff9c6ba",
|
||||
"src/CelerisLab/lbm/kernels/boundary/inlet/zou_he_local.cuh": "e73e66b853b1e4e0e30d8f4185d832aa414ce670a1813ce2b5459f2887f71f89",
|
||||
"src/CelerisLab/lbm/kernels/boundary/inlet/regularized.cuh": "943d4a571818bacb89c70bccfaac202691121e3e385803ce6309123a0a03ddaf",
|
||||
"src/CelerisLab/lbm/kernels/boundary/outlet/pressure_neq.cuh": "c8b2adc66d12fe602076ddc9693c5c208711fcaddb58aa9a31401a269f51c4c4",
|
||||
"src/CelerisLab/lbm/kernels/streaming/esopull_single_buffer.cuh": "77ed4ab9a0ebc5ff62a91a7c39066ef395391ae36e9040a69fb2bd8b1626dc79",
|
||||
"src/CelerisLab/lbm/kernels/streaming/pull_double_buffer.cuh": "b65d741ed78b7b62f99531ba0c0ce1936663d8dc9640e7d7d16c707f1baf6549",
|
||||
"src/CelerisLab/lbm/kernels/streaming/esopull_semantic_helpers.cuh": "dd5a9091628b079efd97e53fd49e52d09dcee88529235db77a5648e02937af6e",
|
||||
"src/CelerisLab/lbm/kernels/step/esopull_sync.cu": "c0ff3e72900c3ab89a05dd03684e96d3b740cf1672d565727fc2af165933d087",
|
||||
"src/CelerisLab/lbm/kernels/step/init_flow.cu": "305be3bb12fc0d039acec1701baabcf0e8a35e683c49c34f2af8ca9867d2b29c",
|
||||
"src/CelerisLab/lbm/kernels/step/esopull_macro.cu": "c73116020ca217ede1e4de27c8269c31f9d91e33433ac8252a21e9b14187c50f",
|
||||
"src/CelerisLab/lbm/kernels/step/aux_kernels.cu": "e163257b9cbbcdd289bf2a76b5b147ed9512dd04825ddfc9518fb626c8cff00e",
|
||||
"src/CelerisLab/lbm/kernels/step/one_step_esopull.cu": "aa223b2744ae6c9125673df311a96ce588032c1ba58bebb11fd33ecb990f8ed4",
|
||||
"src/CelerisLab/lbm/kernels/step/one_step_double.cu": "f9f8242b38e8e0cf8425b75e2b0215bc15363c62eaa0fb43c761b8e0931bfdc9",
|
||||
"src/CelerisLab/lbm/kernels/config/config_physics.h": "26df33c2960ba36f3283e19b55b4ea92e50e4efda705f9ebfbf3f875a4092c59",
|
||||
"src/CelerisLab/lbm/kernels/config/config_method.h": "3db4e16ef2c6b22349d04e6aa8ab04bdfe0eb784f9f3a98277e15dbed1835d81",
|
||||
"src/CelerisLab/lbm/kernels/config/config_grid.h": "8be3a7cf74ba30d7fd3074fed79e63dbda7311c4d03b454ea641bf298ffeaa8d",
|
||||
"src/CelerisLab/lbm/kernels/config/config_objects.h": "dbb93c063586da278c15d95e23f84c12e728f4f5f1bbc3980fe9cedaa6fff90e",
|
||||
"src/CelerisLab/lbm/kernels/config/config_obs.h": "c11e2249359145b5c4cbaaf0487506fa77c1f4b82c7c169ddc574aa0babcd727",
|
||||
"src/CelerisLab/common/checkpoint.py": "b2f960aecd5ac27a3a7130b809ffad4709c44d522edef0359ab952654625410b",
|
||||
"src/CelerisLab/common/_types.py": "aad2ff1a9033d4fd68783ad7123afb47201ddc58785cb6dc0246947037072a5f",
|
||||
"src/CelerisLab/common/pathline.py": "a1b6efcc0a076d0f1dc8d49a595779426d7d5626b00072a59bac710ff02ad046",
|
||||
"src/CelerisLab/common/__init__.py": "d4dbde78bc97fccc9eabac9abae8f0f15c112c10ff8e9b45bd9401d4723df1ef",
|
||||
"src/CelerisLab/common/preprocess.py": "7fc78a08857cf8e98519500b094a1d896af189b6b15658ff9b388ed51bed4515",
|
||||
"src/CelerisLab/common/render.py": "0e055476257eb2bcd11e733766e52195de02f8fad228f570a3511a7c831bdc29",
|
||||
"src/CelerisLab/common/streakline/_render.py": "236cd637414ee318c4d66f9aed32110d8dc42a100d65fde06172f7cd0ba62c65",
|
||||
"src/CelerisLab/common/streakline/_integrate.py": "3fbd4368b2c8d0e7fda40dc65aac5df02b085008b4c68acd83cb7ae45d33a13b",
|
||||
"src/CelerisLab/common/streakline/_streakline.py": "1a3e08daa706b5f83cdeb337e9a945a36ddf7583c40af1d0bb9d825ac954df37",
|
||||
"src/CelerisLab/common/streakline/__init__.py": "13ff1cfa416fdd721a08a659e76b5a5a99b8d3201add10a83b7b0bc654bc1eec",
|
||||
"src/CelerisLab/common/streakline/_config.py": "a9185ef68e9c7b5d5a1dc0b04a28341e2ad91d13c145a7c106636a878cf0a605",
|
||||
"src/CelerisLab/configs/config_lbm.json": "17e4311f1f250c6ece59177a8b6ff856b69a016c7c10267e774b030a0a390865",
|
||||
"src/CelerisLab/configs/CONFIG.md": "41cafdbe525366c08aa9d0416ea026ccf0026ba7123b8a9b65f968a80d928e3a",
|
||||
"src/CelerisLab/configs/config_lbm_three_cylinder_triangle.json": "eeb8e7149dbe4aa6b3a9562802735aa950750dfbe2d972a0727e788573afa817",
|
||||
"src/CelerisLab/configs/config_lbm_flume_trt_regularized.json": "f4bba8e6a4339fc3c4eb14f6e2f57c4b22993c73703c773d853edfbe34736e56",
|
||||
"src/CelerisLab/configs/config_body.json": "055f261f0828ca1d4f2bb694bd15b72bbcabe31d552326208f28e37f761adab1",
|
||||
"src/CelerisLab/configs/config_lbm_flume_mrt_zouhe.json": "8f593321db05a563a42931603a228d61cbcba06dfbe113262d5cd0ad93c0fe79",
|
||||
"src/CelerisLab/body/objects.py": "d1cf7054cc8379a83c39acc66a7c88ae62fa004f110bb0c1def2ee57137401c5",
|
||||
"src/CelerisLab/body/action_smoother.py": "b1a23ee6bbd4850b172cb8738c5c3546ee465a54189e6af9d8044f023d4687dc",
|
||||
"src/CelerisLab/body/registry.py": "fbb7327780adbdc6da15ebdb799980daf32df22ee974af0893d7409f177bbb68",
|
||||
"src/CelerisLab/body/manager.py": "6a40be708c71ef6f3b5f5f0aa9c92cfafc51f2ec2a958f99656cccb850986c16",
|
||||
"src/CelerisLab/body/ddf_patch.py": "60fcfb7441e73bf290bcff41ca3a83da3e7ddad765d7247464e8f02e3043b4e2",
|
||||
"src/CelerisLab/body/sync_plan.py": "a73ac9ee361b2120d0b7bbebeaa2ccbf924ba27bd95d4dd4b383c10a39b2a409",
|
||||
"src/CelerisLab/body/__init__.py": "91d1155080b3ade83d13c84c39693046df122e4bed5ef583de2df1f9453c1b76",
|
||||
"src/CelerisLab/body/preprocess/flag_overlay.py": "831fc9e9736b758847759a085ff133eb49ec91318ace4fda76f85960138ee300",
|
||||
"src/CelerisLab/body/preprocess/__init__.py": "dfd9d58bc07f626ab23a70053e31b88a6d9165d2e4c76a4e9f48abe674d3d2ec",
|
||||
"src/CelerisLab/body/geometry/base.py": "cceca14361ca2f34d34a3e43730e1a79b8ca81be00f0dd62e884db32b479419f",
|
||||
"src/CelerisLab/body/geometry/__init__.py": "ada88980ab672959aca9aa3a4c4aade3219524b2ab68110cd2a2f41e3e0ca90a",
|
||||
"src/CelerisLab/body/geometry/circle.py": "7605ca7c21103f1d801ac73ab8dd18dffbdac425b2dee7b8858b283628a9e436",
|
||||
"src/CelerisLab/body/coupling/soa_packer.py": "8ec26fd55ef74801bbd5ab6bd3d0a7dabc750cbd498aaac2ca4c61a0108ad3c9",
|
||||
"src/CelerisLab/body/coupling/__init__.py": "c931f7eb318d48408c3e2febcc6917c88c8dcc1697cbf4329b1f340d94c35763",
|
||||
"tests/conftest.py": "fa0ec26667872c9c1011d608310d2551fd24719b5d216f06d923ff4c74c73237",
|
||||
"tests/specs/exp_ctrl_matrix.md": "5d9dd2e703582572eb68afe3a7096ea43ec82aa03418d20ed283c5365031e433",
|
||||
"tests/specs/Sah04_validation.md": "1d122d29e281b7f50801b148f3314a0e35fdc27ee7d757c0a661243aa6185fb0",
|
||||
"tests/specs/sah04.md": "33dbe5e0fd63738abd055c4aa403c191b6de04e6efdbc568f1942c6d23c7459f",
|
||||
"tests/specs/Kan99b_validation.md": "0d8bf74f2361f863809af1979bf8807adaa423f98321e1104a3d86d8c7a863cf",
|
||||
"tests/specs/kan99b.md": "b7e0669f0a6b677d902204f3427d1b3ac254bfe70c37d9cf995fb3e8f1fedfb1",
|
||||
"tests/specs/streakline_notes.md": "cd342d214c07eb608ac2e5b8697322c44c31dbf4d27dfdb5409de46ef474df4b",
|
||||
"tests/validation/run_perf_baseline.py": "93dde2eb1132f45ea69e1e285ff421dc97a83651a22c79571f299c1909650721",
|
||||
"tests/validation/run_j1.py": "51b758a271ff358f931b3140a80082294a67e66c2fec0f8c19319e37f92aadc4",
|
||||
"tests/validation/run_kan99b_rotating_cylinder.py": "323186429a100f36b41ab9b81ade2da6a47e93be3ccb7034a3a6b97f4ee8eb00",
|
||||
"tests/validation/run_j2_slot.py": "b7d2d3aa06fcafc3ac62ed4a50892afbdb7f86e5720ce75a39ce317b6f571dad",
|
||||
"tests/validation/run_j3_coverage.py": "329869519b7078e854d96241a7aad8ef93f35ac9be83f0be502c3a93523c3b13",
|
||||
"tests/validation/run_sah04_st_matrix.py": "9b9c0ce063e07a316846635ee769b837ed26be6bf039f78f4219c10b516f8006",
|
||||
"tests/validation/analyze_j3_saved_frames.py": "438f67dac682b94c4950626f8de4fdcde48c3a4e9ecf8fdf1b0ada4b6e0e781a",
|
||||
"tests/validation/diagnose_j3_lags.py": "286fcd65b3261667a847b9b26e213d0af92cf459faa6bbd774f78c8479ce31d7",
|
||||
"tests/validation/run_j3_reservoir.py": "47535bc3569ce68c888d38978bc4f9077fd763a17829c20c081be52bb18a2903",
|
||||
"tests/validation/run_poiseuille.py": "e529288e2ffa8e00d281a9006723954d60a96ae4d025e8f28656c09287d4ff46",
|
||||
"tests/validation/test_sensor_accuracy.py": "c6038a9e7a597a1738814bd15e6ecf357cfd271cdc2a132d47943c5280ac0ef9",
|
||||
"tests/validation/multigrid/test_cpu_reference.py": "ade5d4827f971aed7174b59d83769e7aa542338e625a9fc8db1e8b1805cb74ca",
|
||||
"tests/validation/multigrid/cpu_reference.py": "bba2a06a9f6517b32079ffff15e4060d8c3b7ed35f16ca134e1877226c9e4e1e",
|
||||
"tests/validation/multigrid/cpu_reference_v0.2.py": "b6adbad7da625ef6a6b97958ea9625030ed92676d0cada48e061c87bcf7ca8c9",
|
||||
"tests/validation/multigrid/test_open_corner_negative_control.py": "59a6f8ca80cdd63cb7827fbebf9b4b555c3793f19dd6bca801544ec10b5cbe1b",
|
||||
"tests/validation/multigrid/test_refinement_followup.py": "6643e26cd877bf0d0f030e974f00a1d1c0f0350cc76d1c8affed3e8ba2f4393b",
|
||||
"tests/validation/multigrid/local_stress_observable_v1.py": "0e2777990359a7cf2bb29884173b7b01de37c49bcf49e1f29fc59fe83d62b456",
|
||||
"tests/validation/multigrid/test_refinement_gpu.py": "0021a39b3a131347196845cff6507c90c387b46b772fe1319d634178c5e13354",
|
||||
"tests/validation/multigrid/shear_diagnostic_v0_2.py": "a8b1cf2f7abd00efc4d068bbd27bb2317144a6ca4c545d9b2e0dcf421eadebc6",
|
||||
"tests/validation/multigrid/test_tron_additions.py": "8e7a6a90b85e64c7326719e7b8bca2f6d34fb4c80690f0685f7e291ab93bd2a4",
|
||||
"tests/validation/multigrid/MULTIGRID_VERIFICATION_STRATEGY.md": "d4f3473da44abee6031a0e1bd4d0ca589077a18f15d2461836e4d2ebb98e458a",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/stdout_horsea.txt": "0577df5b3f5cb3c7b6e1ef2de71344f8fd3e6d959117487a06cbaf7f2afa3dea",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/stdout_grok.txt": "28ddd1267ca91a772f5a6bfc65d949c9a4ea7dac5c9ba3a0bdb168492810b670",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/run_once.py": "6698a2e040c56be949b809387d4518eb0ba82d34cc9d99640da4f8bf3c35c23f",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/source_manifest.json": "56fbd0259ff3d4dbd14ace52f64e249a435e9df91732b0e4027def2c344c2e6a",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/results_horsea.json": "c2d7ce8d16a0f47baff0788a153353dcf67088da974d9cd3d521b04ecd91ee05",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/comparison.json": "41c00372099dd04b6d323785e9eaf4fec09da1753d3d150ffa230800f904142f",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/baseline.json": "98a7853341ea732762c7506694e3a867a7259bf110e9e461ea84f741fd9ab829",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/manifest.json": "e42aa19e91608164698bea42da88fbbfab8b0f87cc37b27c5baf165453a4fdb0",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/README.txt": "4306a34b6896bd6e7a5c2ca71d68e18450359239d0c7ad7a67a4e83e7155959a",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/joint_report.md": "1860b8082108c8b8a87998af90cd0b81dce1c04e9f6c67b41e0912f9fef6cc9c",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/stdout_horsea.txt": "882f2cfb1dbdf82cce63c011397e7c2e6307bbcfec42a3510648d328cd6ddcfe",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/run_once.py": "e629800291ef65ffea8555f66ec80bf15200552540b2a493a677bfb53d0830b3",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/source_manifest.json": "d2cf90b73458f493c665c9a281d06aef0c190cf0d143639fb77ab838c78f020c",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/results_horsea.json": "f17b4644d19eb75d55deb7021ab679cb9e7922a2b46f1cacf8b6da6bfb9a2690",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/comparison.json": "be236671a501c31c06f7e266f6e0c0c2a89aede321a483452050ff37bf84c84a",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/baseline.json": "64f6541447afbd15b1b15d802ad6f1b5042aaf84e7d4d2414e4ed4c52cf70507",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/manifest.json": "3a9fa8c7d691c1b8c24f05940eb724d30b890dd8ed636551068d2633d7db2f70",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/README.txt": "4f62314876047ee437bb9ecbf84798d2a9f6e85f6a3aef260277b85bcdb35fae",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/stdout_local_stress_observable_v1.txt": "6a826e5ad729ce45af6879a07a1c659d8b4a21403fde5b9c6d9696cc6a5b09d4",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/TABLE_local_stress_observable_v1.md": "d8ff0568d9c473a4bb09396a8948ddc8dc5af2f0f3a23ac84d238814fc779501",
|
||||
"tests/validation/multigrid/cpuref_0_3_evidence/stdout_horsea.txt": "457f1d2173496554c87ca6e61df518c0b8f1e0a28cdfd94b94ebbb61bc459d70",
|
||||
"tests/validation/multigrid/cpuref_0_3_evidence/stdout_grok.txt": "73e4ef01138842981daaa534390f1463839e63833c11f4e8872f94f8eaadc717",
|
||||
"tests/validation/multigrid/cpuref_0_3_evidence/results_horsea.json": "914389afc39752bcd4132aa21fc8d5cbcf0ca75b1efd6a49becab15c2fa3361b",
|
||||
"tests/validation/multigrid/cpuref_0_3_evidence/baseline.json": "0daaccee41cabeb17a00e2405e2c7fd0b80d36f2d01778eb39c9fd22b13d2d47",
|
||||
"tests/validation/multigrid/cpuref_0_3_evidence/manifest.json": "2850ecaf2e19d010ba35eb54162371d82cc1a092831e08a03b6adf75a614988b",
|
||||
"tests/validation/multigrid/cpuref_0_3_evidence/README.txt": "1947ee0232b88b3cc2c506d0b0af5ba051ecc94aa8f7f09228ef3939cc95919b",
|
||||
"tests/validation/multigrid/cpuref_0_3_evidence/README_grok.md": "065947e15b2242bce7d3eb05a3acdbb59939c621dcd5d31540ad4a1bd4416818",
|
||||
"tests/audit/\u5ba1\u8ba1\u62a5\u544a_kernel_layer.md": "89893c98ed7c2699157bf728ec0e79b0dd6aff4008ee5c7b77eb052de24033f1",
|
||||
"tests/audit/body\u91cd\u6784\u7b14\u8bb0.md": "8f978d7b01c9f49dca9eeaff0d163cec6da085e2f99ee5a5e803d72306e7a72f",
|
||||
"tests/audit/\u517c\u5bb9\u6027\u6d4b\u8bd5.md": "9c1721a33b381b9c3810545772b022913da06617711b5ba13a3c2c991b81a7f7",
|
||||
"tests/audit/Force_region.md": "3092080afe4a30665fe1b721803621ba9d0dd5d20ad17826984d94efc160fdac",
|
||||
"tests/audit/\u5ba1\u8ba1.md": "0f14ad073a0725134e6391f961c324fd0013c7791fd410713e94ed1ad40b7385",
|
||||
"tests/audit/Force_region_validation.md": "279a4484d1bfca0fd67aed4de3282d547aa048f89389420d8e5f2fd86db54fc2",
|
||||
"tests/audit/body\u5220\u51cf\u529f\u80fd.md": "e9f308a8cd0f0e7df5441c32a15f84c0bae50bc0e56b8728f6c6f2cf78596673",
|
||||
"tests/unit/test_initializers.py": "8b4e3358d925614984265ae73c142006b48fd1c3918cf84901f18afd9fe68c3a",
|
||||
"tests/unit/test_simulation_lifecycle.py": "77abdc33218c35e9c8b62dbd99ceddbaccd8417e7f0b539ea8859ea0175c663a",
|
||||
"tests/unit/test_numerical_operators.py": "6d1d560ef553a2af7adac7db3e325d96d7fe39073d5fe3e0e982439537385b27",
|
||||
"tests/unit/test_sync_plan.py": "983313ef783143231fa5a392f85f3bac011184773ccaf5d946504c206cabb721",
|
||||
"tests/unit/test_surface_actuation.py": "89be6f54c4eba6c2bdca0d287a5b9fa6db143de2bcd9a671d4fb8445921303ed",
|
||||
"tests/unit/test_state_regressions.py": "0f69cfeb83428192f95688c76abcae7e5b9cf5f27c52bca4ac20c7f320044374",
|
||||
"tests/unit/test_equilibrium.py": "1ecbcc4547b1c846b75320463d828d6a36b6aae73208084fae476b1001c1bb50",
|
||||
"tests/unit/__init__.py": "17f57920d9c1ff46096ceb2af008eb38c4b98dc81ffa3c3d310e758e80ca1cd4",
|
||||
"tests/unit/test_pending_edits.py": "905a0dff23b123e8e38aaf364984c810fe51c39acd64aa271e343a4701d3d024",
|
||||
"tests/unit/test_planar_velocity.py": "b656da0880b4234b1db805544edbe0d2473cbcc7c2c869c71d8251337f62a982",
|
||||
"tests/unit/test_body_flags.py": "ac6409157924e15a13a3d2cc2f1a09014b8b0198ba17c824f412ff20b19e2aac",
|
||||
"tests/unit/test_build_contracts.py": "7bb237425e8bb481f312fa4841c484e280731e13c7cbb9a53dad3e7f98984ac3",
|
||||
"tests/unit/test_context_ownership.py": "299fed30dd0f9bd4dadd8b27f50df2a6367bdb0ab2ca3f391f215fde7241f35a",
|
||||
"tests/unit/test_reservoir.py": "e718c78a53c3941aba7feb8ae4e8bb0b1726c1145de84febf91220c1917991c9",
|
||||
"tests/unit/test_refinement.py": "90751142f920f1c5e988577a45afa94871a6617009cdc78323a87fc7795f4634",
|
||||
"tests/unit/test_slot_velocity.py": "6a9494de9a32c350389ccbed58af48951f6b25a21a258537d2e8b73eb67cb11d",
|
||||
"tests/unit/cpp/semantic_regression.cpp": "99dba074c0c0a32ea76026e7d54fc60af8e6d3dc5315c8900c470b4518878f39",
|
||||
"tests/unit/cpp/reservoir.cpp": "c3eacaf0271400eb45ad559b571a8f7faa2a809d5f1857ffeb5592addce2cd0c",
|
||||
"tests/unit/cpp/collision_regression.cpp": "f17acdff74ab82a62dc5402b42e3f6a149c262e89b140494164d6ebd630f5e14",
|
||||
"tests/unit/cpp/slot_profile.cpp": "31ac58ccab175bf79fa59fc46d4c0842df18ab0a5e5916be84760d9da2b75788",
|
||||
"tests/unit/cpp/planar_velocity.cpp": "8dea266984edc69d4e0e68007e038d7a587e99f84e33478d6656a66a56680933",
|
||||
"tests/integration/test_body_sync_e2e.py": "d29f01771f3512a4b3ad06fae4ee952327d7fd9f0476942402fe92e9e327fcec",
|
||||
"tests/integration/test_sync_bodies_skeleton.py": "65f55a0980659b49ae0027f0642a27e2ebaead226ef083f233e878150884b07c",
|
||||
"tests/integration/test_numerical_gpu.py": "002a6745929bd5ee86a9491ea9bc3f97602fb825ea17262ea190c9311881100e",
|
||||
"tests/integration/test_ddf_patch.py": "dda2abba32ca13e17098232f2831a0b1b66439c35f8931d9997a0257250c1281",
|
||||
"tests/integration/_cases.py": "ab76ca1096d2d10fb05b3539aa8ed3c7e549619bae6900ac98723f6c3c908f2d",
|
||||
"tests/integration/test_surface_actuation_gpu.py": "3c2b4dda70db1d6493ecd92bd9b0dad6d8b438cdf6dca46410018217f8beb4da",
|
||||
"tests/integration/__init__.py": "c354e43ba09b55a8013a2df2069438740b5f48b5917d855e52e33ab5d7da5a6c",
|
||||
"tests/integration/test_state_gpu.py": "dde0948941e8abbc5ea10a3acb3a35abbaea576f36ecee0f1120fbcf7454d60b",
|
||||
"tests/integration/test_runtime_contracts_gpu.py": "775e578e2e8072af32fc740b2698abbb79454235a0f3ee929ac4c75d747f8db5",
|
||||
"tests/integration/test_unified_obs.py": "4a681536099741d92bdc258525fe3374cbdbeba0d49996e53808381a1b6a13fa",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/summary_C4_deceit_f1p5.json": "11dab8440d8c4f385061d2536403f4313c6f026b4e0b7672681327a9f4f37ebb",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/summary_C6_deceit_f2.json": "e0c4e8bcc55da5dc8de1e2fe88029aa3e67453734faa44451f5a6dfa9131557f",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/streakline_C6_deceit_f2.png": "e0a66708ce2a29c4c6b854d2596b3ffca181dc6e35d99cc94e08af3e2d8c024e",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/summary_C3_deceit_multi.json": "24c8e433aab6d207dab67546c4079868c4244c2948c32c94cd08e4f331991807",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/summary_C0_no_ctrl.json": "cf3af733a08f081cc5f879e8da79d7c60104099f4452af5b2a4a96c0e6bd5889",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/summary_C5_deceit_multi_f1p5.json": "a4cb4ff4481b39b9ee61b1d7209416237a7fe86b22c5068d713ccec9c3f7afe4",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/manifest.json": "d8a20dacc92321d98354684976f771a9ca8989fc63ddcd78e15c7768c6617671",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/streakline_C3_deceit_multi.png": "c6fed617cc6ffe6677157a9b58811d5f4613725eb98a5aec830fd07dc1aac38e",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/summary_C2_deceit.json": "7526a6b20a158461b85b1a64070b46c2b21be1e01c5ee025e6746fcf47ea3397",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/summary_C1_stealth.json": "63d34a0ab33e9fa8fe7311363efbd1b2875691f5b4958bb645b8c7ac38f1ad6b",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/streakline_C0_no_ctrl.png": "0cfd7ce8f9d743bf22a7a694b4e5a3616557cb8f1db2f4ddf49cc4bef96efef2",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/streakline_C4_deceit_f1p5.png": "4dcfc186928dcb83d28e9eb4cb2ecb4b163eb6f121d57036b4c05ab162be0951",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/streakline_C1_stealth.png": "5e3cbbefda06fcef243d7d06d74a473972350cfa4ae88bdfdb349dce13943151",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/streakline_C2_deceit.png": "22f1db77499bdbd1b3cd35f5b58b1a884dd94a86fdcfef07abd4157e6aaf8d19",
|
||||
"tests/output/exp_ctrl_matrix_streak_ny300/streakline_C5_deceit_multi_f1p5.png": "823e475cc901af3d6f4d0c56eb07822b3e73a2b9d0aa23e20e3741023fe90092",
|
||||
"tests/output/kan99b_validation_esopull/summary_runs.json": "fe3294a953580204319fb1143434e15096d8455b6073100dfe0d5491b76af394",
|
||||
"tests/output/kan99b_validation_esopull/summary_runs.csv": "1a44bb27ee0a7fe0270905248c37364834248cdc8710bd68142a6a79bbdad82b",
|
||||
"tests/output/kan99b_validation_esopull/force_csv/k2_k2_inlet_control_domM_re100_a1p000_zou_he_local_mrt.csv": "9fbc7d507c129ed85c68a9a313e3eb3431470d091bd7723e63f8afd8a3d2b737",
|
||||
"tests/output/kan99b_validation_esopull/force_csv/k2_baseline_domM_re100_a1p000_regularized_mrt.csv": "8faac43f42d6e0c70085c6e616bfff4df8de897e315fc0d2b4aa8bd635c3fa05",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/summary_C4_deceit_f1p5.json": "b613ae55fcfbd45a1a922d6d529e5274ba9d2987fdf5620fe866b889b931e48c",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/summary_C6_deceit_f2.json": "dbf54f9a183072547b22fa14334f0167e6eefb21c1208c4e8584bc196545a399",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/summary_C3_deceit_multi.json": "2100c6cc5c358a249804ce8f6f98531f3bc868e27af6d21a9d441b1b6a9e479e",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/summary_C0_no_ctrl.json": "a8b4697b7c0caeb958f80e282e32d673deac8c914008d64e6b38f7883eacc57e",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/state_C6_deceit_f2.h5": "8d0c28566d2230b422691b738cc453705496bd150be038a576c0c0fba218fc1f",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/state_C5_deceit_multi_f1p5.h5": "608767ca11d104fa4506b57204a0c8dbd739688224ebd924fe517ce9e21db823",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/state_C1_stealth.h5": "a83c988cc8b1173a7b2f13b132ed7243e98304dccab2965aa16cf4d32f8df007",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/summary_C5_deceit_multi_f1p5.json": "6f6b9300782178e0ac9308a677bd9cb1565a383a78dff4cd52dea0bd464db31d",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/vorticity_C6_deceit_f2.png": "21bbe2dac1ab06ca1b172ec62d00daa7bcd65d99adac0ed03c5e30bed59e871a",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/vorticity_C5_deceit_multi_f1p5.png": "602a6586277699968b4cb167b134c8c406577038af088aa70baff682691398c4",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/vorticity_C1_stealth.png": "c1e1d04f266deac5fb2815a8283da80f9139ffaccbec2219d98544296bf3152c",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/vorticity_C4_deceit_f1p5.png": "96dee924e89b90091192a8d7b43321f109a5491511b8a83da77cfc611ae0d93b",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/state_C2_deceit.h5": "aa5800a0cd594eeb7cf5449d6469d55e0c9033ced0ee0a3b5d59152e68c7e263",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/manifest.json": "5d28f0f5428d7f0341e20d5d1f19c17bbc6f0f9b2a441d3c95f5422f3f2b4bd4",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/vorticity_C2_deceit.png": "1dcb6fb959f944d7ad89c4abaaef4d1fd4a77db8901804530e86fb336b883eb5",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/summary_C2_deceit.json": "b88ff5049aef59876b349d105f1c3467c17c9ba9022a48a77a6984f20da34345",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/summary_C1_stealth.json": "515689cbfaa30a9e39d9907939ee194a4836b644a5e9124586e6b7221d2b394b",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/vorticity_C3_deceit_multi.png": "d69694a1a1b2f2ea0adc7b74b7526504e2ad0b5d6317bac9b3159b2e7e88cf90",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/state_C0_no_ctrl.h5": "3a858d6be0a946e1d26bbfa192c2f0ca3910c0f140b42575ec9d9529dd99155a",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/state_C4_deceit_f1p5.h5": "660e4619ea530dcd18c3afb2e7fa22cafd9cdba1be7888e31ab5b76a0902d2fc",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/vorticity_C0_no_ctrl.png": "6d4d3934f1c8b20c2a5c742ae080a7143f0c139741966adf009a227c27e9bb1f",
|
||||
"tests/output/exp_ctrl_matrix_vort_nx1500/state_C3_deceit_multi.h5": "1e72126f11b2995437cecb8cc0eeffb8807efbfa43d8f346f28711fea98ddc90",
|
||||
"tests/output/kan99b_validation_ref/summary_runs.json": "449316c30585a8de9997538dead5d4e35a59bf00a2ac22d01b101ab600a4bc06",
|
||||
"tests/output/kan99b_validation_ref/summary_runs.csv": "e8b9620f3772e5e421026103e456e6e844a91292f40affb96174c9dbde9b6e4e",
|
||||
"tests/output/kan99b_validation_ref/force_csv/k2_k2_inlet_control_domM_re100_a1p000_zou_he_local_mrt.csv": "4391f41d17ebeea1092f13b901923ced4ee2a1c5b346b79ef791d692847286b5",
|
||||
"tests/output/kan99b_validation_ref/force_csv/k2_baseline_domM_re100_a1p000_regularized_mrt.csv": "105c6eb21f1943d9d935246eab1602ff2016c415a139e24fee2793e88e006ead",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/summary_C4_deceit_f1p5.json": "0085a679a423621003eea81d4ac83bfe2edef2879eed7809d2a3675a212f791a",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/summary_C6_deceit_f2.json": "e820cf73f0e90bf93c34b24416e7692a6c2e51352ccf490fa6714d0812331ca2",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/summary_C3_deceit_multi.json": "571370c74ad9af589f3dc214669bff3d857efe6fc4fa13815b5d793d12b53770",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/summary_C0_no_ctrl.json": "ec5b89961033d8ebe0d66ce1ec7940dc2faf98130c38319bc9984ef654e60b50",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/state_C6_deceit_f2.h5": "2792be74d8564fa29fd0636fc8493630fba2779c165b44330197095b3e296b18",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/state_C5_deceit_multi_f1p5.h5": "2c64ee6c7a4ea2c42ed8f3d274402bec62de0e02ea0340e16022f0cdc92af724",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/state_C1_stealth.h5": "100727d94fe6c2e46d7807eed0442555bdd1e26ec9b04b4c457171a2bbba3255",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/summary_C5_deceit_multi_f1p5.json": "f86166f121b4eeb6d74d8176c9265e7a3ccfe2540d040f554b6f96e6a6222c16",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/vorticity_C6_deceit_f2.png": "fef4de0e3ac8203742f35c16a02445b19c3f556b11f73abd5d8e3ca05ca33d78",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/vorticity_C5_deceit_multi_f1p5.png": "9136448e6d7565ca5af3666f9cf6e154342d8a3475076abfdbdd1ff9faec34f3",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/vorticity_C1_stealth.png": "544537a9c500a05937fd3be17c25e7d887461d9b83a15564f9ab7063208f40f6",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/vorticity_C4_deceit_f1p5.png": "51e7056db99dd653affbe913d52fa41df6ec0db921109384e3c679bda06b5a83",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/state_C2_deceit.h5": "39d6c162085acae1612650da37d2314757715931e83a854e08bb01407d0f8efc",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/manifest.json": "05fbc2e7bbad4267a38e1094bbdd6bee6ad270412bdb5e92b0dfc9fa56969517",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/vorticity_C2_deceit.png": "07fc5817eba30371272b87ee2e023c0a1144077d1bef77efb2fd5dc284badcb7",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/summary_C2_deceit.json": "b1fcf76039c91a9080b830352dee2e95316d754b968cc27a8f68c51527661e76",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/summary_C1_stealth.json": "b78851637b9b7b93070524a2933cae1dab6d682f8894579b2849c64921e6c29e",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/vorticity_C3_deceit_multi.png": "2658f0747ed7287f7912fe15cc58a086e01ba284277cb98689bac01ecb6ec12b",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/state_C0_no_ctrl.h5": "57f73f5f8dc4b32b156bc82300b1efd1e4eddadd9b8dc51cb7e6b41fa5c966bd",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/state_C4_deceit_f1p5.h5": "2864b9dd086709ee8b8c3f262118a5130b0d40c86838f3ca0deab5bb898dafa8",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/vorticity_C0_no_ctrl.png": "2c7f3a8be2ee540afdfb66299e43a65583434bee84bde590124524a82868c900",
|
||||
"tests/output/exp_ctrl_matrix_vort_ny300/state_C3_deceit_multi.h5": "39e0d9b032dfff8cf057b410a98973729285e7d03e89f9a6a002aaf7de3d7519",
|
||||
"tests/output/stealth_sweep_fix_check/summary_stealth_s150_w0.02709.json": "8b1032e13975bb05c6a810fde175c8da51bacdb3dc745fd11c1049ca63bbf136",
|
||||
"tests/output/stealth_sweep_fix_check/summary_stealth_s050_w0.00903.json": "fa7da24d5dab9fd3a3c2dea6b50d0224c7a99cd9141796e137304a6040b1ac8a",
|
||||
"tests/output/stealth_sweep_fix_check/streakline_stealth_s050_w0.00903.png": "640928f7eb159e7caea32036123f86c281723d083cca46839ba86bce8361ada7",
|
||||
"tests/output/stealth_sweep_fix_check/state_stealth_s050_w0.00903.h5": "187ac365f9f7370c888c4c65570c47e42465b2fccd432056c176528d45cf0c2f",
|
||||
"tests/output/stealth_sweep_fix_check/manifest.json": "83a3f12a942fb644e470bd07a72f24921f2147d7df429110268c5c96a9953d1a",
|
||||
"tests/output/stealth_sweep_fix_check/state_stealth_s150_w0.02709.h5": "e057e9db26b2546c0704e2c959cc7d2aac91e6a49b4c7ee75a409597a5db8716",
|
||||
"tests/output/stealth_sweep_fix_check/vorticity_stealth_s150_w0.02709.png": "d2d202088624cf30868228f9c913ee30e1b386aaa2c22b0ea89be43dedc0712d",
|
||||
"tests/output/stealth_sweep_fix_check/streakline_stealth_s150_w0.02709.png": "0edc7caa9caaffb754490bf1f6ac7ad7180e45a991439a3f4f83ed949a082a1a",
|
||||
"tests/output/stealth_sweep_fix_check/vorticity_stealth_s050_w0.00903.png": "4088359b17c46ed4d7c8401d244808fe67723273b1d16d0671b69f9478c68c1a",
|
||||
"tests/output/final_validation_round/validation_summary_report.md": "881cb7052e5a555afc87168a37268ee66e8e3fba172533706e858d996fabc7b9",
|
||||
"tests/output/final_validation_round/sah04_mixed/s2_d48.json": "83c6c01201d90aae5c49e73ebeca88d1c7ded6cc83c13f4892a9188e6289483f",
|
||||
"tests/output/final_validation_round/sah04_mixed/s4_reg_d96.json": "b32f03e6b347fc709cea2ecd488df0f85849c733bf6a4b9cf65ea69401c93a1d",
|
||||
"tests/output/final_validation_round/sah04_mixed/s1_d48.json": "120e8e878f5712dc89b7cf78c7f8d0e3368d34ad5ef7494977e083b188a54c18",
|
||||
"tests/output/final_validation_round/sah04_mixed/s3_stablecfg.json": "b38a3d197a188e65c163d974113af18f332b3abed083e2654e998d9980f6be9f",
|
||||
"tests/output/final_validation_round/sah04_mixed/vorticity/s3_mrt_laststep.png": "dc96fcd05d458684cfb40d4cb741172213083e2f2665e2bae7e1f0267bb3575d",
|
||||
"tests/output/final_validation_round/sah04_mixed/vorticity/s1_mrt_laststep.png": "73a3580ba3c7fe6ffeee4676a9a51b5bf678d6fb523456a61e185598389ea1e1",
|
||||
"tests/output/final_validation_round/sah04_mixed/vorticity/s4_mrt_laststep.png": "57f2a82761f2de1a9fc2b78ee86159ca542c966494b9c704deb451da857da778",
|
||||
"tests/output/final_validation_round/sah04_mixed/vorticity/s2_mrt_laststep.png": "786f492b96ed932254b5452e2d06ff088727f2d88c7e7c7b47d386eddfe07862",
|
||||
"tests/output/final_validation_round/kan99b/full_summary_runs.json": "8c4a11cbf555e08a66698439170b850c57d537d8e75e4dd75beb767bbf7e38cf",
|
||||
"tests/output/final_validation_round/kan99b/summary_runs.csv": "3fa92fdd3114f0472de44bc03006af1d4b694dfc69b06704c1667cd3627b6dab",
|
||||
"tests/output/final_validation_round/kan99b/force_csv/k5_baseline_domM_re160_a2p000_regularized_mrt.csv": "de05e9699146f2adffc9d7c9991f9e48396aacd142afc3c08b2b64727c83c69a",
|
||||
"tests/output/final_validation_round/kan99b/force_csv/k3_baseline_domM_re60_a1p600_regularized_mrt.csv": "53cd0dc47328b7b370eced1130508655e6815a29b727bf1fe4e4e125e4918905",
|
||||
"tests/output/final_validation_round/kan99b/force_csv/k2_k2_inlet_control_domM_re100_a1p000_zou_he_local_mrt.csv": "4cac1ccfdb7451de3e26d921a6406cc55d1d4630e10ec0d7ec9350a4abd49404",
|
||||
"tests/output/final_validation_round/kan99b/force_csv/k4_baseline_domM_re100_a2p000_regularized_mrt.csv": "392c98de52011ddb344a5761c4520e870f4e49bbba3e144e5a02818ba2f9250b",
|
||||
"tests/output/final_validation_round/kan99b/force_csv/k1_baseline_domM_re100_a0p500_regularized_mrt.csv": "9e83c5175aec644c0b97c081e610deefa731b87aef04da6297abf662a71c0702",
|
||||
"tests/output/final_validation_round/kan99b/force_csv/k2_baseline_domM_re100_a1p000_regularized_mrt.csv": "55b071f278e153aa353aa2bef85f0bce35b910a7b08103032023fe3a28169b89",
|
||||
"tests/output/final_validation_round/kan99b/vorticity/k2_k2_inlet_control_domM_re100_a1p000_zou_he_local_mrt.png": "b91b332e7deb787975d3f08fa3325facd4a972b536694fcda52e6c01943c42cb",
|
||||
"tests/output/final_validation_round/kan99b/vorticity/k1_baseline_domM_re100_a0p500_regularized_mrt.png": "6e7c3f6567c0ff0d00d75da8373031f5ba2a17a624cb8c5d5d6ae4f8749c33c0",
|
||||
"tests/output/final_validation_round/kan99b/vorticity/k5_baseline_domM_re160_a2p000_regularized_mrt.png": "c4d232df2e6f7466acca711191d976aa9411ec0ade81572b531463f42a7d633a",
|
||||
"tests/output/final_validation_round/kan99b/vorticity/k3_baseline_domM_re60_a1p600_regularized_mrt.png": "b2314c60491d20933422e1697998555dec2436d39545c71f990e9906884685b2",
|
||||
"tests/output/final_validation_round/kan99b/vorticity/k2_baseline_domM_re100_a1p000_regularized_mrt.png": "2b2797b8f53170d04d1a70d1cdf898f7e41b3a76b9f3c1f276dfec952520ab04",
|
||||
"tests/output/final_validation_round/kan99b/vorticity/k4_baseline_domM_re100_a2p000_regularized_mrt.png": "8135f470404fe11ac97968fa580ee35232e90dcace3c6ad94de17ef7aace24d6",
|
||||
"tests/output/kan99b_validation/summary_runs.json": "d7239aac64884202558741074f2d644ade9e2365d94d0b7556fba68dac94868d",
|
||||
"tests/output/kan99b_validation/summary_runs.csv": "c44da69563d58b917291a9fd402d1f57055861bffab6f9e32d7db91297428d45",
|
||||
"tests/output/kan99b_validation/force_csv/k5_baseline_domM_re160_a2p000_regularized_mrt.csv": "27b64460923d235d34b760f2a2371ad01611a70e38edb03d6fd6a2fe7a7de6e0",
|
||||
"tests/output/kan99b_validation/force_csv/k3_baseline_domM_re60_a1p600_regularized_mrt.csv": "76ff52f4494b7ef7650c05968732a8caaba94d2b151234c02cf624f5b3a712ab",
|
||||
"tests/output/kan99b_validation/force_csv/k2_k2_inlet_control_domM_re100_a1p000_zou_he_local_mrt.csv": "28a83436ca8bdad38865ba21ce1bda679562a5ae1cfc6ee8fc6e86ff760ec66d",
|
||||
"tests/output/kan99b_validation/force_csv/k4_baseline_domM_re100_a2p000_regularized_mrt.csv": "823ae04870fd951879024a18169ac5cba8db4b3201726f6a00f320f1958d04c6",
|
||||
"tests/output/kan99b_validation/force_csv/k1_baseline_domM_re100_a0p500_regularized_mrt.csv": "a591daf2cdecd6ac3689fa2a2aba917b23053ad26e3ef1f635c81aecc451475f",
|
||||
"tests/output/kan99b_validation/force_csv/k0_baseline_domM_re100_a0p000_regularized_mrt.csv": "e95c27c646c0c9baf8f455f876c115c8dbdb23cef9d9d550f455098bf0c03b55",
|
||||
"tests/output/kan99b_validation/force_csv/k2_baseline_domM_re100_a1p000_regularized_mrt.csv": "3c2ea79a0e27f561215febee2e165d24b3617a648bf908981c068ba59d549c51",
|
||||
"tests/output/stealth_steady_sweep_nx1500/streakline_stealth_s125_w0.02257.png": "a892f18c74fe13efd839bfd5068097ca0ae07acebf6c06eed89e1b867e41fcb2",
|
||||
"tests/output/stealth_steady_sweep_nx1500/summary_stealth_s125_w0.02257.json": "7e542f59746429022ce1794854c6fb36e8ac658dd0aea3bc1140a45e83a3f1c9",
|
||||
"tests/output/stealth_steady_sweep_nx1500/summary_stealth_s100_w0.01806.json": "b76216e0fbee00ef754edbafe5790a99ce7d53638af629947ddd9615598e4c08",
|
||||
"tests/output/stealth_steady_sweep_nx1500/summary_stealth_s150_w0.02709.json": "42cb241d9cfb01308ce28e129756b6cb3fe2a8e9679518da84bcb8b607fe92ac",
|
||||
"tests/output/stealth_steady_sweep_nx1500/state_stealth_s075_w0.01354.h5": "558be308dbf334832bc1d29419ba5be142969117a11b124864f6b221c8fee509",
|
||||
"tests/output/stealth_steady_sweep_nx1500/summary_stealth_s050_w0.00903.json": "53b579811a0b651ba7cc466c230c115b9f88486c6675e0465d0715d3377a75cd",
|
||||
"tests/output/stealth_steady_sweep_nx1500/streakline_stealth_s075_w0.01354.png": "9f4a7d89b2471becaf31e84c14402441c5fd96fc7190cea5e8a9fdd06ee62002",
|
||||
"tests/output/stealth_steady_sweep_nx1500/streakline_stealth_s050_w0.00903.png": "5f18f56b0ff2af3350216b65540a2bc664c569520624cfc6cc2439a3c5369560",
|
||||
"tests/output/stealth_steady_sweep_nx1500/state_stealth_s100_w0.01806.h5": "30776f333959e0e9eb5ca96b269e6a8052c5b94941a4e3b36d8a6af8076920ce",
|
||||
"tests/output/stealth_steady_sweep_nx1500/vorticity_stealth_s075_w0.01354.png": "b5393474d99191e88dafea4144b6a8eccfbdf75107125ce4b05383b17007d06a",
|
||||
"tests/output/stealth_steady_sweep_nx1500/state_stealth_s125_w0.02257.h5": "4ed9d8587f75ad4625ec5501fa99fb733cde037180ac53f92a210ffbb08375de",
|
||||
"tests/output/stealth_steady_sweep_nx1500/summary_stealth_s075_w0.01354.json": "ff1c1cc649e589b5425787493c2b0d04b6c39b43043b1968d65509cb0a426e82",
|
||||
"tests/output/stealth_steady_sweep_nx1500/state_stealth_s050_w0.00903.h5": "4de51584b24095f8cf4480b8941593a5f913332f9396061ed077c9d49eb2ee11",
|
||||
"tests/output/stealth_steady_sweep_nx1500/manifest.json": "0dfbb2c1b5bf9093fef169e4dc6319edb5c87a1e967e8d558613e2c64a2ca734",
|
||||
"tests/output/stealth_steady_sweep_nx1500/vorticity_stealth_s100_w0.01806.png": "60824cbdf21170cb4ffd8af0a49e8522c2d79cb2694690ab67995ee973265efa",
|
||||
"tests/output/stealth_steady_sweep_nx1500/state_stealth_s150_w0.02709.h5": "b22d54a05cbd3138a1fe585a825246989fcff7c00f51aa9312a4185d963db933",
|
||||
"tests/output/stealth_steady_sweep_nx1500/vorticity_stealth_s125_w0.02257.png": "c1e1d04f266deac5fb2815a8283da80f9139ffaccbec2219d98544296bf3152c",
|
||||
"tests/output/stealth_steady_sweep_nx1500/vorticity_stealth_s150_w0.02709.png": "bcf098083a73798dc3906807218058cc571435a010234a5a350b585ba9915c78",
|
||||
"tests/output/stealth_steady_sweep_nx1500/streakline_stealth_s150_w0.02709.png": "3bac21cc75a01429399cec308d6bf5fc8918917def1bf5d7fec1cb6003390a41",
|
||||
"tests/output/stealth_steady_sweep_nx1500/vorticity_stealth_s050_w0.00903.png": "a675f41df763f0a1ac0a06386315806b24f2571f5dabc8693fcd871a13ed22ba",
|
||||
"tests/output/stealth_steady_sweep_nx1500/streakline_stealth_s100_w0.01806.png": "92515588596596cc1d691c643fa48cf828492c2eaed96355dcec58109de4b5aa",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/summary_C4_deceit_f1p5.json": "0393661f08b748428fc366eeecec3b34b9d9a013aa6b151a15b33c7e3c0e1818",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C5_deceit_multi_f1p5_step080000.png": "bffef412087e426b614d8c05e59bd7580ee49bb77319279ddc4c1bf825678c49",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/summary_C6_deceit_f2.json": "de067f01ef5c11249d67bbe5e02db6f2b4c5590214de02609bca115edf8dee64",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C6_deceit_f2.png": "846badbae81b75f765d89e5a7c4f88aeb5d57f2387511e4f2f84c72a192ea9f2",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/summary_C3_deceit_multi.json": "eb21d1c69e51f01c1a6be1ce59fe86763089ea5aa667b8872d0186af035b24b2",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/summary_C0_no_ctrl.json": "780a0d329cb86990a17a088f49084410abb1fad24f659255918e5ddda6b3dabd",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C3_deceit_multi_step080000.png": "ff7836b8229d9a5dd3900f499fe3e7f0c73a61c7109b6e6e79b11a0fb459bb63",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C0_no_ctrl_step040000.png": "f2b56a7e30bcc363ed69fc19705403181ac5de90800eef03039a389a65869e30",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/summary_C5_deceit_multi_f1p5.json": "261b698723f19526a447679a2be8666c8d0cbf6df81b0c9de6d051960d77308b",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C0_no_ctrl_step060000.png": "0697e0ae06a01154afdcf00330ba870bd8f36d21561a33846ad7ba63fb731179",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C1_stealth_step040000.png": "1de3d7f54e91c5d5850f4358d1872e16fefb36d32a1b6293facb54524e32315c",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C0_no_ctrl_step100000.png": "91f0bf6ed3e854f7f83623a3f19bb12c83b4aac239e3eaa849fbe50e7baddff5",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C0_no_ctrl_step080000.png": "303c1d2d4c49b4a7495365c8cb2bcbfe9bdda7cbc0a7c7dd1f01e8aa62b3573b",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C5_deceit_multi_f1p5_step040000.png": "dd5945458a35d81b31a0e2f3a693a5023d6960474263e7dc86c22367a56cc13c",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/manifest.json": "0d97efed02f775c25dd8a2d7439f310b715d142ff8d603c9da6ddab197570ce8",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C3_deceit_multi.png": "69022ef9175acf910374ec73848640548b85fc7beb7e6950843f52c10ed7d61b",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C4_deceit_f1p5_step060000.png": "16ba30b8cca0d49e6b76be0bb4f0d14bbf276ca6ec47ebf56907c7534e15c4e0",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C5_deceit_multi_f1p5_step100000.png": "8548b6dff635cf9c92e2baa119866277e3994366eb31aeb30641b03b3d80ee9f",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C2_deceit_step060000.png": "56100f169c3e378b84bfc89c5477d2c142ca043d9f28eaa70bc5448c49c7f4d5",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/summary_C2_deceit.json": "587cd42d81b1325bbc766d9ca6c1fd3d076bf5a772efd45d056c2c4e3db742b6",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C1_stealth_step060000.png": "e43e95e7126de8cb857154353f161914c225f8c9f17eb44b1ff744249368a4d5",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C6_deceit_f2_step080000.png": "676d21ffc7180d34a6725a8bf49503ce59f48d65500450c3975d01e65162899e",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/summary_C1_stealth.json": "73040aeb7ef07c538d4687b101c599210e660202eb1c2c3e0894dfbde682d137",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C4_deceit_f1p5_step100000.png": "e22171ef86979c4398c45ada9cd0f5e4c4e5b034f271df5fa8ac9a762a8554cd",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C2_deceit_step100000.png": "0d73042be73b0de8d0a591e56c01e3c802483aa22a97f27e0300cba82c708066",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C4_deceit_f1p5_step040000.png": "a6e95fd5c24052db20d5ece200edcfe5e261c00950ca964c89df9f7335579634",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C0_no_ctrl.png": "d74061347ac3505fad878e330f6cb04d23bdb13082bfa1afa2fda0872f80f388",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C4_deceit_f1p5.png": "3156400eb59fae0638556c2711345f12ca49d951ff09e6464a2271249409a6a7",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C1_stealth_step100000.png": "d69e34c82da98b28eef7f1af29f5d11f400e90f628049f6f5f4a3a419a4a4340",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C6_deceit_f2_step040000.png": "ce1f372b517dd52fc3f3eb066145e04ab6841e43b67cb0f6bfbdb42a6738eca6",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C3_deceit_multi_step100000.png": "07cce6c99dfa7b56dd4d3aa452873a676a5a00e9f046555fa9dda30f16dde488",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C1_stealth.png": "a892f18c74fe13efd839bfd5068097ca0ae07acebf6c06eed89e1b867e41fcb2",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C6_deceit_f2_step060000.png": "80b63bd309ef11a3ebb2f1ef301b49cd8f09bcc25562097d382f859306c9fe6d",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C2_deceit.png": "1edb30dc35e29ad991695353f4b84e0507792935ec75ae9a7904ebdc007a471a",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C5_deceit_multi_f1p5_step060000.png": "93ab8e09e58a64c5dd2eedfdafd27cf4dcfe4e8fae1af64ac71eac509e6ffdaf",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C3_deceit_multi_step060000.png": "f773bdef1c8d718d01b6d6d7735182c04564dd8b5692b359e1dd2f721c774b1a",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C4_deceit_f1p5_step080000.png": "5570fe6a25c92e5c6aa9a5129aa1797ba8ee7418170c7a351f9e35b931a366c7",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C1_stealth_step080000.png": "32d3e700286eb4b46b3bcf757669481affd6ff6b53792d730b5a21da92cc57d6",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C6_deceit_f2_step100000.png": "5acfe36694bb4e628309ff8ae1e839ca0a1f684607165bbc2883436b85208bf4",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C2_deceit_step040000.png": "2c6f2b8d61cc2aaa63631eb6c98d3de26dcef705fa6b66c823ce7b9eef50e00c",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C5_deceit_multi_f1p5.png": "adbefd0021e2c981d026718de8c63594b9c8e5971901d1dc40835cb69d95b93e",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C2_deceit_step080000.png": "ce8b18e4dd976ed590fcc44075f3fb058ca7b23e15a1624726c181c4dd0c11da",
|
||||
"tests/output/exp_ctrl_matrix_streak_nx1500/streakline_C3_deceit_multi_step040000.png": "168d21ef24ae198fbfd642f8ca315faad4c7bff2e2c09e16ff7c97e7360ea883",
|
||||
"tests/output/screening/screening_summary.csv": "3a23c4f2bd54ed5ee9bdb5b6dcdc58eed04519fcf1b4790e0abd1e6c5288fb96",
|
||||
"tests/output/screening/screening_summary.json": "caf64530f152b6b8ccec82a3c7ba44fa0b3aeb0e0221ef6121857bf62c031ecd",
|
||||
"tests/output/screening/B1/force_hist.csv": "854bfebe63fb2d140823fc5dbc434a70c317c6ab0bedbd5220cec45665b524c8",
|
||||
"tests/output/screening/B1/summary.json": "35b4d958bc0fdd6ab6c9c0d1ed50e85d89b04f7be3e34632d6c3ea95b89acb47",
|
||||
"tests/output/screening/custom/force_hist.csv": "06da0f67b564d5c114332ef3b39167b1ba222fc50045f95303c75c14755b51d5",
|
||||
"tests/output/screening/custom/summary.json": "1701ed75e5e9ca16127f495ccff1d87de245d81df581e94114c8fca6fbbe77fd",
|
||||
"tests/output/screening/MR1/force_hist.csv": "f70fbfa748fd0709e225523aaaa72b761db56df4f1d48f105384b94cbc44b31f",
|
||||
"tests/output/screening/MR1/summary.json": "3d9a0fc19710820e3634ab2143b913b282beb159336567ab9ebf3de2092947bd",
|
||||
"tests/output/screening/MR2/force_hist.csv": "c947b3c16b8e8f8f85a203cea8cd912bdfc07f96985c1c24a470b644170195ea",
|
||||
"tests/output/screening/MR2/summary.json": "d2344e9e2517ec76c8b56bfbe3763dd465e24721856992401c57c414763481bb",
|
||||
"tests/output/screening/MR3/force_hist.csv": "7df1536c83ee466b7195d9c521d3d3b1309acaf142f2855bba51fb279c7612e4",
|
||||
"tests/output/screening/MR3/summary.json": "ad188eb1b271a6cd0fb4025b456eccac5450776f60db58466f804fc5a0e0ec61",
|
||||
"tests/postproc/run_exp_ctrl_matrix_vorticity.py": "b7e0c4113111b9b677f321750c0055656ccfa4f45c25fe7846f3ed22f30d1467",
|
||||
"tests/postproc/vorticity_triangle_clean.png": "f831b8143b50f038d5920a0658469622655f34176d30cf7216feff108aa2ecaf",
|
||||
"tests/postproc/run_kan99b_streakline.py": "a2bbf3fc629ea170d2d4879317dbf2b81c43378a328100ac1f2ee8d9895666cb",
|
||||
"tests/postproc/streakline_triangle_clean.png": "aa6669de7af6f82e98af25698a15f494e9cea20cb911ad9a30fe52597d33bb79",
|
||||
"tests/postproc/experiment.ipynb": "c6b45db1c57200f0777213ef8d44cb4996c1aa7a5fb42b968b77e56f51b4fca4",
|
||||
"tests/postproc/run_stealth_steady_sweep.py": "3c32c4dede7da77fd6cfbd3f7b1ff43bb11390aaba621883ec96c6c7fdad5af7",
|
||||
"tests/postproc/run_exp_ctrl_matrix_streakline.py": "529d5f31a3862080f890c65177502b589710b2d960ddf131abaf7dc2f9e2a96f",
|
||||
"tests/screening/run_config_sweep.py": "5030c99923815ed6ad39110cb56f748c579ff4c66c7c1a368ad1a6008017e2ff",
|
||||
"examples/fixed_periodic_patch.py": "6732e440a47c237ea341703f2d80717903d34c68fd061bdc97189e5d877be46c",
|
||||
"examples/fixed_patch_jet.py": "9d58ac3f32478603e8e798efcdaf6ea16e9cc92346eb4780a60e438d331abced"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
PYTHONPATH=/home/frank14f/CelerisLab/src CUDA_VISIBLE_DEVICES='' /home/frank14f/anaconda3/envs/pycuda_3_10/bin/python -m pytest tests/validation/multigrid/test_fine_surface_gpu.py::test_missing_surface_device_buffer_rejects_before_launch -q
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1,2 @@
|
||||
.. [100%]
|
||||
2 passed in 0.09s
|
||||
@@ -0,0 +1,30 @@
|
||||
[
|
||||
{
|
||||
"name": "cpu_maps",
|
||||
"command": [
|
||||
"/home/frank14f/anaconda3/envs/pycuda_3_10/bin/python",
|
||||
"-m",
|
||||
"pytest",
|
||||
"-q",
|
||||
"-p",
|
||||
"no:cacheprovider",
|
||||
"tests/unit/test_refinement.py"
|
||||
],
|
||||
"exit_code": 0,
|
||||
"seconds": 1.8799934879643843
|
||||
},
|
||||
{
|
||||
"name": "cpu_shared_kernel",
|
||||
"command": [
|
||||
"/home/frank14f/anaconda3/envs/pycuda_3_10/bin/python",
|
||||
"-m",
|
||||
"pytest",
|
||||
"-q",
|
||||
"-p",
|
||||
"no:cacheprovider",
|
||||
"tests/unit/test_numerical_operators.py::test_actual_semantic_and_auxiliary_kernels[0-0-0]"
|
||||
],
|
||||
"exit_code": 0,
|
||||
"seconds": 2.1572919980389997
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"command": [
|
||||
"/home/frank14f/anaconda3/envs/pycuda_3_10/bin/python",
|
||||
"-m",
|
||||
"pytest",
|
||||
"-q",
|
||||
"-p",
|
||||
"no:cacheprovider",
|
||||
"tests/unit/test_fine_surface.py"
|
||||
],
|
||||
"exit_code": 0,
|
||||
"seconds": 1.947228622972034,
|
||||
"note": "Final CPU recheck after preflight aperture inputs were aligned with packed FP32 lever arms. No kernel/math or uploaded-array changes."
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
............... [100%]
|
||||
15 passed in 0.59s
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"command": [
|
||||
"/home/frank14f/anaconda3/envs/pycuda_3_10/bin/python",
|
||||
"-m",
|
||||
"pytest",
|
||||
"-q",
|
||||
"-p",
|
||||
"no:cacheprovider",
|
||||
"tests/validation/multigrid/test_refinement_followup.py::FaultGuardsCPU",
|
||||
"tests/validation/multigrid/test_refinement_gpu.py::CoupledGPU::test_cleanup_attempts_every_allocation"
|
||||
],
|
||||
"exit_code": 0,
|
||||
"seconds": 1.620646678027697
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
..... [100%]
|
||||
5 passed, 5 subtests passed in 0.25s
|
||||
@@ -0,0 +1,2 @@
|
||||
......... [100%]
|
||||
9 passed, 23 subtests passed in 0.12s
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"command": [
|
||||
"/home/frank14f/anaconda3/envs/pycuda_3_10/bin/python",
|
||||
"-m",
|
||||
"pytest",
|
||||
"-q",
|
||||
"-p",
|
||||
"no:cacheprovider",
|
||||
"tests/validation/multigrid/test_fine_surface_gpu.py::test_cross_interface_donor_rejects_before_cuda"
|
||||
],
|
||||
"exit_code": 0,
|
||||
"seconds": 1.665132363094017,
|
||||
"CUDA_VISIBLE_DEVICES": ""
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
. [100%]
|
||||
1 passed in 0.09s
|
||||
@@ -0,0 +1,2 @@
|
||||
. [100%]
|
||||
1 passed in 0.63s
|
||||
@@ -0,0 +1 @@
|
||||
PYTHONPATH=src /home/frank14f/anaconda3/envs/pycuda_3_10/bin/python -m pytest tests/unit/test_fine_surface.py -q
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
PYTHONPATH=src /home/frank14f/anaconda3/envs/pycuda_3_10/bin/python -m pytest tests/unit/test_fine_surface.py -q -k 'projection_uses_cell_center or transfer_dependencies'
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1,2 @@
|
||||
... [100%]
|
||||
3 passed, 12 deselected in 0.40s
|
||||
@@ -0,0 +1,2 @@
|
||||
............... [100%]
|
||||
15 passed in 0.59s
|
||||
@@ -0,0 +1,290 @@
|
||||
"""CPU preparation for one fixed D2Q9 2:1 patch and optional interior circles.
|
||||
|
||||
Cell indices use y*nx+x; population slots use q*(nx*ny)+cell, matching
|
||||
core/layout.cuh. Bounds are half-open (x0, y0, x1, y1) in coarse cells.
|
||||
The four fine halo cells implement the pinned CPUREF volumetric geometry.
|
||||
Base topology is independent of boundaries; prepare_fine_boundary checks them.
|
||||
"""
|
||||
from dataclasses import dataclass, replace
|
||||
from numbers import Integral
|
||||
|
||||
import numpy as np
|
||||
|
||||
from ..config import LBMConfig
|
||||
from .descriptors import D2Q9_EX, D2Q9_EY, FLUID, SOLID
|
||||
|
||||
ACTIVE, INNER_GHOST, OUTER_GHOST = 0, 1, 2
|
||||
HALO = 4
|
||||
|
||||
|
||||
def _readonly(values, dtype):
|
||||
array = np.ascontiguousarray(values, dtype=dtype)
|
||||
array.setflags(write=False)
|
||||
return array
|
||||
|
||||
|
||||
@dataclass(frozen=True, eq=False)
|
||||
class FixedPatch2D:
|
||||
"""Layer metadata and compact exchange tables, constructed by from_config.
|
||||
|
||||
Shapes are (ny, nx), including the fine halo. ``fine_origin`` is its lower
|
||||
cell edge in coarse physical units, with coarse dx=dt=1 and fine dx=dt=.5.
|
||||
``ghost_fine`` and ``ghost_coarse`` pair fine cells with coarse donors.
|
||||
``coalesce_coarse`` contains incoming population slots; each corresponding
|
||||
row of ``coalesce_fine`` contains four fine slots in (dy, dx) row order.
|
||||
Weights are all 1/4. Closed corner links are included even when the coarse
|
||||
donor is uncovered. These tables contain no DDF data and allocate no GPU.
|
||||
|
||||
This is preparation, not permission to advance these levels with OneStep:
|
||||
its channel boundaries and fused collision do not implement patch coupling.
|
||||
"""
|
||||
coarse_shape: tuple[int, int]
|
||||
bounds: tuple[int, int, int, int]
|
||||
tau_coarse: float
|
||||
tau_fine: float
|
||||
fine_kind: np.ndarray
|
||||
ghost_fine: np.ndarray
|
||||
ghost_coarse: np.ndarray
|
||||
coalesce_coarse: np.ndarray
|
||||
coalesce_fine: np.ndarray
|
||||
|
||||
@classmethod
|
||||
def from_config(cls, cfg: LBMConfig, bounds) -> "FixedPatch2D":
|
||||
"""Prepare maps without changing cfg or allocating coarse-sized tables.
|
||||
|
||||
The initial backend contract is D2Q9/SRT/FP32/unshifted/double_buffer,
|
||||
without LES. Two coarse cells of margin keep all halo donors in bounds;
|
||||
this does NOT certify that those donors are fluid or periodic.
|
||||
"""
|
||||
checked = replace(cfg)
|
||||
checked.validate()
|
||||
if (not checked.is_d2q9 or checked.collision != "SRT"
|
||||
or checked.streaming != "double_buffer"
|
||||
or checked.store_precision != "FP32"
|
||||
or checked.ddf_shifting or checked.les_enabled):
|
||||
raise ValueError("FixedPatch2D requires D2Q9/SRT/FP32/unshifted/double_buffer without LES")
|
||||
bounds = tuple(bounds)
|
||||
if len(bounds) != 4 or any(isinstance(v, (bool, np.bool_))
|
||||
or not isinstance(v, Integral) for v in bounds):
|
||||
raise ValueError("bounds must be four integers: (x0, y0, x1, y1)")
|
||||
x0, y0, x1, y1 = bounds = tuple(map(int, bounds))
|
||||
nx, ny = checked.nx, checked.ny
|
||||
if not (2 <= x0 < x1 <= nx - 2 and 2 <= y0 < y1 <= ny - 2):
|
||||
raise ValueError("patch must be nonempty with a two-coarse-cell margin")
|
||||
fx, fy = 2 * (x1 - x0) + 2 * HALO, 2 * (y1 - y0) + 2 * HALO
|
||||
if max(nx * ny, fx * fy) > np.iinfo(np.uint32).max:
|
||||
raise ValueError("layer cell counts exceed uint32 indexing")
|
||||
tau_c = 3.0 * checked.viscosity + 0.5
|
||||
tau_f = 6.0 * checked.viscosity + 0.5
|
||||
if not checked.omega_min <= 1.0 / tau_f <= checked.omega_max:
|
||||
raise ValueError("fine relaxation rate lies outside configured omega guards")
|
||||
|
||||
kind = np.full((fy, fx), OUTER_GHOST, dtype=np.uint8)
|
||||
kind[2:-2, 2:-2] = INNER_GHOST
|
||||
kind[HALO:-HALO, HALO:-HALO] = ACTIVE
|
||||
gy, gx = np.nonzero(kind != ACTIVE)
|
||||
ghost_fine = gy * fx + gx
|
||||
ghost_coarse = (y0 + (gy - HALO) // 2) * nx + x0 + (gx - HALO) // 2
|
||||
|
||||
targets, sources = [], []
|
||||
# Only the outside ring can receive fine-to-coarse populations.
|
||||
# Integer doubled midpoints include all eight diagonal corner passes.
|
||||
for y in range(y0 - 1, y1 + 1):
|
||||
xs = range(x0 - 1, x1 + 1) if y in (y0 - 1, y1) else (x0 - 1, x1)
|
||||
for x in xs:
|
||||
for q in range(1, 9):
|
||||
mx, my = 2 * x + 1 - D2Q9_EX[q], 2 * y + 1 - D2Q9_EY[q]
|
||||
if 2 * x0 <= mx <= 2 * x1 and 2 * y0 <= my <= 2 * y1:
|
||||
targets.append(q * nx * ny + y * nx + x)
|
||||
a, b = HALO + 2 * (x - x0), HALO + 2 * (y - y0)
|
||||
sources.append([q * fx * fy + (b + dy) * fx + a + dx
|
||||
for dy in (0, 1) for dx in (0, 1)])
|
||||
return cls((ny, nx), bounds, tau_c, tau_f,
|
||||
_readonly(kind, np.uint8),
|
||||
_readonly(ghost_fine, np.uint32),
|
||||
_readonly(ghost_coarse, np.uint32),
|
||||
_readonly(targets, np.uint64),
|
||||
_readonly(sources, np.uint64).reshape(-1, 4))
|
||||
|
||||
@property
|
||||
def fine_shape(self) -> tuple[int, int]:
|
||||
return self.fine_kind.shape
|
||||
|
||||
@property
|
||||
def fine_origin(self) -> tuple[float, float]:
|
||||
return self.bounds[0] - HALO / 2, self.bounds[1] - HALO / 2
|
||||
|
||||
@property
|
||||
def table_bytes(self) -> int:
|
||||
return sum(a.nbytes for a in (self.fine_kind, self.ghost_fine,
|
||||
self.ghost_coarse, self.coalesce_coarse,
|
||||
self.coalesce_fine))
|
||||
|
||||
def check_synchronization(self, coarse_steps: int, fine_steps: int, *, phase: str) -> None:
|
||||
"""Check a proposed backend handoff; does not convert or collide data.
|
||||
|
||||
Production storage is g=C(f), while CPUREF returns arrival_f. A future
|
||||
g-to-g coarse step must collide coarse cells once and fine cells twice;
|
||||
fine halo ghosts never collide. Coalescence must precede coarse collision.
|
||||
Converting reference f to g for comparison is an observation operation,
|
||||
not an additional production collision. Counts here are completed steps.
|
||||
"""
|
||||
if phase != "postcollision_g":
|
||||
raise ValueError("patch backend handoff requires postcollision_g")
|
||||
for value in (coarse_steps, fine_steps):
|
||||
if isinstance(value, (bool, np.bool_)) or not isinstance(value, Integral) or value < 0:
|
||||
raise ValueError("step counts must be nonnegative integers")
|
||||
if fine_steps != 2 * coarse_steps:
|
||||
raise ValueError("levels are not synchronized: fine_steps must equal 2*coarse_steps")
|
||||
|
||||
|
||||
@dataclass(frozen=True, eq=False)
|
||||
class FineBoundary2D:
|
||||
"""Fixed local projection plus auditable, finite transfer dependency sets.
|
||||
|
||||
transfer_reads rows are (hop, direction, cell), traced from coalescence at
|
||||
hop 2 back to exploded G at hop 0. No previous coarse interval is traversed.
|
||||
Cell footprints also include the whole explosion write/donor tables.
|
||||
"""
|
||||
objects: tuple
|
||||
flags: np.ndarray
|
||||
curved_host: tuple
|
||||
boundary_cells: np.ndarray
|
||||
transfer_fine_cells: np.ndarray
|
||||
transfer_coarse_cells: np.ndarray
|
||||
transfer_reads: np.ndarray
|
||||
|
||||
|
||||
def _transfer_footprint(patch):
|
||||
ny, nx = patch.fine_shape
|
||||
cells = nx * ny
|
||||
pending = [(2, *divmod(int(slot), cells)) for slot in patch.coalesce_fine.ravel()]
|
||||
reads = set()
|
||||
while pending:
|
||||
hop, q, k = pending.pop()
|
||||
if (hop, q, k) in reads:
|
||||
continue
|
||||
reads.add((hop, q, k))
|
||||
if hop == 0:
|
||||
continue
|
||||
y, x = divmod(k, nx)
|
||||
kind = patch.fine_kind[y, x]
|
||||
if kind == OUTER_GHOST:
|
||||
raise ValueError("Transfer reads an invalid post-hop outer ghost")
|
||||
# A collided output depends on all nine arrivals; ghosts only stream.
|
||||
for direction in (range(9) if kind == ACTIVE else (q,)):
|
||||
sx, sy = x - D2Q9_EX[direction], y - D2Q9_EY[direction]
|
||||
if not (0 <= sx < nx and 0 <= sy < ny):
|
||||
raise ValueError("Transfer dependency leaves the fine allocation")
|
||||
pending.append((hop - 1, direction, sy * nx + sx))
|
||||
fine = set(map(int, patch.ghost_fine)) | {k for _, _, k in reads}
|
||||
coarse = set(map(int, patch.ghost_coarse)) | set(map(
|
||||
int, patch.coalesce_coarse % np.prod(patch.coarse_shape)))
|
||||
return fine, coarse, _readonly(sorted(reads), np.int64)
|
||||
|
||||
|
||||
def prepare_fine_boundary(cfg, patch, objects, *, wall_aware=False):
|
||||
"""Project fixed circles and reject boundary/transfer overlap before CUDA.
|
||||
|
||||
Input centers/radii are in coarse physical coordinates (dx=dt=1).
|
||||
SurfaceActuation retains its lattice-velocity meaning: input coarse units
|
||||
are converted into independent fine-local objects with dx=dt=.5.
|
||||
Original objects are not retained or mutated. No runtime geometry updates.
|
||||
"""
|
||||
if not objects:
|
||||
return None
|
||||
checked = replace(cfg)
|
||||
checked.validate()
|
||||
if (patch.coarse_shape != (cfg.ny, cfg.nx) or not checked.is_d2q9
|
||||
or checked.collision != "SRT" or checked.streaming != "double_buffer"
|
||||
or checked.store_precision != "FP32" or checked.ddf_shifting or checked.les_enabled
|
||||
or patch.tau_coarse != 3*checked.viscosity+.5):
|
||||
raise ValueError("Fine boundary requires the matching fixed-patch configuration")
|
||||
from ..body.geometry.circle import CircleGeometry
|
||||
from ..body.objects import SimObject
|
||||
from ..body.coupling.soa_packer import pack_cut_links_to_soa
|
||||
|
||||
ny, nx = patch.fine_shape
|
||||
fine_cfg = replace(cfg, nx=nx, ny=ny, viscosity=2 * cfg.viscosity)
|
||||
flags = np.full(nx * ny, FLUID, np.uint16)
|
||||
active = patch.fine_kind.ravel() == ACTIVE
|
||||
local, links = [], []
|
||||
x0, y0, x1, y1 = patch.bounds
|
||||
dx = dt = .5
|
||||
for bid, obj in enumerate(objects):
|
||||
if (type(obj.geometry) is not CircleGeometry or obj.is_sensor or obj.is_force_region
|
||||
or any(getattr(obj.state, name) != 0 for name in ("vx", "vy", "omega"))
|
||||
or any(vars(obj.control).values())):
|
||||
raise ValueError("Fine boundaries require stationary circles without other roles")
|
||||
cx, cy = obj.geometry.center
|
||||
radius = obj.geometry._radius
|
||||
if (not np.isfinite([cx, cy, radius]).all() or radius <= 0
|
||||
or cx-radius < x0 or cx+radius > x1 or cy-radius < y0 or cy+radius > y1):
|
||||
raise ValueError("Entire fine circle must lie inside the physical patch")
|
||||
center = tuple((v-o)/dx-.5 for v, o in zip((cx, cy), patch.fine_origin))
|
||||
spec = obj.surface_actuation
|
||||
if spec is not None:
|
||||
spec = replace(spec, normal_velocity=spec.normal_velocity * dt / dx)
|
||||
item = SimObject(bid, geometry=CircleGeometry(*center, radius/dx),
|
||||
center=center, radius=radius/dx, surface_actuation=spec)
|
||||
item.validate_surface_actuation(fine_cfg)
|
||||
mask = item.get_flag_mask(nx, ny)
|
||||
solid = (mask & SOLID) != 0
|
||||
if not solid.any() or np.any(solid & ~active) or np.any(flags[solid] & SOLID):
|
||||
raise ValueError("Fine solids must be resolved, disjoint and entirely active")
|
||||
flags[solid] = mask[solid]
|
||||
local.append(item)
|
||||
for item in local:
|
||||
cut = item.geometry.build_cut_links(nx, ny, domain_flags=flags)
|
||||
if not cut:
|
||||
raise ValueError("Fine circle has no resolved cut links")
|
||||
if item.surface_actuation is not None:
|
||||
_, aperture = item.surface_actuation.project(
|
||||
np.array([link.rx for link in cut]), np.array([link.ry for link in cut]))
|
||||
if not aperture.any():
|
||||
raise ValueError("Surface aperture hits no resolved cut links")
|
||||
for link in cut:
|
||||
link.body_id = item.obj_id
|
||||
links.extend(cut)
|
||||
|
||||
boundary, writers, receivers = set(), set(), set()
|
||||
for link in links:
|
||||
r, q = link.fluid_idx, link.dir
|
||||
y, x = divmod(r, nx)
|
||||
sx, sy = x + D2Q9_EX[q], y + D2Q9_EY[q]
|
||||
s = sy * nx + sx
|
||||
if not (active[r] and flags[r] & FLUID and active[s] and flags[s] & SOLID):
|
||||
raise ValueError("Cut-link receiver/source must be active fluid/solid")
|
||||
writer = (s, q+1 if q % 2 else q-1)
|
||||
if writer in writers:
|
||||
raise ValueError("Duplicate fine boundary writer")
|
||||
writers.add(writer)
|
||||
receivers.add((r, q))
|
||||
boundary.update((r, s))
|
||||
if link.q < .5:
|
||||
dx_, dy_ = x - D2Q9_EX[q], y - D2Q9_EY[q]
|
||||
if not (0 <= dx_ < nx and 0 <= dy_ < ny and active[dy_*nx+dx_]):
|
||||
raise ValueError("q<.5 donor crosses the fine active interface; fallback cannot hide it")
|
||||
boundary.add(dy_*nx+dx_)
|
||||
# Reverse coverage: every fluid pull across a solid neighbor needs a writer.
|
||||
required = set()
|
||||
for r in np.flatnonzero(active & ((flags & FLUID) != 0)):
|
||||
for q in range(1, 9):
|
||||
if flags[r + D2Q9_EX[q] + nx*D2Q9_EY[q]] & SOLID:
|
||||
required.add((int(r), q))
|
||||
if required != receivers:
|
||||
raise ValueError("Fine solid pull coverage does not match the cut links")
|
||||
fine, coarse, reads = _transfer_footprint(patch)
|
||||
if fine & (boundary | set(map(int, np.flatnonzero(flags & SOLID)))):
|
||||
raise ValueError("Boundary stencil overlaps the two-hop transfer footprint")
|
||||
for k in coarse:
|
||||
y, x = divmod(k, cfg.nx)
|
||||
if x0 <= x < x1 and y0 <= y < y1:
|
||||
raise ValueError("Transfer coarse donor/target is not an uncovered bulk cell")
|
||||
if wall_aware and (y <= 2 or y >= cfg.ny-3):
|
||||
raise ValueError("Transfer footprint touches the coarse wall reconstruction stencil")
|
||||
return FineBoundary2D(tuple(local), _readonly(flags, np.uint16),
|
||||
tuple(_readonly(a, a.dtype) for a in pack_cut_links_to_soa(links)),
|
||||
_readonly(sorted(boundary), np.uint32),
|
||||
_readonly(sorted(fine), np.uint32),
|
||||
_readonly(sorted(coarse), np.uint32), reads)
|
||||
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"start_utc": "2026-10-14T05:08:55.958692+00:00",
|
||||
"preflight_gpu": "0, GPU-e8853ae7-a302-6a17-bcfa-aa767e9ed20c, Tesla V100-SXM2-16GB, 5, 16140, 0\n1, GPU-f1c9fd5a-e917-56e0-21fb-24035ba44a36, Tesla V100-SXM2-16GB, 5, 16140, 0\n2, GPU-b8c11c01-c91f-aa0b-abf6-dad35085cc76, Tesla V100-SXM2-16GB, 5, 16140, 0\n3, GPU-8b71b032-1b75-2891-935c-ce106a53034a, Tesla V100-SXM2-16GB, 5, 16140, 0",
|
||||
"preflight_apps": "",
|
||||
"preflight_ram_bytes": 64091750400,
|
||||
"physical_gpu_uuid": "GPU-e8853ae7-a302-6a17-bcfa-aa767e9ed20c",
|
||||
"command": [
|
||||
"/home/frank14f/anaconda3/envs/pycuda_3_10/bin/python",
|
||||
"-c",
|
||||
"import CelerisLab,pytest; print('SOURCE', CelerisLab.__file__, flush=True); assert CelerisLab.__file__.startswith('/home/frank14f/CelerisLab/src/'); raise SystemExit(pytest.main(['-q', '-s', '-p', 'no:cacheprovider', 'tests/validation/multigrid/test_fine_surface_gpu.py', 'tests/validation/multigrid/test_refinement_followup.py::NormalBuildGPU::test_offcenter_rectangle_margin_two_one_step', 'tests/validation/multigrid/test_refinement_followup.py::NormalBuildGPU::test_slot_reservoir_eight_steps']))"
|
||||
],
|
||||
"cwd": "/home/frank14f/CelerisLab",
|
||||
"env": {
|
||||
"PYTHONPATH": "/home/frank14f/CelerisLab/src",
|
||||
"PYTHONNOUSERSITE": "1",
|
||||
"PYTHONDONTWRITEBYTECODE": "1",
|
||||
"OPENBLAS_NUM_THREADS": "1",
|
||||
"CUDA_VISIBLE_DEVICES": "GPU-e8853ae7-a302-6a17-bcfa-aa767e9ed20c",
|
||||
"CUDA_CACHE_DISABLE": "1",
|
||||
"TMPDIR": "/tmp/celeris-fine-surface-gpu-e9g3hz7z"
|
||||
},
|
||||
"preflight_temp_bytes": 1637890,
|
||||
"limits": {
|
||||
"wall_seconds": 120,
|
||||
"temp_bytes": 2000000000,
|
||||
"ram_reserve_bytes": 6409175040,
|
||||
"vram_reserve_MiB": 1614
|
||||
},
|
||||
"note": "Sampled own process group; no fixed RSS/address-space cap.",
|
||||
"exit_code": 1,
|
||||
"elapsed_seconds": 25.39498820400331,
|
||||
"peak_group_rss_bytes": 386883584,
|
||||
"peak_temp_bytes": 3585985,
|
||||
"min_ram_bytes": 63638339584,
|
||||
"min_vram_free_MiB": 15826,
|
||||
"termination_reason": null,
|
||||
"scratch_removed": true,
|
||||
"source_hashes_captured_during_run": {
|
||||
"src/CelerisLab/lbm/kernels/refinement.cu": "129f3d91da93b4324f88a0da73a4da1e5390f72c14cce574ee63306712da9895",
|
||||
"src/CelerisLab/lbm/kernels/step/aux_kernels.cu": "578a5b20a157241ee678547059abb1372dd5a589ad06bb2c15b987eb01ca1013",
|
||||
"src/CelerisLab/lbm/kernels/step/curved_double.cu": "bfa7a1df1e939020314d49755045f7a85fe4a19cc1c68dbe62653c66c5e7c2b3",
|
||||
"src/CelerisLab/lbm/refinement.py": "b3fe9e58118369adb1bdfc618fbfbd917d508a563beaf2555f656b59aeff4425",
|
||||
"src/CelerisLab/lbm/refinement_stepper.py": "9178224089ee6584420b79f10cf1d91441645b668e8b6898641d19eac757687b",
|
||||
"src/CelerisLab/lbm/stepper.py": "0dcb7cd7ae87e33e3dc67a38b6aa43042fbe673e37d9ad165342ee1d695933ce",
|
||||
"tests/unit/test_fine_surface.py": "b232b55e75eef52480f06a35c401d72b6145892bb8b79d1d1b3cfed965b3506c",
|
||||
"tests/validation/multigrid/test_fine_surface_gpu.py": "3dd0658f63a4e7a1c41eecf433842c872f8fecb391ea4b44d0b48947643d5189"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
SOURCE /home/frank14f/CelerisLab/src/CelerisLab/__init__.py
|
||||
speed=0.0 audit=True BFL=7.4505806e-09 ledger=[1.604948192834854e-05, -5.038455128669739e-07, -6.919726729393005e-07] budget=0.00221051117 boundary=[4.0978193283081055e-08, 0.0, 0.0] transfer=[0.0, 0.0, 0.0] drive_mass=+4.09781933e-08; counts=PASS
|
||||
speed=None audit=False BFL=7.4505806e-09 ledger=[1.604948192834854e-05, -5.038455128669739e-07, -6.919726729393005e-07] budget=0.00221051117 boundary=[4.0978193283081055e-08, 0.0, 0.0] transfer=[0.0, 0.0, 0.0] drive_mass=+4.09781933e-08; counts=normal build
|
||||
.speed=0.002 audit=True BFL=9.73073444e-09 ledger=[1.597730442881584e-05, -5.154870450496674e-07, -7.622875273227692e-07] budget=0.00221052543 boundary=[0.0071802823804318905, 0.003110995050519705, 0.0026390845887362957] transfer=[0.0, 0.0, 0.0] drive_mass=+0.00620033871; counts=PASS
|
||||
.speed=-0.002 audit=True BFL=7.4505806e-09 ledger=[1.66366808116436e-05, -5.881302058696747e-07, -7.147900760173798e-07] budget=0.00221049693 boundary=[-0.007164992857724428, -0.0030983122996985912, -0.00262861093506217] transfer=[0.0, 0.0, 0.0] drive_mass=-0.00618575338; counts=PASS
|
||||
.FF.normal rectangle 17x13 bounds=(2, 2, 6, 5) fine=16x14 steps=1: max_population=1.14050047e-07 device_arrays=35288; halo/stride PASS
|
||||
host_peak_rss=279.887 MiB
|
||||
.slot/reservoir steps=8 max_population=1.78241457e-07 max_BC_error=2.21654773e-07 discrete_leaf_mass_change=+0.0309633738 final_sum_rho_v_bottom=0.00426894613 top=0.000960694626; raw halos/corners/fine BC isolation PASS
|
||||
host_peak_rss=279.887 MiB
|
||||
.
|
||||
=================================== FAILURES ===================================
|
||||
_ test_missing_surface_device_buffer_rejects_before_launch[surface_velocity_gpu] _
|
||||
|
||||
missing = 'surface_velocity_gpu'
|
||||
|
||||
@pytest.mark.parametrize("missing", ["surface_velocity_gpu", "link_exchange_gpu"])
|
||||
def test_missing_surface_device_buffer_rejects_before_launch(missing):
|
||||
backend = implementation.FixedPatchStepper.__new__(implementation.FixedPatchStepper)
|
||||
backend.fine_boundary = SimpleNamespace(objects=[object_spec(.002)])
|
||||
backend._fine_curved = SimpleNamespace(surface_velocity_gpu=object(), link_exchange_gpu=object())
|
||||
setattr(backend._fine_curved, missing, None)
|
||||
backend._curved = Mock()
|
||||
with pytest.raises(RuntimeError, match="Surface boundary device buffers are missing"):
|
||||
> backend._apply_fine_boundary(object())
|
||||
|
||||
tests/validation/multigrid/test_fine_surface_gpu.py:289:
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
|
||||
self = <CelerisLab.lbm.refinement_stepper.FixedPatchStepper object at 0x761fb9325480>
|
||||
buffer = <object object at 0x761fb937c570>, kw = {}
|
||||
cl = namespace(surface_velocity_gpu=None, link_exchange_gpu=<object object at 0x761fb937c630>)
|
||||
|
||||
def _apply_fine_boundary(self, buffer, **kw):
|
||||
"""Stage solid source slots; exchange buffer holds this fine substep only."""
|
||||
cl = self._fine_curved
|
||||
if cl is None:
|
||||
if self.fine_boundary is not None:
|
||||
raise RuntimeError("Fine boundary device buffers are missing")
|
||||
return
|
||||
> if self._curved is None or cl.fluid_idx_gpu is None:
|
||||
E AttributeError: 'types.SimpleNamespace' object has no attribute 'fluid_idx_gpu'
|
||||
|
||||
src/CelerisLab/lbm/refinement_stepper.py:195: AttributeError
|
||||
_ test_missing_surface_device_buffer_rejects_before_launch[link_exchange_gpu] __
|
||||
|
||||
missing = 'link_exchange_gpu'
|
||||
|
||||
@pytest.mark.parametrize("missing", ["surface_velocity_gpu", "link_exchange_gpu"])
|
||||
def test_missing_surface_device_buffer_rejects_before_launch(missing):
|
||||
backend = implementation.FixedPatchStepper.__new__(implementation.FixedPatchStepper)
|
||||
backend.fine_boundary = SimpleNamespace(objects=[object_spec(.002)])
|
||||
backend._fine_curved = SimpleNamespace(surface_velocity_gpu=object(), link_exchange_gpu=object())
|
||||
setattr(backend._fine_curved, missing, None)
|
||||
backend._curved = Mock()
|
||||
with pytest.raises(RuntimeError, match="Surface boundary device buffers are missing"):
|
||||
> backend._apply_fine_boundary(object())
|
||||
|
||||
tests/validation/multigrid/test_fine_surface_gpu.py:289:
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
|
||||
self = <CelerisLab.lbm.refinement_stepper.FixedPatchStepper object at 0x761fb92299c0>
|
||||
buffer = <object object at 0x761fb937f700>, kw = {}
|
||||
cl = namespace(surface_velocity_gpu=<object object at 0x761fb937f710>, link_exchange_gpu=None)
|
||||
|
||||
def _apply_fine_boundary(self, buffer, **kw):
|
||||
"""Stage solid source slots; exchange buffer holds this fine substep only."""
|
||||
cl = self._fine_curved
|
||||
if cl is None:
|
||||
if self.fine_boundary is not None:
|
||||
raise RuntimeError("Fine boundary device buffers are missing")
|
||||
return
|
||||
> if self._curved is None or cl.fluid_idx_gpu is None:
|
||||
E AttributeError: 'types.SimpleNamespace' object has no attribute 'fluid_idx_gpu'
|
||||
|
||||
src/CelerisLab/lbm/refinement_stepper.py:195: AttributeError
|
||||
=========================== short test summary info ============================
|
||||
FAILED tests/validation/multigrid/test_fine_surface_gpu.py::test_missing_surface_device_buffer_rejects_before_launch[surface_velocity_gpu]
|
||||
FAILED tests/validation/multigrid/test_fine_surface_gpu.py::test_missing_surface_device_buffer_rejects_before_launch[link_exchange_gpu]
|
||||
2 failed, 6 passed in 23.73s
|
||||
@@ -0,0 +1,316 @@
|
||||
"""Two coarse/four fine steps: isolated fine circle, no flux-accuracy claim.
|
||||
|
||||
Run only through the bounded GPU runner after a fresh resource check. The test
|
||||
hooks read actual kernel inputs/outputs; they never change the stepping order.
|
||||
"""
|
||||
import importlib.util
|
||||
from contextlib import nullcontext
|
||||
from pathlib import Path
|
||||
from threading import RLock
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import numpy as np
|
||||
import pycuda.driver as cuda
|
||||
import pytest
|
||||
|
||||
import CelerisLab
|
||||
from CelerisLab.body.geometry.circle import CircleGeometry
|
||||
from CelerisLab.body.objects import SimObject
|
||||
from CelerisLab.config import LBMConfig
|
||||
from CelerisLab.cuda import compiler_v2 as compiler
|
||||
from CelerisLab.cuda.context import CudaContext
|
||||
from CelerisLab.lbm import refinement_stepper as implementation
|
||||
from CelerisLab.lbm.descriptors import FLUID, SOLID
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[3]
|
||||
CX = np.array([0, 1, -1, 0, 0, 1, -1, 1, -1])
|
||||
CY = np.array([0, 0, 0, 1, -1, 1, -1, -1, 1])
|
||||
OPP = np.array([0, 2, 1, 4, 3, 6, 5, 8, 7])
|
||||
W = np.array([4/9]+[1/9]*4+[1/36]*4)
|
||||
MOMENTS = np.stack((np.ones(9), CX, CY))
|
||||
GEOMETRY = ("fluid_idx", "dir", "q", "body_id", "rx", "ry", "rz", "fallback_class")
|
||||
BOUNDS = (4, 4, 20, 20)
|
||||
|
||||
|
||||
def read(pointer, shape, dtype=np.float32):
|
||||
values = np.empty(shape, dtype)
|
||||
cuda.memcpy_dtoh(values, pointer)
|
||||
return values
|
||||
|
||||
|
||||
def rest(shape):
|
||||
return np.broadcast_to(W[:, None, None], (9, *shape)).astype(np.float32).copy()
|
||||
|
||||
|
||||
def surface(speed):
|
||||
return None if speed is None else dict(angle=.7, half_width=.85, normal_velocity=speed)
|
||||
|
||||
|
||||
def object_spec(speed):
|
||||
return SimObject(0, CircleGeometry(12.25, 12.25, 2.15), center=(12.25, 12.25),
|
||||
radius=2.15, surface_actuation=surface(speed))
|
||||
|
||||
|
||||
def audit_compiler(original):
|
||||
def compile_private(*args, **kwargs):
|
||||
entry = Path(kwargs["build_dir"])/"fine_surface_audit.cu"
|
||||
entry.write_text('#define CELERIS_REFINEMENT_AUDIT\n#include "refinement.cu"\n')
|
||||
kwargs["source"] = entry.name
|
||||
return original(*args, **kwargs)
|
||||
return compile_private
|
||||
|
||||
|
||||
def reflection_oracle(before, cl, speed, *, verify_projection=True):
|
||||
"""FP64 BFL from frozen spatial populations, independent arc projection."""
|
||||
flat = before.astype(float).reshape(9, -1)
|
||||
radius = np.hypot(cl.rx.astype(float), cl.ry.astype(float))
|
||||
delta = (np.arctan2(cl.ry.astype(float), cl.rx.astype(float))-.7+np.pi) % (2*np.pi)-np.pi
|
||||
amplitude = 0 if speed is None else speed
|
||||
strength = amplitude*np.maximum(0, 1-(delta/.85)**2)**2
|
||||
velocity = strength[:, None]*np.column_stack((cl.rx, cl.ry))/radius[:, None]
|
||||
if verify_projection and cl.surface_velocity is not None:
|
||||
np.testing.assert_allclose(cl.surface_velocity, velocity, atol=3e-9, rtol=0)
|
||||
incoming = []
|
||||
for i, (k, d, q, fallback) in enumerate(zip(cl.fluid_idx, cl.dir, cl.q, cl.fallback_class)):
|
||||
k, d, q = int(k), int(d), float(q)
|
||||
rho = flat[:, k].sum()
|
||||
dot = CX[d]*velocity[i, 0]+CY[d]*velocity[i, 1]
|
||||
if fallback:
|
||||
value = flat[d, k]-6*W[d]*rho*dot
|
||||
elif q < .5:
|
||||
value = 2*q*flat[d, k]+(1-2*q)*flat[d, k-CX[d]-40*CY[d]]-6*W[d]*rho*dot
|
||||
else:
|
||||
value = flat[d, k]/(2*q)+(1-1/(2*q))*flat[OPP[d], k]-3*W[d]*rho*dot/q
|
||||
incoming.append(value)
|
||||
return np.array(incoming)
|
||||
|
||||
|
||||
def fine_flux(before, staged, active, solid):
|
||||
"""Population ledger across the fine leaf boundary: solid versus halo.
|
||||
|
||||
Internal fluid-to-fluid streaming cancels pairwise; solid and halo packets
|
||||
are counted in their actual direction, before any collision.
|
||||
"""
|
||||
boundary, transfer = np.zeros(9), np.zeros(9)
|
||||
magnitude = 0.0
|
||||
for d, (cx, cy) in enumerate(zip(CX, CY)):
|
||||
incoming = active & ~np.roll(active, (cy, cx), (0, 1))
|
||||
outgoing = active & ~np.roll(active, (-cy, -cx), (0, 1))
|
||||
from_solid = np.roll(solid, (cy, cx), (0, 1))
|
||||
into_solid = np.roll(solid, (-cy, -cx), (0, 1))
|
||||
received = np.roll(staged[d], (cy, cx), (0, 1)).astype(float)
|
||||
sent = before[d].astype(float)
|
||||
for vector, inc, out in ((boundary, incoming & from_solid, outgoing & into_solid),
|
||||
(transfer, incoming & ~from_solid, outgoing & ~into_solid)):
|
||||
assert np.isfinite(received[inc]).all() and np.isfinite(sent[out]).all()
|
||||
vector[d] = received[inc].sum()-sent[out].sum()
|
||||
magnitude += np.abs(received[inc]).sum()+np.abs(sent[out]).sum()
|
||||
return boundary, transfer, magnitude
|
||||
|
||||
|
||||
def coarse_flux(before, fine, active):
|
||||
"""Derive every replacement from physical midpoints, not production tables."""
|
||||
x0, y0, x1, y1 = BOUNDS
|
||||
incoming = np.stack([np.roll(before[d], (CY[d], CX[d]), (0, 1)) for d in range(9)]).astype(float)
|
||||
magnitude = 0.0
|
||||
for y, x in np.argwhere(active):
|
||||
for d in range(1, 9):
|
||||
if x0 <= x+.5-CX[d]/2 <= x1 and y0 <= y+.5-CY[d]/2 <= y1:
|
||||
a, b = 4+2*(x-x0), 4+2*(y-y0)
|
||||
children = fine[d, b:b+2, a:a+2].astype(float)
|
||||
assert children.shape == (2, 2) and np.isfinite(children).all()
|
||||
incoming[d, y, x] = children.sum()/4
|
||||
magnitude += np.abs(children).sum()/4
|
||||
assert np.isfinite(incoming[:, active]).all()
|
||||
# This retains the eight grazing-corner replacements of uncovered donors.
|
||||
flux = (incoming[:, active]-before[:, active].astype(float)).sum(axis=1)
|
||||
magnitude += np.abs(incoming[:, active]).sum()+np.abs(before[:, active]).sum(dtype=float)
|
||||
return flux, magnitude
|
||||
|
||||
|
||||
def run_patch(speed, *, audit=True):
|
||||
cfg = LBMConfig(nx=24, ny=24, viscosity=.05, velocity=0, rho=1)
|
||||
coarse_active = np.ones((24, 24), bool)
|
||||
coarse_active[4:20, 4:20] = False
|
||||
source = object_spec(speed)
|
||||
state = vars(source.state).copy()
|
||||
with CudaContext(0) as context:
|
||||
build = (patch.object(compiler, "compile_kernel", audit_compiler(compiler.compile_kernel))
|
||||
if audit else nullcontext())
|
||||
with build:
|
||||
backend = implementation.FixedPatchStepper(cfg, BOUNDS, context=context, fine_objects=[source])
|
||||
with backend, context.activate():
|
||||
c, f = backend._levels
|
||||
cl = backend._fine_curved
|
||||
geometry = {name: getattr(cl, name).copy() for name in GEOMETRY}
|
||||
flags = backend.fine_boundary.flags.reshape(40, 40)
|
||||
solid = (flags & SOLID) != 0
|
||||
active = np.zeros((40, 40), bool)
|
||||
active[4:-4, 4:-4] = True
|
||||
active &= (flags & FLUID) != 0
|
||||
active &= ~solid
|
||||
local = backend.fine_boundary.objects[0]
|
||||
assert local.center == (20., 20.) and local.radius == 4.3
|
||||
assert source.center == (12.25, 12.25) and source.radius == 2.15
|
||||
yy, xx = np.mgrid[:40, :40]
|
||||
roi = active & ((xx-20)**2+(yy-20)**2 <= 9**2)
|
||||
backend.initialize(rest((24, 24)), rest((40, 40)))
|
||||
if audit:
|
||||
for level in backend._levels:
|
||||
for name in ("collision_counts", "explosion_counts", "incoming_counts"):
|
||||
pointer, size = level.module.get_global(name)
|
||||
cuda.memset_d8(pointer, 0, size)
|
||||
initial = backend.download()
|
||||
initial_pop = initial[0][:, coarse_active].sum(axis=1, dtype=float)
|
||||
initial_pop += .25*initial[1][:, active].sum(axis=1, dtype=float)
|
||||
boundary, fine_transfer, coarse_transfer = np.zeros(9), np.zeros(9), np.zeros(9)
|
||||
budget_sum, reflection_error, drive_mass = 0., 0., 0.
|
||||
traces = []
|
||||
original_curved, original_fine, original_coarse = backend._curved, f.kernel, c.kernel
|
||||
|
||||
def curved(*args, **kwargs):
|
||||
nonlocal boundary, fine_transfer, budget_sum, reflection_error, drive_mass
|
||||
backend._stream.synchronize()
|
||||
before = read(args[0], f.shape)
|
||||
expected = reflection_oracle(before, cl, speed)
|
||||
original_curved(*args, **kwargs)
|
||||
backend._stream.synchronize()
|
||||
staged = read(args[0], f.shape)
|
||||
d, k = cl.dir.astype(int), cl.fluid_idx.astype(int)
|
||||
values = staged.reshape(9, -1)[OPP[d], k+CX[d]+40*CY[d]]
|
||||
passive = reflection_oracle(before, cl, None, verify_projection=False)
|
||||
drive_mass += .25*float(np.sum(values-passive))
|
||||
error = float(np.max(np.abs(values-expected)))
|
||||
reflection_error = max(reflection_error, error)
|
||||
assert error <= 1e-7
|
||||
np.testing.assert_array_equal(staged[:, active], before[:, active])
|
||||
b, transfer, magnitude = fine_flux(before, staged, active, solid)
|
||||
boundary += .25*b
|
||||
fine_transfer += .25*transfer
|
||||
budget_sum += .25*magnitude
|
||||
|
||||
def fine(*args, **kwargs):
|
||||
nonlocal budget_sum
|
||||
backend._stream.synchronize()
|
||||
staged = read(args[0], f.shape)
|
||||
original_fine(*args, **kwargs)
|
||||
backend._stream.synchronize()
|
||||
advanced = read(args[1], f.shape)
|
||||
assert np.isfinite(advanced[:, active]).all()
|
||||
assert np.isnan(advanced[:, solid]).all()
|
||||
# Include actual collision operands in the FP32 rounding budget.
|
||||
budget_sum += .25*np.abs(staged[:, active]).sum(dtype=float)
|
||||
traces.append(advanced[:, roi].copy())
|
||||
|
||||
def coarse(*args, **kwargs):
|
||||
nonlocal coarse_transfer, budget_sum
|
||||
backend._stream.synchronize()
|
||||
before, fine_values = read(args[0], c.shape), read(args[2], f.shape)
|
||||
transfer, magnitude = coarse_flux(before, fine_values, coarse_active)
|
||||
coarse_transfer += transfer
|
||||
budget_sum += magnitude
|
||||
return original_coarse(*args, **kwargs)
|
||||
|
||||
with patch.object(backend, "_curved", curved), patch.object(f, "kernel", fine), \
|
||||
patch.object(c, "kernel", coarse):
|
||||
backend.step(2)
|
||||
actual = backend.download()
|
||||
population = actual[0][:, coarse_active].sum(axis=1, dtype=float)
|
||||
population += .25*actual[1][:, active].sum(axis=1, dtype=float)
|
||||
ledger = boundary+fine_transfer+coarse_transfer
|
||||
error = MOMENTS@(population-initial_pop-ledger)
|
||||
budget = 8*np.finfo(np.float32).eps*budget_sum
|
||||
assert np.isfinite(budget_sum) and budget_sum > 0
|
||||
assert np.max(np.abs(error)) <= budget
|
||||
if speed:
|
||||
assert speed*drive_mass > 0
|
||||
assert len(traces) == 4 and backend.step_count == 2
|
||||
if audit:
|
||||
for level, mask, count in ((c, coarse_active, 2), (f, active, 4)):
|
||||
pointer, size = level.module.get_global("collision_counts")
|
||||
counts = read(pointer, mask.shape, np.uint32)
|
||||
assert size == counts.nbytes
|
||||
np.testing.assert_array_equal(counts, count*mask)
|
||||
for name, values in geometry.items():
|
||||
np.testing.assert_array_equal(getattr(cl, name), values)
|
||||
assert vars(source.state) == state and source.geometry.center == source.center
|
||||
print(f"speed={speed} audit={audit} BFL={reflection_error:.9g} ledger={error.tolist()} "
|
||||
f"budget={budget:.9g} boundary={list(MOMENTS@boundary)} "
|
||||
f"transfer={list(MOMENTS@(fine_transfer+coarse_transfer))} "
|
||||
f"drive_mass={drive_mass:+.9g}; counts={'PASS' if audit else 'normal build'}", flush=True)
|
||||
return traces, roi, actual
|
||||
|
||||
|
||||
def uniform_reference(speed, roi):
|
||||
# Reuse the existing explicit config helper without importing unrelated tests.
|
||||
spec = importlib.util.spec_from_file_location("fine_surface_cases", ROOT/"tests/integration/_cases.py")
|
||||
cases = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(cases)
|
||||
with cases.make_sim(nx=48, ny=48, viscosity=.1, velocity=0, rho=1) as sim:
|
||||
sim.add_body("circle", center=(24, 24), radius=4.3, surface_actuation=surface(speed))
|
||||
sim.initialize()
|
||||
# Uniform 48^2 has the same dx=dt=.5 representation. Its distant channel
|
||||
# boundaries cannot influence the circle ROI within these four hops.
|
||||
traces = []
|
||||
for _ in range(4):
|
||||
sim.run(1)
|
||||
traces.append(sim.get_ddf().reshape(9, 48, 48)[:, 4:44, 4:44][:, roi].copy())
|
||||
return traces
|
||||
|
||||
|
||||
@pytest.mark.parametrize("speed", [0., .002, -.002])
|
||||
def test_fine_surface_four_hops(speed):
|
||||
assert Path(CelerisLab.__file__).resolve() == ROOT/"src/CelerisLab/__init__.py"
|
||||
assert Path(compiler._KERNEL_DIR).resolve() == ROOT/"src/CelerisLab/lbm/kernels"
|
||||
assert Path(implementation.__file__).resolve() == ROOT/"src/CelerisLab/lbm/refinement_stepper.py"
|
||||
actual, roi, final = run_patch(speed)
|
||||
reference = uniform_reference(speed, roi)
|
||||
for got, wanted in zip(actual, reference):
|
||||
np.testing.assert_allclose(got, wanted, atol=3e-6, rtol=0)
|
||||
np.testing.assert_allclose(MOMENTS@got.astype(float), MOMENTS@wanted.astype(float),
|
||||
atol=2e-5, rtol=0)
|
||||
if speed == 0:
|
||||
passive, passive_roi, passive_final = run_patch(None, audit=False)
|
||||
np.testing.assert_array_equal(passive_roi, roi)
|
||||
for got, wanted in zip(actual+list(final), passive+list(passive_final)):
|
||||
np.testing.assert_array_equal(got, wanted)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("missing", ["surface_velocity_gpu", "link_exchange_gpu"])
|
||||
def test_missing_surface_device_buffer_rejects_before_launch(missing):
|
||||
backend = implementation.FixedPatchStepper.__new__(implementation.FixedPatchStepper)
|
||||
backend.fine_boundary = SimpleNamespace(objects=[object_spec(.002)])
|
||||
backend._fine_curved = SimpleNamespace(surface_velocity_gpu=object(), link_exchange_gpu=object())
|
||||
setattr(backend._fine_curved, missing, None)
|
||||
backend._curved = Mock()
|
||||
with pytest.raises(RuntimeError, match="Surface boundary device buffers are missing"):
|
||||
backend._apply_fine_boundary(object())
|
||||
backend._curved.assert_not_called()
|
||||
|
||||
|
||||
def test_close_frees_fine_boundary_after_stream_failure_once():
|
||||
backend = implementation.FixedPatchStepper.__new__(implementation.FixedPatchStepper)
|
||||
backend.ctx = SimpleNamespace(activate=nullcontext)
|
||||
backend._lock = RLock()
|
||||
backend._status = "ready"
|
||||
stream, soa, first, second = Mock(), Mock(), Mock(), Mock()
|
||||
stream.synchronize.side_effect = RuntimeError("stream synchronization failed")
|
||||
backend._stream = stream
|
||||
backend._fine_curved = soa
|
||||
backend._fine_flags = first
|
||||
backend._curved = Mock()
|
||||
backend._levels = [object(), object()]
|
||||
backend._allocations = [first, second]
|
||||
with pytest.raises(RuntimeError, match="stream synchronization failed"):
|
||||
backend.close()
|
||||
assert backend._status == "closed"
|
||||
assert backend._levels == [] and backend._allocations == []
|
||||
assert backend._fine_curved is None and backend._fine_flags is None
|
||||
assert backend._curved is None and backend._stream is None
|
||||
backend.close()
|
||||
stream.synchronize.assert_called_once_with()
|
||||
soa.free.assert_called_once_with()
|
||||
first.free.assert_called_once_with()
|
||||
second.free.assert_called_once_with()
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,102 @@
|
||||
{
|
||||
"head": "6e3756c587ec08ab6a55c4a1a5f4671822d3f0a0",
|
||||
"changes": [
|
||||
{
|
||||
"path": "src/CelerisLab/lbm/kernels/refinement.cu",
|
||||
"added": 10,
|
||||
"removed": 2,
|
||||
"sha256": "129f3d91da93b4324f88a0da73a4da1e5390f72c14cce574ee63306712da9895",
|
||||
"characters": 4482
|
||||
},
|
||||
{
|
||||
"path": "src/CelerisLab/lbm/kernels/step/aux_kernels.cu",
|
||||
"added": 1,
|
||||
"removed": 55,
|
||||
"sha256": "578a5b20a157241ee678547059abb1372dd5a589ad06bb2c15b987eb01ca1013",
|
||||
"characters": 10982
|
||||
},
|
||||
{
|
||||
"path": "src/CelerisLab/lbm/kernels/step/curved_double.cu",
|
||||
"added": 61,
|
||||
"removed": 0,
|
||||
"sha256": "bfa7a1df1e939020314d49755045f7a85fe4a19cc1c68dbe62653c66c5e7c2b3",
|
||||
"characters": 2153
|
||||
},
|
||||
{
|
||||
"path": "src/CelerisLab/lbm/refinement.py",
|
||||
"added": 157,
|
||||
"removed": 3,
|
||||
"sha256": "8935b070ec9e7020897919c15f43f7fa6293f02e2ff64a19a3e3d99bc444dbcc",
|
||||
"characters": 14161
|
||||
},
|
||||
{
|
||||
"path": "src/CelerisLab/lbm/refinement_stepper.py",
|
||||
"added": 66,
|
||||
"removed": 10,
|
||||
"sha256": "9178224089ee6584420b79f10cf1d91441645b668e8b6898641d19eac757687b",
|
||||
"characters": 14875
|
||||
},
|
||||
{
|
||||
"path": "src/CelerisLab/lbm/stepper.py",
|
||||
"added": 5,
|
||||
"removed": 1,
|
||||
"sha256": "0dcb7cd7ae87e33e3dc67a38b6aa43042fbe673e37d9ad165342ee1d695933ce",
|
||||
"characters": 7724
|
||||
},
|
||||
{
|
||||
"path": "tests/unit/test_fine_surface.py",
|
||||
"added": 215,
|
||||
"removed": 0,
|
||||
"sha256": "b232b55e75eef52480f06a35c401d72b6145892bb8b79d1d1b3cfed965b3506c",
|
||||
"characters": 10596
|
||||
},
|
||||
{
|
||||
"path": "tests/validation/multigrid/test_fine_surface_gpu.py",
|
||||
"added": 330,
|
||||
"removed": 0,
|
||||
"sha256": "d45ca48fc4e77d021fcc5461329b094ae11b257c036bb23634d326fbbedb7700",
|
||||
"characters": 16204
|
||||
}
|
||||
],
|
||||
"unchanged_baseline_files": 377,
|
||||
"baseline_file_count": 382,
|
||||
"post_status": " M pyproject.toml\n M setup.py\n M src/CelerisLab/__init__.py\n M src/CelerisLab/body/__init__.py\n M src/CelerisLab/body/ddf_patch.py\n M src/CelerisLab/body/manager.py\n M src/CelerisLab/body/objects.py\n M src/CelerisLab/body/preprocess/flag_overlay.py\n M src/CelerisLab/common/__init__.py\n M src/CelerisLab/common/checkpoint.py\n M src/CelerisLab/config.py\n M src/CelerisLab/configs/CONFIG.md\n M src/CelerisLab/cuda/__init__.py\n M src/CelerisLab/cuda/compiler_v2.py\n M src/CelerisLab/cuda/context.py\n M src/CelerisLab/lbm/__init__.py\n M src/CelerisLab/lbm/curved_links.py\n M src/CelerisLab/lbm/field.py\n M src/CelerisLab/lbm/initializers.py\n M src/CelerisLab/lbm/kernels/boundary/bounce_back.cuh\n M src/CelerisLab/lbm/kernels/boundary/curved_boundary.cuh\n M src/CelerisLab/lbm/kernels/boundary/inlet/common.cuh\n M src/CelerisLab/lbm/kernels/boundary/inlet/zou_he_local.cuh\n M src/CelerisLab/lbm/kernels/boundary/inlet_outlet.cuh\n M src/CelerisLab/lbm/kernels/config/config_grid.h\n M src/CelerisLab/lbm/kernels/config/config_method.h\n M src/CelerisLab/lbm/kernels/config/config_objects.h\n M src/CelerisLab/lbm/kernels/config/config_physics.h\n M src/CelerisLab/lbm/kernels/kernel_v2.cu\n M src/CelerisLab/lbm/kernels/operators/collision_mrt.cuh\n M src/CelerisLab/lbm/kernels/operators/collision_trt.cuh\n M src/CelerisLab/lbm/kernels/operators/forcing_guo.cuh\n M src/CelerisLab/lbm/kernels/step/aux_kernels.cu\n M src/CelerisLab/lbm/kernels/step/esopull_sync.cu\n M src/CelerisLab/lbm/kernels/step/init_flow.cu\n M src/CelerisLab/lbm/kernels/step/one_step_double.cu\n M src/CelerisLab/lbm/kernels/step/one_step_esopull.cu\n M src/CelerisLab/lbm/kernels/streaming/esopull_semantic_helpers.cuh\n M src/CelerisLab/lbm/stepper.py\n M src/CelerisLab/simulation.py\n M tests/integration/test_body_sync_e2e.py\n M tests/integration/test_ddf_patch.py\n M tests/integration/test_sync_bodies_skeleton.py\n M tests/integration/test_unified_obs.py\n M tests/postproc/experiment.ipynb\n M tests/validation/run_kan99b_rotating_cylinder.py\n M tests/validation/run_sah04_st_matrix.py\n M tests/validation/test_sensor_accuracy.py\n?? docs/design/\n?? docs/multilevel_grid_architecture_analysis.md\n?? examples/\n?? research/\n?? src/CelerisLab/lbm/kernels/boundary/planar_velocity.cuh\n?? src/CelerisLab/lbm/kernels/refinement.cu\n?? src/CelerisLab/lbm/kernels/step/curved_double.cu\n?? src/CelerisLab/lbm/refinement.py\n?? src/CelerisLab/lbm/refinement_stepper.py\n?? \"tests/audit/body\\345\\210\\240\\345\\207\\217\\345\\212\\237\\350\\203\\275.md\"\n?? tests/integration/_cases.py\n?? tests/integration/test_numerical_gpu.py\n?? tests/integration/test_runtime_contracts_gpu.py\n?? tests/integration/test_state_gpu.py\n?? tests/integration/test_surface_actuation_gpu.py\n?? tests/unit/cpp/\n?? tests/unit/test_build_contracts.py\n?? tests/unit/test_context_ownership.py\n?? tests/unit/test_fine_surface.py\n?? tests/unit/test_initializers.py\n?? tests/unit/test_numerical_operators.py\n?? tests/unit/test_planar_velocity.py\n?? tests/unit/test_refinement.py\n?? tests/unit/test_reservoir.py\n?? tests/unit/test_simulation_lifecycle.py\n?? tests/unit/test_slot_velocity.py\n?? tests/unit/test_state_regressions.py\n?? tests/unit/test_surface_actuation.py\n?? tests/validation/analyze_j3_saved_frames.py\n?? tests/validation/diagnose_j3_lags.py\n?? tests/validation/multigrid/\n?? tests/validation/run_j1.py\n?? tests/validation/run_j2_slot.py\n?? tests/validation/run_j3_coverage.py\n?? tests/validation/run_j3_reservoir.py\n?? tests/validation/run_poiseuille.py\n",
|
||||
"patch_sha256": "9cf8b5cc4ea037c865762ba7069f0c1daabcb4383d4333167d279f8b7704e5b0",
|
||||
"cleanup": {
|
||||
"baseline_copy_dir": "/tmp/celeris-fine-surface-baseline-z98oi6ps",
|
||||
"baseline_copy_bytes": 1581541,
|
||||
"runner": "/tmp/celeris-fine-surface-gpu-run.py",
|
||||
"baseline_copies_removed": true,
|
||||
"runner_removed": true,
|
||||
"gpu_scratch_removed": true
|
||||
},
|
||||
"shared_kernel_exact_extraction": true,
|
||||
"diff_reverse_check": "passed",
|
||||
"evidence_hashes": {
|
||||
"cpu_surface_projection_command.txt": "b1783e26e92737106a5614fff01452c8ea0364372d9bdbc44c7d15c19d9b13f5",
|
||||
"cpu_surface_projection_exit.txt": "9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa",
|
||||
"report.txt": "ad8af2be7239f8fe728ac7a8db340d4458e6ec1bbb30b14e614c1072dd9804ec",
|
||||
"cpu_existing_runs.json": "523b3179b976c2198112c7b49c6c8a75cf7d3332663a8b8a0646c94a39abd1b4",
|
||||
"gpu_run.json": "8c4b4d7c53e17c30ce4c7d2fb92466e0704f39966e89016dbf82d36cf96e35bf",
|
||||
"gpu_stdout.txt": "02d1f6fea194d1185a49b7bcdde58642f1d6b9634fe55e4bcda2f020414eb35d",
|
||||
"cpu_device_guard_cmd.txt": "43a0fb0e20c4adcf1930f145796378294558060d5fd5303402e0538674b68c0a",
|
||||
"cpu_surface_command.txt": "2b8f2a3c9ddfd1e877efa2a50a935eeb937e2b3ea92515610cd334d80703d6ce",
|
||||
"baseline.json": "dc9dfa88e69d2b7cf93b0c572961c0bc7849ea1608a0b14b1a6dca1429abf87c",
|
||||
"cpu_lifecycle_stdout.txt": "af52542989b4a2bf597e020c12064e7083e136f15b938ed5382b616a16f70e38",
|
||||
"cpu_surface_projection_stdout.txt": "96ea3e4ca948962b6eb92aaf215efb6c598a3c4b296f6fd26094df353ded5722",
|
||||
"cpu_lifecycle_run.json": "2a3b09ad2f9c86e43892d643a510c9e936d6153e2ae1f6a9eab90c3067f0473d",
|
||||
"cpu_shared_kernel_stdout.txt": "1ab9905d8b0f34f6d791ff7da4efa2de0f7f3e282a078758cc0496cc0230c0f0",
|
||||
"cpu_device_guard_stdout.txt": "f4c61c0ac8f55c6c9a2d6c593731bf5f8c4a6c5bebbe514284fd4f899818f9e0",
|
||||
"gpu_test_run1.py": "3dd0658f63a4e7a1c41eecf433842c872f8fecb391ea4b44d0b48947643d5189",
|
||||
"gpu_preparation_run1.py": "b3fe9e58118369adb1bdfc618fbfbd917d508a563beaf2555f656b59aeff4425",
|
||||
"cpu_surface_exit.txt": "9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa",
|
||||
"cpu_surface_stdout.txt": "bdb786f2d289eaeab4e53d0fdccb998525c217efaa778496cf7a97ccca9e1597",
|
||||
"cpu_preallocation_run.json": "363106050ba00d9a1c5c948c36926e8510ed7fdd75d28cfeca59f593fd0f1c50",
|
||||
"cpu_final_stdout.txt": "bdb786f2d289eaeab4e53d0fdccb998525c217efaa778496cf7a97ccca9e1597",
|
||||
"cpu_maps_stdout.txt": "7886fd4e2fa8a63e9cecf02bdf650e5447ba149704ac75f51da6964d8e77ba6b",
|
||||
"cpu_device_guard_exit.txt": "9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa",
|
||||
"cpu_preallocation_stdout.txt": "59907462a8d5fd93406cdf4c7d1eb2f7b7a96664ae85c4ec202693d419cd019e",
|
||||
"incremental.diff": "9cf8b5cc4ea037c865762ba7069f0c1daabcb4383d4333167d279f8b7704e5b0",
|
||||
"cpu_final_run.json": "020a9ef12904c2d18185613d68a58dd7ff9b1b22197ac1f95bba61f2f593eaac"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
2026-10-14 — 固定加密区内静止圆表面吹吸:受限整合交付
|
||||
|
||||
状态:当前代码与验证完成,停在独立审查点。A 的单层静止圆功能保持;本次只
|
||||
把完整边界 stencil 位于 fine active 的圆接入 FixedPatchStepper。未增加
|
||||
checkpoint、forcing、运动刚体、喷嘴内部、墙穿接口、blockforest 或临时 ledger。
|
||||
所有 B 反例与既有证据保留。
|
||||
|
||||
入口与单位
|
||||
FixedPatchStepper(cfg, bounds, context=context, fine_objects=[obj])。
|
||||
obj 是现有 SimObject/CircleGeometry;中心/半径用 coarse 物理坐标,速度沿用
|
||||
coarse lattice 单位(当前 dx=dt=1)。构造独立 fine-local 副本,不修改调用方对象。
|
||||
C_local=(C_phys-origin)/dx-.5,R_local=R_phys/dx,U_local=U_phys*dt/dx。
|
||||
真实 hit 反变换为 origin+dx*(hit_local+.5),lever arm 乘 dx,角度/q 不变。
|
||||
维持 D2Q9/SRT/FP32/unshifted/double_buffer、无 LES/forcing 的原 backend 范围。
|
||||
|
||||
生产改动:5 个现有文件 + 1 个共享文件,+300/−71,净 +229 行。
|
||||
- refinement.py:FineBoundary2D、prepare_fine_boundary;纯 CPU 建图和拒绝检查。
|
||||
- refinement_stepper.py:固定 fine 对象、flags/SoA 管理、两个 BFL 子步、solid
|
||||
叶掩码、初始化与释放;不接完整 Simulation/ObjectManager。
|
||||
- aux_kernels.cu → step/curved_double.cu:原 action_omega/CurvedBoundaryKernel
|
||||
代码块逐字相同,只抽取共享位置并增加 include guard,已比对确认。
|
||||
- refinement.cu:包含共享 BFL,PatchFineStep 接 flags;solid 不 pull/collide,
|
||||
输出 NaN;所有 Python launch 传完整参数。
|
||||
- 原 lbm/stepper.py:allocation 显式 is not None;驱动缓冲缺失报错。
|
||||
|
||||
数据/所有权
|
||||
explosion → BFL(current) → fine pull+collision → BFL(spare) → fine pull+collision
|
||||
→ coarse pull/coalescence+collision。active fluid 每 coarse 步碰撞两次;solid
|
||||
与 ghost 不碰撞。BFL 只填当前输入的 solid source 反射槽,下一子步重新填充。
|
||||
下载仅发布流体叶节点,coarse covered、fine solid/ghost 均 NaN。
|
||||
flags/level/transfer arrays 归 stepper._allocations;SoA 的列及速度/交换缓冲只
|
||||
归 SoA,未重复登记。initialize 清空最新交换缓存。无对象不创建这些新缓冲。
|
||||
内部交换缓冲仅代表最后一个 fine 子步,未新增公共 coarse 累计诊断。
|
||||
测试账本分别读取四个 fine 子步的实际 population,按面积 1/4 求和;不是用
|
||||
latest 值冒称区间总量,也不是喷嘴总推力。
|
||||
|
||||
有限依赖规则
|
||||
plan.transfer_reads 保存 (hop, direction, cell),从实际 coalesce_fine 的 hop 2
|
||||
源槽反向两次 pull;遇 active collision 展开全部 9 个输入,hop 0 停止。
|
||||
transfer_fine_cells 加入全部 ghost_fine/explosion 写集;coarse 集合包含实际
|
||||
ghost_coarse donors 与 coalesce_coarse targets。ghost 可以合法参与运输;
|
||||
outer ghost 的各阶段有效性仍按原 kernel 判断。
|
||||
逐条检查 r active fluid、s=r+c active solid、反射写槽唯一、q<.5 的 r−c
|
||||
仍在 active;不可用 fallback 掩盖跨层 donor。同层真实 solid 阻挡的原 fallback
|
||||
语义不改。逆查所有 active-fluid→solid 邻接,确保与 cut links 完全一致。
|
||||
整个 solid 集合及 r/s/donor stencil 均不得碰到上述 transfer footprint。
|
||||
coarse donors/targets 必须 uncovered bulk;slot 模式另外拒绝其真实壁面
|
||||
reconstruction pull stencil。无对象旧 slot 模式保持原规则。
|
||||
|
||||
CPU 结果(原始 command/stdout/exit 见同目录)
|
||||
- 新建图/单位/边界覆盖/拒绝检查:15 passed,最终代码复测 15 passed,exit 0。
|
||||
同行补充的非对角圆心、origin=(2,2)、四子格平均等于 coarse I+.5 也通过。
|
||||
- 旧 maps:9 passed、23 subtests;共享 actual CUDA-header CPU 回归:1 passed。
|
||||
- 旧生命周期/边界模式:5 passed、5 subtests。
|
||||
- 新缺失驱动缓冲拒绝:2 passed,exit 0;同步失败后释放且不重复释放:通过。
|
||||
- 指定 donor 反例通过构造器检查,context.activate/mem_alloc 均未调用:1 passed。
|
||||
|
||||
真实 GPU 结果与首次批次失败说明
|
||||
使用现有 pycuda_3_10、显式 PYTHONPATH=/home/frank14f/CelerisLab/src;stdout
|
||||
首先打印并断言实际包来源。设备 0 UUID GPU-e8853ae7-a302-6a17-bcfa-aa767e9ed20c,
|
||||
开始时占用 5 MiB、util=0、无计算进程;未用其他设备。
|
||||
运行批次真实 exit=1:5 项 GPU 检查和 1 项 CPU cleanup 检查通过,另 2 项 CPU
|
||||
缺失缓冲夹具失败,因为夹具未提供新增前置检查所需的 fluid_idx_gpu 字段。
|
||||
仅补齐夹具后,定向 CPU 重测这 2 项 exit=0;原日志/exit=1 保留,未重跑 GPU。
|
||||
|
||||
5 项 GPU 检查:
|
||||
1–3. speed=0,+.002,−.002 的批准小案例,各 2 coarse/4 fine 步。
|
||||
coarse24²,patch[4,20)²,fine40²,origin(2,2),dx=dt=.5;物理圆心
|
||||
(12.25,12.25)、R2.15 → local(20,20)、R4.3;angle.7/half_width.85;
|
||||
nu_phys=.05,tau_c=.65/tau_f=.8,rho1/u0/G=feq。
|
||||
三个驱动使用私有 audit build 验证 fine fluid 碰撞4次、coarse fluid2次,
|
||||
solid/ghost0次。零驱动另与正常 production build 的 same-solid/no-actuation
|
||||
路径逐元素相等。参考采用正常 A build 的48²、dx=dt=.5、circle local(24,24),
|
||||
对齐真实物理位置与时间(4 fine步=物理时间2),不是跨分辨率逐元素比较。
|
||||
4. 旧无对象 periodic 非居中矩形 normal build:1 coarse步,最大人口误差
|
||||
1.14050047e−7,通过。
|
||||
5. 旧无对象 slot/reservoir normal build:8 coarse步,最大人口误差
|
||||
1.78241457e−7、最大BC误差2.21654773e−7,通过。
|
||||
|
||||
主要数值:
|
||||
speed max |BFL误差| max |累计质量/动量账本残差| 预定FP32预算
|
||||
0 7.4505806e−9 1.6049482e−5 0.00221051117
|
||||
+.002 9.7307344e−9 1.5977304e−5 0.00221052543
|
||||
−.002 7.4505806e−9 1.6636681e−5 0.00221049693
|
||||
BFL阈值1e−7;同细分辨率、未触接口的圆周ROI人口atol3e−6、局部矩2e−5均通过。
|
||||
账本预算为8*eps32*实际参与加权population绝对值总和,未放宽。喷吸附加质量
|
||||
分别约+0.00620033871/−0.00618575338,符号正确。该短例净transfer项为0;
|
||||
仍逐项统计真实非零出入人口,但喷吸扰动尚未触达接口。
|
||||
|
||||
拒绝证据
|
||||
- physical C=(5.05,12.25),R=.7 → fine C=(5.6,20),R=1.4:r=(4,20),c=(1,0),
|
||||
hit=(4.2,20),q≈.2,donor=(3,20)为ghost,构造在任何CUDA调用前拒绝。
|
||||
- physical C=(6.05,12.25),R=.7:全部直接r/s/donor都active,仍因与真实
|
||||
两hop transfer footprint相交而拒绝。说明通过边界检查不能仅靠包围盒或边距。
|
||||
|
||||
资源与记录
|
||||
GPU批次外部耗时25.395s;进程组RSS峰值386883584 bytes,RAM最小空闲
|
||||
63638339584 bytes,VRAM最小空闲15826 MiB,相关临时空间采样峰值3585985 bytes。
|
||||
按实际余量保护,无固定RSS/AS上限;120s与2GB本次临时量约束未触发。监测是
|
||||
采样方式,不是OS硬资源隔离。编译临时目录已清理;不会清理其他任务或旧证据。
|
||||
baseline.json保存382个src/tests/examples文件哈希;其中377个保持不变。
|
||||
manifest.json和incremental.diff只描述本轮;共享kernel抽取相等与反向patch检查通过。
|
||||
GPU执行后仅将建图时的孔口预检输入改成与实际八列完全一致的FP32 lever arm,
|
||||
避免极窄孔口在分配前后得到不同覆盖判断;最终CPU15项复测通过。GPU算子、上传
|
||||
数组生成方式、步序和测试数值部分未变。gpu_test_run1.py/gpu_preparation_run1.py
|
||||
是按GPU运行中已记录的SHA256逐项核对后的执行版快照,保留首次运行的精确来源。
|
||||
|
||||
参考与边界
|
||||
直接复用A已接受BFL。ref/OpenLB/src/boundary/defineU2D.hh:74–79用于真实hit
|
||||
速度投影对照,offBoundaryPostProcessors2D.hh:115–127用于两分支stencil对照;
|
||||
OpenLB commit fb62326f260bf0c5ec2666fc5e055c0813ff50a9,仅算法对照、未复制代码。
|
||||
现有CPUREF-0.3与实际refinement kernel的ghost不碰撞、两hop/每层tau、incoming
|
||||
替换后coarse碰撞保持不变,未移植任何B候选。
|
||||
不声称喷流穿粗细接口精度、长时稳定性、空间收敛或性能已验证。设备free()自身
|
||||
抛错时沿用既有close限制,不保证完整释放或重试;上下文激活失败可保留资源重试。
|
||||
@@ -0,0 +1,182 @@
|
||||
{
|
||||
"src/CelerisLab.egg-info/PKG-INFO": "0b9a8a4e8d60bc531473688723ddef0aab02c7ccc4997e31c9b6a6c35011ca77",
|
||||
"src/CelerisLab.egg-info/top_level.txt": "cd51958ca03afabbaa9618c60b8280e486f8cc0b0359b839e10f886e7c3948f8",
|
||||
"src/CelerisLab.egg-info/dependency_links.txt": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
|
||||
"src/CelerisLab.egg-info/requires.txt": "36e1404178e5ea590b2fc04e8ba4d748ec9a82e7693136ccf0dfd204fe265c04",
|
||||
"src/CelerisLab.egg-info/SOURCES.txt": "f36b29c1b34c4bd6b2acc3ccdd21c24ee5077df7e2a20a652d9fae77eedb8e21",
|
||||
"src/CelerisLab/simulation.py": "c9d903f53fe356d7af281bea07943de1a62494127fb69848d7053fd46f7dec3e",
|
||||
"src/CelerisLab/config.py": "2f1bba7515f5bc08cb3a8d140bcafe7fa0689e01b3b06494697bb2956a71530e",
|
||||
"src/CelerisLab/__init__.py": "21cc469bd6e970a1f9ff5970c8eea4602065e41fc881854759ee565ee55c10c6",
|
||||
"src/CelerisLab/cuda/compiler_v2.py": "c4cc3ec4445c8d75e6a253dd87963877117a722bc73b9d4811806fc6045d08c1",
|
||||
"src/CelerisLab/cuda/obs_layout.py": "5ffb2c3aeeaaaaeb64f2cd8febfbcf4ad9919e5414020ad753cfade0683b21c2",
|
||||
"src/CelerisLab/cuda/context.py": "013dd4ec6d01d2fbd11afdfb103eac6a273bd9f798d663d761b851eeb27885e9",
|
||||
"src/CelerisLab/cuda/__init__.py": "0d01dff9f0399c8baba822aab5ca0122a135f011008ed8a499ebd9f7e5b06aea",
|
||||
"src/CelerisLab/lbm/refinement_stepper.py": "9178224089ee6584420b79f10cf1d91441645b668e8b6898641d19eac757687b",
|
||||
"src/CelerisLab/lbm/field.py": "0e727eacc3706add4d8d15c418e9b631050871f831698d3ac689dd5f2c701b9b",
|
||||
"src/CelerisLab/lbm/equilibrium.py": "2fb2f2bb7ff326d23abce80fc2a4c0907b17740ea3e29fe6ae079c5044783826",
|
||||
"src/CelerisLab/lbm/descriptors.py": "c9f025dfc14da43b989047b84cc22bd05d5cc92c9ec695c1da68fdfb788e3f2b",
|
||||
"src/CelerisLab/lbm/initializers.py": "dacf9586963e862d6d0a98ef1a066036be6f91e9d423720661d8ef2c1fb2df6a",
|
||||
"src/CelerisLab/lbm/curved_links.py": "00d9c29d660b41190f32dd737b12f60e10ce4214b6c9a6ab2a63438813faa594",
|
||||
"src/CelerisLab/lbm/stepper.py": "0dcb7cd7ae87e33e3dc67a38b6aa43042fbe673e37d9ad165342ee1d695933ce",
|
||||
"src/CelerisLab/lbm/__init__.py": "7f60fb3aaae81501b510d08c2fedff44fcb05657260eb10b6f5cc91e7204306b",
|
||||
"src/CelerisLab/lbm/refinement.py": "8935b070ec9e7020897919c15f43f7fa6293f02e2ff64a19a3e3d99bc444dbcc",
|
||||
"src/CelerisLab/lbm/kernels/kernel_v2.cu": "c7bd3fb705b77261ba2441c52a24a7e6a7865c165cba088a1b75201c4d29c408",
|
||||
"src/CelerisLab/lbm/kernels/refinement.cu": "129f3d91da93b4324f88a0da73a4da1e5390f72c14cce574ee63306712da9895",
|
||||
"src/CelerisLab/lbm/kernels/config.h": "7d1124125e0b354558297934460e64c760fb68cdd7bf6d01a1238bb2eaab8c37",
|
||||
"src/CelerisLab/lbm/kernels/kernel_v2.ptx": "a599ee30ae66800f4d4220eb79dfed35ff32991661260f01ea58023ef780f0ca",
|
||||
"src/CelerisLab/lbm/kernels/operators/turbulence_smag.cuh": "ff7f000297ee0817e255ad9fcb6a13b647e3ddd5b206518d35f38d2895a9f501",
|
||||
"src/CelerisLab/lbm/kernels/operators/collision_mrt.cuh": "aee444eb60c47a3fd518dca975d1af05425a0818a0ec6c3fb3f6150f60c2cb44",
|
||||
"src/CelerisLab/lbm/kernels/operators/collision_trt.cuh": "9725b9840b9ad8b4ec7be61ff5d06d3151e86d1a87585c13f2fbf934d0d2c5f6",
|
||||
"src/CelerisLab/lbm/kernels/operators/collision_srt.cuh": "6b7ff842f392c8f853d2d1a97cc69bfe50f21283f73e659404da07cf6c95f5e1",
|
||||
"src/CelerisLab/lbm/kernels/operators/forcing_guo.cuh": "969a430c1af03f32e3bd0df95d805e64f56334717c44dd4ba208ba503062a24b",
|
||||
"src/CelerisLab/lbm/kernels/operators/macro.cuh": "e27c1c410dc857be98da4596568e405eeaf88701d291ac0e398aa9cd23dee740",
|
||||
"src/CelerisLab/lbm/kernels/operators/helpers.cuh": "0b3a4d95d7d19f5fec09e5423b8f4cc99f8a226b541967425967330da5a051ec",
|
||||
"src/CelerisLab/lbm/kernels/core/precision.cuh": "849df14b4cce50af52399e4b8f3e997196f3ae5f1163f68e28df3e6b2507a8c4",
|
||||
"src/CelerisLab/lbm/kernels/core/descriptors.cuh": "8440bc14857da9007982650f828a23608eec9f7cc4bf772e8c8dc1239cb45356",
|
||||
"src/CelerisLab/lbm/kernels/core/obs.cuh": "b742b77c9f61e1f020fe9922c3838ae9d855e17b381154958b58f10a22938922",
|
||||
"src/CelerisLab/lbm/kernels/core/params.cuh": "6e18bf730d936d940e3d85452f0714a2eaae31bf41002f9fd520ec5b372878dd",
|
||||
"src/CelerisLab/lbm/kernels/core/flags.cuh": "0025705f24710330d9d9195f713879bfb650a85a3449baef0e196b831af104ab",
|
||||
"src/CelerisLab/lbm/kernels/core/layout.cuh": "1fbd820021c89ac3efcde24145996cb0147769e607e498e61f308ed3e0b13706",
|
||||
"src/CelerisLab/lbm/kernels/boundary/ibm_kernels.cuh": "e6909b547dc8d64cdd8a76a90660243a8f5fee535caa161b52b4dd8b7c29934b",
|
||||
"src/CelerisLab/lbm/kernels/boundary/planar_velocity.cuh": "0b2f9e0bd483c199637e5672dc0ffc460bc383dd1804805befbeb4c5d8c708d1",
|
||||
"src/CelerisLab/lbm/kernels/boundary/inlet_outlet.cuh": "de8b213a6da42c2e5e9f8966199fc66ea4541b85144a90f3f5dbad3c6ab63b97",
|
||||
"src/CelerisLab/lbm/kernels/boundary/curved_boundary.cuh": "7bccf7e7091c012d7a3d4874a881d4d46699021faedd83d125933fbdaa562711",
|
||||
"src/CelerisLab/lbm/kernels/boundary/bounce_back.cuh": "aba3748c564ed91b161d268ef8b737b7c7be96a823063d201f3da684dd845233",
|
||||
"src/CelerisLab/lbm/kernels/boundary/esopull_curved_helpers.cuh": "b9b474bc4edaff05681c5443235472d04072d0d775fc0eb9c5967faef52b0258",
|
||||
"src/CelerisLab/lbm/kernels/boundary/inlet/equilibrium.cuh": "f0964c811b2c41a5aaa1c6d99c490b06e850c634eb8749f1f05ef61f93c2de1d",
|
||||
"src/CelerisLab/lbm/kernels/boundary/inlet/channel_stabilized.cuh": "efe077afcbb6b731256a987c2fd79a1dbc470c902f87070d60421ea6cb13d4e2",
|
||||
"src/CelerisLab/lbm/kernels/boundary/inlet/common.cuh": "f3cec54c8873c65b3dca4375605d2c89a8727765884d3954c235242fdff9c6ba",
|
||||
"src/CelerisLab/lbm/kernels/boundary/inlet/zou_he_local.cuh": "e73e66b853b1e4e0e30d8f4185d832aa414ce670a1813ce2b5459f2887f71f89",
|
||||
"src/CelerisLab/lbm/kernels/boundary/inlet/regularized.cuh": "943d4a571818bacb89c70bccfaac202691121e3e385803ce6309123a0a03ddaf",
|
||||
"src/CelerisLab/lbm/kernels/boundary/outlet/pressure_neq.cuh": "c8b2adc66d12fe602076ddc9693c5c208711fcaddb58aa9a31401a269f51c4c4",
|
||||
"src/CelerisLab/lbm/kernels/streaming/esopull_single_buffer.cuh": "77ed4ab9a0ebc5ff62a91a7c39066ef395391ae36e9040a69fb2bd8b1626dc79",
|
||||
"src/CelerisLab/lbm/kernels/streaming/pull_double_buffer.cuh": "b65d741ed78b7b62f99531ba0c0ce1936663d8dc9640e7d7d16c707f1baf6549",
|
||||
"src/CelerisLab/lbm/kernels/streaming/esopull_semantic_helpers.cuh": "dd5a9091628b079efd97e53fd49e52d09dcee88529235db77a5648e02937af6e",
|
||||
"src/CelerisLab/lbm/kernels/step/curved_double.cu": "bfa7a1df1e939020314d49755045f7a85fe4a19cc1c68dbe62653c66c5e7c2b3",
|
||||
"src/CelerisLab/lbm/kernels/step/esopull_sync.cu": "c0ff3e72900c3ab89a05dd03684e96d3b740cf1672d565727fc2af165933d087",
|
||||
"src/CelerisLab/lbm/kernels/step/init_flow.cu": "305be3bb12fc0d039acec1701baabcf0e8a35e683c49c34f2af8ca9867d2b29c",
|
||||
"src/CelerisLab/lbm/kernels/step/esopull_macro.cu": "c73116020ca217ede1e4de27c8269c31f9d91e33433ac8252a21e9b14187c50f",
|
||||
"src/CelerisLab/lbm/kernels/step/aux_kernels.cu": "578a5b20a157241ee678547059abb1372dd5a589ad06bb2c15b987eb01ca1013",
|
||||
"src/CelerisLab/lbm/kernels/step/one_step_esopull.cu": "aa223b2744ae6c9125673df311a96ce588032c1ba58bebb11fd33ecb990f8ed4",
|
||||
"src/CelerisLab/lbm/kernels/step/one_step_double.cu": "f9f8242b38e8e0cf8425b75e2b0215bc15363c62eaa0fb43c761b8e0931bfdc9",
|
||||
"src/CelerisLab/lbm/kernels/config/config_physics.h": "26df33c2960ba36f3283e19b55b4ea92e50e4efda705f9ebfbf3f875a4092c59",
|
||||
"src/CelerisLab/lbm/kernels/config/config_method.h": "3db4e16ef2c6b22349d04e6aa8ab04bdfe0eb784f9f3a98277e15dbed1835d81",
|
||||
"src/CelerisLab/lbm/kernels/config/config_grid.h": "8be3a7cf74ba30d7fd3074fed79e63dbda7311c4d03b454ea641bf298ffeaa8d",
|
||||
"src/CelerisLab/lbm/kernels/config/config_objects.h": "dbb93c063586da278c15d95e23f84c12e728f4f5f1bbc3980fe9cedaa6fff90e",
|
||||
"src/CelerisLab/lbm/kernels/config/config_obs.h": "c11e2249359145b5c4cbaaf0487506fa77c1f4b82c7c169ddc574aa0babcd727",
|
||||
"src/CelerisLab/common/checkpoint.py": "b2f960aecd5ac27a3a7130b809ffad4709c44d522edef0359ab952654625410b",
|
||||
"src/CelerisLab/common/_types.py": "aad2ff1a9033d4fd68783ad7123afb47201ddc58785cb6dc0246947037072a5f",
|
||||
"src/CelerisLab/common/pathline.py": "a1b6efcc0a076d0f1dc8d49a595779426d7d5626b00072a59bac710ff02ad046",
|
||||
"src/CelerisLab/common/__init__.py": "d4dbde78bc97fccc9eabac9abae8f0f15c112c10ff8e9b45bd9401d4723df1ef",
|
||||
"src/CelerisLab/common/preprocess.py": "7fc78a08857cf8e98519500b094a1d896af189b6b15658ff9b388ed51bed4515",
|
||||
"src/CelerisLab/common/render.py": "0e055476257eb2bcd11e733766e52195de02f8fad228f570a3511a7c831bdc29",
|
||||
"src/CelerisLab/common/streakline/_render.py": "236cd637414ee318c4d66f9aed32110d8dc42a100d65fde06172f7cd0ba62c65",
|
||||
"src/CelerisLab/common/streakline/_integrate.py": "3fbd4368b2c8d0e7fda40dc65aac5df02b085008b4c68acd83cb7ae45d33a13b",
|
||||
"src/CelerisLab/common/streakline/_streakline.py": "1a3e08daa706b5f83cdeb337e9a945a36ddf7583c40af1d0bb9d825ac954df37",
|
||||
"src/CelerisLab/common/streakline/__init__.py": "13ff1cfa416fdd721a08a659e76b5a5a99b8d3201add10a83b7b0bc654bc1eec",
|
||||
"src/CelerisLab/common/streakline/_config.py": "a9185ef68e9c7b5d5a1dc0b04a28341e2ad91d13c145a7c106636a878cf0a605",
|
||||
"src/CelerisLab/configs/config_lbm.json": "17e4311f1f250c6ece59177a8b6ff856b69a016c7c10267e774b030a0a390865",
|
||||
"src/CelerisLab/configs/CONFIG.md": "41cafdbe525366c08aa9d0416ea026ccf0026ba7123b8a9b65f968a80d928e3a",
|
||||
"src/CelerisLab/configs/config_lbm_three_cylinder_triangle.json": "eeb8e7149dbe4aa6b3a9562802735aa950750dfbe2d972a0727e788573afa817",
|
||||
"src/CelerisLab/configs/config_lbm_flume_trt_regularized.json": "f4bba8e6a4339fc3c4eb14f6e2f57c4b22993c73703c773d853edfbe34736e56",
|
||||
"src/CelerisLab/configs/config_body.json": "055f261f0828ca1d4f2bb694bd15b72bbcabe31d552326208f28e37f761adab1",
|
||||
"src/CelerisLab/configs/config_lbm_flume_mrt_zouhe.json": "8f593321db05a563a42931603a228d61cbcba06dfbe113262d5cd0ad93c0fe79",
|
||||
"src/CelerisLab/body/objects.py": "d1cf7054cc8379a83c39acc66a7c88ae62fa004f110bb0c1def2ee57137401c5",
|
||||
"src/CelerisLab/body/action_smoother.py": "b1a23ee6bbd4850b172cb8738c5c3546ee465a54189e6af9d8044f023d4687dc",
|
||||
"src/CelerisLab/body/registry.py": "fbb7327780adbdc6da15ebdb799980daf32df22ee974af0893d7409f177bbb68",
|
||||
"src/CelerisLab/body/manager.py": "6a40be708c71ef6f3b5f5f0aa9c92cfafc51f2ec2a958f99656cccb850986c16",
|
||||
"src/CelerisLab/body/ddf_patch.py": "60fcfb7441e73bf290bcff41ca3a83da3e7ddad765d7247464e8f02e3043b4e2",
|
||||
"src/CelerisLab/body/sync_plan.py": "a73ac9ee361b2120d0b7bbebeaa2ccbf924ba27bd95d4dd4b383c10a39b2a409",
|
||||
"src/CelerisLab/body/__init__.py": "91d1155080b3ade83d13c84c39693046df122e4bed5ef583de2df1f9453c1b76",
|
||||
"src/CelerisLab/body/preprocess/flag_overlay.py": "831fc9e9736b758847759a085ff133eb49ec91318ace4fda76f85960138ee300",
|
||||
"src/CelerisLab/body/preprocess/__init__.py": "dfd9d58bc07f626ab23a70053e31b88a6d9165d2e4c76a4e9f48abe674d3d2ec",
|
||||
"src/CelerisLab/body/geometry/base.py": "cceca14361ca2f34d34a3e43730e1a79b8ca81be00f0dd62e884db32b479419f",
|
||||
"src/CelerisLab/body/geometry/__init__.py": "ada88980ab672959aca9aa3a4c4aade3219524b2ab68110cd2a2f41e3e0ca90a",
|
||||
"src/CelerisLab/body/geometry/circle.py": "7605ca7c21103f1d801ac73ab8dd18dffbdac425b2dee7b8858b283628a9e436",
|
||||
"src/CelerisLab/body/coupling/soa_packer.py": "8ec26fd55ef74801bbd5ab6bd3d0a7dabc750cbd498aaac2ca4c61a0108ad3c9",
|
||||
"src/CelerisLab/body/coupling/__init__.py": "c931f7eb318d48408c3e2febcc6917c88c8dcc1697cbf4329b1f340d94c35763",
|
||||
"tests/conftest.py": "fa0ec26667872c9c1011d608310d2551fd24719b5d216f06d923ff4c74c73237",
|
||||
"tests/specs/exp_ctrl_matrix.md": "5d9dd2e703582572eb68afe3a7096ea43ec82aa03418d20ed283c5365031e433",
|
||||
"tests/specs/Sah04_validation.md": "1d122d29e281b7f50801b148f3314a0e35fdc27ee7d757c0a661243aa6185fb0",
|
||||
"tests/specs/sah04.md": "33dbe5e0fd63738abd055c4aa403c191b6de04e6efdbc568f1942c6d23c7459f",
|
||||
"tests/specs/Kan99b_validation.md": "0d8bf74f2361f863809af1979bf8807adaa423f98321e1104a3d86d8c7a863cf",
|
||||
"tests/specs/kan99b.md": "b7e0669f0a6b677d902204f3427d1b3ac254bfe70c37d9cf995fb3e8f1fedfb1",
|
||||
"tests/specs/streakline_notes.md": "cd342d214c07eb608ac2e5b8697322c44c31dbf4d27dfdb5409de46ef474df4b",
|
||||
"tests/validation/run_perf_baseline.py": "93dde2eb1132f45ea69e1e285ff421dc97a83651a22c79571f299c1909650721",
|
||||
"tests/validation/run_j1.py": "51b758a271ff358f931b3140a80082294a67e66c2fec0f8c19319e37f92aadc4",
|
||||
"tests/validation/run_kan99b_rotating_cylinder.py": "323186429a100f36b41ab9b81ade2da6a47e93be3ccb7034a3a6b97f4ee8eb00",
|
||||
"tests/validation/run_j2_slot.py": "b7d2d3aa06fcafc3ac62ed4a50892afbdb7f86e5720ce75a39ce317b6f571dad",
|
||||
"tests/validation/run_j3_coverage.py": "329869519b7078e854d96241a7aad8ef93f35ac9be83f0be502c3a93523c3b13",
|
||||
"tests/validation/run_sah04_st_matrix.py": "9b9c0ce063e07a316846635ee769b837ed26be6bf039f78f4219c10b516f8006",
|
||||
"tests/validation/analyze_j3_saved_frames.py": "438f67dac682b94c4950626f8de4fdcde48c3a4e9ecf8fdf1b0ada4b6e0e781a",
|
||||
"tests/validation/diagnose_j3_lags.py": "286fcd65b3261667a847b9b26e213d0af92cf459faa6bbd774f78c8479ce31d7",
|
||||
"tests/validation/run_j3_reservoir.py": "47535bc3569ce68c888d38978bc4f9077fd763a17829c20c081be52bb18a2903",
|
||||
"tests/validation/run_poiseuille.py": "e529288e2ffa8e00d281a9006723954d60a96ae4d025e8f28656c09287d4ff46",
|
||||
"tests/validation/test_sensor_accuracy.py": "c6038a9e7a597a1738814bd15e6ecf357cfd271cdc2a132d47943c5280ac0ef9",
|
||||
"tests/validation/multigrid/test_cpu_reference.py": "ade5d4827f971aed7174b59d83769e7aa542338e625a9fc8db1e8b1805cb74ca",
|
||||
"tests/validation/multigrid/cpu_reference.py": "bba2a06a9f6517b32079ffff15e4060d8c3b7ed35f16ca134e1877226c9e4e1e",
|
||||
"tests/validation/multigrid/test_fine_surface_gpu.py": "d45ca48fc4e77d021fcc5461329b094ae11b257c036bb23634d326fbbedb7700",
|
||||
"tests/validation/multigrid/cpu_reference_v0.2.py": "b6adbad7da625ef6a6b97958ea9625030ed92676d0cada48e061c87bcf7ca8c9",
|
||||
"tests/validation/multigrid/test_open_corner_negative_control.py": "59a6f8ca80cdd63cb7827fbebf9b4b555c3793f19dd6bca801544ec10b5cbe1b",
|
||||
"tests/validation/multigrid/test_refinement_followup.py": "6643e26cd877bf0d0f030e974f00a1d1c0f0350cc76d1c8affed3e8ba2f4393b",
|
||||
"tests/validation/multigrid/local_stress_observable_v1.py": "0e2777990359a7cf2bb29884173b7b01de37c49bcf49e1f29fc59fe83d62b456",
|
||||
"tests/validation/multigrid/test_refinement_gpu.py": "0021a39b3a131347196845cff6507c90c387b46b772fe1319d634178c5e13354",
|
||||
"tests/validation/multigrid/shear_diagnostic_v0_2.py": "a8b1cf2f7abd00efc4d068bbd27bb2317144a6ca4c545d9b2e0dcf421eadebc6",
|
||||
"tests/validation/multigrid/test_tron_additions.py": "8e7a6a90b85e64c7326719e7b8bca2f6d34fb4c80690f0685f7e291ab93bd2a4",
|
||||
"tests/validation/multigrid/MULTIGRID_VERIFICATION_STRATEGY.md": "d4f3473da44abee6031a0e1bd4d0ca589077a18f15d2461836e4d2ebb98e458a",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/stdout_horsea.txt": "0577df5b3f5cb3c7b6e1ef2de71344f8fd3e6d959117487a06cbaf7f2afa3dea",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/stdout_grok.txt": "28ddd1267ca91a772f5a6bfc65d949c9a4ea7dac5c9ba3a0bdb168492810b670",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/run_once.py": "6698a2e040c56be949b809387d4518eb0ba82d34cc9d99640da4f8bf3c35c23f",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/source_manifest.json": "56fbd0259ff3d4dbd14ace52f64e249a435e9df91732b0e4027def2c344c2e6a",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/results_horsea.json": "c2d7ce8d16a0f47baff0788a153353dcf67088da974d9cd3d521b04ecd91ee05",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/comparison.json": "41c00372099dd04b6d323785e9eaf4fec09da1753d3d150ffa230800f904142f",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/baseline.json": "98a7853341ea732762c7506694e3a867a7259bf110e9e461ea84f741fd9ab829",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/manifest.json": "e42aa19e91608164698bea42da88fbbfab8b0f87cc37b27c5baf165453a4fdb0",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/README.txt": "4306a34b6896bd6e7a5c2ca71d68e18450359239d0c7ad7a67a4e83e7155959a",
|
||||
"tests/validation/multigrid/shear_v0_2_evidence/joint_report.md": "1860b8082108c8b8a87998af90cd0b81dce1c04e9f6c67b41e0912f9fef6cc9c",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/stdout_horsea.txt": "882f2cfb1dbdf82cce63c011397e7c2e6307bbcfec42a3510648d328cd6ddcfe",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/run_once.py": "e629800291ef65ffea8555f66ec80bf15200552540b2a493a677bfb53d0830b3",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/source_manifest.json": "d2cf90b73458f493c665c9a281d06aef0c190cf0d143639fb77ab838c78f020c",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/results_horsea.json": "f17b4644d19eb75d55deb7021ab679cb9e7922a2b46f1cacf8b6da6bfb9a2690",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/comparison.json": "be236671a501c31c06f7e266f6e0c0c2a89aede321a483452050ff37bf84c84a",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/baseline.json": "64f6541447afbd15b1b15d802ad6f1b5042aaf84e7d4d2414e4ed4c52cf70507",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/manifest.json": "3a9fa8c7d691c1b8c24f05940eb724d30b890dd8ed636551068d2633d7db2f70",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/README.txt": "4f62314876047ee437bb9ecbf84798d2a9f6e85f6a3aef260277b85bcdb35fae",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/stdout_local_stress_observable_v1.txt": "6a826e5ad729ce45af6879a07a1c659d8b4a21403fde5b9c6d9696cc6a5b09d4",
|
||||
"tests/validation/multigrid/local_stress_v1_evidence/TABLE_local_stress_observable_v1.md": "d8ff0568d9c473a4bb09396a8948ddc8dc5af2f0f3a23ac84d238814fc779501",
|
||||
"tests/validation/multigrid/cpuref_0_3_evidence/stdout_horsea.txt": "457f1d2173496554c87ca6e61df518c0b8f1e0a28cdfd94b94ebbb61bc459d70",
|
||||
"tests/validation/multigrid/cpuref_0_3_evidence/stdout_grok.txt": "73e4ef01138842981daaa534390f1463839e63833c11f4e8872f94f8eaadc717",
|
||||
"tests/validation/multigrid/cpuref_0_3_evidence/results_horsea.json": "914389afc39752bcd4132aa21fc8d5cbcf0ca75b1efd6a49becab15c2fa3361b",
|
||||
"tests/validation/multigrid/cpuref_0_3_evidence/baseline.json": "0daaccee41cabeb17a00e2405e2c7fd0b80d36f2d01778eb39c9fd22b13d2d47",
|
||||
"tests/validation/multigrid/cpuref_0_3_evidence/manifest.json": "2850ecaf2e19d010ba35eb54162371d82cc1a092831e08a03b6adf75a614988b",
|
||||
"tests/validation/multigrid/cpuref_0_3_evidence/README.txt": "1947ee0232b88b3cc2c506d0b0af5ba051ecc94aa8f7f09228ef3939cc95919b",
|
||||
"tests/validation/multigrid/cpuref_0_3_evidence/README_grok.md": "065947e15b2242bce7d3eb05a3acdbb59939c621dcd5d31540ad4a1bd4416818",
|
||||
"tests/audit/\u5ba1\u8ba1\u62a5\u544a_kernel_layer.md": "89893c98ed7c2699157bf728ec0e79b0dd6aff4008ee5c7b77eb052de24033f1",
|
||||
"tests/audit/body\u91cd\u6784\u7b14\u8bb0.md": "8f978d7b01c9f49dca9eeaff0d163cec6da085e2f99ee5a5e803d72306e7a72f",
|
||||
"tests/audit/\u517c\u5bb9\u6027\u6d4b\u8bd5.md": "9c1721a33b381b9c3810545772b022913da06617711b5ba13a3c2c991b81a7f7",
|
||||
"tests/audit/Force_region.md": "3092080afe4a30665fe1b721803621ba9d0dd5d20ad17826984d94efc160fdac",
|
||||
"tests/audit/\u5ba1\u8ba1.md": "0f14ad073a0725134e6391f961c324fd0013c7791fd410713e94ed1ad40b7385",
|
||||
"tests/audit/Force_region_validation.md": "279a4484d1bfca0fd67aed4de3282d547aa048f89389420d8e5f2fd86db54fc2",
|
||||
"tests/audit/body\u5220\u51cf\u529f\u80fd.md": "e9f308a8cd0f0e7df5441c32a15f84c0bae50bc0e56b8728f6c6f2cf78596673",
|
||||
"tests/unit/test_initializers.py": "8b4e3358d925614984265ae73c142006b48fd1c3918cf84901f18afd9fe68c3a",
|
||||
"tests/unit/test_simulation_lifecycle.py": "77abdc33218c35e9c8b62dbd99ceddbaccd8417e7f0b539ea8859ea0175c663a",
|
||||
"tests/unit/test_numerical_operators.py": "6d1d560ef553a2af7adac7db3e325d96d7fe39073d5fe3e0e982439537385b27",
|
||||
"tests/unit/test_fine_surface.py": "b232b55e75eef52480f06a35c401d72b6145892bb8b79d1d1b3cfed965b3506c",
|
||||
"tests/unit/test_sync_plan.py": "983313ef783143231fa5a392f85f3bac011184773ccaf5d946504c206cabb721",
|
||||
"tests/unit/test_surface_actuation.py": "89be6f54c4eba6c2bdca0d287a5b9fa6db143de2bcd9a671d4fb8445921303ed",
|
||||
"tests/unit/test_state_regressions.py": "0f69cfeb83428192f95688c76abcae7e5b9cf5f27c52bca4ac20c7f320044374",
|
||||
"tests/unit/test_equilibrium.py": "1ecbcc4547b1c846b75320463d828d6a36b6aae73208084fae476b1001c1bb50",
|
||||
"tests/unit/__init__.py": "17f57920d9c1ff46096ceb2af008eb38c4b98dc81ffa3c3d310e758e80ca1cd4",
|
||||
"tests/unit/test_pending_edits.py": "905a0dff23b123e8e38aaf364984c810fe51c39acd64aa271e343a4701d3d024",
|
||||
"tests/unit/test_planar_velocity.py": "b656da0880b4234b1db805544edbe0d2473cbcc7c2c869c71d8251337f62a982",
|
||||
"tests/unit/test_body_flags.py": "ac6409157924e15a13a3d2cc2f1a09014b8b0198ba17c824f412ff20b19e2aac",
|
||||
"tests/unit/test_build_contracts.py": "7bb237425e8bb481f312fa4841c484e280731e13c7cbb9a53dad3e7f98984ac3",
|
||||
"tests/unit/test_context_ownership.py": "299fed30dd0f9bd4dadd8b27f50df2a6367bdb0ab2ca3f391f215fde7241f35a",
|
||||
"tests/unit/test_reservoir.py": "e718c78a53c3941aba7feb8ae4e8bb0b1726c1145de84febf91220c1917991c9",
|
||||
"tests/unit/test_refinement.py": "90751142f920f1c5e988577a45afa94871a6617009cdc78323a87fc7795f4634",
|
||||
"tests/unit/test_slot_velocity.py": "6a9494de9a32c350389ccbed58af48951f6b25a21a258537d2e8b73eb67cb11d",
|
||||
"tests/unit/cpp/semantic_regression.cpp": "99dba074c0c0a32ea76026e7d54fc60af8e6d3dc5315c8900c470b4518878f39",
|
||||
"tests/unit/cpp/reservoir.cpp": "c3eacaf0271400eb45ad559b571a8f7faa2a809d5f1857ffeb5592addce2cd0c",
|
||||
"tests/unit/cpp/collision_regression.cpp": "f17acdff74ab82a62dc5402b42e3f6a149c262e89b140494164d6ebd630f5e14",
|
||||
"tests/unit/cpp/slot_profile.cpp": "31ac58ccab175bf79fa59fc46d4c0842df18ab0a5e5916be84760d9da2b75788"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user