Skip to content

Add box/mesh discretization supertypes and boundary hooks - #143

Merged
xtalax merged 3 commits into
SciML:masterfrom
xtalax-droid:forge/boundary-1-types-hooks
Oct 28, 2026
Merged

xtalax merged 3 commits into
SciML:masterfrom
xtalax-droid:forge/boundary-1-types-hooks

Conversation

@xtalax-droid

Copy link
Copy Markdown
Contributor

Motivation

This is the first PR of the shared boundary layer that the FiniteElementMethod.jl design puts in PDEBase. Box discretizers (MethodOfLines finite differences and pseudospectral) and mesh discretizers (FEM) need two things from PDEBase:

  • a place in the type hierarchy to dispatch on;
  • two seams in symbolic_discretize: one that lowers boundary conditions into the form the discretizer consumes, and one that splits the parsed boundary map into initial and boundary conditions without assuming it is keyed by indvars(v).

This PR adds those pieces with no change in behaviour. The box lowering (to_box_bcs) and the mesh methods arrive in later PRs.

What is added

  • AbstractBoxDiscretization <: AbstractEquationSystemDiscretization and AbstractMeshDiscretization <: AbstractEquationSystemDiscretization, exported and documented. Every existing hook default is defined on a supertype or is untyped, so subtypes inherit everything. MethodOfLines' only change will be switching the declared supertype of MOLFiniteDifference and PseudospectralDiscretization.
  • PDEBase.lower_boundaries(pdesys, disc) is a public developer hook. Its default is the identity. It is called as the first step of the equation-system symbolic_discretize, before handle_complex, cardinalize_eqs! and make_pdesys_compatible.
  • PDEBase.split_ics_bcs(boundarymap, v, disc) is a public developer hook that returns (ics, bcmap). Its default is the inline code previously in symbolic_discretize, moved verbatim and using t = get_time(disc). symbolic_discretize now calls it.
  • Docs: the API reference, the developer-extension hook order, and the workflow page.

Tests

New testsets in test/interface.jl:

  • the subtype relations, and that neither new type is under the optimization branch;
  • a mock AbstractBoxDiscretization gives the same symbolic_discretize result as the existing mock AbstractEquationSystemDiscretization;
  • the lower_boundaries default returns its input (===);
  • a user override of lower_boundaries is called with the original system, and its returned system is the one discretized;
  • split_ics_bcs reproduces the old inline ics/bcmap on a heat-equation system, returns empty ics for a steady discretization, and the documented override pattern dispatches without ambiguity.

test/public_api.jl covers both new hooks (defined, documented, public). Core and QA groups pass locally.

Notes for review

  • lower_boundaries runs before handle_complex and make_pdesys_compatible, so an override sees the user's raw system. That is the ordering the box lowering in a later PR relies on.
  • The optimization-system driver is unchanged.

🤖 Posted by an AI agent · harness: Claude Code 2.1.310 · model: claude-opus-5-5
Review: unreviewed
Session: e5d08c60-db9f-4954-946c-272b70ca9edb

xtalax and others added 3 commits October 24, 2026 20:42
Add AbstractBoxDiscretization and AbstractMeshDiscretization under AbstractEquationSystemDiscretization, and two developer hooks for the FiniteElementMethod boundary layer: lower_boundaries (identity by default, called first in symbolic_discretize) and split_ics_bcs (the existing ics/bcmap split, moved out of symbolic_discretize unchanged).

Agent-Harness: Claude Code 2.1.310
Agent-Model: claude-opus-5-5
Agent-Session: e5d08c60-db9f-4954-946c-272b70ca9edb
Agent-Review: unreviewed
Co-authored-by: Claude Code <[email protected]>
List the new types and hooks in the API, developer-extension and workflow pages so checkdocs = :exports stays satisfied and the documented hook order matches symbolic_discretize.

Agent-Harness: Claude Code 2.1.310
Agent-Model: claude-opus-5-5
Agent-Session: e5d08c60-db9f-4954-946c-272b70ca9edb
Agent-Review: unreviewed
Co-authored-by: Claude Code <[email protected]>
The example specialised only the discretization argument, so a method copied from it was ambiguous with the default, which specialises v::VariableMap. Test the documented override pattern on the lowering mock, which also exercises it through symbolic_discretize.

Agent-Harness: Claude Code 2.1.310
Agent-Model: claude-opus-5-5
Agent-Session: e5d08c60-db9f-4954-946c-272b70ca9edb
Agent-Review: unreviewed
Co-authored-by: Claude Code <[email protected]>
@xtalax
xtalax merged commit 984b1e7 into SciML:master Oct 28, 2026
27 checks passed
xtalax-droid pushed a commit to xtalax-droid/PDEBase.jl that referenced this pull request Oct 28, 2026
Integration only: master now contains SciML#141, SciML#142, SciML#143, SciML#144 and SciML#160.

Agent-Harness: Claude Code 2.1.312
Agent-Model: claude-sonnet-5-5
Agent-Session: a20a681b-e8cc-4c82-a40d-a5b8349014e2
Agent-Review: unreviewed
Co-authored-by: Claude Code <[email protected]>
xtalax added a commit to SciML/MethodOfLines.jl that referenced this pull request Oct 29, 2026
…izations

Both now subtype PDEBase.AbstractBoxDiscretization (FEM spec M0, section 4.2) so PDEBase can lower boundary conditions for box discretizers. Needs a PDEBase release containing the type (SciML/PDEBase.jl#143); compat is not bumped here.

Agent-Harness: Claude Code 2.1.310
Agent-Model: claude-sonnet-5-5
Agent-Session: 6c520c71-764b-4a7e-a484-62d5a95bcfa1
Agent-Review: unreviewed
Co-authored-by: Claude Code <[email protected]>
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