Skip to content

pseudospectral (fourier) solutions of a few 1-dimensional PDEs

Notifications You must be signed in to change notification settings

markmbaum/simple-spectral-PDEs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Spectral PDEs

This small repository implements pseudospectral solvers for a few one-dimensional partial differential equations (PDEs) in periodic domains. In each case, the solver uses in-place Fourier transforms (FFTW) and time-steppers from OrdinaryDiffEq.jl for fast, high-accuracy, and stable solutions. The density of the grid can be any power of two.

Look at the short testing script for an example of how to integrate a model.

The three equations implemented are briefly described below, in order of increasing complexity. A different equation could be implemented pretty easily by following the same pattern in the module.

Advection-Diffusion

$$ u_t = -v(x,t)u_x + D u_{xx} $$

where $v(x,t)$ is a velocity function that can be any periodic function of space and time and $D$ is a diffusion coefficient. The example below shows a solution from a random initial condition on a 512 point grid with $v(x,t)=1.25 + \cos(x + 2 \pi t/25)$ and $D=10^{-4}$. The diffusion acts mostly in the migrating low-velocity zone where the ripples are compressed and $u_{xx}$ is highest.

advection_diffusion

Korteweg–De Vries

$$ u_t = -u u_x - a^2u_{xxx} $$

This is a simplified shallow water wave model with a third-order derivative and rippling, ghostly solutions.

korteweg_de_vries

Kuramoto-Sivashinsky

$$ u_t = -u_{xx} - u_{xxxx} - u u_{x} $$

A fourth-order PDE famous for its chaotic behavior. The model produces different behavior for different domain length, which causes the terms above to have different scaling.

kuramoto_sivashinsky


More info about pseudospectral techniques generally can be found in the books:

  • Chebyshev and Fourier Spectral Methods (Boyd)
  • Spectral methods: fundamentals in single domains (Canuto)
  • A Practical Guide to Pseudospectral Methods (Fornberg)

This repo uses the Julia Language and DrWatson to make a reproducible scientific project named

Simple Spectral PDEs

It is authored by Mark Baum markmbaum@protonmail.com.

To (locally) reproduce this project, do the following:

  1. Download this code base. Notice that raw data are typically not included in the git-history and may need to be downloaded independently.
  2. Open a Julia console and do:
    julia> using Pkg
    julia> Pkg.add("DrWatson") # install globally, for using `quickactivate`
    julia> Pkg.activate("path/to/this/project")
    julia> Pkg.instantiate()
    

This will install all necessary packages for you to be able to run the scripts and everything should work out of the box, including correctly finding local paths.

About

pseudospectral (fourier) solutions of a few 1-dimensional PDEs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages