kimy-de / fcnn

Five-point stencil Convolutional Neural Networks (FCNNs)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DOI:10.24433/CO.5429205.v1

Learning finite difference methods for reaction-diffusion type equations with FCNN

Yongho Kim and Yongho Choi (2022) Learning Finite Difference Methods for Reaction-Diffusion Type Equations with FCNN, Computers and Mathematics with Applications, Computers and Mathematics with Applications

In this paper, we propose Five-point stencil CNN (FCNN) containing a five-point stencil kernel and a trainable approximation function. We consider reaction-diffusion type equations including heat, Fisher’s, Allen-Cahn equations, and reaction-diffusion equations with trigonometric functions terms. We show that FCNNs are trained well using few data (used only two consecutive data) and then can predict reaction-diffusion evolutions with diverse initial conditions.

Five-point stencil Convolutional Neural Networks (FCNNs)

modelarchitecture

1. Train

1.1 Hyperparameters

"""
--eq: 'he', 'fe', 'ac', 'sine', 'tanh' (str)
--c: diffusion coefficient (float)
--r: reaction coefficient (float)
--numepochs: number of epochs (int)
--sig: standard deviation for noise generation (float)  
--poly_order: order of polynomial approximation (int)
--lr: learning rate (float)
--pretrained: pretrained model path (str)  
"""

1.2 Execution

python train.py --eq sine --poly_order 9 --r 40 --c 0.1

2. Evaluation

Relative L2 error with the 95% confidence interval over 100 different random initial values

2.1 Hyperparameters

"""
--eq: 'he', 'fe', 'ac', 'sine', 'tanh' (str)
--c: diffusion coefficient (float)
--r: reaction coefficient (float)
--max_iter: max iteration (int)
--poly_order: order of polynomial approximation (int)
--pretrained: pretrained model path (str)  
"""

2.2 Execution

Once your model is trained you can evaluate the pretrained model. (Check your hyperparameters)

python evaluation.py --eq fe --r 20 --pretrained './models/fe/fe_3_0.pth' --poly_order 3

2.3 Result

modelarchitecture

3. Test with different initial shapes

3.1 Hyperparameters

"""
--eq: 'he', 'fe', 'ac', 'sine', 'tanh' (str)
--init: 'circle', 'star', 'threecircles', 'maze', 'torus' (str)
--c: diffusion coefficient (float)
--r: reaction coefficient (float)
--max_iter: max iteration (int) 
--poly_order: order of polynomial approximation (int)
--pretrained: pretrained model path (str)  
"""

3.2 Execution

Once your model is trained you can evaluate the pretrained model. (Check your hyperparameters)

python test.py --eq ac --init star --r 6944 --pretrained './models/ac/ac_3_0.pth' --max_iter 2500

3.3 Result

modelarchitecture

modelarchitecture

* License

Code MIT license

About

Five-point stencil Convolutional Neural Networks (FCNNs)


Languages

Language:Python 100.0%