Loading [MathJax]/jax/output/HTML-CSS/jax.js

Wednesday, July 6, 2011

GOLD: Spectral methods for 3-D driven cavity flows


Purpose
  • The package "Gold" simulates the 3-D incompressible driven cavity flow. The Legendre-Galerkin method was used for the spatial discretization, and the first- and second-order rotational pressure correction projection methods were used for the temporal discretization.

Specifications
  • Name: Gold.
  • Author: Feng Chen.
  • Finishing date: 07/06/2011.
  • Languages: Fortran 90.
  • Required libraries: BLAS, LAPACK.

Simple Example
  • Equation: vt+vv=νΔvp+f,v=0,v(x,y,z,0)=v0(x,y,z),v|Ω=0.
  • Parameters: Ω=(1,1)3,T=1,δt=0.01,Nx=Ny=Nz=64,ν=1.
  • Exact solution and input functions: v1(x,y,z,t)=2πsin2(πx)sin(2πy)sin(2πz)sin(t),v2(x,y,z,t)=πsin(2πx)sin2(πy)sin(2πz)sin(t),v3(x,y,z,t)=πsin(2πx)sin(2πy)sin2(πz)sin(t),p(x,y,z,t)=cos(πx)cos(πy)cos(πz)sin(t), then f(x,y,t) is calculated accordingly.

Quick Start
  • Compiling and running:
    cd ./Gold
    make library
    gfortran Gold_Main.cu -llibrary -llapack -lblas
    ./a.out
    
  • Output:
     
    Second-order scheme was used. 
     At step           20 Error of v =  1.71716801470710173E-004
     At step           20 Error of p =  4.30641138903224419E-002
     At step           40 Error of v =  1.61822030845909292E-004
     At step           40 Error of p =  7.41918977991906092E-002
     At step           60 Error of v =  1.45463465091464418E-004
     At step           60 Error of p =  0.10235141260382691     
     At step           80 Error of v =  1.23321771533398253E-004
     At step           80 Error of p =  0.12646838834271690     
     At step          100 Error of v =  9.62650234262930784E-005
     At step          100 Error of p =  0.14556457932094957     
    ...
    
  • CPU: Intel(R) Xeon(R) CPU X5550 @2.67GHz.
  • OS: CentOS release 6.4 (Final).
  • Compiler: gfortran 4.5.1.

References
Code Highlights
    
    !<
    !! A typical procedure in the rotational pressure correction
    !! projection scheme
    !<
    
    !! calculate the nonlinear term and the gradient of the pressure.   
    call GoldSpace_Calculate_Convection(SV, B%velocity(:,:,:,:,co-1)+ &
     GoldVic, B%conv(:,:,:,:,co-1))
    call GoldSpace_Calculate_Gradient(SP, B%pressure(:,:,:,co-1), B%gradp) 
    
    !! form the right side of the momentum equation.   
    B%velocity(:,:,:,:,co) = 0d0
    do io = 0, co - 1
     B%velocity(:,:,:,:,co) = B%velocity(:,:,:,:,co) - &
      (T%a(co,io)/T%dt) * B%velocity(:,:,:,:,io) - &
      T%b(co,io) * B%conv(:,:,:,:,io)
    end do
    B%gradp2 = 0d0  
    B%gradp2(0:SP%Np(1),0:SP%Np(2),0:SP%Np(3),1:3) = B%gradp
    B%velocity(:,:,:,:,co) = B%velocity(:,:,:,:,co) - B%gradp2 + &
     B%exfr + GoldVisco*GoldVicdd   
    
    !! solve for the velocity field. 
    call GoldSpaceTime_Solve_velocity(co, SV, B%velocity(:,:,:,:,co))  
    
    !! calculate divergence of the velocity field. 
    call GoldSpace_Calculate_Divergence(SV, &
     B%velocity(:,:,:,:,co), B%divv) 
    
    !! form the right side of the projection equation.  
    B%divv2 = B%divv(0:SP%Np(1),0:SP%Np(2),0:SP%Np(3))
    B%pressure(:,:,:,co) = -(T%a(co,co)/T%dt) * B%divv2    
    
    !! solve for the (auxiliary) B%pressure. 
    call GoldSpaceTime_Solve_pressure(co, SP, B%pressure(:,:,:,co))   
    
    !! update the velocity and the pressure. 
    call GoldSpace_Calculate_Gradient(SP, B%pressure(:,:,:,co), B%gradp)
    B%gradp2 = 0d0 
    B%gradp2(0:SP%Np(1),0:SP%Np(2),0:SP%Np(3),1:3) = B%gradp
    B%velocity(:,:,:,:,co) = B%velocity(:,:,:,:,co) - &
     (T%dt/T%a(co,co)) * B%gradp2
    B%pressure(:,:,:,co) = B%pressure(:,:,:,co-1) + &
     B%pressure(:,:,:,co) - GoldVisco * B%divv2
    
    

No comments:

Post a Comment