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 radiiR
of each shell, which should be of equal length. The attributesc
andR
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 byDelta_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 arrayf
. Output is added to the dictself.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 inself.eigenfrequencies
.Because
eigenfrequencies
is a long word to type, theSphere
object itself can be indexed to get the eigenfrequencies, including by using tuples and slices, e.g.self[0,5:10]
returnsself.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. betweenf[0]
andf[1]
,f[1]
andf[2]
, etc. up tof[len(f)-2]
andf[len(f)-1]
.
- wavefunction(l, omega)¶
Given angular degree
l
and frequencyomega
, returns the wavefunction as a function that can then be evaluated at the desired radiir
. Note that this is not necessarily an eigenfunction, unlessomega
is a mode frequency.
- eigenfunction(l, i)¶
Returns the eigenfunction of the
i
-th frequency of angular degreel
, according to the results of the frequency search, as a function that can then be evaluated at the desired radiusr
. Really just evaluateswavefunction()
at frequencyself.eigenfrequencies[l][i]
.
- residual(l, omega)¶
Given angular degree
l
and frequencyomega
, 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 frequencyomega
, 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.