Skip to content

38bangers-only/AllenCahn-CahnHillard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

2D Phase Field PINNs: Allen-Cahn and Cahn-Hillard

A PyTorch implementation of Physics-Informed Neural Networks (PINNs) to solve two 2D phase-field equations, that rains neural networks to solve the Allen-Cahn and Cahn-Hilliard PDEs without any traditional numerical solver — just autograd and a composite loss function.

  • Allen-Cahn — models interface motion (circular droplet IC)
  • Cahn-Hilliard — models spinodal decomposition (conserves mass). A fourth order-PDE, which had to be split into two PDEs with separate independent parameters spatio-temporally.

Both run on a 2D unit square domain with Neumann (zero-flux) boundary conditions.

How to run

pip install torch numpy matplotlib
python ACHPINN.py

NOTE : To obtain the best results out of the model, preferably run it on a GPU. The script is tailored to detect CUDA

Saves model weights (ac_model.pth, ch_model.pth) and a results figure (phase_field_pinns.png).

Tunable parameters

EPOCHS = 3000   # more epochs = better results
T      = 0.3    # time horizon
EPS    = 0.05   # interface width

Stack

Python · PyTorch · Matplotlib

About

Phase field modelling of Thermodynamic equations via Physics-Informed Neural Networks(PINNs)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages