A collection of spectral collocation differentiation matrices
This collection is based on their original matlab/octave version developed by Weidemann and Reddy and available from DMSUITE. The theory and examples are explained in their paper: J. A. C. Weidemann and S. C. Reddy, A MATLAB Differentiation Matrix Suite, ACM Transactions on Mathematical Software, 26, (2000): 465-519.
The port to python was initiated as part of a larger project by ronojoy as https://github.com/ronojoy/pyddx.git
Some examples are available in the examples directory. Considering
for example the case of Chebyshev differentiation matrix, it is first
setup by:
cheb = Chebyshev(degree=NCHEB)with NCHEB the degree of polynomials considered. The
differentiation matrices of degree 1 and 2 are obtained as:
d1 = cheb.at_order(1)
d2 = cheb.at_order(2)and so on for larger orders of differentiation. The colocation nodes
are stored in cheb.nodes which can used to compute a any function
at these location, e.g.:
y = np.sin(2 * pi * cheb.nodes)First and second order differentiation are then simply obtained as
d1 @ y and d2 @ y, respectively. For more complex uses,
e.g. to compute eigenvectors and eigenvalues of partial differential
equations refer to
- Labrosse S, Morison A, Deguen R, and Alboussière T. Rayleigh-Bénard convection in a creeping solid with a phase change at either or both horizontal boundaries. J. Fluid Mech., 2018. DOI.
- Morison A, Labrosse S, Deguen R, and Alboussière T. Timescale of overturn in a magma ocean cumulate. Earth Planet. Sci. Lett., 2019. DOI.
- Morison A, Labrosse S, Deguen R, and Alboussière T. Onset of thermal convection in a solid spherical shell with melting at either or both boundaries. Geophys. J. Int., 2024. DOI.