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 Ω,μ=ϕ(ϕ2−1)ϵ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 ballswith radii 12 and 1√2, 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
- Feng Chen and Jie Shen. Efficient spectral-Galerkin methods for systems of coupled second-order equations and their applications, Journal of Computational Physics, Volume 231, Issue 15, 5016-5028, (2012).
- Jie Shen and Xiaofeng Yang. Numerical Approximations of Allen-Cahn and Cahn-Hilliard Equations. DCDS, Series A, 28:1669-1691 (2010).
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