This program solves the Cahn-Hilliard equation using an implicit pseudospectral method.
The Cahn-Hilliard equation is defined as
with M being a mobility and the functional of free-energy given by
where
where
The concentration field can be expanded as a Fourier series in the form
where the Fourier coefficients are given by
and
The Fourier transform of the dynamical equation is
and using an implicit Euler time integration, we have
such that
where
The following figures are results from the CH equations for a system with M=1.0, W=2.0,
and our system is evolved during 10000 steps with stepsize of dt=0.1.
In cahnhilliard.py we use just the Numpy package to do the fft. In cahnhilliard-pytorch.py we use the torch package to do the fft using the CUDA-capable NVIDIA GPU.
- NumPy is the fundamental package for scientific computing with Python.
- PyTorch is a high-level library for machine learning, with multidimensional tensors that can also be operated on a CUDA-capable NVIDIA GPU.
- Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python.
If you use cahnhilliard.py or cahnhilliard-pytorch.py in your work, please consider to cite it using the following reference:
Soares, E. do A., Barreto, A. G. & Tavares, F. W. Exponential Integrators for Phase-Field Equations using Pseudo-spectral Methods: A Python Implementation. 1–12 (2023). ArXiv: 2305.08998
Bibtex:
@article{Soares2023,
archivePrefix = {arXiv},
arxivId = {2305.08998},
author = {Soares, Elvis do A. and Barreto, Amaro G. and Tavares, Frederico W},
eprint = {2305.08998},
month = {may},
pages = {1--12},
title = {{Exponential Integrators for Phase-Field Equations using Pseudo-spectral Methods: A Python Implementation}},
url = {http://arxiv.org/abs/2305.08998},
year = {2023}
}
Elvis Soares: elvis.asoares@gmail.com
Universidade Federal do Rio de janeiro
School of Chemistry