Sunday, July 7, 2013

BARIS: Fourier method for the Burgers' equation


Purpose
  • The package "BariS" solves the 1-D viscous Burgers' equation with periodic boundary condition. The spatial discretization is a Fourier psuedospectral method. Three methods were proposed to calculate the nonlinear term: (i) evaluating Fourier coefficients exactly with the convolution; (ii) padding zeros in the $k$-space; and (iii) filtering with the two thirds rule. For the temporal discretization, a second-order symmetric Strang splitting was used. The linear diffusion term was integrated exactly, while the nonlinear term by a third-order Runge-Kutta scheme.

Specifications
  • Name: BariS.
  • Author: Feng Chen.
  • Finishing date: 10/13/2012.
  • Languages: MATLAB.

Simple Example
  • Equation: \begin{equation} \begin{aligned} & u_t + uu_x = \epsilon u_{xx}, \quad x\in (0,2\pi), \\ & u \text{ is periodic}. \end{aligned} \end{equation}
  • Parameters: \begin{equation} T=2, \quad \epsilon=0.001, \quad N_x = 1024, \quad \delta t = 0.005. \end{equation}
  • Initial condition: \begin{equation} u_0(x) = \sin(x). \end{equation}

Quick Start
  • Compiling and running:
    matlab Bari_Driver_Serial
    
  • Graphics:
  • CPU: Intel(R) Xeon(R) CPU X5550 @2.67GHz.
  • OS: CentOS release 6.4 (Final).
  • Release: MATLAB R2012a.

References
Code Highlights
    
    %%% calculate the nonlinear term with convolution 
    
    % re-order the modes
    uu = [ui(lcut+1:N); ui(1:lcut)]/N;
    
    % convolution
    uc = conv(uu,uu);
    
    % re-order to matlab convention
    m = length(uc);
    ucc = [uc((m+1)/2:m); uc(1:(m-1)/2)]*2*N;
    
    % first-order derivative
    du = rfft_grad_1d(ucc, 1);
    
    % cut off the high modes
    rhs = [du(1:lcut); du(lcut+N:m)]/2;
    rhs = -rhs/2;
    
    

No comments:

Post a Comment