Three levels: step unpacks only the first two levels; README multipatch nits
step() did 'c, f = self._levels', which raises for three levels before any launch (root review). The child level is driven from the fine hops. Other _levels uses are per-level loops or explicit indices. README multipatch example now defines rest locally and states coarse/fine NaN separately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
76555de4b8
commit
dd9a4dc4b8
2 files changed
+4
-2
No files matched your search
@@ -145,13 +145,15 @@ Scope and limits:
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
cfg = LBMConfig(nx=32, ny=16, viscosity=.1)
|
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(
|
with CudaContext(0) as ctx, FixedPatchStepper(
|
||||||
cfg, ((4, 4, 12, 12), (16, 4, 24, 12)), context=ctx,
|
cfg, ((4, 4, 12, 12), (16, 4, 24, 12)), context=ctx,
|
||||||
fine_block=(4, 4), base_block=(4, 4)) as run:
|
fine_block=(4, 4), base_block=(4, 4)) as run:
|
||||||
run.initialize(np.broadcast_to(rest, (9, *run.patch.coarse_shape)),
|
run.initialize(np.broadcast_to(rest, (9, *run.patch.coarse_shape)),
|
||||||
np.broadcast_to(rest, (9, *run.patch.fine_shape))) # (9, 32, 64)
|
np.broadcast_to(rest, (9, *run.patch.fine_shape))) # (9, 32, 64)
|
||||||
run.step(32)
|
run.step(32)
|
||||||
coarse_g, fine_g = run.download() # NaN outside every patch's active cells
|
coarse_g, fine_g = run.download() # coarse: NaN on every covered cell;
|
||||||
|
# fine: NaN on every non-ACTIVE cell
|
||||||
```
|
```
|
||||||
- Not available: per-link surface exchange/force readout in blocked mode,
|
- 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, dynamic refinement, `Simulation`
|
||||||
|
|||||||
@@ -496,7 +496,7 @@ class FixedPatchStepper:
|
|||||||
raise ValueError("n must be a nonnegative integer")
|
raise ValueError("n must be a nonnegative integer")
|
||||||
with self._lock, self.ctx.activate():
|
with self._lock, self.ctx.activate():
|
||||||
self._require("ready")
|
self._require("ready")
|
||||||
c, f = self._levels
|
c, f = self._levels[:2] # a nested child (third level) runs inside the fine hops
|
||||||
p = self.patch
|
p = self.patch
|
||||||
kw = dict(block=self._block, stream=self._stream)
|
kw = dict(block=self._block, stream=self._stream)
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in new issue
Block a user