This is a simple pedagogical example of spectral differentiation using modified wavenumbers to enforce consistency with a finite difference approximation. This is useful, for example, in Computational Fluid Dynamics, or Magnetohydrodynamics. To solve a Poisson Equation using a spectral solver is far faster than using traditional iterative solvers (but is limited to simple geometries). The example includes the use of cosine/sine transforms, which can be useful in the case of enforcing e.g. homogeneous Neumann boundary conditions.
alexskillen / modified_wavenumbers Goto Github PK
View Code? Open in Web Editor NEWLicense: Creative Commons Attribution Share Alike 4.0 International