puncturedfem.NystromSolver
Nyström Solver for a given mesh cell K.
The Nyström Solver is used to solve the Neumann problem on K, which can be used to compute harmonic conjugates of functions on K, for example.
Attributes:
| Name | Type | Description |
|---|---|---|
K |
MeshCell
|
The mesh cell |
single_layer_mat |
np.ndarray
|
Single layer operator matrix |
double_layer_mat |
np.ndarray
|
Double layer operator matrix |
single_layer_op |
LinearOperator
|
Single layer operator |
double_layer_op |
LinearOperator
|
Double layer operator |
double_layer_sum |
np.ndarray
|
Sum of the double layer operator matrix |
lam_trace |
list[DirichletTrace]
|
Traces of the logarithmic terms |
T1_dlam_dt |
np.ndarray
|
Single layer operator applied to the tangential derivatives of the logarithmic terms |
Sn_lam |
np.ndarray
|
H1 seminorms of the logarithmic terms |
A_simple |
LinearOperator
|
Linear operator for the Neumann problem |
A_augment |
LinearOperator
|
Linear operator for the multiply connected case |
precond_simple |
LinearOperator
|
Preconditioner for the Neumann problem |
precond_augment |
LinearOperator
|
Preconditioner for the multiply connected case |
antilap_strategty |
str
|
Strategy for computing the anti-Laplacian: "direct" or "fft" |
Sn(vals)
Apply the operator S_n(vals) = int_{dK} vals * d_lambda/dn ds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vals |
np.ndarray
|
Vector vals |
required |
Returns:
| Type | Description |
|---|---|
np.ndarray
|
Result of the operator S_n applied to vals. |
St(vals)
Apply the operator S_n(vals) = int_{dK} vals * d_lambda / dt ds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vals |
np.ndarray
|
Vector vals |
required |
Returns:
| Type | Description |
|---|---|
np.ndarray
|
Result of the operator S_t applied to vals. |
__init__(K, antilap_strategy='fft', precond_type='jacobi', verbose=False, debug=False)
Build the Nyström Solver.
This constructor computes the single and double layer operators, as well as the logarithmic terms (if K has holes).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
K |
MeshCell
|
Mesh MeshCell |
required |
antilap_strategy |
str, optional
|
Strategy for computing the anti-Laplacian, by default "direct" |
'fft'
|
precond_type |
str, optional
|
Preconditioner type, by default "jacobi" |
'jacobi'
|
verbose |
bool, optional
|
Whether to print information about the Nyström Solver, by default False |
False
|
debug |
bool, optional
|
Whether to print debug information, by default False |
False
|
build_double_layer_mat()
Construct the double layer operator matrix.
build_preconditioners(precond_type='jacobi')
Build a preconditioner for the Neumann problem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
precond_type |
Optional[str]
|
Preconditioner type, by default "jacobi" |
'jacobi'
|
Notes
Available preconditioners: - "jacobi": Jacobi preconditioner
build_single_and_double_layer_ops()
Build single and double layer operators.
build_single_layer_mat()
Construct the single layer operator matrix.
compute_log_terms()
Compute and store logarithmic terms for multiply connected domains.
double_layer_component_block(ci, cj)
Get the block of the double layer operator matrix by components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ci |
ClosedContour
|
Component ci |
required |
cj |
ClosedContour
|
Component cj |
required |
Returns:
| Type | Description |
|---|---|
np.ndarray
|
Block of the double layer operator matrix for the components ci and cj. |
double_layer_edge_block(e, f)
get_harmonic_conjugate(phi)
Obtain a harmonic conjugate of phi.
In the case where K is multiply connected, phi is decomposed into a real part of a complex analytic function psi (which has a harmonic conjugate psi_hat) and a vector a of coefficients for the logarithmic terms.
In the simply connected case, psi_hat is the harmonic conjugate of phi, and a is an empty array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phi |
np.ndarray
|
Trace of a harmonic function on the boundary of a mesh cell. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
psi_hat |
np.ndarray
|
Trace of the harmonic conjugate of the conjugable part of phi. |
a |
np.ndarray
|
Coefficients for the logarithmic terms. Empty array if K is simply connected. |
linop4doublelayer(u)
Apply the operator for the double layer potential to u.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u |
np.ndarray
|
Vector u |
required |
Returns:
| Type | Description |
|---|---|
np.ndarray
|
Result of the double layer operator applied to u. |
linop4singlelayer(u)
Apply the single layer operator to u.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u |
np.ndarray
|
Vector u |
required |
Returns:
| Type | Description |
|---|---|
np.ndarray
|
Result of the single layer operator applied to u. |
set_K(K)
single_layer_component_block(i, j)
Block of the single layer operator matrix by components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i |
int
|
Component i |
required |
j |
int
|
Component j |
required |
Returns:
| Type | Description |
|---|---|
np.ndarray
|
Block of the single layer operator matrix for the components i and j. |
single_layer_edge_block(e, f, qm)
solve_neumann_zero_average(u_wnd)
Solve the Neumann problem with zero average on the boundary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u_wnd |
np.ndarray
|
Right-hand side of the Neumann problem. |
required |
Returns:
| Type | Description |
|---|---|
np.ndarray
|
Solution to the Neumann problem. |