Skip to content

User guide

OpenSeesPy can delegate linear and eigen solves to a Python solver through the PythonSparse system and eigen commands. OpenSees assembles the sparse matrices and right-hand side, then calls methods on your solver object (solve, and for linear solvers formAp).

openseespy-solvers wraps scipy, cupy, and nvmath as ready-made solver objects so you do not have to implement that callback protocol yourself. In application code you typically:

  1. Call a solver constructor (spsolve, eigsh, direct_solver, …).
  2. Pass solver.to_openseespy() to OpenSeesPy.
import openseespy.opensees as ops
from openseespy_solvers.scipy import spsolve

solver = spsolve()
ops.system("PythonSparse", solver.to_openseespy())
# … numberer, constraints, integrator, analysis …
ops.analyze(num_steps)
from openseespy_solvers.scipy import eigsh

eig_solver = eigsh()
lam = ops.eigen("PythonSparse", num_modes, eig_solver.to_openseespy())

That is the whole integration surface for most analyses. The pages below cover solver configuration, preconditioners, and what you can inspect after a solve.

to_openseespy()

solver.to_openseespy() returns a dict. Pass it to OpenSeesPy unchanged in ops.system("PythonSparse", …) and ops.eigen("PythonSparse", …). Configure the solver when you create it (spsolve(), cg(rtol=1e-8), …), not by editing that dict.

Use copy.copy(solver) to obtain a fresh instance with the same configuration but empty internal state. OpenSees may clone solvers when copying a system of equations.

See also