Skip to content

kimy-de/gpuallencahn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Fast and Accurate Numerical Solution of Allen–Cahn Equation

Yongho Kim, Gilnam Ryu, and Yongho Choi (2021) Fast and Accurate Numerical Solution of Allen-Cahn Equation, Mathematical Problems in Engineering, vol. 2021, Article ID 5263989, 12 pages, 2021. https://doi.org/10.1155/2021/5263989

Simulation speed depends on code structures, hence it is crucial how to build a fast algorithm. We solve the Allen–Cahn equation by an explicit finite difference method, so it requires grid calculations implemented by many for-loops in the simulation code. In terms of programming, many for-loops make the simulation speed slow. We propose a model architecture containing a pad and a convolution operation on the Allen–Cahn equation for fast computations while maintaining accuracy. Also, the GPU operation is used to boost up the speed more. In this way, the simulation of other differential equations can be improved. In this paper, various numerical simulations are conducted to confirm that the Allen–Cahn equation follows motion by mean curvature and phase separation in two-dimensional and three-dimensional spaces. Finally, we demonstrate that our algorithm is much faster than an unoptimized code and the CPU operation.

Allen-Cahn Equation

model_f 스크린샷 2021-05-20 20 43 03

Implementations

"""
Number of iterations: --maxit
Grid size: --Nx, --Ny, (and --Nz)
Initial condition: --init 
# 2D: ['circle', 'dumbbell', 'star', 'separation', 'torus', 'maze'] 
# 3D: ['sphere', 'dumbbell', 'star', 'separation', 'torus', 'maze']
Operation mode: --mode # 0: pytorch gpu, 1: pytorch cpu, 2: python cpu
Saving npy files: --save  # 0: No, 1: Yes
"""
python 2d.py --mode 0 --init star
python 2d.py --mode 0 --init star --maxi 2001 --save 1
python 3d.py --mode 0 --init maze

Results

Screen Shot 2021-04-10 at 8 58 35 AM 스크린샷 2021-04-29 22 00 30

Releases

No releases published

Packages

No packages published