/crank-nicolson-2d

Crank-Nicolson method for the heat equation in 2D

Primary LanguagePython

Crank-Nicolson method in 2D

This repository provides the Crank-Nicolson method to solve the heat equation in 2D. Basically, the numerical method is processed by CPUs, but it can be implemented on GPUs if the CUDA is installed.

1. Requirements

  • numpy, torch, tqdm, matplotlib

2. Default setting

  • Initial condition: a star shape

  • Boundary condition: zero Neumann

  • crank_nicolson.py: iteration

  • disc.py: discretization matrices

  • utils.py: initial condition, result plot

3. Execution

python crank_nicolson.py

4. Result

r1