Skip to content

sannejamila/CahnHilliard_FEM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 

Repository files navigation

FEM Solution of the Cahn–Hilliard Equation

This project implements the finite element method (FEM) to solve the Cahn–Hilliard equation, a nonlinear PDE used to model phase separation.

This work was completed as part of the second project in TMA4220 – Numerical Solution of Partial Differential Equations Using Finite Element Methods at NTNU.
The project was originally intended for groups of three students, but I completed it individually and received a grade of 98/100 (A).


Overview

The Cahn–Hilliard equation describes phase separation dynamics:

$$ \partial_t \phi = \nabla \cdot \Big( M \nabla \big( \gamma (\phi^3 - \phi) - \epsilon \Delta \phi \big) \Big) \quad \text{in } \Omega \times [0,T]. $$

This notebook:

  • Derives the weak formulation.
  • Proves mass conservation and energy dissipation.
  • Implements fully discrete FEM schemes:
    • Fully Explicit scheme
    • IMEX (Implicit–Explicit) scheme
  • Uses NGSolve to solve and visualize the system in 2D.

Project structure

  • Project2.ipynb – main Jupyter Notebook with derivations, code, and results.
  • README.md – project documentation (this file).

Requirements

  • Python 3.x
  • NGSolve
  • NumPy, Pandas, Matplotlib

Install requirements:

pip install numpy pandas matplotlib

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors