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.

particles: int

Number of particles (N)

viscosity: float

Viscosity of the fluid (eta)

mobilityRR(o, r, T)

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,

mobilityRT(o, r, F)

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,

mobilityTR(v, r, T)

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,

mobilityTT(v, r, F)

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,

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, N, eta = 1.0, 1.0, 128, 0.1
>>> #initialise
>>> r = pystokes.utils.initialCondition(N)  # initial random distribution of positions
>>> p = np.zeros(3*N); p[2*N:3*N] = -1    # initial orientation of the colloids
>>>
>>> rbm   = pystokes.unbounded.Rbm(radius=b, particles=N, viscosity=eta)
>>> force = pystokes.forceFields.Forces(particles=N)
>>>
>>> def rhs(rp):
>>>     # assign fresh values at each time step
>>>     r = rp[0:3*N];   p = rp[3*N:6*N]
>>>     F, v, o = np.zeros(3*N), np.zeros(3*N), np.zeros(3*N)
>>>
>>>     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, Nts = 150, 200
>>> pystokes.utils.simulate(np.concatenate((r,p)),
>>>      Tf,Nts,rhs,integrator='odeint', filename='crystallization')
noiseRR(o, r)

Compute rotational Brownian motion …

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,

noiseTT(v, r)

Compute translation Brownian motion …

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,

propulsionR2s(o, r, S)

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,

propulsionR3a(o, r, V)

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,

propulsionR3s(o, r, G)

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,

propulsionR4a(o, r, M)

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,

propulsionT2s(v, r, S)

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,

propulsionT3a(v, r, V)

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,

propulsionT3s(v, r, G)

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,

propulsionT3t(v, r, D)

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,

propulsionT4a(v, r, M)

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,

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(vv, rt, r, F, maskR=1.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,

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.unbounded.Flow(radius=b, particles=N, 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(vv, rt, r, T, maskR=1.0)

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*N,

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

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, 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]) >>> 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=N, 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(vv, rt, r, S, maskR=1.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,

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, 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])
>>> 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=N, 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(vv, rt, r, V, maskR=1.0)

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*N,

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

flowField3s(vv, rt, r, G, maskR=1.0)

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*N,

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

flowField3t(vv, rt, r, D, maskR=1.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,

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, 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])
>>> 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=N, 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(vv, rt, r, M, maskR=1.0)

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*N,

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

Power Dissipation (PD)

class pystokes.unbounded.PD

Power Dissipation(PD)

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

The power dissipation is then update by each method.

particles: int

Number of particles (N)

viscosity: float

Viscosity of the fluid (eta)

frictionRR(depsilon, o, r)

Compute energy dissipation due to translation using \(\dot{\epsilon}=\Omega\cdot\gamma^{RR}\cdot \Omega\) … :param depsilon: :type depsilon: power dissipation :param o: An array of angular velocities

An array of size 3*N,

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

  • ----------

frictionRT(depsilon, v, o, r)

Compute energy dissipation due to rotation using \(\dot{\epsilon}=\Omega\cdot\gamma^{RT}\cdot V\) … :param depsilon: An array of energy dissipation

An array of size 3*N,

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

  • 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,

  • ----------

frictionT2s(depsilon, V1s, S, r)

Compute energy dissipation due to 2s mode of the slip \(\dot{\epsilon}=V^{1s}\cdot\gamma^{T,2s}\cdot V^{2s}\) … :param depsilon: :type depsilon: power dissipation :param V1s: An array of 1s mode of velocities

An array of size 3*N,

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

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

  • ----------

frictionT3t(depsilon, V1s, D, r)

Compute energy dissipation due to 3t mode of the slip \(\dot{\epsilon}=V^{1s}\cdot\gamma^{T,3t}\cdot V^{3t}\) … :param depsilon: :type depsilon: power dissipation :param V1s: An array of 1s mode of velocities

An array of size 3*N,

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

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

  • ----------

frictionTR(depsilon, v, o, r)

Compute energy dissipation due to rotation using \(\dot{\epsilon}=V\cdot\gamma^{TR}\cdot \Omega\) … :param depsilon: :type depsilon: power dissipation, :param v: An array of velocities

An array of size 3*N,

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,

  • ----------

frictionTT(depsilon, v, r)

Compute power dissipation due to translation using \(\dot{\epsilon}=V\cdot\gamma^{TT}\cdot V\) … :param depsilon: :type depsilon: energy dissipation, :param v: An array of velocities

An array of size 3*N,

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

  • ----------