puncturedfem.LocalPoissonFunction
Function with a polynomial Laplacian and continuous trace on the boundary.
Typically, this class is used to represent functions in the local Poisson space V_p(K), which consists of functions whose Laplacian is a polynomial of degree <= p-2 on each edge of K, and whose continuous trace on any edge of the boundary of K is the restriction of a polynomial to that edge. However, it can also be used to represent functions with an arbitrary continuous trace on the boundary of K. Any such function v can be decomposed as v = P + phi where P is a polynomial of degree <= p in K and phi is a harmonic function. (Note that this decomposition is not unique, since there are harmonic polynomials). We refer to P as the "polynomial part" and phi as the "harmonic part". Furthermore, in multiply connected cells the harmonic part can be decomposed as phi = psi + sum_{j=1}^m a_j log |x - xi_j| where xi_j is a fixed arbitrary point in the jth hole of K, and psi is a harmonic function with a harmonic conjugate psi_hat. We refer to psi as the "conjugable part". Given a parametrization x(tau) of the boundary of K, we refer to (d / d tau) v(x(tau)) = nabla v(x(tau)) * x'(tau) as the "weighted normal derivative" of v, which we commonly abbreviate in code with "wnd". Similarly, the "weighted tangential derivative" is abbreviated "wtd". An "anti-Laplacian" of u is any function U such that Delta U = u where Delta is the Laplacian operator. In particular, we desire an anti- Laplacian of the harmonic part phi, as well as its weighted normal derivative. This allows us to compute the L^2 inner product of two local functions v and w using only boundary integrals. Interior values of a local function v, as well as its gradient, can be computed using Cauchy's integral formula.
Attributes:
| Name | Type | Description |
|---|---|---|
harm |
LocalHarmonic
|
The harmonic part, phi. |
poly |
LocalPolynomial
|
The polynomial part, P. |
mesh_cell |
MeshCell
|
The mesh cell on which the local function is defined. |
int_vals |
np.ndarray
|
Interior values of the local function, evaluated on the interior mesh defined by the mesh cell. |
int_grad1 |
np.ndarray
|
First component of the gradient of the local function, evaluated on the interior mesh defined by the mesh cell. |
int_grad2 |
np.ndarray
|
Second component of the gradient of the local function, evaluated on the interior mesh defined by the mesh cell. |
key |
GlobalKey
|
A unique tag that identifies the local function in the global space. |
__add__(other)
Add two local Poisson functions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
LocalPoissonFunction
|
The other local Poisson function. |
required |
Returns:
| Type | Description |
|---|---|
LocalPoissonFunction
|
The sum of the two local Poisson functions. |
__init__(nyst, laplacian=Polynomial(), trace=0, evaluate_interior=True, evaluate_gradient=False, key=None)
Build an element of the local Poisson space V_p(K).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nyst |
NystromSolver
|
Nystrom solver object for solving integral equations. |
required |
laplacian |
Polynomial, optional
|
Polynomial Laplacian of the local function, by default Polynomial(). |
Polynomial()
|
trace |
DirichletTrace or FloatLike, optional
|
Dirichlet trace of the local function, by default 0. If a numpy array, must be the same length as the number of sampled points on the boundary. |
0
|
evaluate_interior |
bool, optional
|
Whether or not to compute the interior values, by default False. |
True
|
evaluate_gradient |
bool, optional
|
Whether or not to compute the gradient, by default False. Takes precedence over evaluate_interior. |
False
|
key |
Optional[GlobalKey], optional
|
A unique tag that identifies the local function in the global space. |
None
|
__mul__(other)
Multiply the local Poisson function by a scalar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
Union[int, float]
|
The scalar. |
required |
Returns:
| Type | Description |
|---|---|
LocalPoissonFunction
|
The product of the local Poisson function and the scalar. |
__rmul__(other)
Multiply the local Poisson function by a scalar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
Union[int, float]
|
The scalar. |
required |
Returns:
| Type | Description |
|---|---|
LocalPoissonFunction
|
The product of the local Poisson function and the scalar. |
__sub__(other)
Subtract two local Poisson functions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
LocalPoissonFunction
|
The other local Poisson function. |
required |
Returns:
| Type | Description |
|---|---|
LocalPoissonFunction
|
The difference of the two local Poisson functions. |
__truediv__(other)
Divide the local Poisson function by a scalar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
Union[int, float]
|
The scalar. |
required |
Returns:
| Type | Description |
|---|---|
LocalPoissonFunction
|
The division of the local Poisson function by the scalar. |
compute_interior_values(compute_int_grad=True)
Compute the interior values.
Also compute the components of the gradient if compute_int_grad is True. The interior values are stored in self.int_vals, and the gradient components are stored in self.int_grad1 and self.int_grad2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
compute_int_grad |
bool, optional
|
Whether or not to compute the gradient, by default True. |
True
|
get_h1_semi_inner_prod(other)
Return the H^1 semi-inner product int_K grad(self) * grad(other) dx.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
LocalPoissonFunction, LocalHarmonic, or LocalPolynomial
|
Another local function on the same mesh cell. |
required |
get_l2_inner_prod(other)
Return the L^2 inner product int_K self * other dx.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
LocalPoissonFunction, LocalHarmonic, or LocalPolynomial
|
Another local function on the same mesh cell. |
required |
get_trace_values()
Return the trace values along the boundary of the mesh cell.
Returns:
| Name | Type | Description |
|---|---|---|
vals |
numpy.ndarray
|
Values of the trace, traverse in the same order as the sampled points on the boundary of the mesh cell. |