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.6 and higher.

Before installing, make sure you have recent versions of Numpy, Scipy and Cython installed and that your environment can compile Python extension modules. Numpy 1.14 or higher is required. If you do not have such an environment set up yet, the easiest way to get it is by installing Anaconda (this can be done without administrator privileges).

Clone this repository and execute

$ python setup.py 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).

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 setup.py install

Running tests

pyiga comes with a small test suite to test basic functionality. Depending on your test runner of choice, move to the main directory and execute nosetests or py.test to run the tests.

If the test runner fails to find the Cython extensions modules (pyiga.bspline_cy etc.), you may have to run 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