Utils: Miscellaneous function

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) –

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’