Skip to content

Fix on_architecture for ImmersedBoundaryGrid on distributed grids#5628

Open
briochemc wants to merge 1 commit into
mainfrom
bp-claude/fix-ibg-on-architecture-mcbc
Open

Fix on_architecture for ImmersedBoundaryGrid on distributed grids#5628
briochemc wants to merge 1 commit into
mainfrom
bp-claude/fix-ibg-on-architecture-mcbc

Conversation

@briochemc

Copy link
Copy Markdown
Collaborator

Fixes #5627.

`on_architecture(arch, ::IBG)` previously routed through the public
`ImmersedBoundaryGrid(grid, ib)` constructor, which re-runs
`materialize_immersed_boundary` and builds a fresh `Field{Center, Center,
Nothing}(grid)` on the arch-converted grid. When the original IBG wraps a
y-partitioned distributed `TripolarGrid`, middle ranks carry
`TY = FullyConnected`; the freshly-serial CPU grid produced by
`on_architecture(arch, grid)` is no longer `<:DistributedGrid`, so
`inject_halo_communication_boundary_conditions` is skipped and the
`FullyConnected` south defaults to `MultiRegionCommunicationBoundaryCondition`
via `default_prognostic_bc`. The subsequent `fill_halo_regions!` then fires
`MultiRegionFillHalo{South}` on a `Nothing` `bc.condition` and crashes with
`FieldError: type Nothing has no field rank`. Only 1×N≥3 partitions trigger
it (end ranks take the `*Connected` → `NoFluxBoundaryCondition` branch).

The same buggy pattern lived in `on_architecture(arch, ::GridFittedBottom{<:Field})`
(which additionally called `fill_halo_regions!`) and in
`on_architecture(arch, ::PartialCellBottom{<:Field})`.

Fix:
- `IBG.on_architecture`: skip `materialize_immersed_boundary`. The IBG is
  already materialized, so use the internal `ImmersedBoundaryGrid{TX, TY,
  TZ}(grid, ib, mi, ms)` constructor and arch-convert all four fields
  directly, including the active-cell maps.
- `GridFittedBottom{<:Field}.on_architecture` and
  `PartialCellBottom{<:Field}.on_architecture`: delegate to
  `on_architecture(arch, ib.bottom_height)` (the standard `Field` overload
  at `Fields/field.jl:459`), which preserves the original boundary
  conditions and copies data including halos — no re-derivation of defaults
  on a freshly-serial grid, no `fill_halo_regions!`.

Closes #5627.
@navidcy navidcy requested a review from simone-silvestri June 19, 2026 01:37
@navidcy navidcy added the distributed 🕸️ Our plan for total cluster domination label Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

distributed 🕸️ Our plan for total cluster domination

Projects

None yet

Development

Successfully merging this pull request may close these issues.

on_architecture(arch, ::GridFittedBottom{<:Field}) crashes on middle ranks of 1×N≥3 distributed TripolarGrid

2 participants