Fix on_architecture for ImmersedBoundaryGrid on distributed grids#5628
Open
briochemc wants to merge 1 commit into
Open
Fix on_architecture for ImmersedBoundaryGrid on distributed grids#5628briochemc wants to merge 1 commit into
briochemc wants to merge 1 commit into
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5627.