Boundary and initial conditions¤
Generic boundary constraints¤
phydrax.constraints.ContinuousDirichletBoundaryConstraint(constraint_var: str, component: DomainComponent | DomainComponentUnion, /, *, target: DomainFunction | ArrayLike | None = None, num_points: NumPoints | tuple[Any, ...], structure: ProductStructure, sampler: str = 'latin_hypercube', weight: DomainFunction | ArrayLike = 1.0, label: str | None = None, over: str | tuple[str, ...] | None = None, reduction: Literal[mean, integral] = 'mean') -> FunctionalConstraint
¤
Continuous Dirichlet boundary constraint.
Enforces \(u = g\) on the boundary component by minimizing the squared residual \(u - g\).
Arguments:
constraint_var: Name of the constrained field.component: Boundary component or component union.target: Target value/function \(g\) (defaults to 0).num_points: Number of boundary samples.structure: Sampling structure over labels.sampler: Sampling method.weight: Scalar weight.label: Optional label for logging.over: Optional reduction axes.reduction:"mean"or"integral".
Returns:
- A
FunctionalConstraintenforcing the Dirichlet condition.
phydrax.constraints.ContinuousNeumannBoundaryConstraint(constraint_var: str, component: DomainComponent, /, *, var: str = 'x', target: DomainFunction | ArrayLike | None = None, mode: Literal[reverse, forward] = 'reverse', num_points: NumPoints | tuple[Any, ...], structure: ProductStructure, sampler: str = 'latin_hypercube', weight: DomainFunction | ArrayLike = 1.0, label: str | None = None, over: str | tuple[str, ...] | None = None, reduction: Literal[mean, integral] = 'mean') -> FunctionalConstraint
¤
Continuous Neumann boundary constraint.
Enforces \(\partial u/\partial n = g\) on the boundary component, where \(n\) is the outward normal.
Arguments:
constraint_var: Name of the constrained field.component: Boundary component.var: Geometry variable used to compute normals.target: Target flux/function \(g\) (defaults to 0).mode: Differentiation mode ("reverse"or"forward").num_points: Number of boundary samples.structure: Sampling structure over labels.sampler: Sampling method.weight: Scalar weight.label: Optional label for logging.over: Optional reduction axes.reduction:"mean"or"integral".
Returns:
- A
FunctionalConstraintenforcing the Neumann condition.
phydrax.constraints.ContinuousRobinBoundaryConstraint(constraint_var: str, component: DomainComponent, /, *, var: str = 'x', dirichlet_coeff: DomainFunction | ArrayLike | None = None, neumann_coeff: DomainFunction | ArrayLike | None = None, target: DomainFunction | ArrayLike | None = None, mode: Literal[reverse, forward] = 'reverse', num_points: NumPoints | tuple[Any, ...], structure: ProductStructure, sampler: str = 'latin_hypercube', weight: DomainFunction | ArrayLike = 1.0, label: str | None = None, over: str | tuple[str, ...] | None = None, reduction: Literal[mean, integral] = 'mean') -> FunctionalConstraint
¤
Continuous Robin boundary constraint.
Enforces \(c_0 u + c_1 \\, \\partial u/\\partial n = g\) on the boundary component.
Arguments:
constraint_var: Name of the constrained field.component: Boundary component.var: Geometry variable used to compute normals.dirichlet_coeff: Coefficient \(c_0\) (defaults to 0).neumann_coeff: Coefficient \(c_1\) (defaults to 0).target: Target value/function \(g\) (defaults to 0).mode: Differentiation mode ("reverse"or"forward").num_points: Number of boundary samples.structure: Sampling structure over labels.sampler: Sampling method.weight: Scalar weight.label: Optional label for logging.over: Optional reduction axes.reduction:"mean"or"integral".
Returns:
- A
FunctionalConstraintenforcing the Robin condition.
phydrax.constraints.AbsorbingBoundaryConstraint(constraint_var: str, component: DomainComponent, /, *, var: str = 'x', time_var: str = 't', wavespeed: DomainFunction | ArrayLike | None = None, target: DomainFunction | ArrayLike | None = None, mode: Literal[reverse, forward] = 'reverse', num_points: NumPoints | tuple[Any, ...], structure: ProductStructure, sampler: str = 'latin_hypercube', weight: DomainFunction | ArrayLike = 1.0, label: str | None = None, over: str | tuple[str, ...] | None = None, reduction: Literal[mean, integral] = 'mean') -> FunctionalConstraint
¤
Absorbing/Sommerfeld boundary constraint
This is a common first-order radiation condition for wave-like PDEs, where c
is a characteristic wave speed.
Arguments:
constraint_var: Name of the constrained field.component: BoundaryDomainComponentto sample from.var: Geometry label used for normals and spatial derivatives.time_var: Time label used for \(\partial/\partial t\).wavespeed: Wave speedcas aDomainFunction, callable, or array-like. Defaults to1.0.target: Target value as aDomainFunction, callable, or array-like. Defaults to0.0.mode: Differentiation mode ("reverse"or"forward").num_points: Number of boundary points to sample (paired or structured; seestructure).structure: AProductStructuredescribing how variables are sampled/blocked.sampler: Sampling scheme (e.g."latin_hypercube").weight: Scalar multiplier applied to this term.over: Optional subset of labels to reduce/integrate over.reduction:"mean"or"integral".
Generic initial constraints¤
phydrax.constraints.ContinuousInitialConstraint(constraint_var: str, component: DomainComponent | DomainComponentUnion, /, *, evolution_var: str = 't', func: DomainFunction | ArrayLike | None = None, time_derivative_order: int = 0, mode: Literal[reverse, forward] = 'reverse', time_derivative_backend: Literal[ad, jet] = 'ad', num_points: SamplingNumPoints, structure: ProductStructure, dense_structure: ProductStructure | None = None, sampler: str = 'latin_hypercube', weight: DomainFunction | ArrayLike = 1.0, label: str | None = None, over: str | tuple[str, ...] | None = None, reduction: Literal[mean, integral] = 'mean') -> FunctionalConstraint
¤
Continuous initial-condition constraint on a fixed-start time slice.
Enforces
by sampling the initial slice, where n = time_derivative_order.
Arguments:
constraint_var: Name of the constrained field.component: Domain component on the initial surface (or a union of such components).evolution_var: Time label used for the initial slice (default:"t").func: Target value/function \(g\) (defaults to 0).time_derivative_order: Derivative order \(n\) for \(\partial^n/\partial t^n\).mode: Differentiation mode ("reverse"or"forward").time_derivative_backend: Backend for time derivatives ("ad"or"jet").num_points: Sampling spec. Accepts dense counts (int/tuple[int, ...]), coord-separable mappings (e.g.{"x": 64}), or mixed forms(dense_num_points, coord_map).structure: AProductStructuredescribing how variables are sampled/blocked.dense_structure: Optional dense structure used when sampling produces dense batches.sampler: Sampling scheme (e.g."latin_hypercube").weight: Scalar multiplier applied to this term.label: Optional label for logging.over: Optional subset of labels to reduce/integrate over.reduction:"mean"or"integral".