Clarify raw exchange metadata and streamline host tests
This commit is contained in:
1 parent
c750493b07
commit
1e8e2c9a69
5 files changed
+142
-130
No files matched your search
@@ -21,7 +21,8 @@ from .block_stepper import MAX_GRID_DIM
|
||||
from .hierarchy import build_hierarchy, is_rectangle
|
||||
from .refinement import ACTIVE, HALO, FixedPatch2D, FixedPatchSet2D, prepare_fine_boundary
|
||||
from .refinement_tables import (blocked_base_tables, blocked_fine_tables, # noqa: F401 (re-export)
|
||||
blocked_kind, _prepare_blocked_boundary)
|
||||
blocked_kind, _prepare_blocked_boundary,
|
||||
BLOCKED_BOUNDARY_DEVICE_COLUMNS)
|
||||
from .descriptors import SOLID
|
||||
from .raw_exchange import summarize_exchange
|
||||
|
||||
@@ -335,8 +336,8 @@ class FixedPatchStepper:
|
||||
b = level.boundary
|
||||
if b is not None:
|
||||
b.flags = self._upload(b.tables["flags"])
|
||||
columns = ("block", "cell", "dir", "q", "fallback", "surface_velocity")
|
||||
b.device = {k: self._upload(v) for k, v in b.tables.items() if k in columns}
|
||||
b.device = {k: self._upload(v) for k, v in b.tables.items()
|
||||
if k in BLOCKED_BOUNDARY_DEVICE_COLUMNS}
|
||||
if self._observe_raw_exchange:
|
||||
b.device.update(rx=self._upload(b.tables["rx"]),
|
||||
ry=self._upload(b.tables["ry"]))
|
||||
|
||||
@@ -66,6 +66,11 @@ def blocked_base_tables(patch, layout, order, wall_aware=False, *, composed_kind
|
||||
blocked_kind(layout, dense_kind))
|
||||
|
||||
|
||||
# Required device columns plus optional actuation; observation arms are uploaded
|
||||
# separately only when enabled. body_id/aperture remain host reduction metadata.
|
||||
BLOCKED_BOUNDARY_DEVICE_COLUMNS = ("block", "cell", "dir", "q", "fallback", "surface_velocity")
|
||||
|
||||
|
||||
@dataclass
|
||||
class _BlockedBoundary:
|
||||
"""One level's stationary BFL data and mutable Jet velocity column."""
|
||||
@@ -87,10 +92,8 @@ def _prepare_blocked_boundary(boundary, layout, cfg, jets):
|
||||
return None
|
||||
fluid_idx, dirs, q, body_id, rx, ry, _, fallback = boundary.curved_host
|
||||
tables, _ = blocked_link_tables(layout, boundary.flags, fluid_idx, dirs, q, fallback)
|
||||
# Physical row identity excludes body_id: duplicate owners are always wrong.
|
||||
keys = np.column_stack((fluid_idx, dirs))
|
||||
if len(np.unique(keys, axis=0)) != len(keys):
|
||||
raise ValueError("duplicate physical boundary cut-link")
|
||||
# blocked_link_tables/map_cut_links already rejects repeated (fluid_idx, dir),
|
||||
# independently of body_id, and repeated local writers.
|
||||
tables.update(body_id=np.asarray(body_id, np.int32), rx=np.asarray(rx, np.float32),
|
||||
ry=np.asarray(ry, np.float32), aperture=np.zeros(len(dirs), bool))
|
||||
actuated = bool(jets) or any(o.surface_actuation is not None for o in boundary.objects)
|
||||
|
||||
Reference in new issue
Block a user