Utils: Miscellaneous function

utils.SlipModes()

Computes Slip Modes

We expand the slip $mathbf{v}^{mathcal{A}}$ in the expansion basis of TSH (tensorial spherical harmonics), which are defined as (read more in S. Hess, Tensors for physics, 2015):

$$ mathbf{Y}^{(l)}(hat{mathbf{ b }})

= (-1)^l b^{l+1} mathbf

abla^{(l)}

[1/{b}]

$$

The first TSH is $$

Y^{(0)}(hat{mathbf{ b }})=1,quad

$$

The second TSH is: $$

Y_{i}^{(1)}(hat{mathbf{ b }})=hat{ b }_{i},quad

$$

The thirs TSH is $$

Y_{ij}^{(2)}(hat{mathbf{ b }})=left(3hat{ b }_{i}hat{ b }_{j}-delta_{ij}

ight).%

$$

particles: int

Number of particles (N)

utils.gridXY(L, Ng)

Returns the grid in XY direction centered around zero …

Parameters:
  • L (float) – Length of the grid

  • Ng (int) – Number of grid points

Examples

An example of creating grid

>>> import numpy as np, pystokes
>>> dim, L, Ng = 3, 10, 32
>>>  rr, vv = pystokes.utils.gridXY(dim, L, Ng)
utils.gridYZ(L, Ng)

Returns the grid in YZ direction centered around zero …

Parameters:
  • L (float) – Length of the grid

  • Ng (int) – Number of grid points

Examples

An example of creating grid

>>> import numpy as np, pystokes
>>> dim, L, Ng = 3, 10, 32
>>>  rr, vv = pystokes.utils.gridYZ(dim, L, Ng)
utils.simulate(Tf, Nts, rhs, integrator='odeint', filename='this.mat', Ti=0, maxNumSteps=100000, **kwargs)

Simulates using choice of integrator

Parameters:
  • rp0 (np.array) – Initial condition

  • Tf (int) – Final time

  • Nts (int) – Number of points to return data

  • rhs (Python Function) – Right hand side to integrate

  • integrator (string) – Default is ‘odeint’ of scipy. Please set integrator=’odeint’ to use the scipy.integrate’s odeint (Default) Use integrator=’solve_ivp’ to use ivp Use integrator=’odespy-vode’ to use vode from odespy (github.com/rajeshrinet/odespy). Use integrator=’odespy-rkf45’ to use RKF45 from odespy (github.com/rajeshrinet/odespy). Use integrator=’odespy-rk4’ to use RK4 from odespy (github.com/rajeshrinet/odespy). Alternatively, write your own integrator to evolve the system in time and store the data.

  • filename (string) – filename to write the data. Deafult is ‘this.mat’

utils.irreducibleTensors(p, Y0=1)

Uniaxial paramterization of the tensorial harmonics (Yl) of order l …

Parameters:
  • l (int) – Tensorial Harmonics of order l

  • p (np.rrray) – An array of size 3 Axis along which the mode is paramterized

  • Y0 (float) – Strength of the mode

  • returns (Yl - tensorialHarmonics of rank l)