pub struct FourierSpectralMethod {
pub N: usize,
pub domain_length: f64,
}Expand description
Fourier spectral method on a periodic domain.
Fields§
§N: usizeNumber of modes (collocation points).
domain_length: f64Length of the periodic domain.
Implementations§
Source§impl FourierSpectralMethod
impl FourierSpectralMethod
Sourcepub fn spectral_differentiation_matrix(&self) -> Vec<Vec<f64>>
pub fn spectral_differentiation_matrix(&self) -> Vec<Vec<f64>>
Build the N×N spectral differentiation matrix for the periodic grid.
D_{jk} = (π/L) · (-1)^{j-k} / tan(π(j-k)/N) (j ≠ k), D_{jj} = 0.
Sourcepub fn fft_solve_poisson(&self, rhs: &[f64]) -> Vec<f64>
pub fn fft_solve_poisson(&self, rhs: &[f64]) -> Vec<f64>
Solve −u’’ = f on [0, L] with periodic BC using FFT.
Returns the solution u at the N evenly-spaced collocation points, with the mean value set to zero.
Auto Trait Implementations§
impl Freeze for FourierSpectralMethod
impl RefUnwindSafe for FourierSpectralMethod
impl Send for FourierSpectralMethod
impl Sync for FourierSpectralMethod
impl Unpin for FourierSpectralMethod
impl UnsafeUnpin for FourierSpectralMethod
impl UnwindSafe for FourierSpectralMethod
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more