Skip to content

feat: add interface and periodic boundary support for non-uniform WENO - #602

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
utkuyilmaz1903:feat/weno-nu-interface-bc
Jul 28, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
utkuyilmaz1903:feat/weno-nu-interface-bc

Conversation

@utkuyilmaz1903

@utkuyilmaz1903 utkuyilmaz1903 commented Jul 16, 2026 •

Copy link
Copy Markdown
Member

Interface and periodic boundary support for non-uniform WENO

Adds native interface / periodic BC support to the non-uniform WENO-5 advection scheme. Previously this configuration crashed at discretization time (BoundsError from slicing the N-1-length dx vector with wrapped indices) and would have fed non-monotonic coordinates to the kernel.

Core changes

  • interface_boundary.jl — new bcoord/_wrapcoord: returns the physical coordinate of a raw stencil tap in the differentiated grid's chart. Wrapped taps use the exact chart transition of the interface (periodic: shift by period length; contiguous two-domain: zero shift), so coordinates are strictly increasing across the seam. Purely additive; existing bwrap/RefCartesianIndex index-wrapping is untouched.
  • function_scheme.jl — get_f_taps_coords now also returns the unwrapped indices (Iraw). With interfaces present, discx is built via bcoord and dx = diff(discx); without interfaces, the original @view fast path is byte-identical. Adds a guard: wrapping requires N-1 >= interior_points (periodic u[1] ≡ u[N] leaves N-1 distinct nodes), with a clear error otherwise. get_f_and_taps kept as a thin wrapper for API compatibility.
  • MOL_discretization.jl — check_boundarymap waives the equal-dx requirement only for non-uniform FunctionalScheme with grid vectors on both sides of the interface (shared predicate mismatched_interface_dxs).
  • interior_map.jl — validate_interface_orders (called from construct_var_equation_mapping): rejects systems containing spatial derivative orders > 1 in variables connected by a mismatched-grid interface, since only the first-order path is coordinate-aware. Prevents silently inaccurate diffusion stencils at the seam; matched-grid interfaces are unaffected.

The WENO kernels (nonuniform_weno.jl, WENO.jl) are untouched. All new code runs at discretization time; the generated RHS structure is unchanged.

Tests

  • test/Components/weno_interface_coords.jl (new): unit tests for bcoord chart transitions (periodic shifts, zero-shift contiguous interface, seam monotonicity) and the stencil-wrap guard (N=5 throws, N=6 passes).
  • test/Convection_WENO/MOL_1D_WENO_NU_Interface.jl (new):
    • Periodic non-uniform traveling wave, MMS refinement 41/81/161: observed orders > 3, last > 3.5.
    • Two-domain interface with deliberately mismatched non-uniform grids, co-refined 41+61 / 81+121 / 161+241: observed orders 3.29, 4.13 (no order loss at the seam); seam continuity exact at every level.
    • @test_throws ArgumentError for Dxx across a mismatched-grid interface.

Docs

advection_schemes.md / boundary_conditions.md: document non-uniform periodic/interface support and the first-order-only restriction for mismatched grids.

@utkuyilmaz1903
utkuyilmaz1903 force-pushed the feat/weno-nu-interface-bc branch 3 times, most recently from 7062ad5 to f79056f Compare July 17, 2026 22:45
@utkuyilmaz1903
utkuyilmaz1903 marked this pull request as ready for review July 17, 2026 23:04
@utkuyilmaz1903

Copy link
Copy Markdown
Member Author

@ChrisRackauckas

@ChrisRackauckas
ChrisRackauckas merged commit 46f6f90 into SciML:master Jul 28, 2026
63 of 65 checks passed
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.

2 participants