Skip to content

Add extensible boundary condition system#121

Open
fluidnumerics-joe wants to merge 2 commits intomainfrom
feature/extensible-bcs
Open

Add extensible boundary condition system#121
fluidnumerics-joe wants to merge 2 commits intomainfrom
feature/extensible-bcs

Conversation

@fluidnumerics-joe
Copy link
Copy Markdown
Member

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

fluidnumerics-joe 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

Codecov Report

❌ Patch coverage is 79.29936% with 65 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/SELF_DGModel2D_t.f90 63.49% 23 Missing ⚠️
src/SELF_DGModel3D_t.f90 63.49% 23 Missing ⚠️
src/SELF_BoundaryConditions.f90 80.59% 13 Missing ⚠️
src/SELF_DGModel1D_t.f90 93.65% 4 Missing ⚠️
src/SELF_ECAdvection2D_t.f90 91.66% 1 Missing ⚠️
src/SELF_ECAdvection3D_t.f90 92.30% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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