dedalus.core.basis
¶
Abstract and built-in classes for spectral bases.
Module Contents¶
-
logger
¶
-
DEFAULT_LIBRARY
¶
-
FFTW_RIGOR
¶
-
class
Basis
¶ Base class for spectral bases.
These classes define methods for transforming, differentiating, and integrating corresponding series represented by their spectral coefficients.
Parameters: - base_grid_size (int) – Number of grid points
- interval (tuple of floats) – Spatial domain of basis
- dealias (float, optional) – Fraction of modes to keep after dealiasing (default: 1.)
Variables: - grid_dtype (dtype) – Grid data type
- coeff_size (int) – Number of spectral coefficients
- coeff_embed (int) – Padded number of spectral coefficients for transform
- coeff_dtype (dtype) – Coefficient data type
-
library
¶
-
set_dtype
(self, grid_dtype)¶ Set transforms based on grid data type.
-
forward
(self, gdata, cdata, axis, meta)¶ Grid-to-coefficient transform.
-
backward
(self, cdata, gdata, axis, meta)¶ Coefficient-to-grid transform.
-
differentiate
(self, cdata, cderiv, axis)¶ Differentiate using coefficients.
-
integrate
(self, cdata, cint, axis)¶ Integrate over interval using coefficients.
-
interpolate
(self, cdata, cint, position, axis)¶ Interpolate in interval using coefficients.
-
grid_size
(self, scale)¶ Compute scaled grid size.
-
check_arrays
(self, cdata, gdata, axis, meta=None)¶ Verify provided arrays sizes and dtypes are correct. Build compliant arrays if not provided.
-
class
TransverseBasis
¶ Bases:
dedalus.core.basis.Basis
Base class for bases supporting transverse differentiation.
-
class
ImplicitBasis
¶ Bases:
dedalus.core.basis.Basis
Base class for bases supporting implicit methods.
These bases define the following matrices encoding the respective linear functions acting on a series represented by its spectral coefficients:
- Linear operators (square matrices):
- Pre : preconditioning (default: identity) Diff : differentiation Mult(p) : multiplication by p-th basis element
- Linear functionals (vectors):
- left_vector : left-endpoint evaluation right_vector : right-endpoint evaluation integ_vector : integration over interval interp_vector : interpolation in interval
Additionally, they define a column vector bc_vector indicating which coefficient’s Galerkin constraint is to be replaced by the boundary condition on a differential equation (i.e. the order of the tau term).
-
Multiply
(self, p)¶ p-element multiplication matrix.
-
bc_vector
(self)¶ Boundary-row column vector.
-
Precondition
(self)¶ Preconditioning matrix.
-
FilterBoundaryRow
(self)¶ Matrix filtering boundary row.
-
ConstantToBoundary
(self)¶ Matrix moving constant coefficient to boundary row.
-
PrefixBoundary
(self)¶ Matrix moving boundary row to first row.
-
NCC
(self, coeffs, cutoff, max_terms)¶ Build NCC multiplication matrix.
-
class
Chebyshev
(name, base_grid_size, interval=(-1, 1), dealias=1)¶ Bases:
dedalus.core.basis.ImplicitBasis
Chebyshev polynomial basis on the roots grid.
-
element_label
= T¶
-
boundary_row
¶
-
separable
= False¶
-
coupled
= True¶
-
default_meta
(self)¶
-
grid
(self, scale=1.0)¶ Build Chebyshev roots grid.
-
set_dtype
(self, grid_dtype)¶ Determine coefficient properties from grid dtype.
-
Integrate
(self)¶ Build integration class.
-
Interpolate
(self)¶ Buld interpolation class.
-
Differentiate
(self)¶ Build differentiation class.
-
Precondition
(self)¶ Preconditioning matrix.
T_n = (U_n - U_(n-2)) / 2 U_(-n) = -U_(n-2)
-
Dirichlet
(self)¶ Dirichlet recombination matrix.
D[0] = T[0] D[1] = T[1] D[n] = T[n] - T[n-2]
- <T[i]|D[j]> = <T[i]|T[j]> - <T[i]|T[j-2]>
- = δ(i,j) - δ(i,j-2)
-
Multiply
(self, p)¶ p-element multiplication matrix
T_p * T_n = (T_(n+p) + T_(n-p)) / 2 T_(-n) = T_n
-
build_mult
(self, coeffs, order)¶
-
-
class
Fourier
(name, base_grid_size, interval=(0, 2 * pi), dealias=1)¶ Bases:
dedalus.core.basis.TransverseBasis
Fourier complex exponential basis.
-
separable
= True¶
-
coupled
= False¶
-
element_label
= k¶
-
default_meta
(self)¶
-
grid
(self, scale=1.0)¶ Build evenly spaced Fourier grid.
-
set_dtype
(self, grid_dtype)¶ Determine coefficient properties from grid dtype.
-
Integrate
(self)¶ Build integration class.
-
Interpolate
(self)¶ Build interpolation class.
-
Differentiate
(self)¶ Build differentiation class.
-
HilbertTransform
(self)¶ Build Hilbert transform class.
-
-
class
SinCos
(name, base_grid_size, interval=(0, pi), dealias=1)¶ Bases:
dedalus.core.basis.TransverseBasis
Sin/Cos series basis.
-
element_label
= k¶
-
separable
= True¶
-
coupled
= False¶
-
default_meta
(self)¶
-
grid
(self, scale=1.0)¶ Evenly spaced interior grid: cos(Nx) = 0
-
set_dtype
(self, grid_dtype)¶ Determine coefficient properties from grid dtype.
-
Integrate
(self)¶ Build integration class.
-
Interpolate
(self)¶ Build interpolation class.
-
Differentiate
(self)¶ Build differentiation class.
-
HilbertTransform
(self)¶ Build Hilbert transform class.
-
-
class
Compound
(name, subbases, dealias=1)¶ Bases:
dedalus.core.basis.ImplicitBasis
Compound basis joining adjascent subbases.
-
separable
= False¶
-
coupled
= True¶
-
library
¶
-
default_meta
(self)¶
-
grid
(self, scale=1.0)¶ Build compound grid.
-
set_dtype
(self, grid_dtype)¶ Determine coefficient properties from grid dtype.
-
coeff_start
(self, index)¶
-
grid_start
(self, index, scale)¶
-
sub_gdata
(self, gdata, index, axis)¶ Retreive gdata corresponding to one subbasis.
-
sub_cdata
(self, cdata, index, axis)¶ Retrieve cdata corresponding to one subbasis.
-
forward
(self, gdata, cdata, axis, meta)¶ Forward transforms.
-
backward
(self, cdata, gdata, axis, meta)¶ Backward transforms.
-
Integrate
(self)¶ Build integration class.
-
Interpolate
(self)¶ Buld interpolation class.
-
Differentiate
(self)¶ Build differentiation class.
-
Precondition
(self)¶
-
Dirichlet
(self)¶
-
Multiply
(self, p, subindex)¶
-
NCC
(self, coeffs, cutoff, max_terms)¶ Build NCC multiplication matrix.
-
FilterMatchRows
(self)¶ Matrix filtering match rows.
-
Match
(self)¶ Matrix matching subbases.
-
PrefixBoundary
(self)¶
-