Processing math: 100%

Saturday, July 2, 2011

RAIN: Robust simulation of the 2-D Cahn-Hilliard equation


Purpose
  • The package "Rain" simulates the 2-D isotropic Cahn-Hilliard equation. The Legendre-Galerkin method was used for the spatial discretization, and the first- and second-order energy stabilized methods were used for the temporal discretization.

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

Simple Example
  • Equation: ϕt=MΔμ,in Ω,μ=ϕ(ϕ21)ϵ2Δϕ,in Ω,nϕ=nμ=0,on Ω.
  • Parameters: Ω=(1,1)2,T=0.6,δt=0.001,Nx=Ny=128,M=0.01,ϵ=0.02,s=2.
  • Exact solution and input functions: ϕ(x,y,0)=two separated balls
    with radii 12 and 12, and with centers (12,12) and (15,15). It is evolved through the first-order scheme.

Quick Start
  • Compiling and running:
    cd ./Rain
    make library
    gfortran Rain_Main.cu -llibrary -llapack -lblas
    ./a.out
    
  • Output:
     
    
    
  • CPU: Intel(R) Xeon(R) CPU X5550 @2.67GHz.
  • OS: CentOS release 6.4 (Final).
  • Compiler: gfortran 4.5.1.

References
Code Highlights
    
    !!Assign the initial condition for phi
    
    case (1)! one ball.
    phi(i,j) = dtanh((dsqrt(x*x+y*y)-r)/RainEps) 
    case (2)! two balls.
    phi(i,j) = dtanh((dsqrt((x+1d0/2d0)**2+&
         (y-1d0/2d0)**2)-1d0/4d0)/RainEps)-1d0 &
       + dtanh((dsqrt((x-1d0/5d0)**2+(y+1d0/5d0)**2)-1d0/2d0)/RainEps)-1d0
    phi(i,j) = phi(i,j) + 1d0 
    case (3)! three balls.
    phi(i,j) = dtanh((dsqrt((x+1d0/2d0)**2+(y-1d0/2d0)**2)-&
         1d0/4d0)/RainEps)-1d0 &
       + dtanh((dsqrt((x-1d0/4d0)**2+(y+1d0/4d0)**2)-1d0/2d0)/RainEps)-1d0 &
       + dtanh((dsqrt((x+1d0/2d0)**2+(y+1d0/2d0)**2)-1d0/5d0)/RainEps)-1d0
    phi(i,j) = phi(i,j) + 1d0
    case (4)! two kissing balls.
    phi(i,j) = dtanh((dsqrt((x+0.346d0)**2+y**2)-1d0/3d0)/RainEps)-1d0 &
       + dtanh((dsqrt((x-0.346d0)**2+y**2)-1d0/3d0)/RainEps)-1d0
    phi(i,j) = phi(i,j) + 1d0 
    case (5)  ! a single tilde line.
    phi(i,j) = dtanh((y-2d0*x)/RainEps)-1d0  
    phi(i,j) = phi(i,j) + 1d0    
    case (6) ! a single verticle line.
    phi(i,j) = dtanh(x/RainEps)-1d0  
    phi(i,j) = phi(i,j) + 1d0            
    
    

No comments:

Post a Comment