Domains

A MeshDomain lets a PDESystem be posed on an unstructured mesh. PDEBase defines the type and a five-function interface; mesh backends (for example a Ferrite adapter) add the methods for their mesh type.

The mesh carries no coordinate names. The domain pairing (x, y) ∈ Ω binds them: tuple position i names coordinate component i of the mesh, and VariableMap checks that the tuple has meshdim(mesh) entries. spatial_domain(v) returns the mesh domain (or, for analytic problems, the domain of the spatial coordinates).

Ω = MeshDomain(grid)
domains = [(x, y) ∈ Ω, t ∈ Interval(0.0, 1.0)]

A tuple pairing on a Rectangle or another product of intervals also fills v.intervals per axis, so box discretizers accept (x, y) ∈ Rectangle(...).

Types

PDEBase.MeshDomain — Type
MeshDomain(mesh)

A DomainSets.Domain whose points are the points of the backend mesh mesh, with element type SVector{meshdim(mesh), Float64}.

A MeshDomain carries no coordinate names. They come only from the PDESystem domain pairing (x, y) ∈ Ω, where tuple position i names coordinate component i of the mesh; VariableMap checks that the tuple has meshdim(mesh) entries.

The mesh type must implement the mesh-domain interface: PDEBase.meshdim, PDEBase.facetset_names, PDEBase.cellset_names, and optionally PDEBase.contains_point and PDEBase.backend_mesh.

Examples

Ω = MeshDomain(grid)
domains = [(x, y) ∈ Ω, t ∈ Interval(0.0, 1.0)]
source
PDEBase.Region — Type
Region(d::MeshDomain, name::Symbol)

The cell set name of the mesh domain d, as a DomainSets.Domain with the element type of d. Fields: parent (the mesh domain) and name.

Throws an ArgumentError unless name ∈ cellset_names(d.mesh).

source
PDEBase.regions — Function
regions(d::MeshDomain)

Return a Region for every cell set of the mesh of d, in the order of cellset_names(d.mesh).

source
PDEBase.spatial_domain — Function
spatial_domain(v::VariableMap)

Return the domain of the spatial coordinates indvars(v), or nothing when there are none.

When one pairing declares exactly the spatial coordinates, as (x, y) ∈ Ω or x ∈ Interval(0, 1), its domain is returned as given. Otherwise, when every spatial coordinate has an interval (its own interval pairing, or its axis of a box pairing that also names time, as in (t, x) ∈ Rectangle(...)), the result is the interval of a single coordinate or the DomainSets.ProductDomain of the intervals.

The axes of that box follow the user's declaration, never the order of indvars(v), which comes from the argument order of the dependent variables: for one tuple pairing they are its coordinates in tuple order with time dropped, and for split pairings [t ∈ It, x ∈ Ix, y ∈ Iy] they are the spatial pairings in the order of the domain list, so the box is Rectangle(Ix, Iy). Throws an ArgumentError for a MeshDomain pairing that also names a non-spatial coordinate, and when the spatial coordinates are declared by more than one pairing and at least one of them is not an interval or interval product, for example a MeshDomain for (x, y) and an interval for z.

source

Backend interface

PDEBase.meshdim — Function
meshdim(mesh)

Return the spatial dimension of the coordinates of mesh. For a surface mesh embedded in three dimensions this is the embedding dimension, 3.

Part of the mesh-domain interface: PDEBase defines no methods, mesh backends add them. A PDESystem pairing (x, y) ∈ MeshDomain(mesh) must name exactly meshdim(mesh) coordinates.

source
PDEBase.facetset_names — Function
facetset_names(mesh)

Return the Symbols naming the boundary facet sets of mesh, the named pieces of the mesh boundary.

Part of the mesh-domain interface: PDEBase defines no methods, mesh backends add them.

source
PDEBase.cellset_names — Function
cellset_names(mesh)

Return the Symbols naming the cell sets of mesh, the named regions of the mesh.

Part of the mesh-domain interface: PDEBase defines no methods, mesh backends add them.

source
PDEBase.contains_point — Function
contains_point(mesh, x)

Return whether the point x lies in mesh. Used by x ∈ MeshDomain(mesh).

Part of the mesh-domain interface. Implementing it is optional; the fallback throws an error naming the mesh type.

source
PDEBase.backend_mesh — Function
backend_mesh(mesh)

Return the native mesh object of the backend that mesh wraps. The fallback returns mesh itself.

Part of the mesh-domain interface.

source

Boundary pieces and condition kinds

boundarypiece(Ω, name) returns the facet set name of the mesh as a BoundaryPiece with no geometry, boundarypieces(Ω) returns one per facet set, and DomainSets.boundary(Ω) is their UnionDomain. PDEBase.bckind classifies a condition on traces by its syntax.

PDEBase.Robin — Type
Robin()

The PDEBase.BCKind of a condition on both trace values and derivatives of traces, such as k * Dn_Γ(u(t, Γ)) + α * u(t, Γ) ~ β.

source
PDEBase.bckind — Function
bckind(eq::Equation)

Classify the boundary condition eq by its syntax. A trace is a call with a BoundaryPiece argument, such as u(t, Γ). Only spatial derivatives of a trace count: a NormalDerivative, or a Differential in a variable that the trace does not keep, such as Dx(u(t, Γ)). A Differential in a kept argument, such as Dt(u(t, Γ)), differentiates along the piece and leaves the trace a value. A condition whose traces all sit inside a spatial derivative is PDEBase.Natural, one with none inside a spatial derivative is PDEBase.Essential (so Dt(u(t, Γ)) ~ g is a dynamic Dirichlet condition), and one with both is PDEBase.Robin.

The classification is advisory: it does not check coefficients or which pieces the operators act on. Throws an ArgumentError when eq contains no trace.

source

Design notes

The mesh-domain types build on the proposal in PDEBase.jl#61, whose domain wrapper, named boundary regions and discretization hierarchy shaped this design; its two commits are the base of this branch. The design here differs in three ways.

  • Named facet sets and cell sets are read from the mesh through the interface (PDEBase.facetset_names, PDEBase.cellset_names), not stored as markers on the domain. A mesh is the single source of truth for its sets, so a domain cannot disagree with its mesh, and a backend that already builds sets from predicates (for example Ferrite's addfacetset!) needs nothing more.
  • A named piece of the boundary is a BoundaryPiece, a DomainSets.Domain that can appear as an argument of a trace u(t, Γ), so boundary conditions are written in the same syntax on a box and on a mesh.
  • PDEBase makes no assumption about the discretization method. It does not assume a weak form, a set of fields, a quadrature rule for each part of a weak form, an ansatz for each field, or that the problem is linear. Those choices belong to the discretizer, which reads the PDESystem and the mesh through the interface above.