diff --git a/README.md b/README.md index 739dc72..23fb20a 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ with CudaContext(0) as ctx, FixedPatchStepper(cfg, (8, 6, 24, 18), context=ctx, ``` Scope and limits: -- D2Q9, SRT, FP32, double buffer, unshifted, no LES or forcing; fixed 2:1 patch(es), two levels. +- D2Q9, SRT, FP32, double buffer, unshifted, no LES or forcing; fixed 2:1 patch(es), two levels (or one nested third). - `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)`), @@ -155,8 +155,28 @@ Scope and limits: coarse_g, fine_g = run.download() # coarse: NaN on every covered cell; # fine: NaN on every non-ACTIVE cell ``` +- Three levels (one nested chain, body-free): add `child=(x0, y0, x1, y1)` in + **L1 window cells** (the patch's fine grid including its 4-cell ghost band) and + `child_block`, with `fine_block` and `base_block`. 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 patch only, no bodies/Jets. + + ```python + cfg = LBMConfig(nx=16, 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, (4, 4, 12, 12), context=ctx, fine_block=(4, 4), base_block=(4, 4), + child=(8, 8, 16, 16), child_block=(4, 4)) as run: + shapes = (run.patch.coarse_shape, run.patch.fine_shape, run.child_patch.fine_shape) + run.initialize(*(np.broadcast_to(rest, (9, *s)) for s in shapes)) # 16², 24², 24² + run.step(32) + coarse_g, l1_g, l2_g = run.download() + ``` - Not available: per-link surface exchange/force readout in blocked mode, - checkpoints, moving bodies, bodies/Jets with several patches, dynamic refinement, `Simulation` + checkpoints, moving bodies, bodies/Jets with several patches or three levels, + several patches per level with nesting, dynamic refinement, `Simulation` integration. Validation so far is storage/operator equivalence and short runs, not accuracy, convergence or long-time stability.