Skip to content

A python script to solve the Cahn-Hilliard equation using an implicit pseudospectral method

License

Notifications You must be signed in to change notification settings

wd15/PyCahnHilliard

 
 

Repository files navigation

PyCahnHilliard

This program solves the Cahn Hilliard equation using the 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 is a parameter related to the interfacial energy and is the bulk free-energy density given by

where W is the height ot the thermodynamic barrier. The next Figure presents this bulk free-energy.

Bulk

Pseudo-spectral method

The concentration field can be expanded as a Fourier series in the form

where the Fourier coefficients are given by

and where and is the stepsize of the meshgrid on the i direction.

The Fourier transform of the dynamical equation is

and using an implicit Euler integration, we have

such that

where is the time step value.

Example

The following figure is a result for the system with M=1.0, W=2.0, , dx=1.0, dt=0.1. The initial condition is given by a normal distribution

And the system is evolved until N = 1000 steps.

C0 = 0.3

GIF

C0 = 0.5

GIF

C0 = 0.7

GIF

About

A python script to solve the Cahn-Hilliard equation using an implicit pseudospectral method

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 99.9%
  • Other 0.1%