Stokes flow in an unbounded domain

Hydrodynamic interactions of active particles in an unbounded domain.

RBM (Rigid Body Motion: Velocity and Angular Velocity)

class pystokes.unbounded.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.

radius: float
Radius of the particles (a).
particles: int
Number of particles (Np)
viscosity: float
Viscosity of the fluid (eta)
mobilityRR()

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*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
  • T (np.array) – An array of forces An array of size 3*Np,
mobilityRT()

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*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
  • F (np.array) – An array of forces An array of size 3*Np,
mobilityTR()

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*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
  • T (np.array) – An array of torques An array of size 3*Np,
mobilityTT()

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*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
  • F (np.array) – An array of forces An array of size 3*Np,

Examples

An example of the RBM

>>> import pystokes, numpy as np, matplotlib.pyplot as plt
>>> # particle radius, self-propulsion speed, number and fluid viscosity
>>> b, vs, Np, eta = 1.0, 1.0, 128, 0.1
>>> #initialise
>>> r = pystokes.utils.initialCondition(Np)  # initial random distribution of positions
>>> p = np.zeros(3*Np); p[2*Np:3*Np] = -1    # initial orientation of the colloids
>>>
>>> rbm   = pystokes.unbounded.Rbm(radius=b, particles=Np, viscosity=eta)
>>> force = pystokes.forceFields.Forces(particles=Np)
>>>
>>> def rhs(rp):
>>>     # assign fresh values at each time step
>>>     r = rp[0:3*Np];   p = rp[3*Np:6*Np]
>>>     F, v, o = np.zeros(3*Np), np.zeros(3*Np), np.zeros(3*Np)
>>>
>>>     force.lennardJonesWall(F, r, lje=0.01, ljr=5, wlje=1.2, wljr=3.4)
>>>     rbm.mobilityTT(v, r, F)
>>>     return np.concatenate( (v,o) )
>>>
>>> # simulate the resulting system
>>> Tf, Npts = 150, 200
>>> pystokes.utils.simulate(np.concatenate((r,p)),
>>>      Tf,Npts,rhs,integrator='odeint', filename='crystallization')
noiseRR()

Compute rotational Brownian motion …

Parameters:
  • o (np.array) – An array of angular velocities An array of size 3*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
noiseTT()

Compute translation Brownian motion …

Parameters:
  • v (np.array) – An array of velocities An array of size 3*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
propulsionR2s()

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*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
  • S (np.array) – An array of 2s mode of the slip An array of size 5*Np,
propulsionR3a()

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*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
  • V (np.array) – An array of 3a mode of the slip An array of size 5*Np,
propulsionR3s()

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*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
  • G (np.array) – An array of 3s mode of the slip An array of size 7*Np,
propulsionR4a()

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*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
  • M (np.array) – An array of 4a mode of the slip An array of size 7*Np,
propulsionT2s()

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*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
  • S (np.array) – An array of 2s mode of the slip An array of size 5*Np,
propulsionT3a()

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*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
  • V (np.array) – An array of 3a mode of the slip An array of size 5*Np,
propulsionT3s()

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*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
  • G (np.array) – An array of 3s mode of the slip An array of size 7*Np,
propulsionT3t()

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*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
  • D (np.array) – An array of 3t mode of the slip An array of size 3*Np,
propulsionT4a()

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*Np,
  • r (np.array) – An array of positions An array of size 3*Np,
  • M (np.array) – An array of 4a mode of the slip An array of size 7*Np,

Flow

class pystokes.unbounded.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

Examples

An example of the RBM

flowField1s()

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*Np,
  • F (np.array) – An array of body force An array of size 3*Np,

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, 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])
>>> F1s  = pystokes.utils.irreducibleTensors(1, p)
>>>
>>> # space dimension , extent , discretization
>>> dim, L, Ng = 3, 10, 64;
>>>
>>> # instantiate the Flow class
>>> flow = pystokes.unbounded.Flow(radius=b, particles=Np, viscosity=eta, gridpoints=Ng*Ng)
>>>
>>> # 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')
flowField2a()

Compute flow field at field points due body Torque …

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*Np,
  • T (np.array) – An array of body torque An array of size 3*Np,

Examples

An example of the RBM

# Example 1: Flow field due to $2a$ 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, 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]) >>> V2a = pystokes.utils.irreducibleTensors(1, 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.gridXY(dim, L, Ng) >>> flow.flowField2a(vv, rr, r, V2a) >>> pystokes.utils.plotStreamlinesXY(vv, rr, r, offset=6-1, density=1.4, title=‘2s’)

flowField2s()

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*Np,
  • S (np.array) – An array of 2s mode of the slip An array of size 5*Np,

Examples

An example of the Flow field due to $3t$ 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])
>>> V3t  = pystokes.utils.irreducibleTensors(1, 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.gridXY(dim, L, Ng)
>>> flow.flowField3t(vv, rr, r, V3t)
>>> pystokes.utils.plotStreamlinesXY(vv, rr, r, offset=6-1, density=1.4, title='1s')
flowField3a()

Compute flow field at field points due to 3a 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*Np,
  • V (np.array) – An array of 3a mode of the slip An array of size 5*Np,
flowField3s()

Compute flow field at field points due to 3s 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*Np,
  • G (np.array) – An array of 3s mode of the slip An array of size 7*Np,
flowField3t()

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*Np,
  • D (np.array) – An array of 3t mode of the slip An array of size 3*Np,

Examples

An example of the Flow field due to $3t$ 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])
>>> V3t  = pystokes.utils.irreducibleTensors(1, 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.gridXY(dim, L, Ng)
>>> flow.flowField3t(vv, rr, r, V3t)
>>> pystokes.utils.plotStreamlinesXY(vv, rr, r, offset=6-1, density=1.4, title='2s')
flowField4a()

Compute flow field at field points due to 4a 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*Np,
  • M (np.array) – An array of 4a mode of the slip An array of size 7*Np,