Skip to content

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

License

Notifications You must be signed in to change notification settings

EndCar808/1DDiffusion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published