Skip to main content

Phoresis and Stokesian hydrodynamics in Python

Project description

Imagel

PyStokes: phoresis and Stokesian hydrodynamics in Python Installation Notebooks Documentation Status DOI PyPI Python Version Downloads

About | Blog | News | Installation | Documentation | Examples | Publications | Gallery | Support | License

About

PyStokes is a numerical library for phoresis and Stokesian hydrodynamics in Python. It uses a grid-free method, combining the integral representation of Laplace and Stokes equations, spectral expansion, and Galerkin discretization, to compute phoretic and hydrodynamic interactions between spheres with slip boundary conditions on their surfaces. The library also computes suspension scale quantities, such as rheological response, energy dissipation and fluid flow. The computational cost is quadratic in the number of particles and upto 1e5 particles have been accommodated on multicore computers. The library has been used to model suspensions of microorganisms, synthetic autophoretic particles and self-propelling droplets.

Please read the PyStokes paper and Wiki before you use PyStokes for your research. Included below are some examples from PyStokes Gallery:

Periodic orbits of active particles

Image

Our work shows that the oscillatory dynamics of a pair of active particles near a boundary, best exemplified by the fascinating dance of the green algae Volvox, can be understood in terms of Hamiltonian mechanics, even though the system does not conserve energy. Read more in the PyStokes Gallery.

Crystallization at a plane no-slip surface

It is well-known that crystallization of colloids approximating hard spheres is due, paradoxically, to the higher entropy of the ordered crystalline state compared to that of the disordered liquid state. Out of equilibrium, no such general principle is available to rationalize crystallization. In this work, we identify a new non-equilibrium mechanism, associated with entropy production rather than entropy gain, which drives crystallization of active colloids near plane walls. Read more in the PyStokes Gallery.

Crystallization of active colloids

News

26th July 2019 -- PyStokes can compute hydrodynamic and phoretic interactions in autophoretic suspensions.

Installation

From a checkout of this repo

Install PyStokes and an extended list of dependencies using

>> git clone https://github.com/rajeshrinet/pystokes.git
>> cd pystokes
>> pip install -r requirements.txt
>> python setup.py install

Install PyStokes and its dependencies in an environment named "pystokes" via Anaconda

>> git clone https://github.com/rajeshrinet/pystokes.git
>> cd pystokes
>> make env
>> conda activate pystokes
>> make

Via pip

Install the latest PyPI version

>> pip install pystokes

Testing

Test installation and running

>> cd tests
>> python test_short.py

Long test of example notebooks

>> cd tests
>> python test_notebooks.py

Examples

# Example 1: Flow field due to $2s$ mode of active slip
import pystokes, numpy as np, matplotlib.pyplot as plt

# particle radius, self-propulsion speed, number and fluid viscosity
b, eta, N = 1.0, 1.0/6.0, 1

# initialize
r, p = np.array([0.0, 0.0, 3.4]), np.array([0.0, 1.0, 0])
V2s  = pystokes.utils.irreducibleTensors(2, p)

# space dimension , extent , discretization
dim, L, Ng = 3, 10, 64;

# instantiate the Flow class
flow = pystokes.wallBounded.Flow(radius=b, particles=N, viscosity=eta, gridpoints=Ng*Ng)

# create grid, evaluate flow and plot
rr, vv = pystokes.utils.gridYZ(dim, L, Ng)
flow.flowField2s(vv, rr, r, V2s)  
pystokes.utils.plotStreamlinesYZsurf(vv, rr, r, offset=6-1, density=1.4, title='2s')
#Example 2: Phoretic field due to active surface flux of l=0 mode
import pystokes, numpy as np, matplotlib.pyplot as plt
# particle radius, fluid viscosity, and number of particles
b, eta, N = 1.0, 1.0/6.0, 1

#initialise
r, p = np.array([0.0, 0.0, 5]), np.array([0.0, 0.0, 1])
J0 = np.ones(N)  # strength of chemical monopolar flux

# space dimension , extent , discretization
dim, L, Ng = 3, 10, 64;

# instantiate the Flow class
phoreticField = pystokes.phoretic.unbounded.Field(radius=b, particles=N, phoreticConstant=eta, gridpoints=Ng*Ng)

# create grid, evaluate phoretic field and plot
rr, vv = pystokes.utils.gridYZ(dim, L, Ng)
phoreticField.phoreticField0(vv, rr, r, J0)  
pystokes.utils.plotContoursYZ(vv, rr, r, density=.8, offset=1e-16,  title='l=0') 

Other examples include

Publications

A selected list of publications is given below. See full publication list here.

Support

  • For help with and questions about PyStokes, please post to the pystokes-users group.
  • For bug reports and feature requests, please use the issue tracker on GitHub.

License

We believe that openness and sharing improves the practice of science and increases the reach of its benefits. This code is released under the MIT license. Our choice is guided by the excellent article on Licensing for the scientist-programmer.

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

pystokes-2.3.2.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

pystokes-2.3.2-cp310-cp310-macosx_11_0_arm64.whl (3.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

File details

Details for the file pystokes-2.3.2.tar.gz.

File metadata

  • Download URL: pystokes-2.3.2.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/6.0.0 pkginfo/1.9.6 requests/2.31.0 requests-toolbelt/1.0.0 tqdm/4.65.0 CPython/3.10.9

File hashes

Hashes for pystokes-2.3.2.tar.gz
Algorithm Hash digest
SHA256 311085f954c18085c57d0c8cb42e617b3b73e6123b87908ad56666dc52c4affe
MD5 fd7afd329b8d2039f4866535e4e6131a
BLAKE2b-256 3be288e62988de7281baadcbbe0465d25a0ec9a0986d54d565be51d977c5e9c9

See more details on using hashes here.

File details

Details for the file pystokes-2.3.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

  • Download URL: pystokes-2.3.2-cp310-cp310-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.10, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/6.0.0 pkginfo/1.9.6 requests/2.31.0 requests-toolbelt/1.0.0 tqdm/4.65.0 CPython/3.10.9

File hashes

Hashes for pystokes-2.3.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e7f61853ccad47d2228d41575d6fbf733e072b8aef67da3a4141654c9d18327f
MD5 5f302749611719aebbdfc64663d5b511
BLAKE2b-256 f1f7f5a760a94d55dd2b3c3dfd9ebf5e4260a53d0cbdc1e2db5f8ac55672bf8d

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