Processing math: 100%

Sunday, June 24, 2012

LAKE: DG-Fourier Multi-stage SSP method for the 2-D advection equation


Purpose
  • The package "Lake" solves the 2-D advection equation in a rectangular domain. A Fourier psuedospectral method was used for the spatial discretization in x, and a nodal discontinuous Galerkin method was used for y. The temporal discretization are one-step multi-stage explicit schemes. It is partially based on packages "Sea" and "Ion".

Specifications
  • Name: Lake.
  • Author: Feng Chen.
  • Finishing date: 06/26/2012.
  • Languages: Fortran 90.
  • Required libraries: BLAS, LAPACK.

Simple Example
  • Equation: Ψt+uΨ=f,Ψ(x,y,0)=Ψ0(x,y),Ψ periodic in x,Ψ no boundary condition in y, where u satisfies u=0,un|y=±1=0.
  • Parameters: Ω=(π,π)×(1,1),T=10,δt=0.001,Nx=64,Ny=10,Ky=10.
  • Exact solution and input functions: Ψ(x,y,t)=cos(x+t)sin(y+t),u1(x,y,t)=πcos(x+t)cos(πy),u2(x,y,t)=sin(x+t)sin(πy), then f(x,y,t) is calculated accordingly.

Quick Start
  • Compiling and running:
    cd ./Lake
    make library
    gfortran Lake_Main.cu -llibrary -llapack -lblas
    ./a.out
    
  • Output:
    Order 3 Runge Kutta was used.
     at step           0 max error=   0.0000000000000000     
     at step        2000 max error=  2.32462854521386930E-009
     at step        4000 max error=  2.56192570491364791E-008
     at step        6000 max error=  6.41112042915753522E-008
     at step        8000 max error=  1.24243067334273150E-007
     at step       10000 max error=  1.15325957505962862E-007
    ...
    
  • CPU: Intel(R) Xeon(R) CPU X5550 @2.67GHz.
  • OS: CentOS release 6.4 (Final).
  • Compiler: gfortran 4.5.1.

References
Code Highlights
    
    !<
    !! calculate the rhs of the linear system
    !<
    subroutine LakeSpaceTime_RHS(SI, SF, rhs, flux, Psi, fsrc)  
     type(domain), intent(in) ::  SF   
     type(IonSpace1D), intent(in) :: SI 
     real(kind=8), dimension(SI%n,SF%ndof), intent(in) :: Psi, fsrc
     real(kind=8), dimension(SI%n,SF%ndof) :: rhs
     real(kind=8), dimension(SI%n,SF%ndof,2) :: flux 
     integer :: j, k  
    
     ! differentiation in y
     do k = 1, SI%n
      call NDG_RHS(SF, rhs(k,:), flux(k,:,2), Psi(k,:))
     end do
     flux(:,:,2) = rhs
    
     ! differentiation in x
     do j = 1, SF%ndof
      ! transform to k-space
      call rfft1d(SI%n, flux(:,j,1), SI%wk, 0)
      ! differentiation
      call fodxcf(SI%n, flux(:,j,1), SI%sc)  
      ! transform to real space
      call rfft1d(SI%n, flux(:,j,1), SI%wk, 1)
     end do 
     ! pseudo-Fourier, no integration by parts.
     flux(:,:,1) = -flux(:,:,1)  
    
    
     ! add up all the rhs
       rhs = flux(:,:,1) + flux(:,:,2) + fsrc 
    end subroutine LakeSpaceTime_RHS
    
    

No comments:

Post a Comment