Sphere

class allium.Sphere(c=[1.0], R=[1.0])

A class for computing eigenfrequencies and eigenfunctions of a sphere with a (radially) piecewise-constant sound-speed profile. The class is initialised with arrays for the sound speeds c and outer radii R of each shell, which should be of equal length. The attributes c and R can also be directly modified after the object is initialised.

The thickness of each shell can be accessed by the property dR and the asymptotic large separation by Delta_omega.

The default initialisation corresponds to a sphere with radius 1 and constant sound speed 1.

All frequencies are angular frequencies.

Parameters
  • c (iterable of floats) – Sound speeds of each shell (default=``[1.0]``)

  • R (iterable of floats) – Radii of outer edge of each shell (default=``[1.0]``).

property dR

Thickness of each radial shell.

property Delta_omega

The asymptotic large separation \(\Delta\omega=\pi/\int_0^R(dr/c)\).

search_eigenfrequencies(l, f)

Search for an eigenfrequency of angular degree(s) l between each consecutive pair of frequencies in the array f. Output is added to the dict self.eigenfrequencies, whose keys are the angular degrees searched (i.e. l) and items are lists of eigenfrequencies. Re-running for the same angular degree will replace (not extend) the results in self.eigenfrequencies.

Because eigenfrequencies is a long word to type, the Sphere object itself can be indexed to get the eigenfrequencies, including by using tuples and slices, e.g. self[0,5:10] returns self.eigenfrequencies[0][5:10].

Parameters
  • l (int or list of ints) – The angular degree(s) for which to search for modes.

  • f (iterable of floats) – The frequency range in which to search for mode. One root find is performed for each pair of values in f. i.e. between f[0] and f[1], f[1] and f[2], etc. up to f[len(f)-2] and f[len(f)-1].

wavefunction(l, omega)

Given angular degree l and frequency omega, returns the wavefunction as a function that can then be evaluated at the desired radii r. Note that this is not necessarily an eigenfunction, unless omega is a mode frequency.

eigenfunction(l, i)

Returns the eigenfunction of the i-th frequency of angular degree l, according to the results of the frequency search, as a function that can then be evaluated at the desired radius r. Really just evaluates wavefunction() at frequency self.eigenfrequencies[l][i].

residual(l, omega)

Given angular degree l and frequency omega, returns the value of the wavefunction at the outer boundary, which the solver uses as a residual to find eigenfrequencies.

solve_coefficients(l, omega)

Given angular degree l and frequency omega, solves for and returns the coefficients of the spherical Bessel functions in each shell. The even and odd elements are the coefficients of \(j\) and \(y\), respectively.