Skip to content

Stokes flow in unbounded, wall-bounded, and periodic geometries

Notifications You must be signed in to change notification settings

noisyoscillator/pystokes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyStokes

Binder

PyStokes is a Cython library for computing Stokes flows produced by spheres with Dirichlet (velocity) or Neumann (traction) boundary conditions on their surfaces. The solution of Stokes equation is represented as an integral of the velocity and traction over the particle boundaries. The boundary conditions are expanded in a basis of tensorial spherical harmonics and the minimal set of terms that includes all long-ranged hydrodynamic interactions is retained. A linear system of equations is obtained for the unknown coefficients of the traction (for Dirichlet boundary conditions) or the velocity (for Neumann boundary conditions). The flow and many-body hydrodynamic interactions are obtained from this solution.

There are open source libraries, most notably Hydrolib and libstokes, which could have been moulded for our purpose but, in spite of Havoc Pennington's warnings, we decided to write our own library. The codebase is kept lean in line with the philosophy that

large codebases are just failed ecosystems.

We hope our effort was worth the while!

What does the library compute ?

The PyStokes library computes:

  • Matrix elements of the single and double layer boundary integral operators of the Stokes equation over N spheres in a Galerkin basis of tensorial spherical harmonics.

  • Flows that are associated with the expansion of the surface stress (in the single layer) or the surface velocity (in the double layer) in the Galerkin basis.

  • Rigid body motion of the N spheres due to the hydrodynamic interaction mediated by the Stokes flow.

What geometries are supported ?

The PyStokes library currently supports four geometries:

  • For unbounded domains, the library computes matrix elements, flow, and rigid body motion include all long-ranged terms.

  • For wall-bounded domains, the Lorentz reflection theorem is applied to the unbounded flows to construct flows that vanish at a plane wall.

  • For sphere-bounded domains, the library uses an asymptotic expansion of Oseen's Green's function that vanishes on a sphere. This functionality is planned.

  • For periodic domains, O'Brien's method is used to derive an unconditionally convergent expression for the flow. Ewald summation of the resulting terms is implemented to accelerate convergence using Beenakker's method.

What about linear solvers ?

The PyStokes library does not directly compute solutions to the boundary integral equation but only evaluates the terms that arise from a global Galerkin discretization. To solve the linear system, the matrix elements computed by the library must be passed to iterative linear solvers like PyKrylov.

What about fast multipole accelerations ?

The PyStokes library defaults to direct summation for matrix elements, flows, and rigid body motion. Direct summation is an O(N^2) operation and, with current many-core architectures, is feasible for about N ~ 1e5. For larger N, accelerated summation methods like the fast multipole is desirable. Future plans include supporting one or more of the following kernel independent fast multipole methods:

  • KIFMM3d (Biros et al) - restricted to Green's functions of elliptic 2nd order pdes.
  • BBFMM3d (Darve et al) - general kernels but no parallelization.
  • ScalaFMM (Inria) - both classic and Darve's kernel independent methods are implemented; parallel version; automatic periodic summations.
  • FMM template library - well written parallel code, includes Stokes kernel and support for general tensor kernels.

Where can I read up the theory behind this ?

The library has a fairly comprehensive documentation which describes the method. Please cite the following papers if you publish research using PyStokes.

And all this is free ?

Yes. Both as in speech and beer. We believe strongly 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.

PyForces

PyForces is a library to be used along with PyStokes for computing body forces and torques on the colloids.

About

Stokes flow in unbounded, wall-bounded, and periodic geometries

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%