Skip to content

Add extensible boundary condition system#121

Merged
fluidnumericsJoe merged 3 commits intomainfrom
feature/extensible-bcs
Apr 10, 2026
Merged

Add extensible boundary condition system#121
fluidnumericsJoe merged 3 commits intomainfrom
feature/extensible-bcs

Conversation

@fluidnumericsJoe
Copy link
Copy Markdown
Member

@fluidnumericsJoe fluidnumericsJoe commented Apr 8, 2026

Summary

  • Replace hardcoded if/else BC dispatch in DGModel classes with a registration-based BoundaryConditionList linked list system
  • BCs are registered via procedure pointers during AdditionalInit and dispatched by walking the list — new BC types no longer require modifying DGModel source files
  • Each BoundaryCondition node stores pre-filtered elements(:) / sides(:) arrays populated from mesh sideInfo at init time
  • GPU backends use per-BC-type HIP kernels that accept element/side device arrays directly, eliminating sideInfo scanning and branch divergence inside kernels
  • Remove 18 hbc*/pbc* type-bound procedures from the Model base class
  • Update all physics models (LinearEuler2D/3D, LinearShallowWater2D, ECAdvection2D/3D, advection_diffusion) and examples (burgers1d_shock, planewave_propagation/reflection) to use registration

Test plan

  • CPU build passes (verified locally — 57/107 tests pass, 50 failures are pre-existing mesh file issues)
  • GPU build compiles (verified locally with AMD gfx90a Dockerfile)
  • CI pipeline tests pass
  • Entropy conservation tests (ec_advection_2d/3d) pass — most sensitive to BC correctness

🤖 Generated with Claude Code

fluidnumericsJoe and others added 2 commits April 8, 2026 11:59
Replace the hardcoded if/else boundary condition dispatch in DGModel classes
with a registration-based BoundaryConditionList system. Boundary conditions
are now registered via procedure pointers during model initialization and
dispatched by walking a linked list. Each BC stores pre-filtered element/side
arrays, eliminating branch divergence in GPU kernels.

CPU: BC methods are registered in AdditionalInit and called via the list.
GPU: Per-BC-type HIP kernels accept element/side device arrays directly,
replacing monolithic kernels that scanned all sideInfo entries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ECAdvection types inherit from ECDGModel_t → DGModel_t, bypassing
the GPU DGModel Init that uploads BC element/side arrays to device.
Add Init/Free overrides to GPU ECAdvection2D/3D that call the parent
_t Init then hipMalloc/hipMemcpy the BC arrays.

Fixes GPU error 700 (illegal address) in ec_advection_2d/3d tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 9, 2026

Register no-normal-flow (mirror) and no-stress (gradient reflection)
boundary conditions on the 2D and 3D advection-diffusion models. The
no-stress BC reflects the interior gradient to zero the normal component
in the BR1 average, giving stable zero-flux walls for the diffusive term.

Add tests that exercise parabolic BC registration, mapping, and dispatch
on non-periodic meshes to improve coverage of the extensible BC system.

Add developer documentation (Learning/BoundaryConditions.md) describing
the BC architecture and a user guide (Models/boundary-conditions.md)
with practical examples.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fluidnumericsJoe fluidnumericsJoe merged commit 3fa444f into main Apr 10, 2026
11 checks passed
@fluidnumericsJoe fluidnumericsJoe deleted the feature/extensible-bcs branch April 10, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant