Stokes flow near interfaces
Hydrodynamic interactions of active particles in the half-space bounded by a plane no-shear surface
RBM (Rigid Body Motion: Velocity and Angular Velocity)
- class pystokes.interface.Rbm
Rigid body motion (RBM)
…
- Parameters:
radius (float) – Radius of the particles (a)
particles (int) – Number of particles (N)
viscosity (float) – Viscosity of the fluid (eta)
- mobilityTR(v, r, T, ll=0.0)
Compute velocity due to body forces 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 forces An array of size 3*N,
ll (float) – viscosity ratio of the two fluids Default is zero
- mobilityTT(v, r, F, ll=0.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,
ll (float) – viscosity ratio of the two fluids Default is zero
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.interface.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, ll=0.0)
Brownian noise for 1 particle only so far
- noiseRR_old(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,
- noiseRT(o, r, ll=0.0)
Brownian noise for 1 particle only so far
- noiseTR(v, r, ll=0.0)
Brownian noise for 1 particle only so far
- noiseTT(v, r, ll=0.0)
Brownian noise for 1 particle only so far
- noiseTT_old(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, ll=0.0)
Compute angular velocity due to 2s mode of the slip \(o=\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,
- propulsionR3t(o, r, D, ll=0.0)
Compute angular velocity due to 3t mode of the slip \(o=\pi^{R,3t}\cdot D\) …
- 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,
D (np.array) – An array of 3t mode of the slip An array of size 3*N,
- propulsionT2s(v, r, S, ll=0.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,
- propulsionT3t(v, r, D, ll=0.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,
Flow
- class pystokes.interface.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)
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.interface.Flow(radius=b, particles=N, viscosity=eta, gridpoints=Ng*Ng) >>> >>> # create grid, evaluate flow and plot >>> rr, vv = pystokes.utils.gridYZ(dim, L, Ng) >>> flow.flowField1s(vv, rr, r, F1s) >>> pystokes.utils.plotStreamlinesYZsurf(vv, rr, r, offset=6-1, density=1.4, title='1s')
- flowField2a(vv, rt, r, T)
Compute flow field at field points due body torques …
- 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 torques An array of size 3*N,
Examples
An example of the 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, T = np.array([0.0, 0.0, 3.4]), np.array([0.0, 1.0, 0]) >>> >>> # space dimension , extent , discretization >>> dim, L, Ng = 3, 10, 64; >>> >>> # instantiate the Flow class >>> flow = pystokes.interface.Flow(radius=b, particles=N, viscosity=eta, gridpoints=Ng*Ng) >>> >>> # create grid, evaluate flow and plot >>> rr, vv = pystokes.utils.gridYZ(dim, L, Ng) >>> flow.flowField2a(vv, rr, r, T) >>> pystokes.utils.plotStreamlinesYZsurf(vv, rr, r, offset=6-1, density=1.4, title='1s')
- flowField2s(vv, rt, r, S)
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.interface.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')
- flowField3t(vv, rt, r, D)
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.interface.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')