Skip to main content

scipy-style PythonSparse solvers for OpenSeesPy

Project description

openseespy-solvers

scipy-style sparse linear and eigen solvers for OpenSeesPy PythonSparse.

openseespy-solvers wraps familiar numerical backends such as scipy.sparse.linalg, cupyx.scipy.sparse.linalg, and NVIDIA nvmath.sparse as solver objects that OpenSeesPy can call directly. OpenSeesPy assembles the stiffness, mass, and right-hand-side arrays; the solver object performs the sparse solve and writes the result back to OpenSeesPy.

Documentation: openseespy-solvers.readthedocs.io

Installation

python -m pip install openseespy-solvers

The base install provides NumPy and scipy.sparse.linalg CPU solvers. It requires Python 3.12 or newer.

OpenSeesPy is optional so the package can be used and tested without forcing an OpenSees install. If OpenSeesPy is not already in your environment, install the extra:

python -m pip install "openseespy-solvers[opensees]"

Optional backends:

# CPU UMFPACK direct solver
python -m pip install "openseespy-solvers[umfpack]"

# NVIDIA GPU backends: choose the CUDA generation reported by nvidia-smi
python -m pip install "openseespy-solvers[cuda13]"   # or [cuda12]

On Windows, install UMFPACK with conda-forge instead of pip:

conda install -c conda-forge scikit-umfpack

See the installation guide for platform notes, CUDA 12.x alternatives, and verification steps.

Quick Example

import openseespy.opensees as ops
from openseespy_solvers.scipy import spsolve

solver = spsolve()

# after defining the OpenSeesPy model:
ops.system("PythonSparse", solver.to_openseespy())

For eigen analysis:

from openseespy_solvers.scipy import eigsh

eig_solver = eigsh()
eigenvalues = ops.eigen("PythonSparse", 5, eig_solver.to_openseespy())

Default Solvers

Analysis CPU NVIDIA GPU
Static or transient linear solve scipy.spsolve; scipy.umfpack for larger CPU systems nvmath.direct_solver
Generalized eigen solve scipy.eigsh cupy.eigsh

Tutorial and API docs cover wiring, alternatives, and optional backends: openseespy-solvers.readthedocs.io.

Modules

Module Provides
openseespy_solvers.scipy CPU solvers: spsolve, umfpack, cg, gmres, eigsh, lobpcg
openseespy_solvers.scipy.precond CPU preconditioners: jacobi, ilu, direct
openseespy_solvers.cupy GPU solvers: spsolve, cg, gmres, eigsh, lobpcg
openseespy_solvers.cupy.precond GPU preconditioners: jacobi, ilu, direct
openseespy_solvers.nvmath GPU direct sparse solver: direct_solver
openseespy_solvers.hybrid Direct factorization reused as a GMRES preconditioner

Factory signatures follow the corresponding scipy/cupy functions where possible. The matrix and right-hand side are supplied by OpenSeesPy at solve time.

Examples and Development

The pip wheel contains the library. Examples, benchmarks, and tests live in the source repository:

git clone https://github.com/gaaraujo/openseespy-solvers.git
cd openseespy-solvers
python -m pip install -e ".[dev,opensees]"
pytest

Then run a smoke example:

cd examples
python solvers/scipy_spsolve.py
python solvers/scipy_eigsh.py

Project Links

License

BSD 3-Clause. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openseespy_solvers-0.1.2.tar.gz (32.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openseespy_solvers-0.1.2-py3-none-any.whl (41.1 kB view details)

Uploaded Python 3

File details

Details for the file openseespy_solvers-0.1.2.tar.gz.

File metadata

  • Download URL: openseespy_solvers-0.1.2.tar.gz
  • Upload date:
  • Size: 32.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for openseespy_solvers-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f268662f57a3419bac4ccc69906947e07d122703b28d1eacab9d9ea3f671e002
MD5 cdfe8a44b6003fe8cdd9cb1a977779ee
BLAKE2b-256 61c10936582286a2e26f5cc166d209a50b88d2048ea52890197f2093cb33d809

See more details on using hashes here.

File details

Details for the file openseespy_solvers-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for openseespy_solvers-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ac7e164a51966f9236ad166a60fd091a198aad690299edded4bf1b36896a2869
MD5 f947565d5ee0394fdb018e6d9437da6d
BLAKE2b-256 60123f8fbf50c78ad4a4d7f0109c65aeb79ce956e5ed66d9f9591f8074820ab2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page