Stokes flow in a periodic domain

Hydrodynamic interactions of active particles in a periodic 3D space

RBM (Rigid Body Motion: Velocity and Angular Velocity)

class pystokes.periodic.Rbm

Rigid body motion (RBM) - velocity and angular velocity

Methods in this class update velocities or angular velocities using the inputs of - arrays of positions, velocity or angular velocity, along with an array of forces or torques or a slip mode

The array of velocity or angular velocities is then update by each method.

particles: int

Number of particles (N)

viscosity: float

Viscosity of the fluid (eta)

boxSize: float

Length of the box which is reperated periodicly in 3D

mobilityRR(o, r, T, Nb=6, Nm=6, xi0=123456789.0)

Compute angular velocity due to body torques using \(o=\mu^{RR}\cdot T\)

Parameters:
  • o (np.array) – An array of angular velocities An array of size 3*N,

  • r (np.array) – An array of positions An array of size 3*N,

  • T (np.array) – An array of forces An array of size 3*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6

mobilityRT(o, r, F, Nb=6, Nm=6, xi0=123456789.0)

Compute angular velocity due to body forces using \(o=\mu^{RT}\cdot F\)

Parameters:
  • o (np.array) – An array of angular velocities An array of size 3*N,

  • r (np.array) – An array of positions An array of size 3*N,

  • F (np.array) – An array of forces An array of size 3*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6

mobilityTR(v, r, T, Nb=6, Nm=6, xi0=123456789.0)

Compute velocity due to body torque using \(v=\mu^{TR}\cdot T\)

Parameters:
  • v (np.array) – An array of velocities An array of size 3*N,

  • r (np.array) – An array of positions An array of size 3*N,

  • T (np.array) – An array of torques An array of size 3*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6

mobilityTT(v, r, F, Nb=6, Nm=6, xi0=123456789.0)

Compute velocity due to body forces using \(v=\mu^{TT}\cdot F\)

Parameters:
  • v (np.array) – An array of velocities An array of size 3*N,

  • r (np.array) – An array of positions An array of size 3*N,

  • F (np.array) – An array of forces An array of size 3*N,

  • Nb (int) – Number of periodic boxed summed Default is 10

  • Nm (int) – Number of Fourier modes summed Default is 1

propulsionR2s(o, r, S, Nb=6, Nm=6, xi0=123456789.0)

Compute angular velocity due to 2s mode of the slip \(v=\pi^{R,2s}\cdot S\)

Parameters:
  • o (np.array) – An array of angular velocities An array of size 3*N,

  • r (np.array) – An array of positions An array of size 3*N,

  • S (np.array) – An array of 2s mode of the slip An array of size 5*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6

propulsionR3a(o, r, V, Nb=6, Nm=6, xi0=123456789.0)

Compute angular velocity due to 3a mode of the slip \(v=\pi^{R,3a}\cdot V\)

Parameters:
  • o (np.array) – An array of angular velocities An array of size 3*N,

  • r (np.array) – An array of positions An array of size 3*N,

  • V (np.array) – An array of 3a mode of the slip An array of size 5*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6

propulsionR3s(o, r, G, Nb=6, Nm=6, xi0=123456789.0)

Compute angular velocity due to 3s mode of the slip \(v=\pi^{R,3s}\cdot G\)

Parameters:
  • o (np.array) – An array of angular velocities An array of size 3*N,

  • r (np.array) – An array of positions An array of size 3*N,

  • G (np.array) – An array of 3s mode of the slip An array of size 7*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6

propulsionR4a(o, r, M, Nb=6, Nm=6, xi0=123456789.0)

Compute angular velocity due to 4a mode of the slip \(v=\pi^{R,4a}\cdot M\)

Parameters:
  • o (np.array) – An array of angular velocities An array of size 3*N,

  • r (np.array) – An array of positions An array of size 3*N,

  • M (np.array) – An array of 4a mode of the slip An array of size 7*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6

propulsionT2s(v, r, S, Nb=6, Nm=6, xi0=123456789.0)

Compute velocity due to 2s mode of the slip \(v=\pi^{T,2s}\cdot S\)

Parameters:
  • v (np.array) – An array of velocities An array of size 3*N,

  • r (np.array) – An array of positions An array of size 3*N,

  • S (np.array) – An array of 2s mode of the slip An array of size 5*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6

propulsionT3a(v, r, V, Nb=6, Nm=6, xi0=123456789.0)

Compute velocity due to 3a mode of the slip \(v=\pi^{T,3a}\cdot V\)

Parameters:
  • v (np.array) – An array of velocities An array of size 3*N,

  • r (np.array) – An array of positions An array of size 3*N,

  • V (np.array) – An array of 3a mode of the slip An array of size 5*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6

propulsionT3s(v, r, G, Nb=6, Nm=6, xi0=123456789.0)

Compute velocity due to 3s mode of the slip \(v=\pi^{T,3s}\cdot G\)

Parameters:
  • v (np.array) – An array of velocities An array of size 3*N,

  • r (np.array) – An array of positions An array of size 3*N,

  • G (np.array) – An array of 3s mode of the slip An array of size 7*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6

propulsionT3t(v, r, D, Nb=6, Nm=6, xi0=123456789.0)

Compute velocity due to 3t mode of the slip \(v=\pi^{T,3t}\cdot D\)

Parameters:
  • v (np.array) – An array of velocities An array of size 3*N,

  • r (np.array) – An array of positions An array of size 3*N,

  • D (np.array) – An array of 3t mode of the slip An array of size 3*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6

propulsionT4a(v, r, M, Nb=6, Nm=6, xi0=123456789.0)

Compute velocity due to 4a mode of the slip \(v=\pi^{T,4a}\cdot M\)

Parameters:
  • v (np.array) – An array of velocities An array of size 3*N,

  • r (np.array) – An array of positions An array of size 3*N,

  • M (np.array) – An array of 4a mode of the slip An array of size 7*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6

Flow

class pystokes.periodic.Flow

Flow at given points

Parameters:
  • radius (float) – Radius of the particles.

  • particles (int) – Number of particles

  • viscosity (viscosity of the fluid) –

  • gridpoints (int) – Number of grid points

  • boxsize (int) – Box size

flowField1s(vv, rt, r, F, Nb=6, Nm=6, xi0=123456789.0)

Compute flow field at field points due body forces …

Parameters:
  • vv (np.array) – An array of flow at field points An array of size 3*Nt,

  • rt (np.array) – An array of field points An array of size 3*Nt,

  • r (np.array) – An array of positions An array of size 3*N,

  • F (np.array) – An array of body force An array of size 3*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6

Examples

An example of the Flow field due to $1s$ mode of force per unit area

>>> 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])
>>> F1s  = pystokes.utils.irreducibleTensors(1, p)
>>>
>>> # space dimension , extent , discretization
>>> dim, L, Ng = 3, 10, 64;
>>>
>>> # instantiate the Flow class
>>> flow = pystokes.periodic.Flow(radius=b, particles=N, viscosity=eta, gridpoints=Ng*Ng,
>>>         boxSize=L)
>>>
>>> # create grid, evaluate flow and plot
>>> rr, vv = pystokes.utils.gridXY(dim, L, Ng)
>>> flow.flowField1s(vv, rr, r, F1s)
>>> pystokes.utils.plotStreamlinesXY(vv, rr, r, offset=6-1, density=1.4, title='1s')
flowField2s(vv, rt, r, S, Nb=6, Nm=6, xi0=123456789.0)

Compute flow field at field points due to 2s mode of the slip …

Parameters:
  • vv (np.array) – An array of flow at field points An array of size 3*Nt,

  • rt (np.array) – An array of field points An array of size 3*Nt,

  • r (np.array) – An array of positions An array of size 3*N,

  • S (np.array) – An array of 2s mode of the slip An array of size 5*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6

flowField3t(vv, rt, r, D, Nb=16, Nm=16, xi0=123456789.0)

Compute flow field at field points due to 3t mode of the slip …

Parameters:
  • vv (np.array) – An array of flow at field points An array of size 3*Nt,

  • rt (np.array) – An array of field points An array of size 3*Nt,

  • r (np.array) – An array of positions An array of size 3*N,

  • D (np.array) – An array of 3t mode of the slip An array of size 3*N,

  • Nb (int) – Number of periodic boxed summed Default is 6

  • Nm (int) – Number of Fourier modes summed Default is 6