pygeon.numerics.poincare module

Module for poincare operators.

class pygeon.numerics.poincare.Poincare(mdg)[source]

Bases: object

Class for generating Poincaré operators p that satisfy \(pd + dp = I\) with d the exterior derivative, following the construction from https://arxiv.org/abs/2410.08830

__init__(mdg)[source]

Initializes a Poincare class

Parameters:

mdg (pg.MixedDimensionalGrid) – A (mixed-dimensional) grid.

define_bar_spaces()[source]

Flag the mesh entities that will be used to generate the Poincaré operators

flag_edges_3d()[source]

Flag the edges of the grid that form a spanning tree of the nodes. This function only gets called in 3D.

Returns:

Boolean array with flagged edges

Return type:

np.ndarray

find_central_node()[source]

Find the node that is closest to the center of the domain.

Returns:

Index of the central node.

Return type:

int

flag_nodes()[source]

Flag all the nodes in the top-dim domain, except for the first node

Returns:

Boolean array with flagged nodes

Return type:

np.ndarray

apply(k, f, solver=<function spsolve>)[source]

Apply the Poincare operator

Parameters:
  • k (int) – Order of the differential k-form that is input.

  • f (np.ndarray) – The input differential k-form as an array of the degrees of freedom.

  • solver (Callable) – The solver function to use. Defaults to sps.linalg.spsolve.

Returns:

The image of f under the Poincaré operator, i.e. p(f)

Return type:

np.ndarray

decompose(k, f)[source]

Use the Poincaré operators to decompose \(f = pd(f) + dp(f)\)

Parameters:
  • k (int) – Order of the k-form f.

  • f (np.ndarray) – The function to be decomposed.

Returns:

The decomposition of f as \((dp(f), pd(f))\)

Return type:

Tuple[np.ndarray]

solve_subproblem(k, A, b, solver=<function spsolve>)[source]

Solve a linear system on the subspace of differential forms identified by the Poincare object.

Parameters:
  • k (int) – Order of the k-form.

  • A (sps.csc_array) – The system, usually a stiffness matrix.

  • b (np.ndarray) – The right-hand side vector.

  • solver (Callable) – The solver function to use. Defaults to sps.linalg.spsolve.

Returns:

The solution

Return type:

np.ndarray