Перейти до основного вмісту

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.

ParameterTypeDescription
meshtypes.TriangleMeshTriangleMesh with boundary tags.
max_iterint = 1000Maximum conjugate gradient iterations.
tolerancefloat = 1e-08Convergence tolerance for CG residual.
ReturnsSequence[float]List of scalar u values, one per vertex.
ComplexityO(i * n) where i = CG iterations, n = mesh vertices

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

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 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 — contours morph smoothly from hole to boundary

Laplace solution on an L-shaped domain

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.

ParameterTypeDescription
meshtypes.TriangleMeshTriangleMesh with boundary tags.
max_iterint = 1000Maximum conjugate gradient iterations.
tolerancefloat = 1e-08Convergence tolerance for CG residual.
Returnstuple[Sequence[float], Sequence[float]]Tuple of (solution, residuals).
ComplexityO(i * n) where i = CG iterations, n = mesh vertices

Conjugate gradient convergence — residual norm per iteration

Conjugate gradient convergence — residual norm per iteration