zoomy_core.symbolic.domains module

zoomy_core.symbolic.domains module#

Symbolic Domain / Boundary / Normal layer.

Sympy-side atoms for representing continuous integration regions and their boundaries. These are not the numerical mesh in zoomy_core.mesh — they are symbolic descriptors used to drive weak-form derivations (DivergenceTheorem, MapToReferenceElement) without committing to a specific discretisation.

Pattern:

  • Domain and its subclasses (Interval, Simplex, Box) are Python descriptors carrying coordinate symbols plus geometry data.

  • BoundaryIntegral(integrand, domain) is an opaque sympy atom — the surface integral ∫_∂D f ds. It is manufactured per Domain via the established phi_fn pattern (one sympy.Function subclass per domain instance, with _domain back-reference).

  • NormalVector(domain) returns the sympy.Function subclass for the outward unit normal. Calls n(0), n(1), … give opaque component atoms.

Volume integrals stay as native sympy.Integral — the existing 1D pipeline keeps consuming them unchanged.

class zoomy_core.symbolic.domains.Domain(coords, name)#

Bases: object

Continuous integration region in symbolic form.

Subclasses fill in geometry (vertices, intervals) and override boundary, reference, affine_map, normal as appropriate for their shape.

Parameters:
  • coords (tuple[sympy.core.symbol.Symbol, ...]) –

  • name (str) –

coords: tuple[sympy.core.symbol.Symbol, ...]#
name: str#
property dim: int#
boundary()#
Return type:

Domain

reference()#
Return type:

Domain

affine_map()#

Return (B, V0) such that x = V0 + B · ξ maps the reference element to self. Defined only on volume domains.

Return type:

tuple[sympy.matrices.dense.MutableDenseMatrix, sympy.matrices.dense.MutableDenseMatrix]

normal()#

Return the sympy.Function class for the outward unit normal on self. Defined only on boundary domains.

Return type:

type

property boundary_integral_fn: type#

sympy.Function subclass for ∫_∂(self) f ds atoms.

One class per Domain instance. The back-reference cls._domain lets operations recover the surrounding domain. Renders in LaTeX as ∮_{<name>} f \, dS via the _latex method.

property normal_fn: type#

sympy.Function subclass for outward unit normal components.

Calls n(i) carry the back-reference cls._domain so downstream operations can verify “this normal belongs to that boundary”. Renders in LaTeX as n_<name>^{(i)}.

class zoomy_core.symbolic.domains.Interval(var, a, b, name=None)#

Bases: Domain

1D interval [a, b] parametrised by a single var.

Parameters:
  • var (sp.Symbol) –

  • name (str) –

boundary()#
Return type:

PointSet

reference()#
Return type:

Interval

affine_map()#

Return (B, V0) such that x = V0 + B · ξ maps the reference element to self. Defined only on volume domains.

Return type:

tuple[sympy.matrices.dense.MutableDenseMatrix, sympy.matrices.dense.MutableDenseMatrix]

class zoomy_core.symbolic.domains.Simplex(vertices, coords, name=None)#

Bases: Domain

n-dim simplex from a vertex tuple.

vertices is a sequence of n+1 points, each a tuple/Matrix of length n (matching coords). B = [V₁−V₀ | V₂−V₀ | …], V₀ is the offset, and the affine map is x = V₀ + B · ξ.

Parameters:
  • vertices (Sequence) –

  • coords (tuple[sympy.core.symbol.Symbol, ...]) –

  • name (str) –

boundary()#
Return type:

SimplexBoundary

reference()#
Return type:

Simplex

affine_map()#

Return (B, V0) such that x = V0 + B · ξ maps the reference element to self. Defined only on volume domains.

Return type:

tuple[sympy.matrices.dense.MutableDenseMatrix, sympy.matrices.dense.MutableDenseMatrix]

class zoomy_core.symbolic.domains.Box(intervals, name=None)#

Bases: Domain

Tensor product of Interval factors.

Parameters:
  • intervals (Sequence[Interval]) –

  • name (str) –

boundary()#
Return type:

BoxBoundary

reference()#
Return type:

Box

affine_map()#

Return (B, V0) such that x = V0 + B · ξ maps the reference element to self. Defined only on volume domains.

Return type:

tuple[sympy.matrices.dense.MutableDenseMatrix, sympy.matrices.dense.MutableDenseMatrix]

class zoomy_core.symbolic.domains.PointSet(var, points, name=None)#

Bases: _BoundaryDomain

Degenerate 0-dim boundary — the boundary of an Interval.

Bridge to the existing Subs(f, var, bound) plumbing in ins_generator: a BoundaryIntegral over a PointSet is semantically f|_{var=b} f|_{var=a} and resolves through that convention rather than producing a new symbolic kind.

Parameters:
  • var (sp.Symbol) –

  • points (Sequence) –

  • name (str) –

property dim: int#
class zoomy_core.symbolic.domains.SimplexBoundary(parent, name=None)#

Bases: _BoundaryDomain

Opaque boundary of a Simplex — one symbolic atom covers ∂K (no per-face decomposition in this layer).

Parameters:
  • parent (Domain) –

  • name (str) –

class zoomy_core.symbolic.domains.BoxBoundary(parent, name=None)#

Bases: _BoundaryDomain

Opaque boundary of a Box — same convention as SimplexBoundary.

Parameters:
  • parent (Domain) –

  • name (str) –

zoomy_core.symbolic.domains.BoundaryIntegral(integrand, domain)#

Construct a symbolic ∫_∂D f ds atom.

domain should be a boundary domain (e.g. K.boundary()). The result is an opaque sympy.Function call whose class carries _domain back to domain — operations like DivergenceTheorem and MapToReferenceElement walk for instances of this class to find boundary integrals.

Parameters:
  • integrand (Expr) –

  • domain (Domain) –

Return type:

Expr

zoomy_core.symbolic.domains.NormalVector(domain)#

Return the sympy.Function class for outward unit normal components on domain.

Usage:

n = NormalVector(K.boundary())
flux = sp.diff(u, x) * n(0) + sp.diff(u, y) * n(1)
Parameters:

domain (Domain) –

Return type:

type