EndCar808 / 1DDiffusion

C code to perform numerical solution of the 1D Diffusion equation using Crank-Nicolson differencing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1DDiffusion

C and MATLAB code to compute the numerical solution of the 1D Diffusion equation using Crank-Nicolson differencing on a periodic domain.

Build & Run C code

  1. Change directory into the /C folder and run the Makefile
cd ./C
make

running make creates an executable called diff.

  1. Run the executable for default parameters (these can be manually changed in the C/diffusion.c file)
./diff

this will run the code and save the solution data in Data/C-Data directory

Plot Data

You can analyse the solution data by running the plot.py script in the parent directory

python3 plot.py

this script computes the $l_2$ norm of the numerical solution and the exact solution over time.

About

C code to perform numerical solution of the 1D Diffusion equation using Crank-Nicolson differencing

License:Apache License 2.0


Languages

Language:C 60.3%Language:MATLAB 32.2%Language:Python 6.9%Language:Makefile 0.7%