Skip to main content

A fast OpenCL Peridynamics package for python

Project description

PeriPy

Build Status codecov

PeriPy, a collaboration between Exeter, Cambridge & the Alan Turing Institute, is a lightweight, open-source and high-performance python package for solving bond-based peridynamics (BBPD) problems in solid mechanics. It is implemented in Python and the performance critical parts are implemented in Cython and PyOpenCL.

PeriPy allows users to write their code in pure Python. Simulations are then executed seamlessly using high performance OpenCL code.

Features

  • Easy to use. Get started with the latest documentation at peripy.readthedocs.org
  • 2-10x faster than exisiting OpenCL solvers
  • 'Outer-loop' applications including uncertainty quantification, optimisation and feature recognition are made possible
  • Support for both regular and irregular mesh files. See meshio for the full list of mesh formats
  • Support for composite and interface material models
  • Support for arbritrary n-linear 'microelastic' damage models
  • Simulates force or displacement controlled boundary conditions and initial conditions
  • Arbritrary subsets of particles are easily measured for their displacements, damages etc.
  • Output files can be viewed in Paraview
  • Various 'partial volume correction' algorithms, 'surface correction' algorithms and 'micromodulus functions' are included. The code is easily extended to define your own
  • Velocity-Verlet, Euler and Euler-Cromer integrators are included and the code is easily extended to define your own higher order and/or adaptive integrators

Get started (preferred)

Building and Installation

  • The package requires Python 3.7+
  • Install pyopencl, a build dependency, by following these instructions https://documen.tician.de/pyopencl/misc.html
  • To install pyopencl, note that pyopencl may need to be installed from (base) environment
  • If using pyopencl on Windows with a CPU (rather than a GPU), first, ensure the C++ build tools for Visual Studio are installed (e.g., see https://youtu.be/KUTVnxCeC50)
  • Make sure the OpenCL device driver is installed for your device:
    python
    import pyopencl
    pyopencl.get_platforms()
    
    The error pyopencl._cl.LogicError: clGetPlatformIDs failed: PLATFORM_NOT_FOUND_KHR means that the OpenCL device driver is not correctly installed.
  • Install cython, a build dependency, pip install cython
  • Install PeriPy pip install peripy

Running examples

  • Run the first example by typing peripy run example1 on the command line
  • You can show the example code by typing peripy run example1 --cat
  • Type peripy run --list for a list of examples
  • For usage, type peripy run --help

Running the tests

The tests for this project use pytest. To run the tests yourself,

  • Install pytest using pip pip install pytest
  • Type peripy test on the command line
  • For coverage install pytest-cov and type peripy coverage on the command line

Get started from the GitHub repository (for developers)

Building and Installation

  • The package requires Python 3.7+
  • Install pyopencl, a build dependency, by following these instructions https://documen.tician.de/pyopencl/misc.html
  • To install pyopencl, note that pyopencl may need to be installed from (base) environment
  • If using pyopencl on Windows with a CPU (rather than a GPU), first, ensure the C++ build tools for Visual Studio are installed (e.g., see https://youtu.be/KUTVnxCeC50)
  • Make sure the OpenCL device driver is installed for your device
    python
    import pyopencl
    pyopencl.get_platforms()
    
    The error pyopencl._cl.LogicError: clGetPlatformIDs failed: PLATFORM_NOT_FOUND_KHR means that the OpenCL device driver is not correctly installed.
  • Install cython, a build dependency, pip install cython
  • Clone the repository git clone git@github.com:alan-turing-institute/peripy.git
  • Install using pip pip install -e . from the root directory of the repository

Running examples

  • You can find examples of how to use the package under:peripy/examples/. Run the first example by typing python peripy/examples/example1/example.py

Running the tests

The tests for this project use pytest. To run the tests yourself,

  • If you haven't already, install using pip pip install -e . from the root directory of the repository
  • Install pytest using pip pip install pytest
  • Run pytest from the root directory of the repository
  • For coverage install pytest-cov and run pytest --cov=./peripy

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

peripy-1.0.0.tar.gz (5.1 MB view details)

Uploaded Source

Built Distribution

peripy-1.0.0-cp37-cp37m-win_amd64.whl (5.5 MB view details)

Uploaded CPython 3.7m Windows x86-64

File details

Details for the file peripy-1.0.0.tar.gz.

File metadata

  • Download URL: peripy-1.0.0.tar.gz
  • Upload date:
  • Size: 5.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for peripy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b88874ae777454a794700a2b105713d47869c302d9201c058528dd9f16c759cb
MD5 ad7986709862ecd74c0e1299ca39de72
BLAKE2b-256 bbd80649d03f630104591b18da77bb233a6c949831108b880078bea802abff42

See more details on using hashes here.

File details

Details for the file peripy-1.0.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: peripy-1.0.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 5.5 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for peripy-1.0.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 d3fe21fa0592d871f8fa298f3ab7526aab56d0ae0c4e651a386ee938af0c255f
MD5 be1d725f9052546a2e59dd2b9068b374
BLAKE2b-256 0a0a17c74926a3fc13bdc4653684d60abe4078fc6e22c32a4f066f45e76d9506

See more details on using hashes here.

Supported by

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