raygeo.mesh.laplace
Functions
solve_laplace()
solve_laplace(
mesh: types.TriangleMesh,
max_iter: int = 1000,
tolerance: float = 1e-08,
) -> Sequence[float]
Solve the Laplace equation Δu=0 on a triangle mesh.
Returns a scalar field with one value per vertex. Outer boundary vertices are fixed to u=1.0 and inner boundary vertices to u=0.0.
| Parameter | Type | Description |
|---|---|---|
mesh | types.TriangleMesh | TriangleMesh with boundary tags. |
max_iter | int = 1000 | Maximum conjugate gradient iterations. |
tolerance | float = 1e-08 | Convergence tolerance for CG residual. |
| Returns | Sequence[float] | List of scalar u values, one per vertex. |
| Complexity | O(i * n) where i = CG iterations, n = mesh vertices |

Stiffness matrix edge weights on the mesh — line thickness ∝ |Kᵢⱼ|

Laplace solution on a multi-island domain — contour lines morph smoothly between four inner islands and the outer boundary

Laplace solution — contours morph smoothly from hole to boundary

Laplace solution on an L-shaped domain
solve_laplace_with_history()
solve_laplace_with_history(
mesh: types.TriangleMesh,
max_iter: int = 1000,
tolerance: float = 1e-08,
) -> tuple[Sequence[float], Sequence[float]]
Solve the Laplace equation and return convergence history.
Identical to solve_laplace() but also returns the residual norm after each conjugate gradient iteration for convergence analysis.
| Parameter | Type | Description |
|---|---|---|
mesh | types.TriangleMesh | TriangleMesh with boundary tags. |
max_iter | int = 1000 | Maximum conjugate gradient iterations. |
tolerance | float = 1e-08 | Convergence tolerance for CG residual. |
| Returns | tuple[Sequence[float], Sequence[float]] | Tuple of (solution, residuals). |
| Complexity | O(i * n) where i = CG iterations, n = mesh vertices |

Conjugate gradient convergence — residual norm per iteration