solve_ksp#

module opensg.utils.shared

opensg.utils.shared.solve_ksp(A, F, V)#

Solve linear system Aw = F using PETSc Krylov Subspace solver.

This function sets up and solves a linear system using PETSc’s KSP (Krylov Subspace) solver with MUMPS direct factorization for robust solution of finite element systems.

Parameters:
  • A (petsc4py.PETSc.Mat) – Assembled stiffness matrix from finite element discretization

  • F (petsc4py.PETSc.Vec) – Right-hand side vector (load vector or force vector)

  • V (dolfinx.fem.FunctionSpace) – Function space corresponding to the degrees of freedom in the system

Returns:

dolfinx.fem.Function – Solution function containing the displacement field that satisfies Aw = F

Notes

The solver is configured with: - MUMPS direct solver for robustness - Automatic null pivot detection - Optimized memory management for large systems - Monitoring capabilities for debugging (optional)

This is the primary linear solver used throughout OpenSG for solving finite element systems arising from ABD matrix computations and boundary value problems.