Skip to content
/ pyiga Public

A Python research toolbox for Isogeometric Analysis.

License

Notifications You must be signed in to change notification settings

c-f-h/pyiga

Repository files navigation

pyiga ghbuild appveyor codecov

pyiga is a Python research toolbox for Isogeometric Analysis. Its current highlights are:

  • Automatic generation of efficient matrix assembling code from a high-level, FEniCS-like description of the bilinear form. See the section "Assembling custom forms" in the Documentation as well as the convection-diffusion and Navier-Stokes examples below.
  • Adaptivity via HB- and THB-spline spaces and a local multigrid solver for adaptive IgA (read the paper). See adaptive.ipynb for an example.
  • Fast assembling by a black-box low-rank assembling algorithm described in this paper (or this technical report).
  • Extensive support for fast tensor approximation methods for tensor product IgA.

To find out more, have a look at the Documentation and the examples below.

Examples

The notebooks directory contains several examples of how to use pyiga:

Installation

pyiga is compatible with Python 3.10 and higher on Linux and Windows. MacOS is currently untested but might work.

Before installing, make sure that your environment can compile Python extension modules; on Linux, this should work out of the box with gcc, but on Windows you need Microsoft Visual Studio or the Microsoft Build Tools. Alternatively, installing on WSL (Windows Subsystem for Linux) works very well on Windows too. You can use either a standard Python distribution or Anaconda.

To install pyiga, clone this repository and execute

$ python -m pip install .

in the main directory. The installation script should now compile the Cython extensions and then install the package.

If you have Intel MKL installed on your machine, be sure to install the pyMKL package; if pyiga detects this package, it will use the MKL PARDISO sparse direct solver instead of the internal scipy solver (typically SuperLU).

In order to run the included Jupyter notebooks, you might also want to install jupyterlab, matplotlib, and sympy.

Updating

If you have already installed the package and want to update to the latest version, assuming that you have cloned it from Github, you can simply move to the project directory and execute

$ git pull
$ python -m pip install .

Running tests

pyiga comes with a small test suite to test basic functionality. To run them, first install pip install pytest, then move to the test subdirectory and execute

$ python -m pytest -v --import-mode=importlib

If the test runner fails to find the Cython extensions modules (pyiga.bspline_cy etc.), try running python setup.py build_ext -i to build them in-place.

Usage

After successful installation, you should be able to load the package. A simple example:

from pyiga import bspline, geometry, assemble

kv = bspline.make_knots(3, 0.0, 1.0, 50)    # knot vector over (0,1) with degree 3 and 50 knot spans
geo = geometry.quarter_annulus()            # a NURBS representation of a quarter annulus
K = assemble.stiffness((kv,kv), geo=geo)    # assemble a stiffness matrix for the 2D tensor product
                                            # B-spline basis over the quarter annulus

There is a relatively complete Documentation. Beyond that, look at the code, the unit tests, and the IPython notebooks to learn more.

FAQ

During compilation, I get an error message involving numpy._build_utils.

Try installing/upgrading setuptools:

$ pip install --upgrade setuptools