About | News | Installation | Examples | Publications | Support | License
PyStokes is a Cython library for Stokesian hydrodynamics. It uses a grid-free method, combining the integral representation of Stokes equation, spectral expansion, and Galerkin discretization, to compute 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 bacterial suspensions, active colloids and autophoretic particles.
03rd October 2019 -- 'Hydrodynamic and phoretic interactions of active particles in Python' is now available at: https://arxiv.org/abs/1910.00909
26th July 2019 -- PyStokes can be combined with PyLaplace to compute hydrodynamic and phoretic interactions in autophoretic suspensions.
Clone (or download) the repository and use a terminal to install using
>> git clone https://github.com/rajeshrinet/pystokes.git
>> cd pystokes
>> python setup.py install
PyStokes requires the following software
- Python 2.6+ or Python 3.4+
- Cython 0.25.x+ | Matplotlib 2.0.x+ | NumPy 1.x+ | OdesPy (optional) | SciPy 1.1.x+
# 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, Np = 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=Np, 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 pylaplace, numpy as np, matplotlib.pyplot as plt
# particle radius, fluid viscosity, and number of particles
b, eta, Np = 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(Np) # strength of chemical monopolar flux
# space dimension , extent , discretization
dim, L, Ng = 3, 10, 64;
# instantiate the Flow class
phoreticField = pylaplace.unbounded.Field(radius=b, particles=Np, 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
- Irreducible Active flows
- Effect of plane boundaries on active flows
- Active Brownian Hydrodynamics near a plane wall
- Flow-induced phase separation at a wall
- Irreducible autophoretic fields
- Autophoretic arrest of flow-induced phase separation
-
Competing phoretic and hydrodynamic interactions in autophoretic colloidal suspensions, Rajesh Singh, R. Adhikari, and M. E. Cates, J. Chem. Phys. 151, 044901 (2019)
-
Generalized Stokes laws for active colloids and their applications, Rajesh Singh and R. Adhikari, Journal of Physics Communications, 2, 025025 (2018)
-
Flow-induced phase separation of active particles is controlled by boundary conditions, Shashi Thutupalli, Delphine Geyer, Rajesh Singh, R. Adhikari, and Howard A. Stone, PNAS, 115, 5403 (2018)
-
Universal hydrodynamic mechanisms for crystallization in active colloidal suspensions, Rajesh Singh and R. Adhikari, Physical Review Letters, 117, 228002 (2016)
- 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.
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.